mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-07 16:19:38 +02:00
enable prettier-plugin-jsdoc
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"endOfLine": "auto",
|
||||
"plugins": ["prettier-plugin-jsdoc"],
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"endOfLine": "auto"
|
||||
"singleQuote": true
|
||||
}
|
||||
|
949
dist/mermaid.core.js
vendored
949
dist/mermaid.core.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/mermaid.core.js.map
vendored
2
dist/mermaid.core.js.map
vendored
File diff suppressed because one or more lines are too long
949
dist/mermaid.js
vendored
949
dist/mermaid.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/mermaid.js.map
vendored
2
dist/mermaid.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.min.js.map
vendored
2
dist/mermaid.min.js.map
vendored
File diff suppressed because one or more lines are too long
357
docs/Setup.md
357
docs/Setup.md
@@ -2,69 +2,51 @@
|
||||
|
||||
## mermaidAPI
|
||||
|
||||
Edit this Page[![N|Solid][2]][1]
|
||||
Edit this
|
||||
Page[\[N|Solid\](img/GitHub-Mark-32px.png)][1]
|
||||
|
||||
This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js.
|
||||
This is the API to be used when optionally handling the integration with the web page, instead of
|
||||
using the default integration provided by mermaid.js.
|
||||
|
||||
The core of this api is the [**render**][3] function which, given a graph
|
||||
The core of this api is the [**render**][2] function which, given a graph
|
||||
definition as text, renders the graph/diagram and returns an svg element for the graph.
|
||||
|
||||
It is is then up to the user of the API to make use of the svg, either insert it somewhere in the page or do something completely different.
|
||||
It is is then up to the user of the API to make use of the svg, either insert it somewhere in the
|
||||
page or do something completely different.
|
||||
|
||||
In addition to the render function, a number of behavioral configuration options are available.
|
||||
|
||||
## Configuration
|
||||
|
||||
**Configuration methods in Mermaid version 8.6.0 have been updated, to learn more\[[click here][4]].**
|
||||
**Configuration methods in Mermaid version 8.6.0 have been updated, to learn more\[[click
|
||||
here][3]].**
|
||||
|
||||
## **What follows are config instructions for older versions**
|
||||
|
||||
These are the default options which can be overridden with the initialization call like so:
|
||||
|
||||
**Example 1:**
|
||||
**Example 1:**<pre> mermaid.initialize({ flowchart:{ htmlLabels: false } }); </pre>
|
||||
|
||||
<pre>
|
||||
mermaid.initialize({
|
||||
flowchart:{
|
||||
htmlLabels: false
|
||||
}
|
||||
});
|
||||
</pre>
|
||||
|
||||
**Example 2:**
|
||||
|
||||
<pre>
|
||||
<script>
|
||||
var config = {
|
||||
startOnLoad:true,
|
||||
flowchart:{
|
||||
useMaxWidth:true,
|
||||
htmlLabels:true,
|
||||
curve:'cardinal',
|
||||
},
|
||||
**Example 2:**<pre> <script> var config = { startOnLoad:true, flowchart:{ useMaxWidth:true,
|
||||
htmlLabels:true, curve:'cardinal', },
|
||||
|
||||
securityLevel:'loose',
|
||||
};
|
||||
mermaid.initialize(config);
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
A summary of all options and their defaults is found [here][5]. A description of each option follows below.
|
||||
}; mermaid.initialize(config); </script> </pre>
|
||||
|
||||
A summary of all options and their defaults is found [here][4].
|
||||
A description of each option follows below.
|
||||
|
||||
## theme
|
||||
|
||||
theme , the CSS style sheet
|
||||
Theme , the CSS style sheet
|
||||
|
||||
| Parameter | Description | Type | Required | Values |
|
||||
| --------- | --------------- | ------ | -------- | ---------------------------------------------- |
|
||||
| theme | Built in Themes | string | Optional | 'default', 'forest', 'dark', 'neutral', 'null' |
|
||||
|
||||
**Notes:** To disable any pre-defined mermaid theme, use "null".
|
||||
|
||||
<pre>
|
||||
"theme": "forest",
|
||||
"themeCSS": ".node rect { fill: red; }"
|
||||
</pre>
|
||||
**Notes:** To disable any pre-defined mermaid theme, use "null".<pre> "theme": "forest",
|
||||
"themeCSS": ".node rect { fill: red; }" </pre>
|
||||
|
||||
## fontFamily
|
||||
|
||||
@@ -72,8 +54,7 @@ theme , the CSS style sheet
|
||||
| ---------- | ------------------------------------------------------ | ------ | -------- | --------------------------- |
|
||||
| fontFamily | specifies the font to be used in the rendered diagrams | string | Required | Any Possible CSS FontFamily |
|
||||
|
||||
**Notes:**
|
||||
Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
|
||||
**Notes:** Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
|
||||
|
||||
## logLevel
|
||||
|
||||
@@ -83,11 +64,11 @@ Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
|
||||
|
||||
**Notes:**
|
||||
|
||||
- debug: 1
|
||||
- info: 2
|
||||
- warn: 3
|
||||
- error: 4
|
||||
- fatal: 5 (default)
|
||||
- Debug: 1
|
||||
- Info: 2
|
||||
- Warn: 3
|
||||
- Error: 4
|
||||
- Fatal: 5 (default)
|
||||
|
||||
## securityLevel
|
||||
|
||||
@@ -99,7 +80,8 @@ Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
|
||||
|
||||
- **strict**: (**default**) tags in text are encoded, click functionality is disabled
|
||||
- **loose**: tags in text are allowed, click functionality is enabled
|
||||
- **antiscript**: html tags in text are allowed, (only script element is removed), click functionality is enabled
|
||||
- **antiscript**: html tags in text are allowed, (only script element is removed), click
|
||||
functionality is enabled
|
||||
|
||||
## startOnLoad
|
||||
|
||||
@@ -123,9 +105,9 @@ Default value: false
|
||||
|
||||
## secure
|
||||
|
||||
This option controls which currentConfig keys are considered _secure_ and can only be changed via
|
||||
call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to
|
||||
the `secure` keys in the current currentConfig. This prevents malicious graph directives from
|
||||
This option controls which currentConfig keys are considered _secure_ and can only be changed
|
||||
via call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to the
|
||||
`secure` keys in the current currentConfig. This prevents malicious graph directives from
|
||||
overriding a site's default security.
|
||||
|
||||
**Notes**:
|
||||
@@ -134,19 +116,22 @@ Default value: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
|
||||
|
||||
## deterministicIds
|
||||
|
||||
This option controls if the generated ids of nodes in the SVG are generated randomly or based on a seed.
|
||||
If set to false, the IDs are generated based on the current date and thus are not deterministic. This is the default behaviour.
|
||||
This option controls if the generated ids of nodes in the SVG are generated randomly or based
|
||||
on a seed. If set to false, the IDs are generated based on the current date and thus are not
|
||||
deterministic. This is the default behaviour.
|
||||
|
||||
**Notes**:
|
||||
|
||||
This matters if your files are checked into sourcecontrol e.g. git and should not change unless content is changed.
|
||||
This matters if your files are checked into sourcecontrol e.g. git and should not change unless
|
||||
content is changed.
|
||||
|
||||
Default value: false
|
||||
|
||||
## deterministicIDSeed
|
||||
|
||||
This option is the optional seed for deterministic ids. if set to undefined but deterministicIds is true, a simple number iterator is used.
|
||||
You can set this attribute to base the seed on a static string.
|
||||
This option is the optional seed for deterministic ids. if set to undefined but
|
||||
deterministicIds is true, a simple number iterator is used. You can set this attribute to base
|
||||
the seed on a static string.
|
||||
|
||||
## flowchart
|
||||
|
||||
@@ -160,7 +145,8 @@ The object containing configurations specific for flowcharts
|
||||
|
||||
**Notes:**
|
||||
|
||||
The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
|
||||
The amount of padding around the diagram as a whole so that embedded diagrams have margins,
|
||||
expressed in pixels
|
||||
|
||||
Default value: 8
|
||||
|
||||
@@ -180,7 +166,8 @@ Default value: 8
|
||||
|
||||
**Notes:**
|
||||
|
||||
Pertains to horizontal spacing for TB (top to bottom) or BT (bottom to top) graphs, and the vertical spacing for LR as well as RL graphs.\*\*
|
||||
Pertains to horizontal spacing for TB (top to bottom) or BT (bottom to top) graphs, and the
|
||||
vertical spacing for LR as well as RL graphs.\*\*
|
||||
|
||||
Default value: 50
|
||||
|
||||
@@ -192,7 +179,8 @@ Default value: 50
|
||||
|
||||
**Notes**:
|
||||
|
||||
pertains to vertical spacing for TB (top to bottom) or BT (bottom to top), and the horizontal spacing for LR as well as RL graphs.
|
||||
Pertains to vertical spacing for TB (top to bottom) or BT (bottom to top), and the horizontal
|
||||
spacing for LR as well as RL graphs.
|
||||
|
||||
Default value 50
|
||||
|
||||
@@ -228,8 +216,7 @@ Default value: true
|
||||
**Notes:**
|
||||
|
||||
Decides which rendering engine that is to be used for the rendering. Legal values are:
|
||||
dagre-d3
|
||||
dagre-wrapper - wrapper for dagre implemented in mermaid
|
||||
dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid
|
||||
|
||||
Default value: 'dagre-d3'
|
||||
|
||||
@@ -267,8 +254,7 @@ The object containing configurations specific for sequence diagrams
|
||||
| ----------- | --------------------- | ------- | -------- | ------------------ |
|
||||
| actorMargin | Margin between actors | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 50
|
||||
**Notes:** Default value: 50
|
||||
|
||||
### width
|
||||
|
||||
@@ -276,8 +262,7 @@ Default value: 50
|
||||
| --------- | -------------------- | ------- | -------- | ------------------ |
|
||||
| width | Width of actor boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 150
|
||||
**Notes:** Default value: 150
|
||||
|
||||
### height
|
||||
|
||||
@@ -285,8 +270,7 @@ Default value: 150
|
||||
| --------- | --------------------- | ------- | -------- | ------------------ |
|
||||
| height | Height of actor boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 65
|
||||
**Notes:** Default value: 65
|
||||
|
||||
### boxMargin
|
||||
|
||||
@@ -294,8 +278,7 @@ Default value: 65
|
||||
| --------- | ------------------------ | ------- | -------- | ------------------ |
|
||||
| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 10
|
||||
**Notes:** Default value: 10
|
||||
|
||||
### boxTextMargin
|
||||
|
||||
@@ -303,8 +286,7 @@ Default value: 10
|
||||
| ------------- | -------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 5
|
||||
**Notes:** Default value: 5
|
||||
|
||||
### noteMargin
|
||||
|
||||
@@ -312,8 +294,7 @@ Default value: 5
|
||||
| ---------- | ------------------- | ------- | -------- | ------------------ |
|
||||
| noteMargin | margin around notes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 10
|
||||
**Notes:** Default value: 10
|
||||
|
||||
### messageMargin
|
||||
|
||||
@@ -321,8 +302,7 @@ Default value: 10
|
||||
| ------------- | ---------------------- | ------- | -------- | ------------------ |
|
||||
| messageMargin | Space between messages | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 35
|
||||
**Notes:** Default value: 35
|
||||
|
||||
### messageAlign
|
||||
|
||||
@@ -330,8 +310,7 @@ Default value: 35
|
||||
| ------------ | --------------------------- | ------ | -------- | ------------------------- |
|
||||
| messageAlign | Multiline message alignment | string | Required | 'left', 'center', 'right' |
|
||||
|
||||
**Notes:**
|
||||
Default value: 'center'
|
||||
**Notes:** Default value: 'center'
|
||||
|
||||
### mirrorActors
|
||||
|
||||
@@ -339,8 +318,7 @@ Default value: 'center'
|
||||
| ------------ | --------------------------- | ------- | -------- | ----------- |
|
||||
| mirrorActors | Mirror actors under diagram | boolean | Required | true, false |
|
||||
|
||||
**Notes:**
|
||||
Default value: true
|
||||
**Notes:** Default value: true
|
||||
|
||||
### forceMenus
|
||||
|
||||
@@ -370,9 +348,8 @@ Default value: 1
|
||||
| ----------- | ----------- | ------- | -------- | ----------- |
|
||||
| useMaxWidth | See Notes | boolean | Required | true, false |
|
||||
|
||||
**Notes:**
|
||||
When this flag is set to true, the height and width is set to 100% and is then scaling with the
|
||||
available space. If set to false, the absolute space required is used.
|
||||
**Notes:** When this flag is set to true, the height and width is set to 100% and is then
|
||||
scaling with the available space. If set to false, the absolute space required is used.
|
||||
|
||||
Default value: true
|
||||
|
||||
@@ -394,8 +371,7 @@ Default value: false
|
||||
| ------------------- | ------------------------------- | ------- | -------- | ----------- |
|
||||
| showSequenceNumbers | This will show the node numbers | boolean | Required | true, false |
|
||||
|
||||
**Notes:**
|
||||
Default value: false
|
||||
**Notes:** Default value: false
|
||||
|
||||
### actorFontSize
|
||||
|
||||
@@ -403,8 +379,7 @@ Default value: false
|
||||
| ------------- | -------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| actorFontSize | This sets the font size of the actor's description | Integer | Require | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
**Default value 14**..
|
||||
**Notes:** **Default value 14**..
|
||||
|
||||
### actorFontFamily
|
||||
|
||||
@@ -412,15 +387,13 @@ Default value: false
|
||||
| --------------- | ---------------------------------------------------- | ------ | -------- | --------------------------- |
|
||||
| actorFontFamily | This sets the font family of the actor's description | string | Required | Any Possible CSS FontFamily |
|
||||
|
||||
**Notes:**
|
||||
Default value: "'Open-Sans", "sans-serif"'
|
||||
**Notes:** Default value: "'Open-Sans", "sans-serif"'
|
||||
|
||||
### actorFontWeight
|
||||
|
||||
This sets the font weight of the actor's description
|
||||
|
||||
**Notes:**
|
||||
Default value: 400.
|
||||
**Notes:** Default value: 400.
|
||||
|
||||
### noteFontSize
|
||||
|
||||
@@ -428,8 +401,7 @@ Default value: 400.
|
||||
| ------------ | ----------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| noteFontSize | This sets the font size of actor-attached notes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 14
|
||||
**Notes:** Default value: 14
|
||||
|
||||
### noteFontFamily
|
||||
|
||||
@@ -437,15 +409,13 @@ Default value: 14
|
||||
| -------------- | -------------------------------------------------- | ------ | -------- | --------------------------- |
|
||||
| noteFontFamily | This sets the font family of actor-attached notes. | string | Required | Any Possible CSS FontFamily |
|
||||
|
||||
**Notes:**
|
||||
Default value: ''"trebuchet ms", verdana, arial, sans-serif'
|
||||
**Notes:** Default value: ''"trebuchet ms", verdana, arial, sans-serif'
|
||||
|
||||
### noteFontWeight
|
||||
|
||||
This sets the font weight of the note's description
|
||||
|
||||
**Notes:**
|
||||
Default value: 400
|
||||
**Notes:** Default value: 400
|
||||
|
||||
### noteAlign
|
||||
|
||||
@@ -453,8 +423,7 @@ Default value: 400
|
||||
| --------- | ---------------------------------------------------- | ------ | -------- | ------------------------- |
|
||||
| noteAlign | This sets the text alignment of actor-attached notes | string | required | 'left', 'center', 'right' |
|
||||
|
||||
**Notes:**
|
||||
Default value: 'center'
|
||||
**Notes:** Default value: 'center'
|
||||
|
||||
### messageFontSize
|
||||
|
||||
@@ -462,8 +431,7 @@ Default value: 'center'
|
||||
| --------------- | ----------------------------------------- | ------- | -------- | ------------------- |
|
||||
| messageFontSize | This sets the font size of actor messages | Integer | Required | Any Positive Number |
|
||||
|
||||
**Notes:**
|
||||
Default value: 16
|
||||
**Notes:** Default value: 16
|
||||
|
||||
### messageFontFamily
|
||||
|
||||
@@ -471,43 +439,37 @@ Default value: 16
|
||||
| ----------------- | ------------------------------------------- | ------ | -------- | --------------------------- |
|
||||
| messageFontFamily | This sets the font family of actor messages | string | Required | Any Possible CSS FontFamily |
|
||||
|
||||
**Notes:**
|
||||
Default value: '"trebuchet ms", verdana, arial, sans-serif'
|
||||
**Notes:** Default value: '"trebuchet ms", verdana, arial, sans-serif'
|
||||
|
||||
### messageFontWeight
|
||||
|
||||
This sets the font weight of the message's description
|
||||
|
||||
**Notes:**
|
||||
Default value: 400.
|
||||
**Notes:** Default value: 400.
|
||||
|
||||
### wrap
|
||||
|
||||
This sets the auto-wrap state for the diagram
|
||||
|
||||
**Notes:**
|
||||
Default value: false.
|
||||
**Notes:** Default value: false.
|
||||
|
||||
### wrapPadding
|
||||
|
||||
This sets the auto-wrap padding for the diagram (sides only)
|
||||
|
||||
**Notes:**
|
||||
Default value: 0.
|
||||
**Notes:** Default value: 0.
|
||||
|
||||
### labelBoxWidth
|
||||
|
||||
This sets the width of the loop-box (loop, alt, opt, par)
|
||||
|
||||
**Notes:**
|
||||
Default value: 50.
|
||||
**Notes:** Default value: 50.
|
||||
|
||||
### labelBoxHeight
|
||||
|
||||
This sets the height of the loop-box (loop, alt, opt, par)
|
||||
|
||||
**Notes:**
|
||||
Default value: 20.
|
||||
**Notes:** Default value: 20.
|
||||
|
||||
## gantt
|
||||
|
||||
@@ -521,8 +483,7 @@ The object containing configurations specific for gantt diagrams
|
||||
| -------------- | ---------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 25
|
||||
**Notes:** Default value: 25
|
||||
|
||||
### barHeight
|
||||
|
||||
@@ -530,8 +491,7 @@ Default value: 25
|
||||
| --------- | ----------------------------------- | ------- | -------- | ------------------ |
|
||||
| barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 20
|
||||
**Notes:** Default value: 20
|
||||
|
||||
### barGap
|
||||
|
||||
@@ -539,8 +499,7 @@ Default value: 20
|
||||
| --------- | ---------------------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| barGap | The margin between the different activities in the gantt diagram | Integer | Optional | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 4
|
||||
**Notes:** Default value: 4
|
||||
|
||||
### topPadding
|
||||
|
||||
@@ -548,8 +507,7 @@ Default value: 4
|
||||
| ---------- | -------------------------------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 50
|
||||
**Notes:** Default value: 50
|
||||
|
||||
### rightPadding
|
||||
|
||||
@@ -557,8 +515,7 @@ Default value: 50
|
||||
| ------------ | ----------------------------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| rightPadding | The space allocated for the section name to the right of the activities | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 75
|
||||
**Notes:** Default value: 75
|
||||
|
||||
### leftPadding
|
||||
|
||||
@@ -566,8 +523,7 @@ Default value: 75
|
||||
| ----------- | ---------------------------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| leftPadding | The space allocated for the section name to the left of the activities | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 75
|
||||
**Notes:** Default value: 75
|
||||
|
||||
### gridLineStartPadding
|
||||
|
||||
@@ -575,8 +531,7 @@ Default value: 75
|
||||
| -------------------- | -------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| gridLineStartPadding | Vertical starting position of the grid lines | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 35
|
||||
**Notes:** Default value: 35
|
||||
|
||||
### fontSize
|
||||
|
||||
@@ -584,8 +539,7 @@ Default value: 35
|
||||
| --------- | ----------- | ------- | -------- | ------------------ |
|
||||
| fontSize | Font size | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 11
|
||||
**Notes:** Default value: 11
|
||||
|
||||
### sectionFontSize
|
||||
|
||||
@@ -593,8 +547,7 @@ Default value: 11
|
||||
| --------------- | ---------------------- | ------- | -------- | ------------------ |
|
||||
| sectionFontSize | Font size for sections | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 11
|
||||
**Notes:** Default value: 11
|
||||
|
||||
### numberSectionStyles
|
||||
|
||||
@@ -602,8 +555,7 @@ Default value: 11
|
||||
| ------------------- | ---------------------------------------- | ------- | -------- | ------------------ |
|
||||
| numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 4
|
||||
**Notes:** Default value: 4
|
||||
|
||||
### axisFormat
|
||||
|
||||
@@ -636,8 +588,7 @@ Default value: true
|
||||
| --------- | ----------- | ------- | -------- | ----------- |
|
||||
| topAxis | See notes | Boolean | 4 | True, False |
|
||||
|
||||
**Notes:** when this flag is set date labels will be added to the
|
||||
top of the chart
|
||||
**Notes:** when this flag is set date labels will be added to the top of the chart
|
||||
|
||||
**Default value false**.
|
||||
|
||||
@@ -651,8 +602,7 @@ The object containing configurations specific for journey diagrams
|
||||
| -------------- | ---------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 50
|
||||
**Notes:** Default value: 50
|
||||
|
||||
### diagramMarginY
|
||||
|
||||
@@ -660,8 +610,7 @@ Default value: 50
|
||||
| -------------- | -------------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| diagramMarginY | Margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 10
|
||||
**Notes:** Default value: 10
|
||||
|
||||
### leftMargin
|
||||
|
||||
@@ -669,8 +618,7 @@ Default value: 10
|
||||
| ----------- | --------------------- | ------- | -------- | ------------------ |
|
||||
| actorMargin | Margin between actors | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 50
|
||||
**Notes:** Default value: 50
|
||||
|
||||
### width
|
||||
|
||||
@@ -678,8 +626,7 @@ Default value: 50
|
||||
| --------- | -------------------- | ------- | -------- | ------------------ |
|
||||
| width | Width of actor boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 150
|
||||
**Notes:** Default value: 150
|
||||
|
||||
### height
|
||||
|
||||
@@ -687,8 +634,7 @@ Default value: 150
|
||||
| --------- | --------------------- | ------- | -------- | ------------------ |
|
||||
| height | Height of actor boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 65
|
||||
**Notes:** Default value: 65
|
||||
|
||||
### boxMargin
|
||||
|
||||
@@ -696,8 +642,7 @@ Default value: 65
|
||||
| --------- | ------------------------ | ------- | -------- | ------------------ |
|
||||
| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 10
|
||||
**Notes:** Default value: 10
|
||||
|
||||
### boxTextMargin
|
||||
|
||||
@@ -705,8 +650,7 @@ Default value: 10
|
||||
| ------------- | -------------------------------------------- | ------- | -------- | ------------------ |
|
||||
| boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 5
|
||||
**Notes:** Default value: 5
|
||||
|
||||
### noteMargin
|
||||
|
||||
@@ -714,8 +658,7 @@ Default value: 5
|
||||
| ---------- | ------------------- | ------- | -------- | ------------------ |
|
||||
| noteMargin | Margin around notes | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Default value: 10
|
||||
**Notes:** Default value: 10
|
||||
|
||||
### messageMargin
|
||||
|
||||
@@ -735,8 +678,7 @@ Default value: 35
|
||||
| ------------ | --------------------------- | ---- | -------- | ------------------------- |
|
||||
| messageAlign | Multiline message alignment | 3 | 4 | 'left', 'center', 'right' |
|
||||
|
||||
**Notes:**
|
||||
Default value: 'center'
|
||||
**Notes:** Default value: 'center'
|
||||
|
||||
### bottomMarginAdj
|
||||
|
||||
@@ -797,8 +739,7 @@ Default value: true
|
||||
**Notes**:
|
||||
|
||||
Decides which rendering engine that is to be used for the rendering. Legal values are:
|
||||
dagre-d3
|
||||
dagre-wrapper - wrapper for dagre implemented in mermaid
|
||||
dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid
|
||||
|
||||
Default value: 'dagre-d3'
|
||||
|
||||
@@ -837,8 +778,7 @@ Default value: true
|
||||
**Notes:**
|
||||
|
||||
Decides which rendering engine that is to be used for the rendering. Legal values are:
|
||||
dagre-d3
|
||||
dagre-wrapper - wrapper for dagre implemented in mermaid
|
||||
dagre-d3 dagre-wrapper - wrapper for dagre implemented in mermaid
|
||||
|
||||
Default value: 'dagre-d3'
|
||||
|
||||
@@ -854,7 +794,8 @@ The object containing configurations specific for entity relationship diagrams
|
||||
|
||||
**Notes:**
|
||||
|
||||
The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
|
||||
The amount of padding around the diagram as a whole so that embedded diagrams have margins,
|
||||
expressed in pixels
|
||||
|
||||
Default value: 20
|
||||
|
||||
@@ -878,9 +819,7 @@ Default value: 'TB'
|
||||
| -------------- | ---------------------------------- | ------- | -------- | ------------------ |
|
||||
| minEntityWidth | The minimum width of an entity box | Integer | Required | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Expressed in pixels.
|
||||
Default value: 100
|
||||
**Notes:** Expressed in pixels. Default value: 100
|
||||
|
||||
### minEntityHeight
|
||||
|
||||
@@ -888,9 +827,7 @@ Default value: 100
|
||||
| --------------- | ----------------------------------- | ------- | -------- | ------------------ |
|
||||
| minEntityHeight | The minimum height of an entity box | Integer | 4 | Any Positive Value |
|
||||
|
||||
**Notes:**
|
||||
Expressed in pixels
|
||||
Default value: 75
|
||||
**Notes:** Expressed in pixels Default value: 75
|
||||
|
||||
### entityPadding
|
||||
|
||||
@@ -900,7 +837,8 @@ Default value: 75
|
||||
|
||||
**Notes:**
|
||||
|
||||
The minimum internal padding betweentext in an entity box and the enclosing box borders, expressed in pixels.
|
||||
The minimum internal padding betweentext in an entity box and the enclosing box borders,
|
||||
expressed in pixels.
|
||||
|
||||
Default value: 15
|
||||
|
||||
@@ -910,8 +848,7 @@ Default value: 15
|
||||
| --------- | ----------------------------------- | ------ | -------- | -------------------- |
|
||||
| stroke | Stroke color of box edges and lines | string | 4 | Any recognized color |
|
||||
|
||||
**Notes:**
|
||||
Default value: 'gray'
|
||||
**Notes:** Default value: 'gray'
|
||||
|
||||
### fill
|
||||
|
||||
@@ -919,8 +856,7 @@ Default value: 'gray'
|
||||
| --------- | -------------------------- | ------ | -------- | -------------------- |
|
||||
| fill | Fill color of entity boxes | string | 4 | Any recognized color |
|
||||
|
||||
**Notes:**
|
||||
Default value: 'honeydew'
|
||||
**Notes:** Default value: 'honeydew'
|
||||
|
||||
### fontSize
|
||||
|
||||
@@ -930,8 +866,7 @@ Default value: 'honeydew'
|
||||
|
||||
**Notes:**
|
||||
|
||||
Font size (expressed as an integer representing a number of pixels)
|
||||
Default value: 12
|
||||
Font size (expressed as an integer representing a number of pixels) Default value: 12
|
||||
|
||||
### useMaxWidth
|
||||
|
||||
@@ -941,9 +876,8 @@ Default value: 12
|
||||
|
||||
**Notes:**
|
||||
|
||||
When this flag is set to true, the diagram width is locked to 100% and
|
||||
scaled based on available space. If set to false, the diagram reserves its
|
||||
absolute width.
|
||||
When this flag is set to true, the diagram width is locked to 100% and scaled based on
|
||||
available space. If set to false, the diagram reserves its absolute width.
|
||||
|
||||
Default value: true
|
||||
|
||||
@@ -959,9 +893,8 @@ The object containing configurations specific for pie diagrams
|
||||
|
||||
**Notes:**
|
||||
|
||||
When this flag is set to true, the diagram width is locked to 100% and
|
||||
scaled based on available space. If set to false, the diagram reserves its
|
||||
absolute width.
|
||||
When this flag is set to true, the diagram width is locked to 100% and scaled based on
|
||||
available space. If set to false, the diagram reserves its absolute width.
|
||||
|
||||
Default value: true
|
||||
|
||||
@@ -977,9 +910,8 @@ The object containing configurations specific for req diagrams
|
||||
|
||||
**Notes:**
|
||||
|
||||
When this flag is set to true, the diagram width is locked to 100% and
|
||||
scaled based on available space. If set to false, the diagram reserves its
|
||||
absolute width.
|
||||
When this flag is set to true, the diagram width is locked to 100% and scaled based on
|
||||
available space. If set to false, the diagram reserves its absolute width.
|
||||
|
||||
Default value: true
|
||||
|
||||
@@ -991,18 +923,19 @@ Default value: true
|
||||
| ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||
| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||
|
||||
**Notes:**
|
||||
Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
|
||||
the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
|
||||
to the defaultConfig
|
||||
**Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls
|
||||
to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig)
|
||||
will reset siteConfig and current Config to the defaultConfig
|
||||
|
||||
Note: currentConfig is set in this function
|
||||
|
||||
Default value: At default, will mirror Global Config
|
||||
|
||||
### Parameters
|
||||
|
||||
- `conf` **any** the base currentConfig to use as siteConfig
|
||||
- `conf` **any** The base currentConfig to use as siteConfig
|
||||
|
||||
Returns **any** the siteConfig
|
||||
Returns **any** The siteConfig
|
||||
|
||||
## parse
|
||||
|
||||
@@ -1020,8 +953,7 @@ Returns **any**
|
||||
| ------------- | ------------------------------------------------- | ----------- | --------------------------------- |
|
||||
| setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in site Config |
|
||||
|
||||
**Notes**:
|
||||
Returns **any** values in siteConfig.
|
||||
**Notes**: Returns **any** values in siteConfig.
|
||||
|
||||
Returns **any**
|
||||
|
||||
@@ -1033,29 +965,27 @@ Returns **any**
|
||||
| ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||
| setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||
|
||||
**Notes**:
|
||||
Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
|
||||
values found in conf with key found in siteConfig.secure will be replaced with the corresponding
|
||||
siteConfig value.
|
||||
**Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure
|
||||
keys. Any values found in conf with key found in siteConfig.secure will be replaced with the
|
||||
corresponding siteConfig value.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `conf` **any** the potential currentConfig
|
||||
- `conf` **any** The potential currentConfig
|
||||
|
||||
Returns **any** the currentConfig merged with the sanitized conf
|
||||
Returns **any** The currentConfig merged with the sanitized conf
|
||||
|
||||
## getConfig
|
||||
|
||||
## getConfig
|
||||
|
||||
| Function | Description | Type | Return Values |
|
||||
| --------- | ------------------------- | ----------- | ----------------------------- |
|
||||
| --------- | ------------------------- | ----------- | ------------------------------ |
|
||||
| getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |
|
||||
|
||||
**Notes**:
|
||||
Returns **any** the currentConfig
|
||||
**Notes**: Returns **any** the currentConfig
|
||||
|
||||
Returns **any** the currentConfig
|
||||
Returns **any** The currentConfig
|
||||
|
||||
## sanitize
|
||||
|
||||
@@ -1065,13 +995,12 @@ Returns **any** the currentConfig
|
||||
| -------- | -------------------------------------- | ----------- | ------ |
|
||||
| sanitize | Sets the siteConfig to desired values. | Put Request | None |
|
||||
|
||||
Ensures options parameter does not attempt to override siteConfig secure keys
|
||||
**Notes**:
|
||||
modifies options in-place
|
||||
Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies
|
||||
options in-place
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **any** the potential setConfig parameter
|
||||
- `options` **any** The potential setConfig parameter
|
||||
|
||||
## reset
|
||||
|
||||
@@ -1082,11 +1011,11 @@ modifies options in-place
|
||||
| reset | Resets currentConfig to conf | Put Request | Required | None |
|
||||
|
||||
| Parameter | Description | Type | Required | Values |
|
||||
| --------- | ------------------------------------------------------------- | ---------- | -------- | -------------------------------------------- |
|
||||
|
||||
\| --------- \| ------------------------------------------------------------ \| ---------- \| -------- \| -------------------------------------------- \|
|
||||
| conf | base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array |
|
||||
|
||||
**Notes**:
|
||||
(default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||
**Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||
|
||||
## render
|
||||
|
||||
@@ -1094,7 +1023,7 @@ Function that renders an svg with a graph from a chart definition. Usage example
|
||||
|
||||
```js
|
||||
mermaidAPI.initialize({
|
||||
startOnLoad:true
|
||||
startOnLoad: true,
|
||||
});
|
||||
$(function () {
|
||||
const graphDefinition = 'graph TB\na-->b';
|
||||
@@ -1107,12 +1036,12 @@ mermaidAPI.initialize({
|
||||
|
||||
### Parameters
|
||||
|
||||
- `id` **any** the id of the element to be rendered
|
||||
- `_txt` **any** the graph definition
|
||||
- `cb` **any** callback which is called after rendering is finished with the svg code as inparam.
|
||||
- `container` **any** selector to element in which a div with the graph temporarily will be inserted. In one is
|
||||
provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
|
||||
completed.
|
||||
- `id` **any** The id of the element to be rendered
|
||||
- `_txt` **any** The graph definition
|
||||
- `cb` **any** Callback which is called after rendering is finished with the svg code as inparam.
|
||||
- `container` **any** Selector to element in which a div with the graph temporarily will be
|
||||
inserted. In one is provided a hidden div will be inserted in the body of the page instead. The
|
||||
element will be removed when rendering is completed.
|
||||
|
||||
Returns **any**
|
||||
|
||||
@@ -1122,8 +1051,6 @@ Returns **any**
|
||||
|
||||
- `conf` **any**
|
||||
|
||||
## reinitialize
|
||||
|
||||
## initialize
|
||||
|
||||
### Parameters
|
||||
@@ -1188,7 +1115,7 @@ Returns **any**
|
||||
numberSectionStyles: 4,
|
||||
axisFormat: '%Y-%m-%d',
|
||||
topAxis: false,
|
||||
}
|
||||
},
|
||||
};
|
||||
mermaid.initialize(config);
|
||||
</script>
|
||||
@@ -1196,10 +1123,8 @@ Returns **any**
|
||||
|
||||
[1]: https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js
|
||||
|
||||
[2]: img/GitHub-Mark-32px.png
|
||||
[2]: Setup.md?id=render
|
||||
|
||||
[3]: Setup.md?id=render
|
||||
[3]: 8.6.0_docs.md
|
||||
|
||||
[4]: 8.6.0_docs.md
|
||||
|
||||
[5]: #mermaidapi-configuration-defaults
|
||||
[4]: #mermaidapi-configuration-defaults
|
||||
|
@@ -93,6 +93,7 @@
|
||||
"moment": "^2.23.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prettier": "^2.3.2",
|
||||
"prettier-plugin-jsdoc": "^0.3.30",
|
||||
"start-server-and-test": "^1.12.6",
|
||||
"terser-webpack-plugin": "^5.2.4",
|
||||
"webpack": "^5.53.0",
|
||||
|
@@ -43,18 +43,21 @@ export const updateCurrentConfig = (siteCfg, _directives) => {
|
||||
};
|
||||
/**
|
||||
* ## setSiteConfig
|
||||
*
|
||||
* | Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
* | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||
* | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||
***Notes:**
|
||||
*Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
|
||||
*the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
|
||||
*to the defaultConfig
|
||||
*
|
||||
* **Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls
|
||||
* to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig)
|
||||
* will reset siteConfig and current Config to the defaultConfig
|
||||
*
|
||||
* Note: currentConfig is set in this function
|
||||
*
|
||||
* Default value: At default, will mirror Global Config
|
||||
*
|
||||
* @param {any} conf - the base currentConfig to use as siteConfig
|
||||
* @returns {*} - the siteConfig
|
||||
* @param {any} conf - The base currentConfig to use as siteConfig
|
||||
* @returns {any} - The siteConfig
|
||||
*/
|
||||
export const setSiteConfig = (conf) => {
|
||||
siteConfig = assignWithDepth({}, defaultConfig);
|
||||
@@ -80,29 +83,31 @@ export const updateSiteConfig = (conf) => {
|
||||
};
|
||||
/**
|
||||
* ## getSiteConfig
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| setSiteConfig|Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig|
|
||||
***Notes**:
|
||||
*Returns **any** values in siteConfig.
|
||||
*
|
||||
* @returns {*}
|
||||
* | Function | Description | Type | Values |
|
||||
* | ------------- | ------------------------------------------------- | ----------- | --------------------------------- |
|
||||
* | setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in site Config |
|
||||
*
|
||||
* **Notes**: Returns **any** values in siteConfig.
|
||||
*
|
||||
* @returns {any}
|
||||
*/
|
||||
export const getSiteConfig = () => {
|
||||
return assignWithDepth({}, siteConfig);
|
||||
};
|
||||
/**
|
||||
* ## setConfig
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| setSiteConfig|Sets the siteConfig to desired values | Put Request| Any Values, except ones in secure array|
|
||||
***Notes**:
|
||||
*Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
|
||||
*values found in conf with key found in siteConfig.secure will be replaced with the corresponding
|
||||
*siteConfig value.
|
||||
*
|
||||
* @param {any} conf - the potential currentConfig
|
||||
* @returns {*} - the currentConfig merged with the sanitized conf
|
||||
* | Function | Description | Type | Values |
|
||||
* | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||
* | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||
*
|
||||
* **Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure
|
||||
* keys. Any values found in conf with key found in siteConfig.secure will be replaced with the
|
||||
* corresponding siteConfig value.
|
||||
*
|
||||
* @param {any} conf - The potential currentConfig
|
||||
* @returns {any} - The currentConfig merged with the sanitized conf
|
||||
*/
|
||||
export const setConfig = (conf) => {
|
||||
// sanitize(conf);
|
||||
@@ -118,27 +123,29 @@ export const setConfig = (conf) => {
|
||||
|
||||
/**
|
||||
* ## getConfig
|
||||
*| Function | Description | Type | Return Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
|
||||
***Notes**:
|
||||
*Returns **any** the currentConfig
|
||||
*
|
||||
* @returns {*} - the currentConfig
|
||||
* | Function | Description | Type | Return Values |
|
||||
* | --------- | ------------------------- | ----------- | ------------------------------ |
|
||||
* | getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |
|
||||
*
|
||||
* **Notes**: Returns **any** the currentConfig
|
||||
*
|
||||
* @returns {any} - The currentConfig
|
||||
*/
|
||||
export const getConfig = () => {
|
||||
return assignWithDepth({}, currentConfig);
|
||||
};
|
||||
/**
|
||||
* ## sanitize
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| sanitize |Sets the siteConfig to desired values. | Put Request |None|
|
||||
*Ensures options parameter does not attempt to override siteConfig secure keys
|
||||
***Notes**:
|
||||
* modifies options in-place
|
||||
*
|
||||
* @param {any} options - the potential setConfig parameter
|
||||
* | Function | Description | Type | Values |
|
||||
* | -------- | -------------------------------------- | ----------- | ------ |
|
||||
* | sanitize | Sets the siteConfig to desired values. | Put Request | None |
|
||||
*
|
||||
* Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies
|
||||
* options in-place
|
||||
*
|
||||
* @param {any} options - The potential setConfig parameter
|
||||
*/
|
||||
export const sanitize = (options) => {
|
||||
// Checking that options are not in the list of excluded options
|
||||
@@ -194,17 +201,17 @@ export const addDirective = (directive) => {
|
||||
|
||||
/**
|
||||
* ## reset
|
||||
*
|
||||
* | Function | Description | Type | Required | Values |
|
||||
*| --------- | ------------------- | ------- | -------- | ------------------ |
|
||||
* | -------- | ---------------------------- | ----------- | -------- | ------ |
|
||||
* | reset | Resets currentConfig to conf | Put Request | Required | None |
|
||||
*
|
||||
* | Parameter | Description | Type | Required | Values |
|
||||
*| --- | --- | --- | --- | --- |
|
||||
*
|
||||
* | --------- | ------------------------------------------------------------ | ---------- | -------- | -------------------------------------------- |
|
||||
* | conf | base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array |
|
||||
*
|
||||
***Notes**:
|
||||
* (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||
*
|
||||
* **Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||
*/
|
||||
export const reset = () => {
|
||||
// Replace current config with siteConfig
|
||||
|
@@ -21,18 +21,18 @@ const currentConfig = assignWithDepth({}, defaultConfig);
|
||||
|
||||
/**
|
||||
* ## setSiteConfig
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| setSiteConfig|Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array|
|
||||
***Notes:**
|
||||
*Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
|
||||
*the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
|
||||
*to the defaultConfig
|
||||
*Note: currentConfig is set in this function
|
||||
*Default value: At default, will mirror Global Config
|
||||
*
|
||||
* @param {any} conf - the base currentConfig to use as siteConfig
|
||||
* @returns {*} - the siteConfig
|
||||
* | Function | Description | Type | Values |
|
||||
* | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||
* | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||
*
|
||||
* **Notes:** Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls
|
||||
* to reset() will reset the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig)
|
||||
* will reset siteConfig and currentConfig to the defaultConfig Note: currentConfig is set in this
|
||||
* function Default value: At default, will mirror Global Config
|
||||
*
|
||||
* @param {any} conf - The base currentConfig to use as siteConfig
|
||||
* @returns {any} - The siteConfig
|
||||
*/
|
||||
export const setSiteConfig = (conf) => {
|
||||
console.log('setSiteConfig');
|
||||
@@ -50,29 +50,31 @@ export const setSiteConfig = (conf) => {
|
||||
};
|
||||
/**
|
||||
* ## getSiteConfig
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| setSiteConfig|Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig|
|
||||
***Notes**:
|
||||
*Returns **any** values in siteConfig.
|
||||
*
|
||||
* @returns {*}
|
||||
* | Function | Description | Type | Values |
|
||||
* | ------------- | ------------------------------------------------- | ----------- | -------------------------------- |
|
||||
* | setSiteConfig | Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig |
|
||||
*
|
||||
* **Notes**: Returns **any** values in siteConfig.
|
||||
*
|
||||
* @returns {any}
|
||||
*/
|
||||
export const getSiteConfig = () => {
|
||||
return assignWithDepth({}, siteConfig);
|
||||
};
|
||||
/**
|
||||
* ## setConfig
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| setSiteConfig|Sets the siteConfig to desired values | Put Request| Any Values, except ones in secure array|
|
||||
***Notes**:
|
||||
*Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
|
||||
*values found in conf with key found in siteConfig.secure will be replaced with the corresponding
|
||||
*siteConfig value.
|
||||
*
|
||||
* @param {any} conf - the potential currentConfig
|
||||
* @returns {*} - the currentConfig merged with the sanitized conf
|
||||
* | Function | Description | Type | Values |
|
||||
* | ------------- | ------------------------------------- | ----------- | --------------------------------------- |
|
||||
* | setSiteConfig | Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array |
|
||||
*
|
||||
* **Notes**: Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure
|
||||
* keys. Any values found in conf with key found in siteConfig.secure will be replaced with the
|
||||
* corresponding siteConfig value.
|
||||
*
|
||||
* @param {any} conf - The potential currentConfig
|
||||
* @returns {any} - The currentConfig merged with the sanitized conf
|
||||
*/
|
||||
export const setConfig = (conf) => {
|
||||
console.log('setConfig');
|
||||
@@ -87,27 +89,29 @@ export const setConfig = (conf) => {
|
||||
};
|
||||
/**
|
||||
* ## getConfig
|
||||
*| Function | Description | Type | Return Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
|
||||
***Notes**:
|
||||
*Returns **any** the currentConfig
|
||||
*
|
||||
* @returns {*} - the currentConfig
|
||||
* | Function | Description | Type | Return Values |
|
||||
* | --------- | ------------------------- | ----------- | ----------------------------- |
|
||||
* | getConfig | Obtains the currentConfig | Get Request | Any Values from currentConfig |
|
||||
*
|
||||
* **Notes**: Returns **any** the currentConfig
|
||||
*
|
||||
* @returns {any} - The currentConfig
|
||||
*/
|
||||
export const getConfig = () => {
|
||||
return assignWithDepth({}, currentConfig);
|
||||
};
|
||||
/**
|
||||
* ## sanitize
|
||||
*| Function | Description | Type | Values |
|
||||
*| --------- | ------------------- | ------- | ------------------ |
|
||||
*| sanitize |Sets the siteConfig to desired values. | Put Request |None|
|
||||
*Ensures options parameter does not attempt to override siteConfig secure keys
|
||||
***Notes**:
|
||||
*modifies options in-place
|
||||
*
|
||||
* @param {any} options - the potential setConfig parameter
|
||||
* | Function | Description | Type | Values |
|
||||
* | -------- | -------------------------------------- | ----------- | ------ |
|
||||
* | sanitize | Sets the siteConfig to desired values. | Put Request | None |
|
||||
*
|
||||
* Ensures options parameter does not attempt to override siteConfig secure keys **Notes**: modifies
|
||||
* options in-place
|
||||
*
|
||||
* @param {any} options - The potential setConfig parameter
|
||||
*/
|
||||
export const sanitize = (options) => {
|
||||
Object.keys(siteConfig.secure).forEach((key) => {
|
||||
@@ -124,18 +128,19 @@ export const sanitize = (options) => {
|
||||
};
|
||||
/**
|
||||
* ## reset
|
||||
*
|
||||
* | Function | Description | Type | Required | Values |
|
||||
*| --------- | ------------------- | ------- | -------- | ------------------ |
|
||||
* | -------- | ---------------------------- | ----------- | -------- | ------ |
|
||||
* | reset | Resets currentConfig to conf | Put Request | Required | None |
|
||||
*
|
||||
* | Parameter | Description |Type | Required | Values|
|
||||
*
|
||||
* | --- | --- | --- | --- | --- |
|
||||
* | conf| base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array|
|
||||
*
|
||||
***Notes**:
|
||||
*(default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||
* **Notes**: (default: current siteConfig ) (optional, default `getSiteConfig()`)
|
||||
*
|
||||
* @param {any} conf - the base currentConfig to reset to (default: current siteConfig )
|
||||
* @param {any} conf - The base currentConfig to reset to (default: current siteConfig )
|
||||
*/
|
||||
export const reset = (conf = getSiteConfig()) => {
|
||||
console.warn('reset');
|
||||
|
@@ -82,7 +82,7 @@ const rect = (parent, node) => {
|
||||
*
|
||||
* @param {any} parent
|
||||
* @param {any} node
|
||||
* @returns {*} shapeSvg
|
||||
* @returns {any} ShapeSvg
|
||||
*/
|
||||
const noteGroup = (parent, node) => {
|
||||
// Add outer g element
|
||||
|
@@ -15,7 +15,7 @@ function applyStyle(dom, styleFn) {
|
||||
|
||||
/**
|
||||
* @param {any} node
|
||||
* @returns {SVGForeignObjectElement} node
|
||||
* @returns {SVGForeignObjectElement} Node
|
||||
*/
|
||||
function addHtmlLabel(node) {
|
||||
const fo = select(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));
|
||||
|
@@ -311,8 +311,8 @@ export const intersection = (node, outsidePoint, insidePoint) => {
|
||||
* and return an update path ending by the border of the node.
|
||||
*
|
||||
* @param {Array} _points
|
||||
* @param {*} boundryNode
|
||||
* @returns {Array} points
|
||||
* @param {any} boundryNode
|
||||
* @returns {Array} Points
|
||||
*/
|
||||
const cutPathAtIntersect = (_points, boundryNode) => {
|
||||
log.warn('abc88 cutPathAtIntersect', _points, boundryNode);
|
||||
|
@@ -1,7 +1,5 @@
|
||||
/**
|
||||
* Returns the point at which two lines, p and q, intersect or returns
|
||||
* undefined if they do not intersect.
|
||||
*
|
||||
* Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect.
|
||||
*
|
||||
* @param p1
|
||||
* @param p2
|
||||
|
@@ -5,8 +5,8 @@ import intersectLine from './intersect-line';
|
||||
export default intersectPolygon;
|
||||
|
||||
/**
|
||||
* Returns the point ({x, y}) at which the point argument intersects with the
|
||||
* node argument assuming that it has the shape specified by polygon.
|
||||
* Returns the point ({x, y}) at which the point argument intersects with the node argument assuming
|
||||
* that it has the shape specified by polygon.
|
||||
*
|
||||
* @param node
|
||||
* @param polyPoints
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Setup arrow head and define the marker. The result is appended to the svg.
|
||||
*/
|
||||
/** Setup arrow head and define the marker. The result is appended to the svg. */
|
||||
|
||||
import { log } from '../logger';
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Decorates with functions required by mermaids dagre-wrapper.
|
||||
*/
|
||||
/** Decorates with functions required by mermaids dagre-wrapper. */
|
||||
import { log } from '../logger';
|
||||
import graphlib from 'graphlib';
|
||||
|
||||
@@ -168,7 +166,7 @@ export const validate = (graph) => {
|
||||
* Finds a child that is not a cluster. When faking a edge between a node and a cluster.
|
||||
*
|
||||
* @param {Finds a} id
|
||||
* @param {*} graph
|
||||
* @param {any} graph
|
||||
*/
|
||||
export const findNonClusterChild = (id, graph) => {
|
||||
// const node = graph.node(id);
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Setup arrow head and define the marker. The result is appended to the svg.
|
||||
*/
|
||||
/** Setup arrow head and define the marker. The result is appended to the svg. */
|
||||
|
||||
// import { log } from '../logger';
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -100,8 +100,8 @@ export const addRelation = function (relation) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an annotation to the specified class
|
||||
* Annotations mark special properties of the given type (like 'interface' or 'service')
|
||||
* Adds an annotation to the specified class Annotations mark special properties of the given type
|
||||
* (like 'interface' or 'service')
|
||||
*
|
||||
* @param className The class name
|
||||
* @param annotation The name of the annotation without any brackets
|
||||
@@ -116,10 +116,9 @@ export const addAnnotation = function (className, annotation) {
|
||||
* Adds a member to the specified class
|
||||
*
|
||||
* @param className The class name
|
||||
* @param member The full name of the member.
|
||||
* If the member is enclosed in <<brackets>> it is treated as an annotation
|
||||
* If the member is ending with a closing bracket ) it is treated as a method
|
||||
* Otherwise the member will be treated as a normal property
|
||||
* @param member The full name of the member. If the member is enclosed in <<brackets>> it is
|
||||
* treated as an annotation If the member is ending with a closing bracket ) it is treated as a
|
||||
* method Otherwise the member will be treated as a normal property
|
||||
* @public
|
||||
*/
|
||||
export const addMember = function (className, member) {
|
||||
|
@@ -506,9 +506,7 @@ export default {
|
||||
setConf,
|
||||
draw,
|
||||
};
|
||||
/**
|
||||
* @param type
|
||||
*/
|
||||
/** @param type */
|
||||
function getArrowMarker(type) {
|
||||
let marker;
|
||||
switch (type) {
|
||||
|
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
import { log } from '../../logger';
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import * as configApi from '../../config';
|
||||
|
@@ -11,9 +11,9 @@ import { configureSvgSize } from '../../utils';
|
||||
const conf = {};
|
||||
|
||||
/**
|
||||
* Allows the top-level API module to inject config specific to this renderer,
|
||||
* storing it in the local conf object. Note that generic config still needs to be
|
||||
* retrieved using getConfig() imported from the config module
|
||||
* Allows the top-level API module to inject config specific to this renderer, storing it in the
|
||||
* local conf object. Note that generic config still needs to be retrieved using getConfig()
|
||||
* imported from the config module
|
||||
*
|
||||
* @param cnf
|
||||
*/
|
||||
@@ -27,10 +27,10 @@ export const setConf = function (cnf) {
|
||||
/**
|
||||
* Draw attributes for an entity
|
||||
*
|
||||
* @param groupNode the svg group node for the entity
|
||||
* @param entityTextNode the svg node for the entity label text
|
||||
* @param attributes an array of attributes defined for the entity (each attribute has a type and a name)
|
||||
* @returns the bounding box of the entity, after attributes have been added
|
||||
* @param groupNode The svg group node for the entity
|
||||
* @param entityTextNode The svg node for the entity label text
|
||||
* @param attributes An array of attributes defined for the entity (each attribute has a type and a name)
|
||||
* @returns The bounding box of the entity, after attributes have been added
|
||||
*/
|
||||
const drawAttributes = (groupNode, entityTextNode, attributes) => {
|
||||
const heightPadding = conf.entityPadding / 3; // Padding internal to attribute boxes
|
||||
@@ -273,7 +273,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
|
||||
/**
|
||||
* Use D3 to construct the svg elements for the entities
|
||||
*
|
||||
* @param svgNode the svg node that contains the diagram
|
||||
* @param svgNode The svg node that contains the diagram
|
||||
* @param entities The entities to be drawn
|
||||
* @param graph The graph that contains the vertex and edge definitions post-layout
|
||||
* @returns The first entity that was inserted
|
||||
@@ -361,8 +361,8 @@ const getEdgeName = function (rel) {
|
||||
/**
|
||||
* Add each relationship to the graph
|
||||
*
|
||||
* @param relationships the relationships to be added
|
||||
* @param g the graph
|
||||
* @param relationships The relationships to be added
|
||||
* @param g The graph
|
||||
* @returns {Array} The array of relationships
|
||||
*/
|
||||
const addRelationships = function (relationships, g) {
|
||||
@@ -376,10 +376,11 @@ let relCnt = 0;
|
||||
/**
|
||||
* Draw a relationship using edge information from the graph
|
||||
*
|
||||
* @param svg the svg node
|
||||
* @param rel the relationship to draw in the svg
|
||||
* @param g the graph containing the edge information
|
||||
* @param insert the insertion point in the svg DOM (because relationships have markers that need to sit 'behind' opaque entity boxes)
|
||||
* @param svg The svg node
|
||||
* @param rel The relationship to draw in the svg
|
||||
* @param g The graph containing the edge information
|
||||
* @param insert The insertion point in the svg DOM (because relationships have markers that need to
|
||||
* sit 'behind' opaque entity boxes)
|
||||
*/
|
||||
const drawRelationshipFromLayout = function (svg, rel, g, insert) {
|
||||
relCnt++;
|
||||
@@ -509,8 +510,8 @@ const drawRelationshipFromLayout = function (svg, rel, g, insert) {
|
||||
/**
|
||||
* Draw en E-R diagram in the tag with id: id based on the text definition of the diagram
|
||||
*
|
||||
* @param text the text of the diagram
|
||||
* @param id the unique id of the DOM node that contains the diagram
|
||||
* @param text The text of the diagram
|
||||
* @param id The unique id of the DOM node that contains the diagram
|
||||
*/
|
||||
export const draw = function (text, id) {
|
||||
log.info('Drawing ER diagram');
|
||||
|
@@ -294,9 +294,7 @@ function cylinder(parent, bbox, node) {
|
||||
return shapeSvg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param render
|
||||
*/
|
||||
/** @param render */
|
||||
export function addToRender(render) {
|
||||
render.shapes().question = question;
|
||||
render.shapes().hexagon = hexagon;
|
||||
@@ -323,9 +321,7 @@ export function addToRender(render) {
|
||||
render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addShape
|
||||
*/
|
||||
/** @param addShape */
|
||||
export function addToRenderV2(addShape) {
|
||||
addShape({ question });
|
||||
addShape({ hexagon });
|
||||
|
@@ -349,7 +349,7 @@ export const getDirection = function () {
|
||||
/**
|
||||
* Retrieval function for fetching the found nodes after parsing has completed.
|
||||
*
|
||||
* @returns {{}|*|vertices}
|
||||
* @returns {{} | any | vertices}
|
||||
*/
|
||||
export const getVertices = function () {
|
||||
return vertices;
|
||||
@@ -358,7 +358,7 @@ export const getVertices = function () {
|
||||
/**
|
||||
* Retrieval function for fetching the found links after parsing has completed.
|
||||
*
|
||||
* @returns {{}|*|edges}
|
||||
* @returns {{} | any | edges}
|
||||
*/
|
||||
export const getEdges = function () {
|
||||
return edges;
|
||||
@@ -367,7 +367,7 @@ export const getEdges = function () {
|
||||
/**
|
||||
* Retrieval function for fetching the found class definitions after parsing has completed.
|
||||
*
|
||||
* @returns {{}|*|classes}
|
||||
* @returns {{} | any | classes}
|
||||
*/
|
||||
export const getClasses = function () {
|
||||
return classes;
|
||||
@@ -429,10 +429,7 @@ export const clear = function (ver) {
|
||||
export const setGen = (ver) => {
|
||||
version = ver || 'gen-1';
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
/** @returns {string} */
|
||||
export const defaultStyle = function () {
|
||||
return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
|
||||
};
|
||||
@@ -451,9 +448,7 @@ export const addSubGraph = function (_id, list, _title) {
|
||||
if (_id === _title && _title.match(/\s/)) {
|
||||
id = undefined;
|
||||
}
|
||||
/**
|
||||
* @param a
|
||||
*/
|
||||
/** @param a */
|
||||
function uniq(a) {
|
||||
const prims = { boolean: {}, number: {}, string: {} };
|
||||
const objs = [];
|
||||
@@ -497,9 +492,7 @@ export const addSubGraph = function (_id, list, _title) {
|
||||
|
||||
log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);
|
||||
|
||||
/**
|
||||
* Deletes an id from all subgraphs
|
||||
*/
|
||||
/** Deletes an id from all subgraphs */
|
||||
// const del = _id => {
|
||||
// subGraphs.forEach(sg => {
|
||||
// const pos = sg.nodes.indexOf(_id);
|
||||
|
@@ -323,7 +323,7 @@ export const addEdges = function (edges, g) {
|
||||
* Returns the all the styles from classDef statements in the graph definition.
|
||||
*
|
||||
* @param text
|
||||
* @returns {object} classDef styles
|
||||
* @returns {object} ClassDef styles
|
||||
*/
|
||||
export const getClasses = function (text) {
|
||||
log.info('Extracting classes');
|
||||
|
@@ -263,7 +263,7 @@ export const addEdges = function (edges, g) {
|
||||
* Returns the all the styles from classDef statements in the graph definition.
|
||||
*
|
||||
* @param text
|
||||
* @returns {object} classDef styles
|
||||
* @returns {object} ClassDef styles
|
||||
*/
|
||||
export const getClasses = function (text) {
|
||||
log.info('Extracting classes');
|
||||
|
@@ -562,7 +562,8 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
};
|
||||
|
||||
/**
|
||||
* The callbackFunction is executed in a click event bound to the task with the specified id or the task's assigned text
|
||||
* The callbackFunction is executed in a click event bound to the task with the specified id or the
|
||||
* task's assigned text
|
||||
*
|
||||
* @param id The task's id
|
||||
* @param callbackFunction A function to be executed when clicked on the task or the task's text
|
||||
|
@@ -570,7 +570,8 @@ export const draw = function (text, id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
|
||||
* From this stackexchange question:
|
||||
* http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
|
||||
*
|
||||
* @param arr
|
||||
*/
|
||||
@@ -589,7 +590,8 @@ export const draw = function (text, id) {
|
||||
}
|
||||
|
||||
/**
|
||||
*from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
|
||||
* From this stackexchange question:
|
||||
* http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
|
||||
*
|
||||
* @param arr
|
||||
*/
|
||||
@@ -603,7 +605,7 @@ export const draw = function (text, id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* get specific from everything
|
||||
* Get specific from everything
|
||||
*
|
||||
* @param word
|
||||
* @param arr
|
||||
|
@@ -7,9 +7,6 @@ let curBranch = 'master';
|
||||
let direction = 'LR';
|
||||
let seq = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function getId() {
|
||||
return random({ length: 7 });
|
||||
}
|
||||
@@ -167,9 +164,7 @@ function upsert(arr, key, newval) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param commitArr
|
||||
*/
|
||||
/** @param commitArr */
|
||||
function prettyPrintCommitHistory(commitArr) {
|
||||
const commit = commitArr.reduce((out, commit) => {
|
||||
if (out.seq > commit.seq) return out;
|
||||
|
@@ -30,9 +30,7 @@ export const setConf = function (c) {
|
||||
apiConfig = c;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param svg
|
||||
*/
|
||||
/** @param svg */
|
||||
function svgCreateDefs(svg) {
|
||||
svg
|
||||
.append('defs')
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Created by knut on 15-01-14.
|
||||
*/
|
||||
/** Created by knut on 15-01-14. */
|
||||
import { log } from '../../logger';
|
||||
|
||||
var message = '';
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Created by knut on 14-12-11.
|
||||
*/
|
||||
/** Created by knut on 14-12-11. */
|
||||
import { select } from 'd3';
|
||||
import db from './infoDb';
|
||||
import infoParser from './parser/info';
|
||||
|
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
import { log } from '../../logger';
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import * as configApi from '../../config';
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Created by AshishJ on 11-09-2019.
|
||||
*/
|
||||
/** Created by AshishJ on 11-09-2019. */
|
||||
import { select, scaleOrdinal, pie as d3pie, arc } from 'd3';
|
||||
import pieData from './pieDb';
|
||||
import pieParser from './parser/pie';
|
||||
|
@@ -97,9 +97,7 @@ export const bounds = {
|
||||
updateBounds: function (startx, starty, stopx, stopy) {
|
||||
const _self = this;
|
||||
let cnt = 0;
|
||||
/**
|
||||
* @param {any} type
|
||||
*/
|
||||
/** @param {any} type */
|
||||
function updateFn(type) {
|
||||
return function updateItemBounds(item) {
|
||||
cnt++;
|
||||
@@ -203,7 +201,9 @@ export const bounds = {
|
||||
* Draws an note in the diagram with the attached line
|
||||
*
|
||||
* @param {any} elem - The diagram to draw to.
|
||||
* @param {{x: number, y: number, message: string, width: number}} noteModel - startx: x axis start position, verticalPos: y axis position, messsage: the message to be shown, width: Set this with a custom width to override the default configured width.
|
||||
* @param {{ x: number; y: number; message: string; width: number }} noteModel - Startx: x axis
|
||||
* start position, verticalPos: y axis position, messsage: the message to be shown, width: Set
|
||||
* this with a custom width to override the default configured width.
|
||||
*/
|
||||
const drawNote = function (elem, noteModel) {
|
||||
bounds.bumpVerticalPos(conf.boxMargin);
|
||||
@@ -273,8 +273,8 @@ const actorFont = (cnf) => {
|
||||
/**
|
||||
* Draws a message
|
||||
*
|
||||
* @param {any} g - the parent of the message element
|
||||
* @param {any} msgModel - the model containing fields describing a message
|
||||
* @param {any} g - The parent of the message element
|
||||
* @param {any} msgModel - The model containing fields describing a message
|
||||
*/
|
||||
const drawMessage = function (g, msgModel) {
|
||||
bounds.bumpVerticalPos(10);
|
||||
@@ -786,11 +786,10 @@ export const draw = function (text, id) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the max message width of each actor, supports signals (messages, loops)
|
||||
* and notes.
|
||||
* Retrieves the max message width of each actor, supports signals (messages, loops) and notes.
|
||||
*
|
||||
* It will enumerate each given message, and will determine its text width, in relation
|
||||
* to the actor it originates from, and destined to.
|
||||
* It will enumerate each given message, and will determine its text width, in relation to the actor
|
||||
* it originates from, and destined to.
|
||||
*
|
||||
* @param {any} actors - The actors map
|
||||
* @param {Array} messages - A list of message objects to iterate
|
||||
@@ -906,11 +905,10 @@ const getRequiredPopupWidth = function (actor) {
|
||||
};
|
||||
|
||||
/**
|
||||
* This will calculate the optimal margin for each given actor, for a given
|
||||
* actor->messageWidth map.
|
||||
* This will calculate the optimal margin for each given actor, for a given actor->messageWidth map.
|
||||
*
|
||||
* An actor's margin is determined by the width of the actor, the width of the
|
||||
* largest message that originates from it, and the configured conf.actorMargin.
|
||||
* An actor's margin is determined by the width of the actor, the width of the largest message that
|
||||
* originates from it, and the configured conf.actorMargin.
|
||||
*
|
||||
* @param {any} actors - The actors map to calculate margins for
|
||||
* @param {any} actorToMessageWidth - A map of actor key -> max message width it holds
|
||||
|
@@ -331,7 +331,7 @@ export const fixLifeLineHeights = (diagram, bounds) => {
|
||||
*
|
||||
* @param {any} elem - The diagram we'll draw to.
|
||||
* @param {any} actor - The actor to draw.
|
||||
* @param {any} conf - drawText implementation discriminator object
|
||||
* @param {any} conf - DrawText implementation discriminator object
|
||||
*/
|
||||
const drawActorTypeParticipant = function (elem, actor, conf) {
|
||||
const center = actor.x + actor.width / 2;
|
||||
@@ -504,11 +504,11 @@ export const anchorElement = function (elem) {
|
||||
/**
|
||||
* Draws an activation in the diagram
|
||||
*
|
||||
* @param {any} elem - element to append activation rect.
|
||||
* @param {any} bounds - activation box bounds.
|
||||
* @param {any} verticalPos - precise y cooridnate of bottom activation box edge.
|
||||
* @param {any} conf - sequence diagram config object.
|
||||
* @param {any} actorActivations - number of activations on the actor.
|
||||
* @param {any} elem - Element to append activation rect.
|
||||
* @param {any} bounds - Activation box bounds.
|
||||
* @param {any} verticalPos - Precise y cooridnate of bottom activation box edge.
|
||||
* @param {any} conf - Sequence diagram config object.
|
||||
* @param {any} actorActivations - Number of activations on the actor.
|
||||
*/
|
||||
export const drawActivation = function (elem, bounds, verticalPos, conf, actorActivations) {
|
||||
const rect = getNoteRect();
|
||||
@@ -524,10 +524,10 @@ export const drawActivation = function (elem, bounds, verticalPos, conf, actorAc
|
||||
/**
|
||||
* Draws a loop in the diagram
|
||||
*
|
||||
* @param {any} elem - elemenet to append the loop to.
|
||||
* @param {any} loopModel - loopModel of the given loop.
|
||||
* @param {any} elem - Elemenet to append the loop to.
|
||||
* @param {any} loopModel - LoopModel of the given loop.
|
||||
* @param {any} labelText - Text within the loop.
|
||||
* @param {any} conf - diagrom configuration
|
||||
* @param {any} conf - Diagrom configuration
|
||||
* @returns {any}
|
||||
*/
|
||||
export const drawLoop = function (elem, loopModel, labelText, conf) {
|
||||
@@ -626,8 +626,8 @@ export const drawLoop = function (elem, loopModel, labelText, conf) {
|
||||
/**
|
||||
* Draws a background rectangle
|
||||
*
|
||||
* @param {any} elem diagram (reference for bounds)
|
||||
* @param {any} bounds shape of the rectangle
|
||||
* @param {any} elem Diagram (reference for bounds)
|
||||
* @param {any} bounds Shape of the rectangle
|
||||
*/
|
||||
export const drawBackgroundRect = function (elem, bounds) {
|
||||
const rectElem = drawRect(elem, {
|
||||
|
@@ -66,8 +66,8 @@ export const drawSimpleState = (g, stateDef) => {
|
||||
/**
|
||||
* Draws a state with descriptions
|
||||
*
|
||||
* @param {*} g
|
||||
* @param {*} stateDef
|
||||
* @param {any} g
|
||||
* @param {any} stateDef
|
||||
* @returns
|
||||
*/
|
||||
export const drawDescrState = (g, stateDef) => {
|
||||
@@ -135,16 +135,13 @@ export const drawDescrState = (g, stateDef) => {
|
||||
return g;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the creates a box around the existing content and adds a
|
||||
* panel for the id on top of the content.
|
||||
*/
|
||||
/** Adds the creates a box around the existing content and adds a panel for the id on top of the content. */
|
||||
/**
|
||||
* Function that creates an title row and a frame around a substate for a composit state diagram.
|
||||
* The function returns a new d3 svg object with updated width and height properties;
|
||||
*
|
||||
* @param {*} g The d3 svg object for the substate to framed
|
||||
* @param {*} stateDef The info about the
|
||||
* @param {any} g The d3 svg object for the substate to framed
|
||||
* @param {any} stateDef The info about the
|
||||
* @param {any} altBkg
|
||||
*/
|
||||
export const addTitleAndBox = (g, stateDef, altBkg) => {
|
||||
@@ -364,11 +361,11 @@ export const drawNote = (text, g) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Starting point for drawing a state. The function finds out the specifics
|
||||
* about the state and renders with approprtiate function.
|
||||
* Starting point for drawing a state. The function finds out the specifics about the state and
|
||||
* renders with approprtiate function.
|
||||
*
|
||||
* @param {*} elem
|
||||
* @param {*} stateDef
|
||||
* @param {any} elem
|
||||
* @param {any} stateDef
|
||||
*/
|
||||
|
||||
export const drawState = function (elem, stateDef) {
|
||||
|
@@ -22,7 +22,7 @@ let nodeDb = {};
|
||||
* Returns the all the styles from classDef statements in the graph definition.
|
||||
*
|
||||
* @param {any} text
|
||||
* @returns {object} classDef styles
|
||||
* @returns {object} ClassDef styles
|
||||
*/
|
||||
export const getClasses = function (text) {
|
||||
log.trace('Extracting classes');
|
||||
|
@@ -17,9 +17,7 @@ export const setConf = function (cnf) {
|
||||
|
||||
const actors = {};
|
||||
|
||||
/**
|
||||
* @param {any} diagram
|
||||
*/
|
||||
/** @param {any} diagram */
|
||||
function drawActorLegend(diagram) {
|
||||
const conf = getConfig().journey;
|
||||
// Draw the actors
|
||||
@@ -143,9 +141,7 @@ export const bounds = {
|
||||
const conf = getConfig().journey;
|
||||
const _self = this;
|
||||
let cnt = 0;
|
||||
/**
|
||||
* @param {any} type
|
||||
*/
|
||||
/** @param {any} type */
|
||||
function updateFn(type) {
|
||||
return function updateItemBounds(item) {
|
||||
cnt++;
|
||||
|
@@ -51,9 +51,7 @@ export const drawFace = function (element, faceData) {
|
||||
.attr('fill', '#666')
|
||||
.attr('stroke', '#666');
|
||||
|
||||
/**
|
||||
* @param {any} face
|
||||
*/
|
||||
/** @param {any} face */
|
||||
function smile(face) {
|
||||
const arc = d3arc()
|
||||
.startAngle(Math.PI / 2)
|
||||
@@ -68,9 +66,7 @@ export const drawFace = function (element, faceData) {
|
||||
.attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 2) + ')');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} face
|
||||
*/
|
||||
/** @param {any} face */
|
||||
function sad(face) {
|
||||
const arc = d3arc()
|
||||
.startAngle((3 * Math.PI) / 2)
|
||||
@@ -85,9 +81,7 @@ export const drawFace = function (element, faceData) {
|
||||
.attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 7) + ')');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} face
|
||||
*/
|
||||
/** @param {any} face */
|
||||
function ambivalent(face) {
|
||||
face
|
||||
.append('line')
|
||||
|
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* Created by knut on 14-12-11.
|
||||
*/
|
||||
/** Created by knut on 14-12-11. */
|
||||
import { select } from 'd3';
|
||||
import { log } from './logger';
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
|
||||
* the diagrams to svg code.
|
||||
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid
|
||||
* functionality and to render the diagrams to svg code.
|
||||
*/
|
||||
import { log } from './logger';
|
||||
import mermaidAPI from './mermaidAPI';
|
||||
@@ -8,15 +8,17 @@ import utils from './utils';
|
||||
|
||||
/**
|
||||
* ## init
|
||||
*
|
||||
* Function that goes through the document to find the chart definitions in there and render them.
|
||||
*
|
||||
* The function tags the processed attributes with the attribute data-processed and ignores found elements with the
|
||||
* attribute already set. This way the init function can be triggered several times.
|
||||
* The function tags the processed attributes with the attribute data-processed and ignores found
|
||||
* elements with the attribute already set. This way the init function can be triggered several times.
|
||||
*
|
||||
* Optionally, `init` can accept in the second argument one of the following:
|
||||
* - a DOM Node
|
||||
* - an array of DOM nodes (as would come from a jQuery selector)
|
||||
* - a W3C selector, a la `.mermaid`
|
||||
*
|
||||
* - A DOM Node
|
||||
* - An array of DOM nodes (as would come from a jQuery selector)
|
||||
* - A W3C selector, a la `.mermaid`
|
||||
*
|
||||
* ```mermaid
|
||||
* graph LR;
|
||||
@@ -24,8 +26,8 @@ import utils from './utils';
|
||||
* b-->|Yes|c(Leave element)
|
||||
* b-->|No |d(Transform)
|
||||
* ```
|
||||
* Renders the mermaid diagrams
|
||||
*
|
||||
* Renders the mermaid diagrams
|
||||
*/
|
||||
const init = function () {
|
||||
const conf = mermaidAPI.getConfig();
|
||||
@@ -145,9 +147,8 @@ const initialize = function (config) {
|
||||
};
|
||||
|
||||
/**
|
||||
* ##contentLoaded
|
||||
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
|
||||
* calls init for rendering the mermaid diagrams on the page.
|
||||
* ##contentLoaded Callback function that is called when page is loaded. This functions fetches
|
||||
* configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the page.
|
||||
*/
|
||||
const contentLoaded = function () {
|
||||
let config;
|
||||
|
@@ -1,13 +1,15 @@
|
||||
/**
|
||||
*Edit this Page[](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js)
|
||||
*
|
||||
*This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js.
|
||||
* Edit this
|
||||
* Page[[N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js)
|
||||
*
|
||||
* This is the API to be used when optionally handling the integration with the web page, instead of
|
||||
* using the default integration provided by mermaid.js.
|
||||
*
|
||||
* The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
|
||||
* definition as text, renders the graph/diagram and returns an svg element for the graph.
|
||||
*
|
||||
* It is is then up to the user of the API to make use of the svg, either insert it somewhere in the page or do something completely different.
|
||||
* It is is then up to the user of the API to make use of the svg, either insert it somewhere in the
|
||||
* page or do something completely different.
|
||||
*
|
||||
* In addition to the render function, a number of behavioral configuration options are available.
|
||||
*
|
||||
@@ -197,7 +199,7 @@ export const decodeEntities = function (text) {
|
||||
*
|
||||
* ```js
|
||||
* mermaidAPI.initialize({
|
||||
* startOnLoad:true
|
||||
* startOnLoad: true,
|
||||
* });
|
||||
* $(function () {
|
||||
* const graphDefinition = 'graph TB\na-->b';
|
||||
@@ -208,12 +210,12 @@ export const decodeEntities = function (text) {
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param {any} id the id of the element to be rendered
|
||||
* @param {any} _txt the graph definition
|
||||
* @param {any} cb callback which is called after rendering is finished with the svg code as inparam.
|
||||
* @param {any} container selector to element in which a div with the graph temporarily will be inserted. In one is
|
||||
* provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
|
||||
* completed.
|
||||
* @param {any} id The id of the element to be rendered
|
||||
* @param {any} _txt The graph definition
|
||||
* @param {any} cb Callback which is called after rendering is finished with the svg code as inparam.
|
||||
* @param {any} container Selector to element in which a div with the graph temporarily will be
|
||||
* inserted. In one is provided a hidden div will be inserted in the body of the page instead. The
|
||||
* element will be removed when rendering is completed.
|
||||
* @returns {any}
|
||||
*/
|
||||
const render = function (id, _txt, cb, container) {
|
||||
@@ -542,9 +544,7 @@ const handleDirective = function (p, directive, type) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {any} conf
|
||||
*/
|
||||
/** @param {any} conf */
|
||||
function updateRendererConfigs(conf) {
|
||||
// Todo remove, all diagrams should get config on demoand from the config object, no need for this
|
||||
gitGraphRenderer.setConf(conf.git);
|
||||
@@ -566,9 +566,6 @@ function updateRendererConfigs(conf) {
|
||||
errorRenderer.setConf(conf.class);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function reinitialize() {
|
||||
// `mermaidAPI.reinitialize: v${pkg.version}`,
|
||||
// JSON.stringify(options),
|
||||
@@ -584,9 +581,7 @@ function reinitialize() {
|
||||
// log.debug('mermaidAPI.reinitialize: ', config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} options
|
||||
*/
|
||||
/** @param {any} options */
|
||||
function initialize(options) {
|
||||
// console.warn(`mermaidAPI.initialize: v${pkg.version} `, options);
|
||||
|
||||
@@ -702,7 +697,7 @@ export default mermaidAPI;
|
||||
* numberSectionStyles: 4,
|
||||
* axisFormat: '%Y-%m-%d',
|
||||
* topAxis: false,
|
||||
* }
|
||||
* },
|
||||
* };
|
||||
* mermaid.initialize(config);
|
||||
* </script>
|
||||
|
@@ -3,7 +3,10 @@ import { mkBorder } from './theme-helpers';
|
||||
class Theme {
|
||||
constructor() {
|
||||
/** # Base variables */
|
||||
/** * background - used to know what the background color is of the diagram. This is used for deducing colors for istance line color. Defaulr value is #f4f4f4. */
|
||||
/**
|
||||
* - Background - used to know what the background color is of the diagram. This is used for
|
||||
* deducing colors for istance line color. Defaulr value is #f4f4f4.
|
||||
*/
|
||||
this.background = '#f4f4f4';
|
||||
this.darkMode = false;
|
||||
|
||||
|
87
src/utils.js
87
src/utils.js
@@ -38,8 +38,8 @@ const directiveWithoutOpen =
|
||||
const anyComment = /\s*%%.*\n/gm;
|
||||
|
||||
/**
|
||||
* @function detectInit
|
||||
* Detects the init config object from the text
|
||||
* @function detectInit Detects the init config object from the text
|
||||
*
|
||||
* ```mermaid
|
||||
* %%{init: {"theme": "debug", "logLevel": 1 }}%%
|
||||
* graph LR
|
||||
@@ -51,7 +51,9 @@ const anyComment = /\s*%%.*\n/gm;
|
||||
* f-->g
|
||||
* g-->h
|
||||
* ```
|
||||
* or
|
||||
*
|
||||
* Or
|
||||
*
|
||||
* ```mermaid
|
||||
* %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
|
||||
* graph LR
|
||||
@@ -65,7 +67,7 @@ const anyComment = /\s*%%.*\n/gm;
|
||||
* ```
|
||||
* @param {string} text The text defining the graph
|
||||
* @param {any} cnf
|
||||
* @returns {object} the json object representing the init passed to mermaid.initialize()
|
||||
* @returns {object} The json object representing the init passed to mermaid.initialize()
|
||||
*/
|
||||
export const detectInit = function (text, cnf) {
|
||||
let inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
|
||||
@@ -97,9 +99,9 @@ export const detectInit = function (text, cnf) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @function detectDirective
|
||||
* Detects the directive from the text. Text can be single line or multiline. If type is null or omitted
|
||||
* the first directive encountered in text will be returned
|
||||
* @function detectDirective Detects the directive from the text. Text can be single line or
|
||||
* multiline. If type is null or omitted the first directive encountered in text will be returned
|
||||
*
|
||||
* ```mermaid
|
||||
* graph LR
|
||||
* %%{somedirective}%%
|
||||
@@ -113,8 +115,9 @@ export const detectInit = function (text, cnf) {
|
||||
* ```
|
||||
* @param {string} text The text defining the graph
|
||||
* @param {string | RegExp} type The directive to return (default: null)
|
||||
* @returns {object | Array} An object or Array representing the directive(s): { type: string, args: object|null } matched by the input type
|
||||
* if a single directive was found, that directive object will be returned.
|
||||
* @returns {object | Array} An object or Array representing the directive(s): { type: string, args:
|
||||
* object|null } matched by the input type if a single directive was found, that directive object
|
||||
* will be returned.
|
||||
*/
|
||||
export const detectDirective = function (text, type = null) {
|
||||
try {
|
||||
@@ -158,9 +161,9 @@ export const detectDirective = function (text, type = null) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @function detectType
|
||||
* Detects the type of the graph text. Takes into consideration the possible existence of an %%init
|
||||
* directive
|
||||
* @function detectType Detects the type of the graph text. Takes into consideration the possible
|
||||
* existence of an %%init directive
|
||||
*
|
||||
* ```mermaid
|
||||
* %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
|
||||
* graph LR
|
||||
@@ -248,11 +251,10 @@ const memoize = (fn, resolver) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @function isSubstringInArray
|
||||
* Detects whether a substring in present in a given array
|
||||
* @function isSubstringInArray Detects whether a substring in present in a given array
|
||||
* @param {string} str The substring to detect
|
||||
* @param {Array} arr The array to search
|
||||
* @returns {number} the array index containing the substring or -1 if not present
|
||||
* @returns {number} The array index containing the substring or -1 if not present
|
||||
*/
|
||||
export const isSubstringInArray = function (str, arr) {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
@@ -391,7 +393,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
|
||||
};
|
||||
|
||||
/**
|
||||
* position ['start_left', 'start_right', 'end_left', 'end_right']
|
||||
* Position ['start_left', 'start_right', 'end_left', 'end_right']
|
||||
*
|
||||
* @param {any} terminalMarkerSize
|
||||
* @param {any} position
|
||||
@@ -509,30 +511,27 @@ export const random = (options) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @function assignWithDepth
|
||||
* Extends the functionality of {@link ObjectConstructor.assign} with the ability to merge arbitrary-depth objects
|
||||
* For each key in src with path `k` (recursively) performs an Object.assign(dst[`k`], src[`k`]) with
|
||||
* a slight change from the typical handling of undefined for dst[`k`]: instead of raising an error,
|
||||
* dst[`k`] is auto-initialized to {} and effectively merged with src[`k`]
|
||||
* <p>
|
||||
* Additionally, dissimilar types will not clobber unless the config.clobber parameter === true. Example:
|
||||
* ```
|
||||
* @function assignWithDepth Extends the functionality of {@link ObjectConstructor.assign} with the
|
||||
* ability to merge arbitrary-depth objects For each key in src with path `k` (recursively)
|
||||
* performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of
|
||||
* undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to {} and
|
||||
* effectively merged with src[`k`]<p> Additionally, dissimilar types will not clobber unless the
|
||||
* config.clobber parameter === true. Example:
|
||||
*
|
||||
* let config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
|
||||
* let config_1 = { foo: 'foo', bar: 'bar' };
|
||||
* let result = assignWithDepth(config_0, config_1);
|
||||
* console.log(result);
|
||||
* //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
|
||||
* ```
|
||||
* <p>
|
||||
* Traditional Object.assign would have clobbered foo in config_0 with foo in config_1.
|
||||
* <p>
|
||||
* If src is a destructured array of objects and dst is not an array, assignWithDepth will apply each element of src to dst
|
||||
* in order.
|
||||
* @param {any} dst - the destination of the merge
|
||||
* @param {any} src - the source object(s) to merge into destination
|
||||
* @param {{ depth: number, clobber: boolean }} config - depth: depth to traverse within src and dst for merging -
|
||||
* clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
|
||||
* @returns {*}
|
||||
* //-> result: { foo: { bar: 'bar' }, bar: 'bar' }<p>
|
||||
*
|
||||
* Traditional Object.assign would have clobbered foo in config_0 with foo in config_1.<p> If src is
|
||||
* a destructured array of objects and dst is not an array, assignWithDepth will apply each
|
||||
* element of src to dst in order.
|
||||
* @param {any} dst - The destination of the merge
|
||||
* @param {any} src - The source object(s) to merge into destination
|
||||
* @param {{ depth: number; clobber: boolean }} config - Depth: depth to traverse within src and dst
|
||||
* for merging - clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
|
||||
* @returns {any}
|
||||
*/
|
||||
export const assignWithDepth = function (dst, src, config) {
|
||||
const { depth, clobber } = Object.assign({ depth: 2, clobber: false }, config);
|
||||
@@ -681,14 +680,13 @@ const breakString = memoize(
|
||||
);
|
||||
|
||||
/**
|
||||
* This calculates the text's height, taking into account the wrap breaks and
|
||||
* both the statically configured height, width, and the length of the text (in pixels).
|
||||
* This calculates the text's height, taking into account the wrap breaks and both the statically
|
||||
* configured height, width, and the length of the text (in pixels).
|
||||
*
|
||||
* If the wrapped text text has greater height, we extend the height, so it's
|
||||
* value won't overflow.
|
||||
* If the wrapped text text has greater height, we extend the height, so it's value won't overflow.
|
||||
*
|
||||
* @param {any} text the text to measure
|
||||
* @param {any} config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
||||
* @param {any} text The text to measure
|
||||
* @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
||||
* @returns {any} - The height for the given text
|
||||
*/
|
||||
export const calculateTextHeight = function (text, config) {
|
||||
@@ -703,7 +701,7 @@ export const calculateTextHeight = function (text, config) {
|
||||
* This calculates the width of the given text, font size and family.
|
||||
*
|
||||
* @param {any} text - The text to calculate the width of
|
||||
* @param {any} config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
||||
* @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the resulting size
|
||||
* @returns {any} - The width for the given text
|
||||
*/
|
||||
export const calculateTextWidth = function (text, config) {
|
||||
@@ -715,7 +713,8 @@ export const calculateTextWidth = function (text, config) {
|
||||
* This calculates the dimensions of the given text, font size, font family, font weight, and margins.
|
||||
*
|
||||
* @param {any} text - The text to calculate the width of
|
||||
* @param {any} config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size
|
||||
* @param {any} config - The config for fontSize, fontFamily, fontWeight, and margin all impacting
|
||||
* the resulting size
|
||||
* @returns - The width for the given text
|
||||
*/
|
||||
export const calculateTextDimensions = memoize(
|
||||
|
72
yarn.lock
72
yarn.lock
@@ -1912,6 +1912,13 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.8.tgz#edf1bf1dbf4e04413ca8e5b17b3b7d7d54b59818"
|
||||
integrity sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==
|
||||
|
||||
"@types/mdast@^3.0.0":
|
||||
version "3.0.10"
|
||||
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af"
|
||||
integrity sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA==
|
||||
dependencies:
|
||||
"@types/unist" "*"
|
||||
|
||||
"@types/minimist@^1.2.0":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"
|
||||
@@ -1962,6 +1969,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
|
||||
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==
|
||||
|
||||
"@types/unist@*":
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
|
||||
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==
|
||||
|
||||
"@types/unist@^2.0.0", "@types/unist@^2.0.2":
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.5.tgz#fdd299f23205c3455af88ce618dd65c14cb73e22"
|
||||
@@ -2623,6 +2635,11 @@ binary-extensions@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
|
||||
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
|
||||
|
||||
binary-search-bounds@^2.0.5:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/binary-search-bounds/-/binary-search-bounds-2.0.5.tgz#125e5bd399882f71e6660d4bf1186384e989fba7"
|
||||
integrity sha512-H0ea4Fd3lS1+sTEB2TgcLoK21lLhwEJzlQv3IN47pJS976Gx4zoWe0ak3q+uYh60ppQxg9F16Ri4tS1sfD4+jA==
|
||||
|
||||
bl@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a"
|
||||
@@ -3166,7 +3183,7 @@ commander@^5.1.0:
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
|
||||
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
|
||||
|
||||
comment-parser@1.2.4:
|
||||
comment-parser@1.2.4, comment-parser@^1.1.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.2.4.tgz#489f3ee55dfd184a6e4bffb31baba284453cb760"
|
||||
integrity sha512-pm0b+qv+CkWNriSTMsfnjChF9kH0kxz55y44Wo5le9qLxMj5xDQAaEd9ZN1ovSuk9CsrncWaFwgpOMg7ClJwkw==
|
||||
@@ -4158,7 +4175,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@4, debug@4.3.2, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2:
|
||||
debug@4, debug@4.3.2, debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2:
|
||||
version "4.3.2"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
|
||||
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
|
||||
@@ -7150,6 +7167,11 @@ lines-and-columns@^1.1.6:
|
||||
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
|
||||
integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=
|
||||
|
||||
linguist-languages@^7.13.0:
|
||||
version "7.15.0"
|
||||
resolved "https://registry.yarnpkg.com/linguist-languages/-/linguist-languages-7.15.0.tgz#a93bed6b93015d8133622cb05da6296890862bfa"
|
||||
integrity sha512-qkSSNDjDDycZ2Wcw+GziNBB3nNo3ddYUInM/PL8Amgwbd9RQ/BKGj2/1d6mdxKgBFnUqZuaDbkIwkE4KUwwmtQ==
|
||||
|
||||
listr2@^3.8.3:
|
||||
version "3.10.0"
|
||||
resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.10.0.tgz#58105a53ed7fa1430d1b738c6055ef7bb006160f"
|
||||
@@ -7385,6 +7407,17 @@ mdast-util-definitions@^1.2.0:
|
||||
dependencies:
|
||||
unist-util-visit "^1.0.0"
|
||||
|
||||
mdast-util-from-markdown@^0.8.5:
|
||||
version "0.8.5"
|
||||
resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz#d1ef2ca42bc377ecb0463a987910dae89bd9a28c"
|
||||
integrity sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==
|
||||
dependencies:
|
||||
"@types/mdast" "^3.0.0"
|
||||
mdast-util-to-string "^2.0.0"
|
||||
micromark "~2.11.0"
|
||||
parse-entities "^2.0.0"
|
||||
unist-util-stringify-position "^2.0.0"
|
||||
|
||||
mdast-util-inject@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mdast-util-inject/-/mdast-util-inject-1.1.0.tgz#db06b8b585be959a2dcd2f87f472ba9b756f3675"
|
||||
@@ -7414,6 +7447,11 @@ mdast-util-to-string@^1.0.0, mdast-util-to-string@^1.0.5:
|
||||
resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz#27055500103f51637bd07d01da01eb1967a43527"
|
||||
integrity sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==
|
||||
|
||||
mdast-util-to-string@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz#b8cfe6a713e1091cb5b728fc48885a4767f8b97b"
|
||||
integrity sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==
|
||||
|
||||
mdast-util-toc@^3.0.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mdast-util-toc/-/mdast-util-toc-3.1.0.tgz#395eeb877f067f9d2165d990d77c7eea6f740934"
|
||||
@@ -7495,6 +7533,14 @@ methods@~1.1.2:
|
||||
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
|
||||
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
|
||||
|
||||
micromark@~2.11.0:
|
||||
version "2.11.4"
|
||||
resolved "https://registry.yarnpkg.com/micromark/-/micromark-2.11.4.tgz#d13436138eea826383e822449c9a5c50ee44665a"
|
||||
integrity sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==
|
||||
dependencies:
|
||||
debug "^4.0.0"
|
||||
parse-entities "^2.0.0"
|
||||
|
||||
micromatch@^3.1.5:
|
||||
version "3.1.10"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
|
||||
@@ -8085,6 +8131,18 @@ parse-entities@^1.0.2, parse-entities@^1.1.0:
|
||||
is-decimal "^1.0.0"
|
||||
is-hexadecimal "^1.0.0"
|
||||
|
||||
parse-entities@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8"
|
||||
integrity sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==
|
||||
dependencies:
|
||||
character-entities "^1.0.0"
|
||||
character-entities-legacy "^1.0.0"
|
||||
character-reference-invalid "^1.0.0"
|
||||
is-alphanumerical "^1.0.0"
|
||||
is-decimal "^1.0.0"
|
||||
is-hexadecimal "^1.0.0"
|
||||
|
||||
parse-filepath@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891"
|
||||
@@ -8325,6 +8383,16 @@ prettier-linter-helpers@^1.0.0:
|
||||
dependencies:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier-plugin-jsdoc@^0.3.30:
|
||||
version "0.3.30"
|
||||
resolved "https://registry.yarnpkg.com/prettier-plugin-jsdoc/-/prettier-plugin-jsdoc-0.3.30.tgz#c0cce02279ad1467c9dc9660c6dec1fada259d7f"
|
||||
integrity sha512-BTBojOMmrUA1qsWLpJN5whUfU/E72WBUQAB5AvrDkha+O8TxmqaAivnuW+87ItYGRPBFWWzj2r5iWELhBml1Ag==
|
||||
dependencies:
|
||||
binary-search-bounds "^2.0.5"
|
||||
comment-parser "^1.1.4"
|
||||
linguist-languages "^7.13.0"
|
||||
mdast-util-from-markdown "^0.8.5"
|
||||
|
||||
prettier@^2.3.2:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
|
||||
|
Reference in New Issue
Block a user