enable prettier-plugin-jsdoc

This commit is contained in:
Matthieu MOREL
2021-11-10 08:41:52 +01:00
committed by GitHub
parent 4d103c14f7
commit 57671b2b78
47 changed files with 2293 additions and 2681 deletions

View File

@@ -42,19 +42,22 @@ export const updateCurrentConfig = (siteCfg, _directives) => {
return cfg;
};
/**
*## 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
* ## setSiteConfig
*
* @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 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 {any} - The siteConfig
*/
export const setSiteConfig = (conf) => {
siteConfig = assignWithDepth({}, defaultConfig);
@@ -79,30 +82,32 @@ export const updateSiteConfig = (conf) => {
return siteConfig;
};
/**
*## 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.
* ## getSiteConfig
*
* @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.
* ## setConfig
*
* @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);
@@ -117,28 +122,30 @@ 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
* ## getConfig
*
* @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
* ## sanitize
*
* @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
@@ -193,18 +200,18 @@ export const addDirective = (directive) => {
};
/**
*## reset
*| Function | Description | Type | Required | Values |
*| --------- | ------------------- | ------- | -------- | ------------------ |
*| reset|Resets currentConfig to conf| Put Request | Required | None|
* ## reset
*
*| 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|
* | Function | Description | Type | Required | Values |
* | -------- | ---------------------------- | ----------- | -------- | ------ |
* | reset | Resets currentConfig to conf | Put Request | Required | None |
*
***Notes**:
* (default: current siteConfig ) (optional, default `getSiteConfig()`)
* | 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()`)
*/
export const reset = () => {
// Replace current config with siteConfig

View File

@@ -20,19 +20,19 @@ const siteConfig = assignWithDepth({}, defaultConfig);
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
* ## setSiteConfig
*
* @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');
@@ -49,30 +49,32 @@ export const setSiteConfig = (conf) => {
return getSiteConfig();
};
/**
*## 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.
* ## getSiteConfig
*
* @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.
* ## setConfig
*
* @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');
@@ -86,28 +88,30 @@ export const setConfig = (conf) => {
return getConfig();
};
/**
* ## getConfig
*| Function | Description | Type | Return Values |
*| --------- | ------------------- | ------- | ------------------ |
*| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
***Notes**:
*Returns **any** the currentConfig
* ## getConfig
*
* @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
* ## sanitize
*
* @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) => {
@@ -123,19 +127,20 @@ export const sanitize = (options) => {
});
};
/**
*## reset
*| Function | Description | Type | Required | Values |
*| --------- | ------------------- | ------- | -------- | ------------------ |
*| reset|Resets currentConfig to conf| Put Request | Required | None|
* ## reset
*
*| 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|
* | Function | Description | Type | Required | Values |
* | -------- | ---------------------------- | ----------- | -------- | ------ |
* | reset | Resets currentConfig to conf | Put Request | Required | None |
*
***Notes**:
*(default: current siteConfig ) (optional, default `getSiteConfig()`)
* | Parameter | Description |Type | Required | Values|
*
* @param {any} conf - the base currentConfig to reset to (default: current siteConfig )
* | --- | --- | --- | --- | --- |
* | 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()`)
*
* @param {any} conf - The base currentConfig to reset to (default: current siteConfig )
*/
export const reset = (conf = getSiteConfig()) => {
console.warn('reset');

View File

@@ -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

View File

@@ -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'));

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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';

View File

@@ -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';
@@ -167,8 +165,8 @@ 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 {Finds a} id
* @param {any} graph
*/
export const findNonClusterChild = (id, graph) => {
// const node = graph.node(id);

View File

@@ -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

View File

@@ -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) {

View File

@@ -506,9 +506,7 @@ export default {
setConf,
draw,
};
/**
* @param type
*/
/** @param type */
function getArrowMarker(type) {
let marker;
switch (type) {

View File

@@ -1,6 +1,3 @@
/**
*
*/
import { log } from '../../logger';
import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config';

View File

@@ -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');

View File

@@ -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 });

View File

@@ -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);

View File

@@ -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');

View File

@@ -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');

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -30,9 +30,7 @@ export const setConf = function (c) {
apiConfig = c;
};
/**
* @param svg
*/
/** @param svg */
function svgCreateDefs(svg) {
svg
.append('defs')

View File

@@ -1,6 +1,4 @@
/**
* Created by knut on 15-01-14.
*/
/** Created by knut on 15-01-14. */
import { log } from '../../logger';
var message = '';

View File

@@ -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';

View File

@@ -1,6 +1,3 @@
/**
*
*/
import { log } from '../../logger';
import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config';

View File

@@ -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';

View File

@@ -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

View File

@@ -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, {

View File

@@ -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) {

View File

@@ -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');

View File

@@ -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++;

View File

@@ -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')

View File

@@ -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';

View File

@@ -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;

View File

@@ -1,13 +1,15 @@
/**
*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.
* 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,23 +199,23 @@ export const decodeEntities = function (text) {
*
* ```js
* mermaidAPI.initialize({
* startOnLoad:true
* });
* $(function(){
* const graphDefinition = 'graph TB\na-->b';
* const cb = function(svgGraph){
* console.log(svgGraph);
* };
* mermaidAPI.render('id1',graphDefinition,cb);
* });
*```
* startOnLoad: true,
* });
* $(function () {
* const graphDefinition = 'graph TB\na-->b';
* const cb = function (svgGraph) {
* console.log(svgGraph);
* };
* mermaidAPI.render('id1', graphDefinition, cb);
* });
* ```
*
* @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);
@@ -651,58 +646,58 @@ export default mermaidAPI;
* ```html
* <script>
* var config = {
* theme:'default',
* logLevel:'fatal',
* securityLevel:'strict',
* startOnLoad:true,
* arrowMarkerAbsolute:false,
* theme: 'default',
* logLevel: 'fatal',
* securityLevel: 'strict',
* startOnLoad: true,
* arrowMarkerAbsolute: false,
*
* er:{
* diagramPadding:20,
* layoutDirection:'TB',
* minEntityWidth:100,
* minEntityHeight:75,
* entityPadding:15,
* stroke:'gray',
* fill:'honeydew',
* fontSize:12,
* useMaxWidth:true,
* er: {
* diagramPadding: 20,
* layoutDirection: 'TB',
* minEntityWidth: 100,
* minEntityHeight: 75,
* entityPadding: 15,
* stroke: 'gray',
* fill: 'honeydew',
* fontSize: 12,
* useMaxWidth: true,
* },
* flowchart:{
* diagramPadding:8,
* htmlLabels:true,
* curve:'basis',
* flowchart: {
* diagramPadding: 8,
* htmlLabels: true,
* curve: 'basis',
* },
* sequence:{
* diagramMarginX:50,
* diagramMarginY:10,
* actorMargin:50,
* width:150,
* height:65,
* boxMargin:10,
* boxTextMargin:5,
* noteMargin:10,
* messageMargin:35,
* messageAlign:'center',
* mirrorActors:true,
* bottomMarginAdj:1,
* useMaxWidth:true,
* rightAngles:false,
* showSequenceNumbers:false,
* sequence: {
* diagramMarginX: 50,
* diagramMarginY: 10,
* actorMargin: 50,
* width: 150,
* height: 65,
* boxMargin: 10,
* boxTextMargin: 5,
* noteMargin: 10,
* messageMargin: 35,
* messageAlign: 'center',
* mirrorActors: true,
* bottomMarginAdj: 1,
* useMaxWidth: true,
* rightAngles: false,
* showSequenceNumbers: false,
* },
* gantt: {
* titleTopMargin: 25,
* barHeight: 20,
* barGap: 4,
* topPadding: 50,
* leftPadding: 75,
* gridLineStartPadding: 35,
* fontSize: 11,
* fontFamily: '"Open-Sans", "sans-serif"',
* numberSectionStyles: 4,
* axisFormat: '%Y-%m-%d',
* topAxis: false,
* },
* gantt:{
* titleTopMargin:25,
* barHeight:20,
* barGap:4,
* topPadding:50,
* leftPadding:75,
* gridLineStartPadding:35,
* fontSize:11,
* fontFamily:'"Open-Sans", "sans-serif"',
* numberSectionStyles:4,
* axisFormat:'%Y-%m-%d',
* topAxis:false,
* }
* };
* mermaid.initialize(config);
* </script>

View File

@@ -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;

View File

@@ -38,34 +38,36 @@ const directiveWithoutOpen =
const anyComment = /\s*%%.*\n/gm;
/**
* @function detectInit
* Detects the init config object from the text
* ```mermaid
* %%{init: {"theme": "debug", "logLevel": 1 }}%%
* graph LR
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* @function detectInit Detects the init config object from the text
*
* ```mermaid
* %%{init: {"theme": "debug", "logLevel": 1 }}%%
* graph LR
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* ```
* or
* ```mermaid
* %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
* graph LR
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
*
* Or
*
* ```mermaid
* %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
* graph LR
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* ```
* @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,24 +99,25 @@ 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
* ```mermaid
* graph LR
* %%{somedirective}%%
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* @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}%%
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* ```
* @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.
* @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.
*/
export const detectDirective = function (text, type = null) {
try {
@@ -158,19 +161,19 @@ 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
* ```mermaid
* %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
* graph LR
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* @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
* a-->b
* b-->c
* c-->d
* d-->e
* e-->f
* f-->g
* g-->h
* ```
* @param {string} text The text defining the graph
* @param {any} cnf
@@ -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:
* ```
* 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 {*}
* @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 {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(