Update of prettier, eslint and rules

This commit is contained in:
Knut Sveidqvist 2021-07-15 11:35:12 +02:00
parent 896c7eca57
commit 5399214ad8
80 changed files with 1192 additions and 1329 deletions

View File

@ -656,7 +656,7 @@ module.exports = function(module) {
/*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, yarn-upgrade-all, sideEffects, husky, default */ /*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, yarn-upgrade-all, sideEffects, husky, default */
/***/ (function(module) { /***/ (function(module) {
module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.11.0\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --colors\",\"build:production\":\"yarn build:development -p --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"minify\":\"minify ./dist/mermaid.js > ./dist/mermaid.min.js\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack-dev-server --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"@percy/migrate\":\"^0.10.0\",\"d3\":\"^5.7.0\",\"dagre\":\"^0.8.5\",\"dagre-d3\":\"^0.6.4\",\"graphlib\":\"^2.1.8\",\"khroma\":\"^1.4.1\",\"moment-mini\":\"^2.24.0\",\"stylis\":\"^4.0.10\"},\"devDependencies\":{\"@babel/core\":\"^7.14.6\",\"@babel/preset-env\":\"^7.14.7\",\"@babel/register\":\"^7.14.5\",\"@percy/cli\":\"^1.0.0-beta.58\",\"@percy/cypress\":\"^3.1.0\",\"babel-core\":\"7.0.0-bridge.0\",\"babel-eslint\":\"^10.1.0\",\"babel-jest\":\"^27.0.6\",\"babel-loader\":\"^8.2.2\",\"coveralls\":\"^3.0.2\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"7.6.0\",\"documentation\":\"^12.0.1\",\"dompurify\":\"2.3.0\",\"eslint\":\"^6.3.0\",\"eslint-config-prettier\":\"^6.3.0\",\"eslint-plugin-prettier\":\"^3.1.0\",\"husky\":\"^1.2.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^27.0.6\",\"jison\":\"^0.4.18\",\"js-base64\":\"3.6.1\",\"minify\":\"^4.1.1\",\"moment\":\"^2.23.0\",\"prettier\":\"^1.18.2\",\"start-server-and-test\":\"^1.12.6\",\"terser-webpack-plugin\":\"^2.2.2\",\"webpack\":\"^4.41.2\",\"webpack-bundle-analyzer\":\"^4.4.2\",\"webpack-cli\":\"^3.1.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^1.7.2\"},\"files\":[\"dist\"],\"yarn-upgrade-all\":{\"ignore\":[\"babel-core\"]},\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}"); module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.11.0\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --colors\",\"build:production\":\"yarn build:development -p --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"minify\":\"minify ./dist/mermaid.js > ./dist/mermaid.min.js\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack-dev-server --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"@percy/migrate\":\"^0.10.0\",\"d3\":\"^5.7.0\",\"dagre\":\"^0.8.5\",\"dagre-d3\":\"^0.6.4\",\"graphlib\":\"^2.1.8\",\"khroma\":\"^1.4.1\",\"moment-mini\":\"^2.24.0\",\"stylis\":\"^4.0.10\"},\"devDependencies\":{\"@babel/core\":\"^7.14.6\",\"@babel/preset-env\":\"^7.14.7\",\"@babel/register\":\"^7.14.5\",\"@percy/cli\":\"^1.0.0-beta.58\",\"@percy/cypress\":\"^3.1.0\",\"babel-core\":\"7.0.0-bridge.0\",\"babel-eslint\":\"^10.1.0\",\"babel-jest\":\"^27.0.6\",\"babel-loader\":\"^8.2.2\",\"coveralls\":\"^3.0.2\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"7.6.0\",\"documentation\":\"^12.0.1\",\"dompurify\":\"2.3.0\",\"eslint\":\"^7.30.0\",\"eslint-config-prettier\":\"^8.3.0\",\"eslint-plugin-prettier\":\"^3.4.0\",\"husky\":\"^1.2.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^27.0.6\",\"jison\":\"^0.4.18\",\"js-base64\":\"3.6.1\",\"moment\":\"^2.23.0\",\"prettier\":\"^2.3.2\",\"start-server-and-test\":\"^1.12.6\",\"terser-webpack-plugin\":\"^2.2.2\",\"webpack\":\"^4.41.2\",\"webpack-bundle-analyzer\":\"^4.4.2\",\"webpack-cli\":\"^3.1.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^1.7.2\"},\"files\":[\"dist\"],\"yarn-upgrade-all\":{\"ignore\":[\"babel-core\"]},\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}");
/***/ }), /***/ }),
@ -25416,7 +25416,7 @@ var render = function render(id, _txt, cb, container) {
var rules = stylis("#".concat(id), Object(_styles__WEBPACK_IMPORTED_MODULE_42__["default"])(graphType, userStyles, cnf.themeVariables)); var rules = stylis("#".concat(id), Object(_styles__WEBPACK_IMPORTED_MODULE_42__["default"])(graphType, userStyles, cnf.themeVariables));
var style1 = document.createElement('style'); var style1 = document.createElement('style');
style1.innerHTML = rules; style1.innerHTML = "#".concat(id, " ") + rules;
svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this
// const style2 = document.createElement('style'); // const style2 = document.createElement('style');
// const cs = window.getComputedStyle(svg); // const cs = window.getComputedStyle(svg);

File diff suppressed because one or more lines are too long

4
dist/mermaid.js vendored
View File

@ -49068,7 +49068,7 @@ module.exports = function(module) {
/*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, yarn-upgrade-all, sideEffects, husky, default */ /*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, yarn-upgrade-all, sideEffects, husky, default */
/***/ (function(module) { /***/ (function(module) {
module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.11.0\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --colors\",\"build:production\":\"yarn build:development -p --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"minify\":\"minify ./dist/mermaid.js > ./dist/mermaid.min.js\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack-dev-server --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"@percy/migrate\":\"^0.10.0\",\"d3\":\"^5.7.0\",\"dagre\":\"^0.8.5\",\"dagre-d3\":\"^0.6.4\",\"graphlib\":\"^2.1.8\",\"khroma\":\"^1.4.1\",\"moment-mini\":\"^2.24.0\",\"stylis\":\"^4.0.10\"},\"devDependencies\":{\"@babel/core\":\"^7.14.6\",\"@babel/preset-env\":\"^7.14.7\",\"@babel/register\":\"^7.14.5\",\"@percy/cli\":\"^1.0.0-beta.58\",\"@percy/cypress\":\"^3.1.0\",\"babel-core\":\"7.0.0-bridge.0\",\"babel-eslint\":\"^10.1.0\",\"babel-jest\":\"^27.0.6\",\"babel-loader\":\"^8.2.2\",\"coveralls\":\"^3.0.2\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"7.6.0\",\"documentation\":\"^12.0.1\",\"dompurify\":\"2.3.0\",\"eslint\":\"^6.3.0\",\"eslint-config-prettier\":\"^6.3.0\",\"eslint-plugin-prettier\":\"^3.1.0\",\"husky\":\"^1.2.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^27.0.6\",\"jison\":\"^0.4.18\",\"js-base64\":\"3.6.1\",\"minify\":\"^4.1.1\",\"moment\":\"^2.23.0\",\"prettier\":\"^1.18.2\",\"start-server-and-test\":\"^1.12.6\",\"terser-webpack-plugin\":\"^2.2.2\",\"webpack\":\"^4.41.2\",\"webpack-bundle-analyzer\":\"^4.4.2\",\"webpack-cli\":\"^3.1.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^1.7.2\"},\"files\":[\"dist\"],\"yarn-upgrade-all\":{\"ignore\":[\"babel-core\"]},\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}"); module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.11.0\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --colors\",\"build:production\":\"yarn build:development -p --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"minify\":\"minify ./dist/mermaid.js > ./dist/mermaid.min.js\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack-dev-server --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"@percy/migrate\":\"^0.10.0\",\"d3\":\"^5.7.0\",\"dagre\":\"^0.8.5\",\"dagre-d3\":\"^0.6.4\",\"graphlib\":\"^2.1.8\",\"khroma\":\"^1.4.1\",\"moment-mini\":\"^2.24.0\",\"stylis\":\"^4.0.10\"},\"devDependencies\":{\"@babel/core\":\"^7.14.6\",\"@babel/preset-env\":\"^7.14.7\",\"@babel/register\":\"^7.14.5\",\"@percy/cli\":\"^1.0.0-beta.58\",\"@percy/cypress\":\"^3.1.0\",\"babel-core\":\"7.0.0-bridge.0\",\"babel-eslint\":\"^10.1.0\",\"babel-jest\":\"^27.0.6\",\"babel-loader\":\"^8.2.2\",\"coveralls\":\"^3.0.2\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"7.6.0\",\"documentation\":\"^12.0.1\",\"dompurify\":\"2.3.0\",\"eslint\":\"^7.30.0\",\"eslint-config-prettier\":\"^8.3.0\",\"eslint-plugin-prettier\":\"^3.4.0\",\"husky\":\"^1.2.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^27.0.6\",\"jison\":\"^0.4.18\",\"js-base64\":\"3.6.1\",\"moment\":\"^2.23.0\",\"prettier\":\"^2.3.2\",\"start-server-and-test\":\"^1.12.6\",\"terser-webpack-plugin\":\"^2.2.2\",\"webpack\":\"^4.41.2\",\"webpack-bundle-analyzer\":\"^4.4.2\",\"webpack-cli\":\"^3.1.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^1.7.2\"},\"files\":[\"dist\"],\"yarn-upgrade-all\":{\"ignore\":[\"babel-core\"]},\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}");
/***/ }), /***/ }),
@ -73801,7 +73801,7 @@ var render = function render(id, _txt, cb, container) {
var rules = stylis("#".concat(id), Object(_styles__WEBPACK_IMPORTED_MODULE_42__["default"])(graphType, userStyles, cnf.themeVariables)); var rules = stylis("#".concat(id), Object(_styles__WEBPACK_IMPORTED_MODULE_42__["default"])(graphType, userStyles, cnf.themeVariables));
var style1 = document.createElement('style'); var style1 = document.createElement('style');
style1.innerHTML = rules; style1.innerHTML = "#".concat(id, " ") + rules;
svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this
// const style2 = document.createElement('style'); // const style2 = document.createElement('style');
// const cs = window.getComputedStyle(svg); // const cs = window.getComputedStyle(svg);

2
dist/mermaid.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/mermaid.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -73,17 +73,16 @@
"cypress": "7.6.0", "cypress": "7.6.0",
"documentation": "^12.0.1", "documentation": "^12.0.1",
"dompurify": "2.3.0", "dompurify": "2.3.0",
"eslint": "^6.3.0", "eslint": "^7.30.0",
"eslint-config-prettier": "^6.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.1.0", "eslint-plugin-prettier": "^3.4.0",
"husky": "^1.2.1", "husky": "^1.2.1",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^27.0.6", "jest": "^27.0.6",
"jison": "^0.4.18", "jison": "^0.4.18",
"js-base64": "3.6.1", "js-base64": "3.6.1",
"minify": "^4.1.1",
"moment": "^2.23.0", "moment": "^2.23.0",
"prettier": "^1.18.2", "prettier": "^2.3.2",
"start-server-and-test": "^1.12.6", "start-server-and-test": "^1.12.6",
"terser-webpack-plugin": "^2.2.2", "terser-webpack-plugin": "^2.2.2",
"webpack": "^4.41.2", "webpack": "^4.41.2",

View File

@ -1,3 +1,3 @@
module.exports = function(txt) { module.exports = function (txt) {
return txt; return txt;
}; };

View File

@ -55,7 +55,7 @@ export const updateCurrentConfig = (siteCfg, _directives) => {
* @param conf - the base currentConfig to use as siteConfig * @param conf - the base currentConfig to use as siteConfig
* @returns {*} - the siteConfig * @returns {*} - the siteConfig
*/ */
export const setSiteConfig = conf => { export const setSiteConfig = (conf) => {
siteConfig = assignWithDepth({}, defaultConfig); siteConfig = assignWithDepth({}, defaultConfig);
siteConfig = assignWithDepth(siteConfig, conf); siteConfig = assignWithDepth(siteConfig, conf);
@ -67,11 +67,11 @@ export const setSiteConfig = conf => {
return siteConfig; return siteConfig;
}; };
export const saveConfigFromInitilize = conf => { export const saveConfigFromInitilize = (conf) => {
configFromInitialize = assignWithDepth({}, conf); configFromInitialize = assignWithDepth({}, conf);
}; };
export const updateSiteConfig = conf => { export const updateSiteConfig = (conf) => {
siteConfig = assignWithDepth(siteConfig, conf); siteConfig = assignWithDepth(siteConfig, conf);
updateCurrentConfig(siteConfig, directives); updateCurrentConfig(siteConfig, directives);
@ -101,7 +101,7 @@ export const getSiteConfig = () => {
* @param conf - the potential currentConfig * @param conf - the potential currentConfig
* @returns {*} - the currentConfig merged with the sanitized conf * @returns {*} - the currentConfig merged with the sanitized conf
*/ */
export const setConfig = conf => { export const setConfig = (conf) => {
// sanitize(conf); // sanitize(conf);
// Object.keys(conf).forEach(key => { // Object.keys(conf).forEach(key => {
// const manipulator = manipulators[key]; // const manipulator = manipulators[key];
@ -134,9 +134,9 @@ export const getConfig = () => {
*Note: modifies options in-place *Note: modifies options in-place
* @param options - the potential setConfig parameter * @param options - the potential setConfig parameter
*/ */
export const sanitize = options => { export const sanitize = (options) => {
// Checking that options are not in the list of excluded options // Checking that options are not in the list of excluded options
Object.keys(siteConfig.secure).forEach(key => { Object.keys(siteConfig.secure).forEach((key) => {
if (typeof options[siteConfig.secure[key]] !== 'undefined') { if (typeof options[siteConfig.secure[key]] !== 'undefined') {
// DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
// can exploit the logger's attempt to stringify the value and execute arbitrary code // can exploit the logger's attempt to stringify the value and execute arbitrary code
@ -149,14 +149,14 @@ export const sanitize = options => {
}); });
// Check that there no attempts of prototype pollution // Check that there no attempts of prototype pollution
Object.keys(options).forEach(key => { Object.keys(options).forEach((key) => {
if (key.indexOf('__') === 0) { if (key.indexOf('__') === 0) {
delete options[key]; delete options[key];
} }
}); });
// Check that there no attempts of xss, there should be no tags at all in the directive // Check that there no attempts of xss, there should be no tags at all in the directive
// blocking data urls as base64 urls can contain svgs with inline script tags // blocking data urls as base64 urls can contain svgs with inline script tags
Object.keys(options).forEach(key => { Object.keys(options).forEach((key) => {
if (typeof options[key] === 'string') { if (typeof options[key] === 'string') {
if ( if (
options[key].indexOf('<') > -1 || options[key].indexOf('<') > -1 ||
@ -172,7 +172,7 @@ export const sanitize = options => {
}); });
}; };
export const addDirective = directive => { export const addDirective = (directive) => {
if (directive.fontFamily) { if (directive.fontFamily) {
if (!directive.themeVariables) { if (!directive.themeVariables) {
directive.themeVariables = { fontFamily: directive.fontFamily }; directive.themeVariables = { fontFamily: directive.fontFamily };

View File

@ -10,12 +10,12 @@ import config from './defaultConfig';
// import themeForestVariables from './theme-forest'; // import themeForestVariables from './theme-forest';
// import themeNeutralVariables from './theme-neutral'; // import themeNeutralVariables from './theme-neutral';
const handleThemeVariables = value => { const handleThemeVariables = (value) => {
return theme[value] ? theme[value].getThemeVariables() : theme.default.getThemeVariables(); return theme[value] ? theme[value].getThemeVariables() : theme.default.getThemeVariables();
}; };
const manipulators = { const manipulators = {
themeVariables: handleThemeVariables themeVariables: handleThemeVariables,
}; };
// debugger; // debugger;
@ -40,10 +40,10 @@ const currentConfig = assignWithDepth({}, defaultConfig);
* @param conf - the base currentConfig to use as siteConfig * @param conf - the base currentConfig to use as siteConfig
* @returns {*} - the siteConfig * @returns {*} - the siteConfig
*/ */
export const setSiteConfig = conf => { export const setSiteConfig = (conf) => {
console.log('setSiteConfig'); console.log('setSiteConfig');
Object.keys(conf).forEach(key => { Object.keys(conf).forEach((key) => {
const manipulator = manipulators[key]; const manipulator = manipulators[key];
conf[key] = manipulator ? manipulator(conf[key]) : conf[key]; conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
}); });
@ -78,10 +78,10 @@ export const getSiteConfig = () => {
* @param conf - the potential currentConfig * @param conf - the potential currentConfig
* @returns {*} - the currentConfig merged with the sanitized conf * @returns {*} - the currentConfig merged with the sanitized conf
*/ */
export const setConfig = conf => { export const setConfig = (conf) => {
console.log('setConfig'); console.log('setConfig');
sanitize(conf); sanitize(conf);
Object.keys(conf).forEach(key => { Object.keys(conf).forEach((key) => {
const manipulator = manipulators[key]; const manipulator = manipulators[key];
conf[key] = manipulator ? manipulator(conf[key]) : conf[key]; conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
}); });
@ -110,8 +110,8 @@ export const getConfig = () => {
*Note: modifies options in-place *Note: modifies options in-place
* @param options - the potential setConfig parameter * @param options - the potential setConfig parameter
*/ */
export const sanitize = options => { export const sanitize = (options) => {
Object.keys(siteConfig.secure).forEach(key => { Object.keys(siteConfig.secure).forEach((key) => {
if (typeof options[siteConfig.secure[key]] !== 'undefined') { if (typeof options[siteConfig.secure[key]] !== 'undefined') {
// DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
// can exploit the logger's attempt to stringify the value and execute arbitrary code // can exploit the logger's attempt to stringify the value and execute arbitrary code
@ -139,8 +139,8 @@ export const sanitize = options => {
*/ */
export const reset = (conf = getSiteConfig()) => { export const reset = (conf = getSiteConfig()) => {
console.warn('reset'); console.warn('reset');
Object.keys(siteConfig).forEach(key => delete siteConfig[key]); Object.keys(siteConfig).forEach((key) => delete siteConfig[key]);
Object.keys(currentConfig).forEach(key => delete currentConfig[key]); Object.keys(currentConfig).forEach((key) => delete currentConfig[key]);
assignWithDepth(siteConfig, conf, { clobber: true }); assignWithDepth(siteConfig, conf, { clobber: true });
assignWithDepth(currentConfig, conf, { clobber: true }); assignWithDepth(currentConfig, conf, { clobber: true });
}; };
@ -152,6 +152,6 @@ const configApi = Object.freeze({
setConfig, setConfig,
getConfig, getConfig,
reset, reset,
defaultConfig defaultConfig,
}); });
export default configApi; export default configApi;

View File

@ -70,7 +70,7 @@ const rect = (parent, node) => {
node.width = rectBox.width; node.width = rectBox.width;
node.height = rectBox.height; node.height = rectBox.height;
node.intersect = function(point) { node.intersect = function (point) {
return intersectRect(node, point); return intersectRect(node, point);
}; };
@ -82,10 +82,7 @@ const rect = (parent, node) => {
*/ */
const noteGroup = (parent, node) => { const noteGroup = (parent, node) => {
// Add outer g element // Add outer g element
const shapeSvg = parent const shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id);
.insert('g')
.attr('class', 'note-cluster')
.attr('id', node.id);
// add the rect // add the rect
const rect = shapeSvg.insert('rect', ':first-child'); const rect = shapeSvg.insert('rect', ':first-child');
@ -107,7 +104,7 @@ const noteGroup = (parent, node) => {
node.width = rectBox.width; node.width = rectBox.width;
node.height = rectBox.height; node.height = rectBox.height;
node.intersect = function(point) { node.intersect = function (point) {
return intersectRect(node, point); return intersectRect(node, point);
}; };
@ -115,10 +112,7 @@ const noteGroup = (parent, node) => {
}; };
const roundedWithTitle = (parent, node) => { const roundedWithTitle = (parent, node) => {
// Add outer g element // Add outer g element
const shapeSvg = parent const shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id);
.insert('g')
.attr('class', node.classes)
.attr('id', node.id);
// add the rect // add the rect
const rect = shapeSvg.insert('rect', ':first-child'); const rect = shapeSvg.insert('rect', ':first-child');
@ -181,7 +175,7 @@ const roundedWithTitle = (parent, node) => {
const rectBox = rect.node().getBBox(); const rectBox = rect.node().getBBox();
node.height = rectBox.height; node.height = rectBox.height;
node.intersect = function(point) { node.intersect = function (point) {
return intersectRect(node, point); return intersectRect(node, point);
}; };
@ -190,10 +184,7 @@ const roundedWithTitle = (parent, node) => {
const divider = (parent, node) => { const divider = (parent, node) => {
// Add outer g element // Add outer g element
const shapeSvg = parent const shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id);
.insert('g')
.attr('class', node.classes)
.attr('id', node.id);
// add the rect // add the rect
const rect = shapeSvg.insert('rect', ':first-child'); const rect = shapeSvg.insert('rect', ':first-child');
@ -213,7 +204,7 @@ const divider = (parent, node) => {
node.width = rectBox.width; node.width = rectBox.width;
node.height = rectBox.height; node.height = rectBox.height;
node.diff = -node.padding / 2; node.diff = -node.padding / 2;
node.intersect = function(point) { node.intersect = function (point) {
return intersectRect(node, point); return intersectRect(node, point);
}; };
@ -241,7 +232,7 @@ export const clear = () => {
clusterElems = {}; clusterElems = {};
}; };
export const positionCluster = node => { export const positionCluster = (node) => {
log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')'); log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')');
const el = clusterElems[node.id]; const el = clusterElems[node.id];

View File

@ -95,9 +95,9 @@ const createLabel = (_vertexText, style, isTitle, isNode) => {
isNode, isNode,
label: vertexText.replace( label: vertexText.replace(
/fa[lrsb]?:fa-[\w-]+/g, /fa[lrsb]?:fa-[\w-]+/g,
s => `<i class='${s.replace(':', ' ')}'></i>` (s) => `<i class='${s.replace(':', ' ')}'></i>`
), ),
labelStyle: style.replace('fill:', 'color:') labelStyle: style.replace('fill:', 'color:'),
}; };
let vertexNode = addHtmlLabel(node); let vertexNode = addHtmlLabel(node);
// vertexNode.parentNode.removeChild(vertexNode); // vertexNode.parentNode.removeChild(vertexNode);

View File

@ -240,7 +240,7 @@ export const intersection = (node, outsidePoint, insidePoint) => {
r = (R * q) / Q; r = (R * q) / Q;
const res = { const res = {
x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r, x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q,
}; };
if (r === 0) { if (r === 0) {
@ -298,7 +298,7 @@ const cutPathAtIntersect = (_points, boundryNode) => {
let points = []; let points = [];
let lastPointOutside = _points[0]; let lastPointOutside = _points[0];
let isInside = false; let isInside = false;
_points.forEach(point => { _points.forEach((point) => {
// const node = clusterDb[edge.toCluster].node; // const node = clusterDb[edge.toCluster].node;
log.info('abc88 checking point', point, boundryNode); log.info('abc88 checking point', point, boundryNode);
@ -312,11 +312,11 @@ const cutPathAtIntersect = (_points, boundryNode) => {
// // Check case where the intersection is the same as the last point // // Check case where the intersection is the same as the last point
let pointPresent = false; let pointPresent = false;
points.forEach(p => { points.forEach((p) => {
pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y); pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
}); });
// // if (!pointPresent) { // // if (!pointPresent) {
if (!points.find(e => e.x === inter.x && e.y === inter.y)) { if (!points.find((e) => e.x === inter.x && e.y === inter.y)) {
points.push(inter); points.push(inter);
} else { } else {
log.warn('abc88 no intersect', inter, points); log.warn('abc88 no intersect', inter, points);
@ -336,7 +336,7 @@ const cutPathAtIntersect = (_points, boundryNode) => {
}; };
//(edgePaths, e, edge, clusterDb, diagramtype, graph) //(edgePaths, e, edge, clusterDb, diagramtype, graph)
export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) { export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph) {
let points = edge.points; let points = edge.points;
let pointsHasChanged = false; let pointsHasChanged = false;
const tail = graph.node(e.v); const tail = graph.node(e.v);
@ -437,7 +437,7 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
} }
// The data for our line // The data for our line
const lineData = points.filter(p => !Number.isNaN(p.y)); const lineData = points.filter((p) => !Number.isNaN(p.y));
// This is the accessor function we talked about above // This is the accessor function we talked about above
let curve; let curve;
@ -451,10 +451,10 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
} }
// curve = curveLinear; // curve = curveLinear;
const lineFunction = line() const lineFunction = line()
.x(function(d) { .x(function (d) {
return d.x; return d.x;
}) })
.y(function(d) { .y(function (d) {
return d.y; return d.y;
}) })
.curve(curve); .curve(curve);

View File

@ -7,7 +7,7 @@ import {
clusterDb, clusterDb,
adjustClustersAndEdges, adjustClustersAndEdges,
findNonClusterChild, findNonClusterChild,
sortNodesByHierarchy sortNodesByHierarchy,
} from './mermaid-graphlib'; } from './mermaid-graphlib';
import { insertNode, positionNode, clear as clearNodes, setNodeElem } from './nodes'; import { insertNode, positionNode, clear as clearNodes, setNodeElem } from './nodes';
import { insertCluster, clear as clearClusters } from './clusters'; import { insertCluster, clear as clearClusters } from './clusters';
@ -35,7 +35,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
// Insert nodes, this will insert them into the dom and each node will get a size. The size is updated // Insert nodes, this will insert them into the dom and each node will get a size. The size is updated
// to the abstract node and is later used by dagre for the layout // to the abstract node and is later used by dagre for the layout
graph.nodes().forEach(function(v) { graph.nodes().forEach(function (v) {
const node = graph.node(v); const node = graph.node(v);
if (typeof parentCluster !== 'undefined') { if (typeof parentCluster !== 'undefined') {
const data = JSON.parse(JSON.stringify(parentCluster.clusterData)); const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
@ -78,7 +78,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
// Also figure out which edges point to/from clusters and adjust them accordingly // Also figure out which edges point to/from clusters and adjust them accordingly
// Edges from/to clusters really points to the first child in the cluster. // Edges from/to clusters really points to the first child in the cluster.
// TODO: pick optimal child in the cluster to us as link anchor // TODO: pick optimal child in the cluster to us as link anchor
graph.edges().forEach(function(e) { graph.edges().forEach(function (e) {
const edge = graph.edge(e.v, e.w, e.name); const edge = graph.edge(e.v, e.w, e.name);
log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
log.info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e))); log.info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e)));
@ -88,7 +88,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
insertEdgeLabel(edgeLabels, edge); insertEdgeLabel(edgeLabels, edge);
}); });
graph.edges().forEach(function(e) { graph.edges().forEach(function (e) {
log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
}); });
log.info('#############################################'); log.info('#############################################');
@ -99,7 +99,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
log.info('Graph after layout:', graphlib.json.write(graph)); log.info('Graph after layout:', graphlib.json.write(graph));
// Move the nodes to the correct place // Move the nodes to the correct place
let diff = 0; let diff = 0;
sortNodesByHierarchy(graph).forEach(function(v) { sortNodesByHierarchy(graph).forEach(function (v) {
const node = graph.node(v); const node = graph.node(v);
log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v))); log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
log.info( log.info(
@ -128,7 +128,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
}); });
// Move the edge labels to the correct place after layout // Move the edge labels to the correct place after layout
graph.edges().forEach(function(e) { graph.edges().forEach(function (e) {
const edge = graph.edge(e); const edge = graph.edge(e);
log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge); log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
@ -136,7 +136,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
positionEdgeLabel(edge, paths); positionEdgeLabel(edge, paths);
}); });
graph.nodes().forEach(function(v) { graph.nodes().forEach(function (v) {
const n = graph.node(v); const n = graph.node(v);
log.info(v, n.type, n.diff); log.info(v, n.type, n.diff);
if (n.type === 'group') { if (n.type === 'group') {

View File

@ -3,5 +3,5 @@ module.exports = {
circle: require('./intersect-circle'), circle: require('./intersect-circle'),
ellipse: require('./intersect-ellipse'), ellipse: require('./intersect-ellipse'),
polygon: require('./intersect-polygon'), polygon: require('./intersect-polygon'),
rect: require('./intersect-rect') rect: require('./intersect-rect'),
}; };

View File

@ -13,5 +13,5 @@ export default {
circle, circle,
ellipse, ellipse,
polygon, polygon,
rect rect,
}; };

View File

@ -17,7 +17,7 @@ function intersectPolygon(node, polyPoints, point) {
var minX = Number.POSITIVE_INFINITY; var minX = Number.POSITIVE_INFINITY;
var minY = Number.POSITIVE_INFINITY; var minY = Number.POSITIVE_INFINITY;
if (typeof polyPoints.forEach === 'function') { if (typeof polyPoints.forEach === 'function') {
polyPoints.forEach(function(entry) { polyPoints.forEach(function (entry) {
minX = Math.min(minX, entry.x); minX = Math.min(minX, entry.x);
minY = Math.min(minY, entry.y); minY = Math.min(minY, entry.y);
}); });
@ -50,7 +50,7 @@ function intersectPolygon(node, polyPoints, point) {
if (intersections.length > 1) { if (intersections.length > 1) {
// More intersections, find the one nearest to edge end point // More intersections, find the one nearest to edge end point
intersections.sort(function(p, q) { intersections.sort(function (p, q) {
var pdx = p.x - point.x; var pdx = p.x - point.x;
var pdy = p.y - point.y; var pdy = p.y - point.y;
var distp = Math.sqrt(pdx * pdx + pdy * pdy); var distp = Math.sqrt(pdx * pdx + pdy * pdy);

View File

@ -6,7 +6,7 @@ import { log } from '../logger';
// Only add the number of markers that the diagram needs // Only add the number of markers that the diagram needs
const insertMarkers = (elem, markerArray, type, id) => { const insertMarkers = (elem, markerArray, type, id) => {
markerArray.forEach(markerName => { markerArray.forEach((markerName) => {
markers[markerName](elem, type, id); markers[markerName](elem, type, id);
}); });
}; };
@ -255,6 +255,6 @@ const markers = {
point, point,
circle, circle,
cross, cross,
barb barb,
}; };
export default insertMarkers; export default insertMarkers;

View File

@ -70,7 +70,7 @@ const copy = (clusterId, graph, newGraph, rootId) => {
log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes); log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
nodes.forEach(node => { nodes.forEach((node) => {
if (graph.children(node).length > 0) { if (graph.children(node).length > 0) {
copy(node, graph, newGraph, rootId); copy(node, graph, newGraph, rootId);
} else { } else {
@ -98,7 +98,7 @@ const copy = (clusterId, graph, newGraph, rootId) => {
} }
const edges = graph.edges(node); const edges = graph.edges(node);
log.debug('Copying Edges', edges); log.debug('Copying Edges', edges);
edges.forEach(edge => { edges.forEach((edge) => {
log.info('Edge', edge); log.info('Edge', edge);
const data = graph.edge(edge.v, edge.w, edge.name); const data = graph.edge(edge.v, edge.w, edge.name);
log.info('Edge data', data, rootId); log.info('Edge data', data, rootId);
@ -147,7 +147,7 @@ export const extractDecendants = (id, graph) => {
* edges between nodes also ia correct. When not correct the function logs the discrepancies. * edges between nodes also ia correct. When not correct the function logs the discrepancies.
* @param {graphlib graph} g * @param {graphlib graph} g
*/ */
export const validate = graph => { export const validate = (graph) => {
const edges = graph.edges(); const edges = graph.edges();
log.trace('Edges: ', edges); log.trace('Edges: ', edges);
for (let i = 0; i < edges.length; i++) { for (let i = 0; i < edges.length; i++) {
@ -187,7 +187,7 @@ export const findNonClusterChild = (id, graph) => {
} }
}; };
const getAnchorId = id => { const getAnchorId = (id) => {
if (!clusterDb[id]) { if (!clusterDb[id]) {
return id; return id;
} }
@ -212,7 +212,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
} }
// Go through the nodes and for each cluster found, save a replacment node, this can be used when // Go through the nodes and for each cluster found, save a replacment node, this can be used when
// faking a link to a cluster // faking a link to a cluster
graph.nodes().forEach(function(id) { graph.nodes().forEach(function (id) {
const children = graph.children(id); const children = graph.children(id);
if (children.length > 0) { if (children.length > 0) {
log.warn( log.warn(
@ -227,12 +227,12 @@ export const adjustClustersAndEdges = (graph, depth) => {
}); });
// Check incoming and outgoing edges for each cluster // Check incoming and outgoing edges for each cluster
graph.nodes().forEach(function(id) { graph.nodes().forEach(function (id) {
const children = graph.children(id); const children = graph.children(id);
const edges = graph.edges(); const edges = graph.edges();
if (children.length > 0) { if (children.length > 0) {
log.debug('Cluster identified', id, decendants); log.debug('Cluster identified', id, decendants);
edges.forEach(edge => { edges.forEach((edge) => {
// log.debug('Edge, decendants: ', edge, decendants[id]); // log.debug('Edge, decendants: ', edge, decendants[id]);
// Check if any edge leaves the cluster (not the actual cluster, thats a link from the box) // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box)
@ -258,7 +258,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
// For clusters with incoming and/or outgoing edges translate those edges to a real node // For clusters with incoming and/or outgoing edges translate those edges to a real node
// in the cluster inorder to fake the edge // in the cluster inorder to fake the edge
graph.edges().forEach(function(e) { graph.edges().forEach(function (e) {
const edge = graph.edge(e); const edge = graph.edge(e);
log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e))); log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
@ -368,16 +368,16 @@ export const extractor = (graph, depth) => {
const clusterGraph = new graphlib.Graph({ const clusterGraph = new graphlib.Graph({
multigraph: true, multigraph: true,
compound: true compound: true,
}) })
.setGraph({ .setGraph({
rankdir: dir, // Todo: set proper spacing rankdir: dir, // Todo: set proper spacing
nodesep: 50, nodesep: 50,
ranksep: 50, ranksep: 50,
marginx: 8, marginx: 8,
marginy: 8 marginy: 8,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -388,7 +388,7 @@ export const extractor = (graph, depth) => {
id: node, id: node,
clusterData: clusterDb[node].clusterData, clusterData: clusterDb[node].clusterData,
labelText: clusterDb[node].labelText, labelText: clusterDb[node].labelText,
graph: clusterGraph graph: clusterGraph,
}); });
log.warn('New graph after copy node: (', node, ')', graphlib.json.write(clusterGraph)); log.warn('New graph after copy node: (', node, ')', graphlib.json.write(clusterGraph));
log.debug('Old graph after copy', graphlib.json.write(graph)); log.debug('Old graph after copy', graphlib.json.write(graph));
@ -424,7 +424,7 @@ export const extractor = (graph, depth) => {
const sorter = (graph, nodes) => { const sorter = (graph, nodes) => {
if (nodes.length === 0) return []; if (nodes.length === 0) return [];
let result = Object.assign(nodes); let result = Object.assign(nodes);
nodes.forEach(node => { nodes.forEach((node) => {
const children = graph.children(node); const children = graph.children(node);
const sorted = sorter(graph, children); const sorted = sorter(graph, children);
result = result.concat(sorted); result = result.concat(sorted);
@ -433,4 +433,4 @@ const sorter = (graph, nodes) => {
return result; return result;
}; };
export const sortNodesByHierarchy = graph => sorter(graph, graph.children()); export const sortNodesByHierarchy = (graph) => sorter(graph, graph.children());

View File

@ -18,7 +18,7 @@ const question = (parent, node) => {
{ x: s / 2, y: 0 }, { x: s / 2, y: 0 },
{ x: s, y: -s / 2 }, { x: s, y: -s / 2 },
{ x: s / 2, y: -s }, { x: s / 2, y: -s },
{ x: 0, y: -s / 2 } { x: 0, y: -s / 2 },
]; ];
log.info('Question main (Circle)'); log.info('Question main (Circle)');
@ -27,7 +27,7 @@ const question = (parent, node) => {
questionElem.attr('style', node.style); questionElem.attr('style', node.style);
updateNodeBounds(node, questionElem); updateNodeBounds(node, questionElem);
node.intersect = function(point) { node.intersect = function (point) {
log.warn('Intersect called'); log.warn('Intersect called');
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -46,27 +46,23 @@ const choice = (parent, node) => {
{ x: 0, y: s / 2 }, { x: 0, y: s / 2 },
{ x: s / 2, y: 0 }, { x: s / 2, y: 0 },
{ x: 0, y: -s / 2 }, { x: 0, y: -s / 2 },
{ x: -s / 2, y: 0 } { x: -s / 2, y: 0 },
]; ];
const choice = shapeSvg.insert('polygon', ':first-child').attr( const choice = shapeSvg.insert('polygon', ':first-child').attr(
'points', 'points',
points points
.map(function(d) { .map(function (d) {
return d.x + ',' + d.y; return d.x + ',' + d.y;
}) })
.join(' ') .join(' ')
); );
// center the circle around its coordinate // center the circle around its coordinate
choice choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28);
.attr('class', 'state-start')
.attr('r', 7)
.attr('width', 28)
.attr('height', 28);
node.width = 28; node.width = 28;
node.height = 28; node.height = 28;
node.intersect = function(point) { node.intersect = function (point) {
return intersect.circle(node, 14, point); return intersect.circle(node, 14, point);
}; };
@ -86,14 +82,14 @@ const hexagon = (parent, node) => {
{ x: w, y: -h / 2 }, { x: w, y: -h / 2 },
{ x: w - m, y: -h }, { x: w - m, y: -h },
{ x: m, y: -h }, { x: m, y: -h },
{ x: 0, y: -h / 2 } { x: 0, y: -h / 2 },
]; ];
const hex = insertPolygonShape(shapeSvg, w, h, points); const hex = insertPolygonShape(shapeSvg, w, h, points);
hex.attr('style', node.style); hex.attr('style', node.style);
updateNodeBounds(node, hex); updateNodeBounds(node, hex);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -110,7 +106,7 @@ const rect_left_inv_arrow = (parent, node) => {
{ x: w, y: 0 }, { x: w, y: 0 },
{ x: w, y: -h }, { x: w, y: -h },
{ x: -h / 2, y: -h }, { x: -h / 2, y: -h },
{ x: 0, y: -h / 2 } { x: 0, y: -h / 2 },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
@ -119,7 +115,7 @@ const rect_left_inv_arrow = (parent, node) => {
node.width = w + h; node.width = w + h;
node.height = h; node.height = h;
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -135,14 +131,14 @@ const lean_right = (parent, node) => {
{ x: (-2 * h) / 6, y: 0 }, { x: (-2 * h) / 6, y: 0 },
{ x: w - h / 6, y: 0 }, { x: w - h / 6, y: 0 },
{ x: w + (2 * h) / 6, y: -h }, { x: w + (2 * h) / 6, y: -h },
{ x: h / 6, y: -h } { x: h / 6, y: -h },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
el.attr('style', node.style); el.attr('style', node.style);
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -158,14 +154,14 @@ const lean_left = (parent, node) => {
{ x: (2 * h) / 6, y: 0 }, { x: (2 * h) / 6, y: 0 },
{ x: w + h / 6, y: 0 }, { x: w + h / 6, y: 0 },
{ x: w - (2 * h) / 6, y: -h }, { x: w - (2 * h) / 6, y: -h },
{ x: -h / 6, y: -h } { x: -h / 6, y: -h },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
el.attr('style', node.style); el.attr('style', node.style);
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -181,14 +177,14 @@ const trapezoid = (parent, node) => {
{ x: (-2 * h) / 6, y: 0 }, { x: (-2 * h) / 6, y: 0 },
{ x: w + (2 * h) / 6, y: 0 }, { x: w + (2 * h) / 6, y: 0 },
{ x: w - h / 6, y: -h }, { x: w - h / 6, y: -h },
{ x: h / 6, y: -h } { x: h / 6, y: -h },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
el.attr('style', node.style); el.attr('style', node.style);
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -204,14 +200,14 @@ const inv_trapezoid = (parent, node) => {
{ x: h / 6, y: 0 }, { x: h / 6, y: 0 },
{ x: w - h / 6, y: 0 }, { x: w - h / 6, y: 0 },
{ x: w + (2 * h) / 6, y: -h }, { x: w + (2 * h) / 6, y: -h },
{ x: (-2 * h) / 6, y: -h } { x: (-2 * h) / 6, y: -h },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
el.attr('style', node.style); el.attr('style', node.style);
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -228,14 +224,14 @@ const rect_right_inv_arrow = (parent, node) => {
{ x: w + h / 2, y: 0 }, { x: w + h / 2, y: 0 },
{ x: w, y: -h / 2 }, { x: w, y: -h / 2 },
{ x: w + h / 2, y: -h }, { x: w + h / 2, y: -h },
{ x: 0, y: -h } { x: 0, y: -h },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
el.attr('style', node.style); el.attr('style', node.style);
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -285,7 +281,7 @@ const cylinder = (parent, node) => {
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
const pos = intersect.rect(node, point); const pos = intersect.rect(node, point);
const x = pos.x - node.x; const x = pos.x - node.x;
@ -329,7 +325,7 @@ const rect = (parent, node) => {
updateNodeBounds(node, rect); updateNodeBounds(node, rect);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.rect(node, point); return intersect.rect(node, point);
}; };
@ -442,7 +438,7 @@ const rectWithTitle = (parent, node) => {
updateNodeBounds(node, rect); updateNodeBounds(node, rect);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.rect(node, point); return intersect.rect(node, point);
}; };
@ -468,7 +464,7 @@ const stadium = (parent, node) => {
updateNodeBounds(node, rect); updateNodeBounds(node, rect);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.rect(node, point); return intersect.rect(node, point);
}; };
@ -492,7 +488,7 @@ const circle = (parent, node) => {
updateNodeBounds(node, circle); updateNodeBounds(node, circle);
node.intersect = function(point) { node.intersect = function (point) {
log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point); log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point);
return intersect.circle(node, bbox.width / 2 + halfPadding, point); return intersect.circle(node, bbox.width / 2 + halfPadding, point);
}; };
@ -515,14 +511,14 @@ const subroutine = (parent, node) => {
{ x: w + 8, y: 0 }, { x: w + 8, y: 0 },
{ x: w + 8, y: -h }, { x: w + 8, y: -h },
{ x: -8, y: -h }, { x: -8, y: -h },
{ x: -8, y: 0 } { x: -8, y: 0 },
]; ];
const el = insertPolygonShape(shapeSvg, w, h, points); const el = insertPolygonShape(shapeSvg, w, h, points);
el.attr('style', node.style); el.attr('style', node.style);
updateNodeBounds(node, el); updateNodeBounds(node, el);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.polygon(node, points, point); return intersect.polygon(node, points, point);
}; };
@ -537,15 +533,11 @@ const start = (parent, node) => {
const circle = shapeSvg.insert('circle', ':first-child'); const circle = shapeSvg.insert('circle', ':first-child');
// center the circle around its coordinate // center the circle around its coordinate
circle circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
.attr('class', 'state-start')
.attr('r', 7)
.attr('width', 14)
.attr('height', 14);
updateNodeBounds(node, circle); updateNodeBounds(node, circle);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.circle(node, 7, point); return intersect.circle(node, 7, point);
}; };
@ -577,7 +569,7 @@ const forkJoin = (parent, node, dir) => {
updateNodeBounds(node, shape); updateNodeBounds(node, shape);
node.height = node.height + node.padding / 2; node.height = node.height + node.padding / 2;
node.width = node.width + node.padding / 2; node.width = node.width + node.padding / 2;
node.intersect = function(point) { node.intersect = function (point) {
return intersect.rect(node, point); return intersect.rect(node, point);
}; };
@ -592,21 +584,13 @@ const end = (parent, node) => {
const innerCircle = shapeSvg.insert('circle', ':first-child'); const innerCircle = shapeSvg.insert('circle', ':first-child');
const circle = shapeSvg.insert('circle', ':first-child'); const circle = shapeSvg.insert('circle', ':first-child');
circle circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
.attr('class', 'state-start')
.attr('r', 7)
.attr('width', 14)
.attr('height', 14);
innerCircle innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
.attr('class', 'state-end')
.attr('r', 5)
.attr('width', 10)
.attr('height', 10);
updateNodeBounds(node, circle); updateNodeBounds(node, circle);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.circle(node, 7, point); return intersect.circle(node, 7, point);
}; };
@ -683,7 +667,7 @@ const class_box = (parent, node) => {
maxWidth = classTitleBBox.width; maxWidth = classTitleBBox.width;
} }
const classAttributes = []; const classAttributes = [];
node.classData.members.forEach(str => { node.classData.members.forEach((str) => {
const parsedText = parseMember(str).displayText; const parsedText = parseMember(str).displayText;
const lbl = labelContainer const lbl = labelContainer
.node() .node()
@ -706,7 +690,7 @@ const class_box = (parent, node) => {
maxHeight += lineHeight; maxHeight += lineHeight;
const classMethods = []; const classMethods = [];
node.classData.methods.forEach(str => { node.classData.methods.forEach((str) => {
const parsedText = parseMember(str).displayText; const parsedText = parseMember(str).displayText;
const lbl = labelContainer const lbl = labelContainer
.node() .node()
@ -761,7 +745,7 @@ const class_box = (parent, node) => {
verticalPos += lineHeight; verticalPos += lineHeight;
classAttributes.forEach(lbl => { classAttributes.forEach((lbl) => {
select(lbl).attr( select(lbl).attr(
'transform', 'transform',
'translate( ' + 'translate( ' +
@ -783,7 +767,7 @@ const class_box = (parent, node) => {
verticalPos += lineHeight; verticalPos += lineHeight;
classMethods.forEach(lbl => { classMethods.forEach((lbl) => {
select(lbl).attr( select(lbl).attr(
'transform', 'transform',
'translate( ' + -maxWidth / 2 + ', ' + ((-1 * maxHeight) / 2 + verticalPos) + ')' 'translate( ' + -maxWidth / 2 + ', ' + ((-1 * maxHeight) / 2 + verticalPos) + ')'
@ -862,7 +846,7 @@ const class_box = (parent, node) => {
updateNodeBounds(node, rect); updateNodeBounds(node, rect);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.rect(node, point); return intersect.rect(node, point);
}; };
@ -890,7 +874,7 @@ const shapes = {
subroutine, subroutine,
fork: forkJoin, fork: forkJoin,
join: forkJoin, join: forkJoin,
class_box class_box,
}; };
let nodeElems = {}; let nodeElems = {};
@ -930,7 +914,7 @@ export const clear = () => {
nodeElems = {}; nodeElems = {};
}; };
export const positionNode = node => { export const positionNode = (node) => {
const el = nodeElems[node.id]; const el = nodeElems[node.id];
log.trace( log.trace(
'Transforming node', 'Transforming node',

View File

@ -6,7 +6,7 @@
// Only add the number of markers that the diagram needs // Only add the number of markers that the diagram needs
const insertPatterns = (elem, patternArray, type, id) => { const insertPatterns = (elem, patternArray, type, id) => {
patternArray.forEach(patternName => { patternArray.forEach((patternName) => {
patterns[patternName](elem, type, id); patterns[patternName](elem, type, id);
}); });
}; };
@ -49,6 +49,6 @@ const dots = (elem, type) => {
// TODO rename the class diagram markers to something shape descriptive and semanitc free // TODO rename the class diagram markers to something shape descriptive and semanitc free
const patterns = { const patterns = {
dots dots,
}; };
export default insertPatterns; export default insertPatterns;

View File

@ -19,7 +19,7 @@ const note = (parent, node) => {
updateNodeBounds(node, rect); updateNodeBounds(node, rect);
node.intersect = function(point) { node.intersect = function (point) {
return intersect.rect(node, point); return intersect.rect(node, point);
}; };

View File

@ -16,10 +16,7 @@ export const labelHelper = (parent, node, _classes, isNode) => {
.attr('id', node.domId || node.id); .attr('id', node.domId || node.id);
// Create the label and insert it after the rect // Create the label and insert it after the rect
const label = shapeSvg const label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
.insert('g')
.attr('class', 'label')
.attr('style', node.labelStyle);
const text = label const text = label
.node() .node()
@ -56,7 +53,7 @@ export function insertPolygonShape(parent, w, h, points) {
.attr( .attr(
'points', 'points',
points points
.map(function(d) { .map(function (d) {
return d.x + ',' + d.y; return d.x + ',' + d.y;
}) })
.join(' ') .join(' ')

View File

@ -241,7 +241,7 @@ const config = {
* *
* Default value: 'dagre-d3' * Default value: 'dagre-d3'
*/ */
defaultRenderer: 'dagre-d3' defaultRenderer: 'dagre-d3',
}, },
/** /**
@ -541,27 +541,27 @@ const config = {
*/ */
labelBoxHeight: 20, labelBoxHeight: 20,
messageFont: function() { messageFont: function () {
return { return {
fontFamily: this.messageFontFamily, fontFamily: this.messageFontFamily,
fontSize: this.messageFontSize, fontSize: this.messageFontSize,
fontWeight: this.messageFontWeight fontWeight: this.messageFontWeight,
}; };
}, },
noteFont: function() { noteFont: function () {
return { return {
fontFamily: this.noteFontFamily, fontFamily: this.noteFontFamily,
fontSize: this.noteFontSize, fontSize: this.noteFontSize,
fontWeight: this.noteFontWeight fontWeight: this.noteFontWeight,
}; };
}, },
actorFont: function() { actorFont: function () {
return { return {
fontFamily: this.actorFontFamily, fontFamily: this.actorFontFamily,
fontSize: this.actorFontSize, fontSize: this.actorFontSize,
fontWeight: this.actorFontWeight fontWeight: this.actorFontWeight,
}; };
} },
}, },
/** /**
@ -709,7 +709,7 @@ top of the chart
*/ */
topAxis: false, topAxis: false,
useWidth: undefined useWidth: undefined,
}, },
/** /**
@ -869,7 +869,7 @@ top of the chart
actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'], actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'], sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
sectionColours: ['#fff'] sectionColours: ['#fff'],
}, },
class: { class: {
arrowMarkerAbsolute: false, arrowMarkerAbsolute: false,
@ -900,7 +900,7 @@ top of the chart
* *
* Default value: 'dagre-d3' * Default value: 'dagre-d3'
*/ */
defaultRenderer: 'dagre-d3' defaultRenderer: 'dagre-d3',
}, },
git: { git: {
arrowMarkerAbsolute: false, arrowMarkerAbsolute: false,
@ -919,7 +919,7 @@ top of the chart
* *
* Default value: true * Default value: true
*/ */
useMaxWidth: true useMaxWidth: true,
}, },
state: { state: {
dividerMargin: 10, dividerMargin: 10,
@ -966,7 +966,7 @@ top of the chart
* *
* Default value: 'dagre-d3' * Default value: 'dagre-d3'
*/ */
defaultRenderer: 'dagre-wrapper' defaultRenderer: 'dagre-wrapper',
}, },
/** /**
@ -1081,7 +1081,7 @@ top of the chart
* *
* Default value: true * Default value: true
*/ */
useMaxWidth: true useMaxWidth: true,
}, },
/** /**
@ -1103,7 +1103,7 @@ top of the chart
* *
* Default value: true * Default value: true
*/ */
useMaxWidth: true useMaxWidth: true,
}, },
/** /**
@ -1135,8 +1135,8 @@ top of the chart
rect_min_height: 200, rect_min_height: 200,
fontSize: 14, fontSize: 14,
rect_padding: 10, rect_padding: 10,
line_height: 20 line_height: 20,
} },
}; };
config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute; config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;

View File

@ -13,11 +13,11 @@ let classCounter = 0;
let funs = []; let funs = [];
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
const splitClassNameAndType = function(id) { const splitClassNameAndType = function (id) {
let genericType = ''; let genericType = '';
let className = id; let className = id;
@ -36,7 +36,7 @@ const splitClassNameAndType = function(id) {
* @param id * @param id
* @public * @public
*/ */
export const addClass = function(id) { export const addClass = function (id) {
let classId = splitClassNameAndType(id); let classId = splitClassNameAndType(id);
// Only add class if not exists // Only add class if not exists
if (typeof classes[classId.className] !== 'undefined') return; if (typeof classes[classId.className] !== 'undefined') return;
@ -48,7 +48,7 @@ export const addClass = function(id) {
methods: [], methods: [],
members: [], members: [],
annotations: [], annotations: [],
domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter,
}; };
classCounter++; classCounter++;
@ -59,7 +59,7 @@ export const addClass = function(id) {
* @param id * @param id
* @public * @public
*/ */
export const lookUpDomId = function(id) { export const lookUpDomId = function (id) {
const classKeys = Object.keys(classes); const classKeys = Object.keys(classes);
for (let i = 0; i < classKeys.length; i++) { for (let i = 0; i < classKeys.length; i++) {
if (classes[classKeys[i]].id === id) { if (classes[classKeys[i]].id === id) {
@ -68,25 +68,25 @@ export const lookUpDomId = function(id) {
} }
}; };
export const clear = function() { export const clear = function () {
relations = []; relations = [];
classes = {}; classes = {};
funs = []; funs = [];
funs.push(setupToolTips); funs.push(setupToolTips);
}; };
export const getClass = function(id) { export const getClass = function (id) {
return classes[id]; return classes[id];
}; };
export const getClasses = function() { export const getClasses = function () {
return classes; return classes;
}; };
export const getRelations = function() { export const getRelations = function () {
return relations; return relations;
}; };
export const addRelation = function(relation) { export const addRelation = function (relation) {
log.debug('Adding relation: ' + JSON.stringify(relation)); log.debug('Adding relation: ' + JSON.stringify(relation));
addClass(relation.id1); addClass(relation.id1);
addClass(relation.id2); addClass(relation.id2);
@ -104,7 +104,7 @@ export const addRelation = function(relation) {
* @param annotation The name of the annotation without any brackets * @param annotation The name of the annotation without any brackets
* @public * @public
*/ */
export const addAnnotation = function(className, annotation) { export const addAnnotation = function (className, annotation) {
const validatedClassName = splitClassNameAndType(className).className; const validatedClassName = splitClassNameAndType(className).className;
classes[validatedClassName].annotations.push(annotation); classes[validatedClassName].annotations.push(annotation);
}; };
@ -118,7 +118,7 @@ export const addAnnotation = function(className, annotation) {
* Otherwise the member will be treated as a normal property * Otherwise the member will be treated as a normal property
* @public * @public
*/ */
export const addMember = function(className, member) { export const addMember = function (className, member) {
const validatedClassName = splitClassNameAndType(className).className; const validatedClassName = splitClassNameAndType(className).className;
const theClass = classes[validatedClassName]; const theClass = classes[validatedClassName];
@ -137,14 +137,14 @@ export const addMember = function(className, member) {
} }
}; };
export const addMembers = function(className, members) { export const addMembers = function (className, members) {
if (Array.isArray(members)) { if (Array.isArray(members)) {
members.reverse(); members.reverse();
members.forEach(member => addMember(className, member)); members.forEach((member) => addMember(className, member));
} }
}; };
export const cleanupLabel = function(label) { export const cleanupLabel = function (label) {
if (label.substring(0, 1) === ':') { if (label.substring(0, 1) === ':') {
return label.substr(1).trim(); return label.substr(1).trim();
} else { } else {
@ -157,8 +157,8 @@ export const cleanupLabel = function(label) {
* @param ids Comma separated list of ids * @param ids Comma separated list of ids
* @param className Class to add * @param className Class to add
*/ */
export const setCssClass = function(ids, className) { export const setCssClass = function (ids, className) {
ids.split(',').forEach(function(_id) { ids.split(',').forEach(function (_id) {
let id = _id; let id = _id;
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id; if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
if (typeof classes[id] !== 'undefined') { if (typeof classes[id] !== 'undefined') {
@ -172,9 +172,9 @@ export const setCssClass = function(ids, className) {
* @param ids Comma separated list of ids * @param ids Comma separated list of ids
* @param tooltip Tooltip to add * @param tooltip Tooltip to add
*/ */
const setTooltip = function(ids, tooltip) { const setTooltip = function (ids, tooltip) {
const config = configApi.getConfig(); const config = configApi.getConfig();
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
if (typeof tooltip !== 'undefined') { if (typeof tooltip !== 'undefined') {
classes[id].tooltip = common.sanitizeText(tooltip, config); classes[id].tooltip = common.sanitizeText(tooltip, config);
} }
@ -187,9 +187,9 @@ const setTooltip = function(ids, tooltip) {
* @param linkStr URL to create a link for * @param linkStr URL to create a link for
* @param target Target of the link, _blank by default as originally defined in the svgDraw.js file * @param target Target of the link, _blank by default as originally defined in the svgDraw.js file
*/ */
export const setLink = function(ids, linkStr, target) { export const setLink = function (ids, linkStr, target) {
const config = configApi.getConfig(); const config = configApi.getConfig();
ids.split(',').forEach(function(_id) { ids.split(',').forEach(function (_id) {
let id = _id; let id = _id;
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id; if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
if (typeof classes[id] !== 'undefined') { if (typeof classes[id] !== 'undefined') {
@ -210,15 +210,15 @@ export const setLink = function(ids, linkStr, target) {
* @param functionName Function to be called on click * @param functionName Function to be called on click
* @param functionArgs Function args the function should be called with * @param functionArgs Function args the function should be called with
*/ */
export const setClickEvent = function(ids, functionName, functionArgs) { export const setClickEvent = function (ids, functionName, functionArgs) {
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
setClickFunc(id, functionName, functionArgs); setClickFunc(id, functionName, functionArgs);
classes[id].haveCallback = true; classes[id].haveCallback = true;
}); });
setCssClass(ids, 'clickable'); setCssClass(ids, 'clickable');
}; };
const setClickFunc = function(domId, functionName, functionArgs) { const setClickFunc = function (domId, functionName, functionArgs) {
const config = configApi.getConfig(); const config = configApi.getConfig();
let id = domId; let id = domId;
let elemId = lookUpDomId(id); let elemId = lookUpDomId(id);
@ -250,12 +250,12 @@ const setClickFunc = function(domId, functionName, functionArgs) {
argList.push(elemId); argList.push(elemId);
} }
funs.push(function() { funs.push(function () {
const elem = document.querySelector(`[id="${elemId}"]`); const elem = document.querySelector(`[id="${elemId}"]`);
if (elem !== null) { if (elem !== null) {
elem.addEventListener( elem.addEventListener(
'click', 'click',
function() { function () {
utils.runFunc(functionName, ...argList); utils.runFunc(functionName, ...argList);
}, },
false false
@ -265,38 +265,35 @@ const setClickFunc = function(domId, functionName, functionArgs) {
} }
}; };
export const bindFunctions = function(element) { export const bindFunctions = function (element) {
funs.forEach(function(fun) { funs.forEach(function (fun) {
fun(element); fun(element);
}); });
}; };
export const lineType = { export const lineType = {
LINE: 0, LINE: 0,
DOTTED_LINE: 1 DOTTED_LINE: 1,
}; };
export const relationType = { export const relationType = {
AGGREGATION: 0, AGGREGATION: 0,
EXTENSION: 1, EXTENSION: 1,
COMPOSITION: 2, COMPOSITION: 2,
DEPENDENCY: 3 DEPENDENCY: 3,
}; };
const setupToolTips = function(element) { const setupToolTips = function (element) {
let tooltipElem = select('.mermaidTooltip'); let tooltipElem = select('.mermaidTooltip');
if ((tooltipElem._groups || tooltipElem)[0][0] === null) { if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
tooltipElem = select('body') tooltipElem = select('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
.append('div')
.attr('class', 'mermaidTooltip')
.style('opacity', 0);
} }
const svg = select(element).select('svg'); const svg = select(element).select('svg');
const nodes = svg.selectAll('g.node'); const nodes = svg.selectAll('g.node');
nodes nodes
.on('mouseover', function() { .on('mouseover', function () {
const el = select(this); const el = select(this);
const title = el.attr('title'); const title = el.attr('title');
// Dont try to draw a tooltip if no data is provided // Dont try to draw a tooltip if no data is provided
@ -305,21 +302,15 @@ const setupToolTips = function(element) {
} }
const rect = this.getBoundingClientRect(); const rect = this.getBoundingClientRect();
tooltipElem tooltipElem.transition().duration(200).style('opacity', '.9');
.transition()
.duration(200)
.style('opacity', '.9');
tooltipElem tooltipElem
.html(el.attr('title')) .html(el.attr('title'))
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px') .style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px'); .style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
el.classed('hover', true); el.classed('hover', true);
}) })
.on('mouseout', function() { .on('mouseout', function () {
tooltipElem tooltipElem.transition().duration(500).style('opacity', 0);
.transition()
.duration(500)
.style('opacity', 0);
const el = select(this); const el = select(this);
el.classed('hover', false); el.classed('hover', false);
}); });
@ -346,5 +337,5 @@ export default {
setCssClass, setCssClass,
setLink, setLink,
setTooltip, setTooltip,
lookUpDomId lookUpDomId,
}; };

View File

@ -20,7 +20,7 @@ const padding = 20;
const conf = { const conf = {
dividerMargin: 10, dividerMargin: 10,
padding: 5, padding: 5,
textHeight: 10 textHeight: 10,
}; };
/** /**
@ -28,14 +28,14 @@ const conf = {
* @param vert Object containing the vertices. * @param vert Object containing the vertices.
* @param g The graph that is to be drawn. * @param g The graph that is to be drawn.
*/ */
export const addClasses = function(classes, g) { export const addClasses = function (classes, g) {
// const svg = select(`[id="${svgId}"]`); // const svg = select(`[id="${svgId}"]`);
const keys = Object.keys(classes); const keys = Object.keys(classes);
log.info('keys:', keys); log.info('keys:', keys);
log.info(classes); log.info(classes);
// Iterate through each item in the vertex object (containing all the vertices found) in the graph definition // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
keys.forEach(function(id) { keys.forEach(function (id) {
const vertex = classes[id]; const vertex = classes[id];
/** /**
@ -109,7 +109,7 @@ export const addClasses = function(classes, g) {
link: vertex.link, link: vertex.link,
width: vertex.type === 'group' ? 500 : undefined, width: vertex.type === 'group' ? 500 : undefined,
type: vertex.type, type: vertex.type,
padding: getConfig().flowchart.padding padding: getConfig().flowchart.padding,
}); });
log.info('setNode', { log.info('setNode', {
@ -123,7 +123,7 @@ export const addClasses = function(classes, g) {
id: vertex.id, id: vertex.id,
width: vertex.type === 'group' ? 500 : undefined, width: vertex.type === 'group' ? 500 : undefined,
type: vertex.type, type: vertex.type,
padding: getConfig().flowchart.padding padding: getConfig().flowchart.padding,
}); });
}); });
}; };
@ -133,7 +133,7 @@ export const addClasses = function(classes, g) {
* @param {Object} edges The edges to add to the graph * @param {Object} edges The edges to add to the graph
* @param {Object} g The graph object * @param {Object} g The graph object
*/ */
export const addRelations = function(relations, g) { export const addRelations = function (relations, g) {
let cnt = 0; let cnt = 0;
let defaultStyle; let defaultStyle;
@ -145,7 +145,7 @@ export const addRelations = function(relations, g) {
// defaultLabelStyle = defaultStyles.labelStyle; // defaultLabelStyle = defaultStyles.labelStyle;
// } // }
relations.forEach(function(edge) { relations.forEach(function (edge) {
cnt++; cnt++;
const edgeData = {}; const edgeData = {};
//Set relationship style and line type //Set relationship style and line type
@ -227,7 +227,7 @@ export const addRelations = function(relations, g) {
}; };
// Todo optimize // Todo optimize
const getGraphId = function(label) { const getGraphId = function (label) {
const keys = Object.keys(idCache); const keys = Object.keys(idCache);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
@ -239,10 +239,10 @@ const getGraphId = function(label) {
return undefined; return undefined;
}; };
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
keys.forEach(function(key) { keys.forEach(function (key) {
conf[key] = cnf[key]; conf[key] = cnf[key];
}); });
}; };
@ -252,7 +252,7 @@ export const setConf = function(cnf) {
* @param text * @param text
* @param id * @param id
*/ */
export const drawOld = function(text, id) { export const drawOld = function (text, id) {
idCache = {}; idCache = {};
parser.yy.clear(); parser.yy.clear();
parser.parse(text); parser.parse(text);
@ -265,16 +265,16 @@ export const drawOld = function(text, id) {
// Layout graph, Create a new directed graph // Layout graph, Create a new directed graph
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: true multigraph: true,
}); });
// Set an object for the graph label // Set an object for the graph label
g.setGraph({ g.setGraph({
isMultiGraph: true isMultiGraph: true,
}); });
// Default to assigning a new object as a label for each new edge. // Default to assigning a new object as a label for each new edge.
g.setDefaultEdgeLabel(function() { g.setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -297,7 +297,7 @@ export const drawOld = function(text, id) {
const relations = classDb.getRelations(); const relations = classDb.getRelations();
log.info('relations:', relations); log.info('relations:', relations);
relations.forEach(function(relation) { relations.forEach(function (relation) {
log.info( log.info(
'tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation) 'tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
); );
@ -305,14 +305,14 @@ export const drawOld = function(text, id) {
getGraphId(relation.id1), getGraphId(relation.id1),
getGraphId(relation.id2), getGraphId(relation.id2),
{ {
relation: relation relation: relation,
}, },
relation.title || 'DEFAULT' relation.title || 'DEFAULT'
); );
}); });
dagre.layout(g); dagre.layout(g);
g.nodes().forEach(function(v) { g.nodes().forEach(function (v) {
if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') { if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v))); log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
select('#' + lookUpDomId(v)).attr( select('#' + lookUpDomId(v)).attr(
@ -326,7 +326,7 @@ export const drawOld = function(text, id) {
} }
}); });
g.edges().forEach(function(e) { g.edges().forEach(function (e) {
if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') { if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e))); log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
svgDraw.drawEdge(diagram, g.edge(e), g.edge(e).relation, conf); svgDraw.drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
@ -345,7 +345,7 @@ export const drawOld = function(text, id) {
diagram.attr('viewBox', vBox); diagram.attr('viewBox', vBox);
}; };
export const draw = function(text, id) { export const draw = function (text, id) {
log.info('Drawing class'); log.info('Drawing class');
classDb.clear(); classDb.clear();
// const parser = classDb.parser; // const parser = classDb.parser;
@ -369,16 +369,16 @@ export const draw = function(text, id) {
// Create the input mermaid.graph // Create the input mermaid.graph
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: true, multigraph: true,
compound: true compound: true,
}) })
.setGraph({ .setGraph({
rankdir: dir, rankdir: dir,
nodesep: nodeSpacing, nodesep: nodeSpacing,
ranksep: rankSpacing, ranksep: rankSpacing,
marginx: 8, marginx: 8,
marginy: 8 marginy: 8,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -500,7 +500,7 @@ export const draw = function(text, id) {
export default { export default {
setConf, setConf,
draw draw,
}; };
function getArrowMarker(type) { function getArrowMarker(type) {
let marker; let marker;

View File

@ -15,11 +15,11 @@ const padding = 20;
const conf = { const conf = {
dividerMargin: 10, dividerMargin: 10,
padding: 5, padding: 5,
textHeight: 10 textHeight: 10,
}; };
// Todo optimize // Todo optimize
const getGraphId = function(label) { const getGraphId = function (label) {
const keys = Object.keys(idCache); const keys = Object.keys(idCache);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
@ -34,7 +34,7 @@ const getGraphId = function(label) {
/** /**
* 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.
*/ */
const insertMarkers = function(elem) { const insertMarkers = function (elem) {
elem elem
.append('defs') .append('defs')
.append('marker') .append('marker')
@ -136,10 +136,10 @@ const insertMarkers = function(elem) {
.attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z'); .attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
}; };
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
keys.forEach(function(key) { keys.forEach(function (key) {
conf[key] = cnf[key]; conf[key] = cnf[key];
}); });
}; };
@ -149,7 +149,7 @@ export const setConf = function(cnf) {
* @param text * @param text
* @param id * @param id
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
idCache = {}; idCache = {};
parser.yy.clear(); parser.yy.clear();
parser.parse(text); parser.parse(text);
@ -163,16 +163,16 @@ export const draw = function(text, id) {
// Layout graph, Create a new directed graph // Layout graph, Create a new directed graph
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: true multigraph: true,
}); });
// Set an object for the graph label // Set an object for the graph label
g.setGraph({ g.setGraph({
isMultiGraph: true isMultiGraph: true,
}); });
// Default to assigning a new object as a label for each new edge. // Default to assigning a new object as a label for each new edge.
g.setDefaultEdgeLabel(function() { g.setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -193,7 +193,7 @@ export const draw = function(text, id) {
} }
const relations = classDb.getRelations(); const relations = classDb.getRelations();
relations.forEach(function(relation) { relations.forEach(function (relation) {
log.info( log.info(
'tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation) 'tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation)
); );
@ -201,14 +201,14 @@ export const draw = function(text, id) {
getGraphId(relation.id1), getGraphId(relation.id1),
getGraphId(relation.id2), getGraphId(relation.id2),
{ {
relation: relation relation: relation,
}, },
relation.title || 'DEFAULT' relation.title || 'DEFAULT'
); );
}); });
dagre.layout(g); dagre.layout(g);
g.nodes().forEach(function(v) { g.nodes().forEach(function (v) {
if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') { if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v))); log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
select('#' + lookUpDomId(v)).attr( select('#' + lookUpDomId(v)).attr(
@ -222,7 +222,7 @@ export const draw = function(text, id) {
} }
}); });
g.edges().forEach(function(e) { g.edges().forEach(function (e) {
if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') { if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e))); log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
svgDraw.drawEdge(diagram, g.edge(e), g.edge(e).relation, conf); svgDraw.drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
@ -243,5 +243,5 @@ export const draw = function(text, id) {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
`g.classGroup text { `g.classGroup text {
fill: ${options.nodeBorder}; fill: ${options.nodeBorder};
fill: ${options.classText}; fill: ${options.classText};

View File

@ -4,8 +4,8 @@ import utils from '../../utils';
import { log } from '../../logger'; import { log } from '../../logger';
let edgeCount = 0; let edgeCount = 0;
export const drawEdge = function(elem, path, relation, conf) { export const drawEdge = function (elem, path, relation, conf) {
const getRelationType = function(type) { const getRelationType = function (type) {
switch (type) { switch (type) {
case relationType.AGGREGATION: case relationType.AGGREGATION:
return 'aggregation'; return 'aggregation';
@ -18,17 +18,17 @@ export const drawEdge = function(elem, path, relation, conf) {
} }
}; };
path.points = path.points.filter(p => !Number.isNaN(p.y)); path.points = path.points.filter((p) => !Number.isNaN(p.y));
// The data for our line // The data for our line
const lineData = path.points; const lineData = path.points;
// This is the accessor function we talked about above // This is the accessor function we talked about above
const lineFunction = line() const lineFunction = line()
.x(function(d) { .x(function (d) {
return d.x; return d.x;
}) })
.y(function(d) { .y(function (d) {
return d.y; return d.y;
}) })
.curve(curveBasis); .curve(curveBasis);
@ -144,7 +144,7 @@ export const drawEdge = function(elem, path, relation, conf) {
edgeCount++; edgeCount++;
}; };
export const drawClass = function(elem, classDef, conf) { export const drawClass = function (elem, classDef, conf) {
log.info('Rendering class ' + classDef); log.info('Rendering class ' + classDef);
const id = classDef.id; const id = classDef.id;
@ -152,14 +152,11 @@ export const drawClass = function(elem, classDef, conf) {
id: id, id: id,
label: classDef.id, label: classDef.id,
width: 0, width: 0,
height: 0 height: 0,
}; };
// add class group // add class group
const g = elem const g = elem.append('g').attr('id', lookUpDomId(id)).attr('class', 'classGroup');
.append('g')
.attr('id', lookUpDomId(id))
.attr('class', 'classGroup');
// add title // add title
let title; let title;
@ -180,7 +177,7 @@ export const drawClass = function(elem, classDef, conf) {
// add annotations // add annotations
let isFirst = true; let isFirst = true;
classDef.annotations.forEach(function(member) { classDef.annotations.forEach(function (member) {
const titleText2 = title.append('tspan').text('«' + member + '»'); const titleText2 = title.append('tspan').text('«' + member + '»');
if (!isFirst) titleText2.attr('dy', conf.textHeight); if (!isFirst) titleText2.attr('dy', conf.textHeight);
isFirst = false; isFirst = false;
@ -192,10 +189,7 @@ export const drawClass = function(elem, classDef, conf) {
classTitleString += '<' + classDef.type + '>'; classTitleString += '<' + classDef.type + '>';
} }
const classTitle = title const classTitle = title.append('tspan').text(classTitleString).attr('class', 'title');
.append('tspan')
.text(classTitleString)
.attr('class', 'title');
// If class has annotations the title needs to have an offset of the text height // If class has annotations the title needs to have an offset of the text height
if (!isFirst) classTitle.attr('dy', conf.textHeight); if (!isFirst) classTitle.attr('dy', conf.textHeight);
@ -216,7 +210,7 @@ export const drawClass = function(elem, classDef, conf) {
.attr('class', 'classText'); .attr('class', 'classText');
isFirst = true; isFirst = true;
classDef.members.forEach(function(member) { classDef.members.forEach(function (member) {
addTspan(members, member, isFirst, conf); addTspan(members, member, isFirst, conf);
isFirst = false; isFirst = false;
}); });
@ -238,7 +232,7 @@ export const drawClass = function(elem, classDef, conf) {
isFirst = true; isFirst = true;
classDef.methods.forEach(function(method) { classDef.methods.forEach(function (method) {
addTspan(methods, method, isFirst, conf); addTspan(methods, method, isFirst, conf);
isFirst = false; isFirst = false;
}); });
@ -262,7 +256,7 @@ export const drawClass = function(elem, classDef, conf) {
// Center title // Center title
// We subtract the width of each text element from the class box width and divide it by 2 // We subtract the width of each text element from the class box width and divide it by 2
title.node().childNodes.forEach(function(x) { title.node().childNodes.forEach(function (x) {
x.setAttribute('x', (rectWidth - x.getBBox().width) / 2); x.setAttribute('x', (rectWidth - x.getBBox().width) / 2);
}); });
@ -279,7 +273,7 @@ export const drawClass = function(elem, classDef, conf) {
return classInfo; return classInfo;
}; };
export const parseMember = function(text) { export const parseMember = function (text) {
const fieldRegEx = /(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+)/; const fieldRegEx = /(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+)/;
const methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/; const methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
@ -295,7 +289,7 @@ export const parseMember = function(text) {
} }
}; };
const buildFieldDisplay = function(parsedText) { const buildFieldDisplay = function (parsedText) {
let displayText = ''; let displayText = '';
try { try {
@ -311,11 +305,11 @@ const buildFieldDisplay = function(parsedText) {
return { return {
displayText: displayText, displayText: displayText,
cssStyle: '' cssStyle: '',
}; };
}; };
const buildMethodDisplay = function(parsedText) { const buildMethodDisplay = function (parsedText) {
let cssStyle = ''; let cssStyle = '';
let displayText = ''; let displayText = '';
@ -335,11 +329,11 @@ const buildMethodDisplay = function(parsedText) {
return { return {
displayText: displayText, displayText: displayText,
cssStyle: cssStyle cssStyle: cssStyle,
}; };
}; };
const buildLegacyDisplay = function(text) { const buildLegacyDisplay = function (text) {
// if for some reason we dont have any match, use old format to parse text // if for some reason we dont have any match, use old format to parse text
let displayText = ''; let displayText = '';
let cssStyle = ''; let cssStyle = '';
@ -382,17 +376,14 @@ const buildLegacyDisplay = function(text) {
return { return {
displayText: displayText, displayText: displayText,
cssStyle: cssStyle cssStyle: cssStyle,
}; };
}; };
const addTspan = function(textEl, txt, isFirst, conf) { const addTspan = function (textEl, txt, isFirst, conf) {
let member = parseMember(txt); let member = parseMember(txt);
const tSpan = textEl const tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
.append('tspan')
.attr('x', conf.padding)
.text(member.displayText);
if (member.cssStyle !== '') { if (member.cssStyle !== '') {
tSpan.attr('style', member.cssStyle); tSpan.attr('style', member.cssStyle);
@ -403,7 +394,7 @@ const addTspan = function(textEl, txt, isFirst, conf) {
} }
}; };
const parseGenericTypes = function(text) { const parseGenericTypes = function (text) {
let cleanedText = text; let cleanedText = text;
if (text.indexOf('~') != -1) { if (text.indexOf('~') != -1) {
@ -416,7 +407,7 @@ const parseGenericTypes = function(text) {
} }
}; };
const parseClassifier = function(classifier) { const parseClassifier = function (classifier) {
switch (classifier) { switch (classifier) {
case '*': case '*':
return 'font-style:italic;'; return 'font-style:italic;';
@ -430,5 +421,5 @@ const parseClassifier = function(classifier) {
export default { export default {
drawClass, drawClass,
drawEdge, drawEdge,
parseMember parseMember,
}; };

View File

@ -1,13 +1,13 @@
import DOMPurify from 'dompurify'; import DOMPurify from 'dompurify';
export const getRows = s => { export const getRows = (s) => {
if (!s) return 1; if (!s) return 1;
let str = breakToPlaceholder(s); let str = breakToPlaceholder(s);
str = str.replace(/\\n/g, '#br#'); str = str.replace(/\\n/g, '#br#');
return str.split('#br#'); return str.split('#br#');
}; };
export const removeScript = txt => { export const removeScript = (txt) => {
var rs = ''; var rs = '';
var idx = 0; var idx = 0;
@ -36,26 +36,26 @@ export const removeScript = txt => {
return rs; return rs;
}; };
export const sanitizeText = text => { export const sanitizeText = (text) => {
const txt = DOMPurify.sanitize(text); const txt = DOMPurify.sanitize(text);
return txt; return txt;
}; };
export const lineBreakRegex = /<br\s*\/?>/gi; export const lineBreakRegex = /<br\s*\/?>/gi;
export const hasBreaks = text => { export const hasBreaks = (text) => {
return /<br\s*[/]?>/gi.test(text); return /<br\s*[/]?>/gi.test(text);
}; };
export const splitBreaks = text => { export const splitBreaks = (text) => {
return text.split(/<br\s*[/]?>/gi); return text.split(/<br\s*[/]?>/gi);
}; };
const breakToPlaceholder = s => { const breakToPlaceholder = (s) => {
return s.replace(lineBreakRegex, '#br#'); return s.replace(lineBreakRegex, '#br#');
}; };
const getUrl = useAbsolute => { const getUrl = (useAbsolute) => {
let url = ''; let url = '';
if (useAbsolute) { if (useAbsolute) {
url = url =
@ -71,7 +71,7 @@ const getUrl = useAbsolute => {
return url; return url;
}; };
export const evaluate = val => (val === 'false' || val === false ? false : true); export const evaluate = (val) => (val === 'false' || val === false ? false : true);
export default { export default {
getRows, getRows,
@ -81,5 +81,5 @@ export default {
lineBreakRegex, lineBreakRegex,
removeScript, removeScript,
getUrl, getUrl,
evaluate evaluate,
}; };

View File

@ -13,19 +13,19 @@ const Cardinality = {
ZERO_OR_ONE: 'ZERO_OR_ONE', ZERO_OR_ONE: 'ZERO_OR_ONE',
ZERO_OR_MORE: 'ZERO_OR_MORE', ZERO_OR_MORE: 'ZERO_OR_MORE',
ONE_OR_MORE: 'ONE_OR_MORE', ONE_OR_MORE: 'ONE_OR_MORE',
ONLY_ONE: 'ONLY_ONE' ONLY_ONE: 'ONLY_ONE',
}; };
const Identification = { const Identification = {
NON_IDENTIFYING: 'NON_IDENTIFYING', NON_IDENTIFYING: 'NON_IDENTIFYING',
IDENTIFYING: 'IDENTIFYING' IDENTIFYING: 'IDENTIFYING',
}; };
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
const addEntity = function(name) { const addEntity = function (name) {
if (typeof entities[name] === 'undefined') { if (typeof entities[name] === 'undefined') {
entities[name] = { attributes: [] }; entities[name] = { attributes: [] };
log.info('Added new entity :', name); log.info('Added new entity :', name);
@ -36,7 +36,7 @@ const addEntity = function(name) {
const getEntities = () => entities; const getEntities = () => entities;
const addAttributes = function(entityName, attribs) { const addAttributes = function (entityName, attribs) {
let entity = addEntity(entityName); // May do nothing (if entity has already been added) let entity = addEntity(entityName); // May do nothing (if entity has already been added)
// Process attribs in reverse order due to effect of recursive construction (last attribute is first) // Process attribs in reverse order due to effect of recursive construction (last attribute is first)
@ -54,12 +54,12 @@ const addAttributes = function(entityName, attribs) {
* @param entB The second entity in the relationship * @param entB The second entity in the relationship
* @param rSpec The details of the relationship between the two entities * @param rSpec The details of the relationship between the two entities
*/ */
const addRelationship = function(entA, rolA, entB, rSpec) { const addRelationship = function (entA, rolA, entB, rSpec) {
let rel = { let rel = {
entityA: entA, entityA: entA,
roleA: rolA, roleA: rolA,
entityB: entB, entityB: entB,
relSpec: rSpec relSpec: rSpec,
}; };
relationships.push(rel); relationships.push(rel);
@ -69,15 +69,15 @@ const addRelationship = function(entA, rolA, entB, rSpec) {
const getRelationships = () => relationships; const getRelationships = () => relationships;
// Keep this - TODO: revisit...allow the diagram to have a title // Keep this - TODO: revisit...allow the diagram to have a title
const setTitle = function(txt) { const setTitle = function (txt) {
title = txt; title = txt;
}; };
const getTitle = function() { const getTitle = function () {
return title; return title;
}; };
const clear = function() { const clear = function () {
entities = {}; entities = {};
relationships = []; relationships = [];
title = ''; title = '';
@ -95,5 +95,5 @@ export default {
getRelationships, getRelationships,
clear, clear,
setTitle, setTitle,
getTitle getTitle,
}; };

View File

@ -6,13 +6,13 @@ const ERMarkers = {
ONE_OR_MORE_START: 'ONE_OR_MORE_START', ONE_OR_MORE_START: 'ONE_OR_MORE_START',
ONE_OR_MORE_END: 'ONE_OR_MORE_END', ONE_OR_MORE_END: 'ONE_OR_MORE_END',
ZERO_OR_MORE_START: 'ZERO_OR_MORE_START', ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',
ZERO_OR_MORE_END: 'ZERO_OR_MORE_END' ZERO_OR_MORE_END: 'ZERO_OR_MORE_END',
}; };
/** /**
* Put the markers into the svg DOM for later use with edge paths * Put the markers into the svg DOM for later use with edge paths
*/ */
const insertMarkers = function(elem, conf) { const insertMarkers = function (elem, conf) {
let marker; let marker;
elem elem
@ -59,11 +59,7 @@ const insertMarkers = function(elem, conf) {
.attr('cx', 21) .attr('cx', 21)
.attr('cy', 9) .attr('cy', 9)
.attr('r', 6); .attr('r', 6);
marker marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
.append('path')
.attr('stroke', conf.stroke)
.attr('fill', 'none')
.attr('d', 'M9,0 L9,18');
marker = elem marker = elem
.append('defs') .append('defs')
@ -81,11 +77,7 @@ const insertMarkers = function(elem, conf) {
.attr('cx', 9) .attr('cx', 9)
.attr('cy', 9) .attr('cy', 9)
.attr('r', 6); .attr('r', 6);
marker marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
.append('path')
.attr('stroke', conf.stroke)
.attr('fill', 'none')
.attr('d', 'M21,0 L21,18');
elem elem
.append('defs') .append('defs')
@ -164,5 +156,5 @@ const insertMarkers = function(elem, conf) {
export default { export default {
ERMarkers, ERMarkers,
insertMarkers insertMarkers,
}; };

View File

@ -15,7 +15,7 @@ const conf = {};
* storing it in the local conf object. Note that generic config still needs to be * storing it in the local conf object. Note that generic config still needs to be
* retrieved using getConfig() imported from the config module * retrieved using getConfig() imported from the config module
*/ */
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
conf[keys[i]] = cnf[keys[i]]; conf[keys[i]] = cnf[keys[i]];
@ -40,7 +40,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
let cumulativeHeight = labelBBox.height + heightPadding * 2; let cumulativeHeight = labelBBox.height + heightPadding * 2;
let attrNum = 1; let attrNum = 1;
attributes.forEach(item => { attributes.forEach((item) => {
const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`; const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`;
// Add a text node for the attribute type // Add a text node for the attribute type
@ -98,7 +98,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
height: height:
attributes.length > 0 attributes.length > 0
? cumulativeHeight ? cumulativeHeight
: Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2) : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2),
}; };
// There might be some spare width for padding out attributes if the entity name is very long // There might be some spare width for padding out attributes if the entity name is very long
@ -115,7 +115,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
let heightOffset = labelBBox.height + heightPadding * 2; // Start at the bottom of the entity label let heightOffset = labelBBox.height + heightPadding * 2; // Start at the bottom of the entity label
let attribStyle = 'attributeBoxOdd'; // We will flip the style on alternate rows to achieve a banded effect let attribStyle = 'attributeBoxOdd'; // We will flip the style on alternate rows to achieve a banded effect
attributeNodes.forEach(nodePair => { attributeNodes.forEach((nodePair) => {
// Calculate the alignment y co-ordinate for the type/name of the attribute // Calculate the alignment y co-ordinate for the type/name of the attribute
const alignY = const alignY =
heightOffset + heightOffset +
@ -182,11 +182,11 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
* @param graph The graph that contains the vertex and edge definitions post-layout * @param graph The graph that contains the vertex and edge definitions post-layout
* @return The first entity that was inserted * @return The first entity that was inserted
*/ */
const drawEntities = function(svgNode, entities, graph) { const drawEntities = function (svgNode, entities, graph) {
const keys = Object.keys(entities); const keys = Object.keys(entities);
let firstOne; let firstOne;
keys.forEach(function(id) { keys.forEach(function (id) {
// Create a group for each entity // Create a group for each entity
const groupNode = svgNode.append('g').attr('id', id); const groupNode = svgNode.append('g').attr('id', id);
@ -234,14 +234,14 @@ const drawEntities = function(svgNode, entities, graph) {
width: rectBBox.width, width: rectBBox.width,
height: rectBBox.height, height: rectBBox.height,
shape: 'rect', shape: 'rect',
id: id id: id,
}); });
}); });
return firstOne; return firstOne;
}; // drawEntities }; // drawEntities
const adjustEntities = function(svgNode, graph) { const adjustEntities = function (svgNode, graph) {
graph.nodes().forEach(function(v) { graph.nodes().forEach(function (v) {
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') { if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
svgNode svgNode
.select('#' + v) .select('#' + v)
@ -258,7 +258,7 @@ const adjustEntities = function(svgNode, graph) {
return; return;
}; };
const getEdgeName = function(rel) { const getEdgeName = function (rel) {
return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, ''); return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
}; };
@ -268,8 +268,8 @@ const getEdgeName = function(rel) {
* @param g the graph * @param g the graph
* @return {Array} The array of relationships * @return {Array} The array of relationships
*/ */
const addRelationships = function(relationships, g) { const addRelationships = function (relationships, g) {
relationships.forEach(function(r) { relationships.forEach(function (r) {
g.setEdge(r.entityA, r.entityB, { relationship: r }, getEdgeName(r)); g.setEdge(r.entityA, r.entityB, { relationship: r }, getEdgeName(r));
}); });
return relationships; return relationships;
@ -283,7 +283,7 @@ let relCnt = 0;
* @param g the graph containing the edge information * @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 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) { const drawRelationshipFromLayout = function (svg, rel, g, insert) {
relCnt++; relCnt++;
// Find the edge relating to this relationship // Find the edge relating to this relationship
@ -291,10 +291,10 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) {
// Get a function that will generate the line path // Get a function that will generate the line path
const lineFunction = line() const lineFunction = line()
.x(function(d) { .x(function (d) {
return d.x; return d.x;
}) })
.y(function(d) { .y(function (d) {
return d.y; return d.y;
}) })
.curve(curveBasis); .curve(curveBasis);
@ -413,7 +413,7 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) {
* @param text the text of the diagram * @param text the text of the diagram
* @param id the unique id of the DOM node that contains the diagram * @param id the unique id of the DOM node that contains the diagram
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
log.info('Drawing ER diagram'); log.info('Drawing ER diagram');
erDb.clear(); erDb.clear();
const parser = erParser.parser; const parser = erParser.parser;
@ -457,7 +457,7 @@ export const draw = function(text, id) {
g = new graphlib.Graph({ g = new graphlib.Graph({
multigraph: true, multigraph: true,
directed: true, directed: true,
compound: false compound: false,
}) })
.setGraph({ .setGraph({
rankdir: conf.layoutDirection, rankdir: conf.layoutDirection,
@ -465,9 +465,9 @@ export const draw = function(text, id) {
marginy: 20, marginy: 20,
nodesep: 100, nodesep: 100,
edgesep: 100, edgesep: 100,
ranksep: 100 ranksep: 100,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -486,7 +486,7 @@ export const draw = function(text, id) {
adjustEntities(svg, g); adjustEntities(svg, g);
// Draw the relationships // Draw the relationships
relationships.forEach(function(rel) { relationships.forEach(function (rel) {
drawRelationshipFromLayout(svg, rel, g, firstEntity); drawRelationshipFromLayout(svg, rel, g, firstEntity);
}); });
@ -503,5 +503,5 @@ export const draw = function(text, id) {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
` `
.entityBox { .entityBox {
fill: ${options.mainBkg}; fill: ${options.mainBkg};

View File

@ -8,10 +8,10 @@ function question(parent, bbox, node) {
{ x: s / 2, y: 0 }, { x: s / 2, y: 0 },
{ x: s, y: -s / 2 }, { x: s, y: -s / 2 },
{ x: s / 2, y: -s }, { x: s / 2, y: -s },
{ x: 0, y: -s / 2 } { x: 0, y: -s / 2 },
]; ];
const shapeSvg = insertPolygonShape(parent, s, s, points); const shapeSvg = insertPolygonShape(parent, s, s, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -28,10 +28,10 @@ function hexagon(parent, bbox, node) {
{ x: w, y: -h / 2 }, { x: w, y: -h / 2 },
{ x: w - m, y: -h }, { x: w - m, y: -h },
{ x: m, y: -h }, { x: m, y: -h },
{ x: 0, y: -h / 2 } { x: 0, y: -h / 2 },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -45,10 +45,10 @@ function rect_left_inv_arrow(parent, bbox, node) {
{ x: w, y: 0 }, { x: w, y: 0 },
{ x: w, y: -h }, { x: w, y: -h },
{ x: -h / 2, y: -h }, { x: -h / 2, y: -h },
{ x: 0, y: -h / 2 } { x: 0, y: -h / 2 },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -61,10 +61,10 @@ function lean_right(parent, bbox, node) {
{ x: (-2 * h) / 6, y: 0 }, { x: (-2 * h) / 6, y: 0 },
{ x: w - h / 6, y: 0 }, { x: w - h / 6, y: 0 },
{ x: w + (2 * h) / 6, y: -h }, { x: w + (2 * h) / 6, y: -h },
{ x: h / 6, y: -h } { x: h / 6, y: -h },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -77,10 +77,10 @@ function lean_left(parent, bbox, node) {
{ x: (2 * h) / 6, y: 0 }, { x: (2 * h) / 6, y: 0 },
{ x: w + h / 6, y: 0 }, { x: w + h / 6, y: 0 },
{ x: w - (2 * h) / 6, y: -h }, { x: w - (2 * h) / 6, y: -h },
{ x: -h / 6, y: -h } { x: -h / 6, y: -h },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -93,10 +93,10 @@ function trapezoid(parent, bbox, node) {
{ x: (-2 * h) / 6, y: 0 }, { x: (-2 * h) / 6, y: 0 },
{ x: w + (2 * h) / 6, y: 0 }, { x: w + (2 * h) / 6, y: 0 },
{ x: w - h / 6, y: -h }, { x: w - h / 6, y: -h },
{ x: h / 6, y: -h } { x: h / 6, y: -h },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -109,10 +109,10 @@ function inv_trapezoid(parent, bbox, node) {
{ x: h / 6, y: 0 }, { x: h / 6, y: 0 },
{ x: w - h / 6, y: 0 }, { x: w - h / 6, y: 0 },
{ x: w + (2 * h) / 6, y: -h }, { x: w + (2 * h) / 6, y: -h },
{ x: (-2 * h) / 6, y: -h } { x: (-2 * h) / 6, y: -h },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -126,10 +126,10 @@ function rect_right_inv_arrow(parent, bbox, node) {
{ x: w + h / 2, y: 0 }, { x: w + h / 2, y: 0 },
{ x: w, y: -h / 2 }, { x: w, y: -h / 2 },
{ x: w + h / 2, y: -h }, { x: w + h / 2, y: -h },
{ x: 0, y: -h } { x: 0, y: -h },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -148,7 +148,7 @@ function stadium(parent, bbox, node) {
.attr('width', w) .attr('width', w)
.attr('height', h); .attr('height', h);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.rect(node, point); return dagreD3.intersect.rect(node, point);
}; };
return shapeSvg; return shapeSvg;
@ -167,10 +167,10 @@ function subroutine(parent, bbox, node) {
{ x: w + 8, y: 0 }, { x: w + 8, y: 0 },
{ x: w + 8, y: -h }, { x: w + 8, y: -h },
{ x: -8, y: -h }, { x: -8, y: -h },
{ x: -8, y: 0 } { x: -8, y: 0 },
]; ];
const shapeSvg = insertPolygonShape(parent, w, h, points); const shapeSvg = insertPolygonShape(parent, w, h, points);
node.intersect = function(point) { node.intersect = function (point) {
return dagreD3.intersect.polygon(node, points, point); return dagreD3.intersect.polygon(node, points, point);
}; };
return shapeSvg; return shapeSvg;
@ -214,7 +214,7 @@ function cylinder(parent, bbox, node) {
.attr('d', shape) .attr('d', shape)
.attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')'); .attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
node.intersect = function(point) { node.intersect = function (point) {
const pos = dagreD3.intersect.rect(node, point); const pos = dagreD3.intersect.rect(node, point);
const x = pos.x - node.x; const x = pos.x - node.x;
@ -297,7 +297,7 @@ function insertPolygonShape(parent, w, h, points) {
.attr( .attr(
'points', 'points',
points points
.map(function(d) { .map(function (d) {
return d.x + ',' + d.y; return d.x + ',' + d.y;
}) })
.join(' ') .join(' ')
@ -307,5 +307,5 @@ function insertPolygonShape(parent, w, h, points) {
export default { export default {
addToRender, addToRender,
addToRenderV2 addToRenderV2,
}; };

View File

@ -23,7 +23,7 @@ let version; // As in graph
// Functions to be run after graph rendering // Functions to be run after graph rendering
let funs = []; let funs = [];
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
@ -32,7 +32,7 @@ export const parseDirective = function(statement, context, type) {
* @param id * @param id
* @public * @public
*/ */
export const lookUpDomId = function(id) { export const lookUpDomId = function (id) {
const veritceKeys = Object.keys(vertices); const veritceKeys = Object.keys(vertices);
for (let i = 0; i < veritceKeys.length; i++) { for (let i = 0; i < veritceKeys.length; i++) {
if (vertices[veritceKeys[i]].id === id) { if (vertices[veritceKeys[i]].id === id) {
@ -50,7 +50,7 @@ export const lookUpDomId = function(id) {
* @param style * @param style
* @param classes * @param classes
*/ */
export const addVertex = function(_id, text, type, style, classes, dir) { export const addVertex = function (_id, text, type, style, classes, dir) {
let txt; let txt;
let id = _id; let id = _id;
if (typeof id === 'undefined') { if (typeof id === 'undefined') {
@ -67,7 +67,7 @@ export const addVertex = function(_id, text, type, style, classes, dir) {
id: id, id: id,
domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter, domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
styles: [], styles: [],
classes: [] classes: [],
}; };
} }
vertexCounter++; vertexCounter++;
@ -91,14 +91,14 @@ export const addVertex = function(_id, text, type, style, classes, dir) {
} }
if (typeof style !== 'undefined') { if (typeof style !== 'undefined') {
if (style !== null) { if (style !== null) {
style.forEach(function(s) { style.forEach(function (s) {
vertices[id].styles.push(s); vertices[id].styles.push(s);
}); });
} }
} }
if (typeof classes !== 'undefined') { if (typeof classes !== 'undefined') {
if (classes !== null) { if (classes !== null) {
classes.forEach(function(s) { classes.forEach(function (s) {
vertices[id].classes.push(s); vertices[id].classes.push(s);
}); });
} }
@ -115,7 +115,7 @@ export const addVertex = function(_id, text, type, style, classes, dir) {
* @param type * @param type
* @param linktext * @param linktext
*/ */
export const addSingleLink = function(_start, _end, type, linktext) { export const addSingleLink = function (_start, _end, type, linktext) {
let start = _start; let start = _start;
let end = _end; let end = _end;
// if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start; // if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
@ -141,7 +141,7 @@ export const addSingleLink = function(_start, _end, type, linktext) {
} }
edges.push(edge); edges.push(edge);
}; };
export const addLink = function(_start, _end, type, linktext) { export const addLink = function (_start, _end, type, linktext) {
let i, j; let i, j;
for (i = 0; i < _start.length; i++) { for (i = 0; i < _start.length; i++) {
for (j = 0; j < _end.length; j++) { for (j = 0; j < _end.length; j++) {
@ -155,8 +155,8 @@ export const addLink = function(_start, _end, type, linktext) {
* @param pos * @param pos
* @param interpolate * @param interpolate
*/ */
export const updateLinkInterpolate = function(positions, interp) { export const updateLinkInterpolate = function (positions, interp) {
positions.forEach(function(pos) { positions.forEach(function (pos) {
if (pos === 'default') { if (pos === 'default') {
edges.defaultInterpolate = interp; edges.defaultInterpolate = interp;
} else { } else {
@ -170,8 +170,8 @@ export const updateLinkInterpolate = function(positions, interp) {
* @param pos * @param pos
* @param style * @param style
*/ */
export const updateLink = function(positions, style) { export const updateLink = function (positions, style) {
positions.forEach(function(pos) { positions.forEach(function (pos) {
if (pos === 'default') { if (pos === 'default') {
edges.defaultStyle = style; edges.defaultStyle = style;
} else { } else {
@ -183,14 +183,14 @@ export const updateLink = function(positions, style) {
}); });
}; };
export const addClass = function(id, style) { export const addClass = function (id, style) {
if (typeof classes[id] === 'undefined') { if (typeof classes[id] === 'undefined') {
classes[id] = { id: id, styles: [], textStyles: [] }; classes[id] = { id: id, styles: [], textStyles: [] };
} }
if (typeof style !== 'undefined') { if (typeof style !== 'undefined') {
if (style !== null) { if (style !== null) {
style.forEach(function(s) { style.forEach(function (s) {
if (s.match('color')) { if (s.match('color')) {
const newStyle1 = s.replace('fill', 'bgFill'); const newStyle1 = s.replace('fill', 'bgFill');
const newStyle2 = newStyle1.replace('color', 'fill'); const newStyle2 = newStyle1.replace('color', 'fill');
@ -206,7 +206,7 @@ export const addClass = function(id, style) {
* Called by parser when a graph definition is found, stores the direction of the chart. * Called by parser when a graph definition is found, stores the direction of the chart.
* @param dir * @param dir
*/ */
export const setDirection = function(dir) { export const setDirection = function (dir) {
direction = dir; direction = dir;
if (direction.match(/.*</)) { if (direction.match(/.*</)) {
direction = 'RL'; direction = 'RL';
@ -227,8 +227,8 @@ export const setDirection = function(dir) {
* @param ids Comma separated list of ids * @param ids Comma separated list of ids
* @param className Class to add * @param className Class to add
*/ */
export const setClass = function(ids, className) { export const setClass = function (ids, className) {
ids.split(',').forEach(function(_id) { ids.split(',').forEach(function (_id) {
// let id = version === 'gen-2' ? lookUpDomId(_id) : _id; // let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
let id = _id; let id = _id;
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id; // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
@ -242,15 +242,15 @@ export const setClass = function(ids, className) {
}); });
}; };
const setTooltip = function(ids, tooltip) { const setTooltip = function (ids, tooltip) {
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
if (typeof tooltip !== 'undefined') { if (typeof tooltip !== 'undefined') {
tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = common.sanitizeText(tooltip, config); tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = common.sanitizeText(tooltip, config);
} }
}); });
}; };
const setClickFun = function(id, functionName, functionArgs) { const setClickFun = function (id, functionName, functionArgs) {
let domId = lookUpDomId(id); let domId = lookUpDomId(id);
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id; // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
if (configApi.getConfig().securityLevel !== 'loose') { if (configApi.getConfig().securityLevel !== 'loose') {
@ -281,12 +281,12 @@ const setClickFun = function(id, functionName, functionArgs) {
if (typeof vertices[id] !== 'undefined') { if (typeof vertices[id] !== 'undefined') {
vertices[id].haveCallback = true; vertices[id].haveCallback = true;
funs.push(function() { funs.push(function () {
const elem = document.querySelector(`[id="${domId}"]`); const elem = document.querySelector(`[id="${domId}"]`);
if (elem !== null) { if (elem !== null) {
elem.addEventListener( elem.addEventListener(
'click', 'click',
function() { function () {
utils.runFunc(functionName, ...argList); utils.runFunc(functionName, ...argList);
}, },
false false
@ -301,8 +301,8 @@ const setClickFun = function(id, functionName, functionArgs) {
* @param ids Comma separated list of ids * @param ids Comma separated list of ids
* @param linkStr URL to create a link for * @param linkStr URL to create a link for
*/ */
export const setLink = function(ids, linkStr, target) { export const setLink = function (ids, linkStr, target) {
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
if (typeof vertices[id] !== 'undefined') { if (typeof vertices[id] !== 'undefined') {
vertices[id].link = utils.formatUrl(linkStr, config); vertices[id].link = utils.formatUrl(linkStr, config);
vertices[id].linkTarget = target; vertices[id].linkTarget = target;
@ -310,7 +310,7 @@ export const setLink = function(ids, linkStr, target) {
}); });
setClass(ids, 'clickable'); setClass(ids, 'clickable');
}; };
export const getTooltip = function(id) { export const getTooltip = function (id) {
return tooltips[id]; return tooltips[id];
}; };
@ -320,26 +320,26 @@ export const getTooltip = function(id) {
* @param functionName Function to be called on click * @param functionName Function to be called on click
* @param tooltip Tooltip for the clickable element * @param tooltip Tooltip for the clickable element
*/ */
export const setClickEvent = function(ids, functionName, functionArgs) { export const setClickEvent = function (ids, functionName, functionArgs) {
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
setClickFun(id, functionName, functionArgs); setClickFun(id, functionName, functionArgs);
}); });
setClass(ids, 'clickable'); setClass(ids, 'clickable');
}; };
export const bindFunctions = function(element) { export const bindFunctions = function (element) {
funs.forEach(function(fun) { funs.forEach(function (fun) {
fun(element); fun(element);
}); });
}; };
export const getDirection = function() { export const getDirection = function () {
return direction.trim(); return direction.trim();
}; };
/** /**
* Retrieval function for fetching the found nodes after parsing has completed. * Retrieval function for fetching the found nodes after parsing has completed.
* @returns {{}|*|vertices} * @returns {{}|*|vertices}
*/ */
export const getVertices = function() { export const getVertices = function () {
return vertices; return vertices;
}; };
@ -347,7 +347,7 @@ export const getVertices = function() {
* Retrieval function for fetching the found links after parsing has completed. * Retrieval function for fetching the found links after parsing has completed.
* @returns {{}|*|edges} * @returns {{}|*|edges}
*/ */
export const getEdges = function() { export const getEdges = function () {
return edges; return edges;
}; };
@ -355,24 +355,21 @@ export const getEdges = function() {
* Retrieval function for fetching the found class definitions after parsing has completed. * Retrieval function for fetching the found class definitions after parsing has completed.
* @returns {{}|*|classes} * @returns {{}|*|classes}
*/ */
export const getClasses = function() { export const getClasses = function () {
return classes; return classes;
}; };
const setupToolTips = function(element) { const setupToolTips = function (element) {
let tooltipElem = select('.mermaidTooltip'); let tooltipElem = select('.mermaidTooltip');
if ((tooltipElem._groups || tooltipElem)[0][0] === null) { if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
tooltipElem = select('body') tooltipElem = select('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
.append('div')
.attr('class', 'mermaidTooltip')
.style('opacity', 0);
} }
const svg = select(element).select('svg'); const svg = select(element).select('svg');
const nodes = svg.selectAll('g.node'); const nodes = svg.selectAll('g.node');
nodes nodes
.on('mouseover', function() { .on('mouseover', function () {
const el = select(this); const el = select(this);
const title = el.attr('title'); const title = el.attr('title');
@ -382,21 +379,15 @@ const setupToolTips = function(element) {
} }
const rect = this.getBoundingClientRect(); const rect = this.getBoundingClientRect();
tooltipElem tooltipElem.transition().duration(200).style('opacity', '.9');
.transition()
.duration(200)
.style('opacity', '.9');
tooltipElem tooltipElem
.html(el.attr('title')) .html(el.attr('title'))
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px') .style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px'); .style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
el.classed('hover', true); el.classed('hover', true);
}) })
.on('mouseout', function() { .on('mouseout', function () {
tooltipElem tooltipElem.transition().duration(500).style('opacity', 0);
.transition()
.duration(500)
.style('opacity', 0);
const el = select(this); const el = select(this);
el.classed('hover', false); el.classed('hover', false);
}); });
@ -406,7 +397,7 @@ funs.push(setupToolTips);
/** /**
* Clears the internal graph db so that a new graph can be parsed. * Clears the internal graph db so that a new graph can be parsed.
*/ */
export const clear = function(ver) { export const clear = function (ver) {
vertices = {}; vertices = {};
classes = {}; classes = {};
edges = []; edges = [];
@ -419,21 +410,21 @@ export const clear = function(ver) {
firstGraphFlag = true; firstGraphFlag = true;
version = ver || 'gen-1'; version = ver || 'gen-1';
}; };
export const setGen = ver => { export const setGen = (ver) => {
version = ver || 'gen-1'; version = ver || 'gen-1';
}; };
/** /**
* *
* @returns {string} * @returns {string}
*/ */
export const defaultStyle = function() { export const defaultStyle = function () {
return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;'; return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
}; };
/** /**
* Clears the internal graph db so that a new graph can be parsed. * Clears the internal graph db so that a new graph can be parsed.
*/ */
export const addSubGraph = function(_id, list, _title) { export const addSubGraph = function (_id, list, _title) {
// console.log('addSubGraph', _id, list, _title); // console.log('addSubGraph', _id, list, _title);
let id = _id.trim(); let id = _id.trim();
let title = _title; let title = _title;
@ -445,7 +436,7 @@ export const addSubGraph = function(_id, list, _title) {
const objs = []; const objs = [];
let dir; // = unbdefined; direction.trim(); let dir; // = unbdefined; direction.trim();
const nodeList = a.filter(function(item) { const nodeList = a.filter(function (item) {
const type = typeof item; const type = typeof item;
if (item.stmt && item.stmt === 'dir') { if (item.stmt && item.stmt === 'dir') {
dir = item.value; dir = item.value;
@ -505,7 +496,7 @@ export const addSubGraph = function(_id, list, _title) {
return id; return id;
}; };
const getPosForId = function(id) { const getPosForId = function (id) {
for (let i = 0; i < subGraphs.length; i++) { for (let i = 0; i < subGraphs.length; i++) {
if (subGraphs[i].id === id) { if (subGraphs[i].id === id) {
return i; return i;
@ -515,7 +506,7 @@ const getPosForId = function(id) {
}; };
let secCount = -1; let secCount = -1;
const posCrossRef = []; const posCrossRef = [];
const indexNodes2 = function(id, pos) { const indexNodes2 = function (id, pos) {
const nodes = subGraphs[pos].nodes; const nodes = subGraphs[pos].nodes;
secCount = secCount + 1; secCount = secCount + 1;
if (secCount > 2000) { if (secCount > 2000) {
@ -526,7 +517,7 @@ const indexNodes2 = function(id, pos) {
if (subGraphs[pos].id === id) { if (subGraphs[pos].id === id) {
return { return {
result: true, result: true,
count: 0 count: 0,
}; };
} }
@ -540,7 +531,7 @@ const indexNodes2 = function(id, pos) {
if (res.result) { if (res.result) {
return { return {
result: true, result: true,
count: posCount + res.count count: posCount + res.count,
}; };
} else { } else {
posCount = posCount + res.count; posCount = posCount + res.count;
@ -551,21 +542,21 @@ const indexNodes2 = function(id, pos) {
return { return {
result: false, result: false,
count: posCount count: posCount,
}; };
}; };
export const getDepthFirstPos = function(pos) { export const getDepthFirstPos = function (pos) {
return posCrossRef[pos]; return posCrossRef[pos];
}; };
export const indexNodes = function() { export const indexNodes = function () {
secCount = -1; secCount = -1;
if (subGraphs.length > 0) { if (subGraphs.length > 0) {
indexNodes2('none', subGraphs.length - 1, 0); indexNodes2('none', subGraphs.length - 1, 0);
} }
}; };
export const getSubGraphs = function() { export const getSubGraphs = function () {
return subGraphs; return subGraphs;
}; };
@ -577,7 +568,7 @@ export const firstGraph = () => {
return false; return false;
}; };
const destructStartLink = _str => { const destructStartLink = (_str) => {
let str = _str.trim(); let str = _str.trim();
let type = 'arrow_open'; let type = 'arrow_open';
@ -620,7 +611,7 @@ const countChar = (char, str) => {
return count; return count;
}; };
const destructEndLink = _str => { const destructEndLink = (_str) => {
const str = _str.trim(); const str = _str.trim();
let line = str.slice(0, -1); let line = str.slice(0, -1);
let type = 'arrow_open'; let type = 'arrow_open';
@ -700,7 +691,7 @@ const destructLink = (_str, _startStr) => {
// Todo optimizer this by caching existing nodes // Todo optimizer this by caching existing nodes
const exists = (allSgs, _id) => { const exists = (allSgs, _id) => {
let res = false; let res = false;
allSgs.forEach(sg => { allSgs.forEach((sg) => {
const pos = sg.nodes.indexOf(_id); const pos = sg.nodes.indexOf(_id);
if (pos >= 0) { if (pos >= 0) {
res = true; res = true;
@ -750,8 +741,8 @@ export default {
getSubGraphs, getSubGraphs,
destructLink, destructLink,
lex: { lex: {
firstGraph firstGraph,
}, },
exists, exists,
makeUniq makeUniq,
}; };

View File

@ -12,7 +12,7 @@ import common, { evaluate } from '../common/common';
import { interpolateToCurve, getStylesFromArray, configureSvgSize } from '../../utils'; import { interpolateToCurve, getStylesFromArray, configureSvgSize } from '../../utils';
const conf = {}; const conf = {};
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
conf[keys[i]] = cnf[keys[i]]; conf[keys[i]] = cnf[keys[i]];
@ -24,12 +24,12 @@ export const setConf = function(cnf) {
* @param vert Object containing the vertices. * @param vert Object containing the vertices.
* @param g The graph that is to be drawn. * @param g The graph that is to be drawn.
*/ */
export const addVertices = function(vert, g, svgId) { export const addVertices = function (vert, g, svgId) {
const svg = select(`[id="${svgId}"]`); const svg = select(`[id="${svgId}"]`);
const keys = Object.keys(vert); const keys = Object.keys(vert);
// Iterate through each item in the vertex object (containing all the vertices found) in the graph definition // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
keys.forEach(function(id) { keys.forEach(function (id) {
const vertex = vert[id]; const vertex = vert[id];
/** /**
@ -53,8 +53,8 @@ export const addVertices = function(vert, g, svgId) {
const node = { const node = {
label: vertexText.replace( label: vertexText.replace(
/fa[lrsb]?:fa-[\w-]+/g, /fa[lrsb]?:fa-[\w-]+/g,
s => `<i class='${s.replace(':', ' ')}'></i>` (s) => `<i class='${s.replace(':', ' ')}'></i>`
) ),
}; };
vertexNode = addHtmlLabel(svg, node).node(); vertexNode = addHtmlLabel(svg, node).node();
vertexNode.parentNode.removeChild(vertexNode); vertexNode.parentNode.removeChild(vertexNode);
@ -149,7 +149,7 @@ export const addVertices = function(vert, g, svgId) {
width: vertex.type === 'group' ? 500 : undefined, width: vertex.type === 'group' ? 500 : undefined,
dir: vertex.dir, dir: vertex.dir,
type: vertex.type, type: vertex.type,
padding: getConfig().flowchart.padding padding: getConfig().flowchart.padding,
}); });
log.info('setNode', { log.info('setNode', {
@ -165,7 +165,7 @@ export const addVertices = function(vert, g, svgId) {
width: vertex.type === 'group' ? 500 : undefined, width: vertex.type === 'group' ? 500 : undefined,
type: vertex.type, type: vertex.type,
dir: vertex.dir, dir: vertex.dir,
padding: getConfig().flowchart.padding padding: getConfig().flowchart.padding,
}); });
}); });
}; };
@ -175,7 +175,7 @@ export const addVertices = function(vert, g, svgId) {
* @param {Object} edges The edges to add to the graph * @param {Object} edges The edges to add to the graph
* @param {Object} g The graph object * @param {Object} g The graph object
*/ */
export const addEdges = function(edges, g) { export const addEdges = function (edges, g) {
log.info('abc78 edges = ', edges); log.info('abc78 edges = ', edges);
let cnt = 0; let cnt = 0;
let linkIdCnt = {}; let linkIdCnt = {};
@ -189,7 +189,7 @@ export const addEdges = function(edges, g) {
defaultLabelStyle = defaultStyles.labelStyle; defaultLabelStyle = defaultStyles.labelStyle;
} }
edges.forEach(function(edge) { edges.forEach(function (edge) {
cnt++; cnt++;
// Identify Link // Identify Link
@ -319,7 +319,7 @@ export const addEdges = function(edges, g) {
* Returns the all the styles from classDef statements in the graph definition. * Returns the all the styles from classDef statements in the graph definition.
* @returns {object} classDef styles * @returns {object} classDef styles
*/ */
export const getClasses = function(text) { export const getClasses = function (text) {
log.info('Extracting classes'); log.info('Extracting classes');
flowDb.clear(); flowDb.clear();
const parser = flow.parser; const parser = flow.parser;
@ -341,7 +341,7 @@ export const getClasses = function(text) {
* @param id * @param id
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
log.info('Drawing flowchart'); log.info('Drawing flowchart');
flowDb.clear(); flowDb.clear();
flowDb.setGen('gen-2'); flowDb.setGen('gen-2');
@ -368,16 +368,16 @@ export const draw = function(text, id) {
// Create the input mermaid.graph // Create the input mermaid.graph
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: true, multigraph: true,
compound: true compound: true,
}) })
.setGraph({ .setGraph({
rankdir: dir, rankdir: dir,
nodesep: nodeSpacing, nodesep: nodeSpacing,
ranksep: rankSpacing, ranksep: rankSpacing,
marginx: 8, marginx: 8,
marginy: 8 marginy: 8,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -463,7 +463,7 @@ export const draw = function(text, id) {
// If node has a link, wrap it in an anchor SVG object. // If node has a link, wrap it in an anchor SVG object.
const keys = Object.keys(vert); const keys = Object.keys(vert);
keys.forEach(function(key) { keys.forEach(function (key) {
const vertex = vert[key]; const vertex = vert[key];
if (vertex.link) { if (vertex.link) {
@ -477,20 +477,20 @@ export const draw = function(text, id) {
link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget); link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
} }
const linkNode = node.insert(function() { const linkNode = node.insert(function () {
return link; return link;
}, ':first-child'); }, ':first-child');
const shape = node.select('.label-container'); const shape = node.select('.label-container');
if (shape) { if (shape) {
linkNode.append(function() { linkNode.append(function () {
return shape.node(); return shape.node();
}); });
} }
const label = node.select('.label'); const label = node.select('.label');
if (label) { if (label) {
linkNode.append(function() { linkNode.append(function () {
return label.node(); return label.node();
}); });
} }
@ -504,5 +504,5 @@ export default {
addVertices, addVertices,
addEdges, addEdges,
getClasses, getClasses,
draw draw,
}; };

View File

@ -13,7 +13,7 @@ import { interpolateToCurve, getStylesFromArray, configureSvgSize } from '../../
import flowChartShapes from './flowChartShapes'; import flowChartShapes from './flowChartShapes';
const conf = {}; const conf = {};
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
conf[keys[i]] = cnf[keys[i]]; conf[keys[i]] = cnf[keys[i]];
@ -25,12 +25,12 @@ export const setConf = function(cnf) {
* @param vert Object containing the vertices. * @param vert Object containing the vertices.
* @param g The graph that is to be drawn. * @param g The graph that is to be drawn.
*/ */
export const addVertices = function(vert, g, svgId) { export const addVertices = function (vert, g, svgId) {
const svg = select(`[id="${svgId}"]`); const svg = select(`[id="${svgId}"]`);
const keys = Object.keys(vert); const keys = Object.keys(vert);
// Iterate through each item in the vertex object (containing all the vertices found) in the graph definition // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
keys.forEach(function(id) { keys.forEach(function (id) {
const vertex = vert[id]; const vertex = vert[id];
/** /**
@ -54,8 +54,8 @@ export const addVertices = function(vert, g, svgId) {
const node = { const node = {
label: vertexText.replace( label: vertexText.replace(
/fa[lrsb]?:fa-[\w-]+/g, /fa[lrsb]?:fa-[\w-]+/g,
s => `<i class='${s.replace(':', ' ')}'></i>` (s) => `<i class='${s.replace(':', ' ')}'></i>`
) ),
}; };
vertexNode = addHtmlLabel(svg, node).node(); vertexNode = addHtmlLabel(svg, node).node();
vertexNode.parentNode.removeChild(vertexNode); vertexNode.parentNode.removeChild(vertexNode);
@ -143,7 +143,7 @@ export const addVertices = function(vert, g, svgId) {
ry: radious, ry: radious,
class: classStr, class: classStr,
style: styles.style, style: styles.style,
id: flowDb.lookUpDomId(vertex.id) id: flowDb.lookUpDomId(vertex.id),
}); });
}); });
}; };
@ -153,7 +153,7 @@ export const addVertices = function(vert, g, svgId) {
* @param {Object} edges The edges to add to the graph * @param {Object} edges The edges to add to the graph
* @param {Object} g The graph object * @param {Object} g The graph object
*/ */
export const addEdges = function(edges, g) { export const addEdges = function (edges, g) {
let cnt = 0; let cnt = 0;
let defaultStyle; let defaultStyle;
@ -165,7 +165,7 @@ export const addEdges = function(edges, g) {
defaultLabelStyle = defaultStyles.labelStyle; defaultLabelStyle = defaultStyles.labelStyle;
} }
edges.forEach(function(edge) { edges.forEach(function (edge) {
cnt++; cnt++;
// Identify Link // Identify Link
@ -232,7 +232,7 @@ export const addEdges = function(edges, g) {
edgeData.labelType = 'html'; edgeData.labelType = 'html';
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}">${edge.text.replace( edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}">${edge.text.replace(
/fa[lrsb]?:fa-[\w-]+/g, /fa[lrsb]?:fa-[\w-]+/g,
s => `<i class='${s.replace(':', ' ')}'></i>` (s) => `<i class='${s.replace(':', ' ')}'></i>`
)}</span>`; )}</span>`;
} else { } else {
edgeData.labelType = 'text'; edgeData.labelType = 'text';
@ -259,7 +259,7 @@ export const addEdges = function(edges, g) {
* Returns the all the styles from classDef statements in the graph definition. * Returns the all the styles from classDef statements in the graph definition.
* @returns {object} classDef styles * @returns {object} classDef styles
*/ */
export const getClasses = function(text) { export const getClasses = function (text) {
log.info('Extracting classes'); log.info('Extracting classes');
flowDb.clear(); flowDb.clear();
try { try {
@ -279,7 +279,7 @@ export const getClasses = function(text) {
* @param text * @param text
* @param id * @param id
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
log.info('Drawing flowchart'); log.info('Drawing flowchart');
flowDb.clear(); flowDb.clear();
flowDb.setGen('gen-1'); flowDb.setGen('gen-1');
@ -306,16 +306,16 @@ export const draw = function(text, id) {
// Create the input mermaid.graph // Create the input mermaid.graph
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: true, multigraph: true,
compound: true compound: true,
}) })
.setGraph({ .setGraph({
rankdir: dir, rankdir: dir,
nodesep: nodeSpacing, nodesep: nodeSpacing,
ranksep: rankSpacing, ranksep: rankSpacing,
marginx: 8, marginx: 8,
marginy: 8 marginy: 8,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -406,7 +406,7 @@ export const draw = function(text, id) {
const element = select('#' + id + ' g'); const element = select('#' + id + ' g');
render(element, g); render(element, g);
element.selectAll('g.node').attr('title', function() { element.selectAll('g.node').attr('title', function () {
return flowDb.getTooltip(this.id); return flowDb.getTooltip(this.id);
}); });
@ -472,7 +472,7 @@ export const draw = function(text, id) {
// If node has a link, wrap it in an anchor SVG object. // If node has a link, wrap it in an anchor SVG object.
const keys = Object.keys(vert); const keys = Object.keys(vert);
keys.forEach(function(key) { keys.forEach(function (key) {
const vertex = vert[key]; const vertex = vert[key];
if (vertex.link) { if (vertex.link) {
@ -486,20 +486,20 @@ export const draw = function(text, id) {
link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget); link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
} }
const linkNode = node.insert(function() { const linkNode = node.insert(function () {
return link; return link;
}, ':first-child'); }, ':first-child');
const shape = node.select('.label-container'); const shape = node.select('.label-container');
if (shape) { if (shape) {
linkNode.append(function() { linkNode.append(function () {
return shape.node(); return shape.node();
}); });
} }
const label = node.select('.label'); const label = node.select('.label');
if (label) { if (label) {
linkNode.append(function() { linkNode.append(function () {
return label.node(); return label.node();
}); });
} }
@ -513,5 +513,5 @@ export default {
addVertices, addVertices,
addEdges, addEdges,
getClasses, getClasses,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
`.label { `.label {
font-family: ${options.fontFamily}; font-family: ${options.fontFamily};
color: ${options.nodeTextColor || options.textColor}; color: ${options.nodeTextColor || options.textColor};

View File

@ -21,11 +21,11 @@ let topAxis = false;
// The serial order of the task in the script // The serial order of the task in the script
let lastOrder = 0; let lastOrder = 0;
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
export const clear = function() { export const clear = function () {
sections = []; sections = [];
tasks = []; tasks = [];
currentSection = ''; currentSection = '';
@ -44,72 +44,72 @@ export const clear = function() {
lastOrder = 0; lastOrder = 0;
}; };
export const setAxisFormat = function(txt) { export const setAxisFormat = function (txt) {
axisFormat = txt; axisFormat = txt;
}; };
export const getAxisFormat = function() { export const getAxisFormat = function () {
return axisFormat; return axisFormat;
}; };
export const setTodayMarker = function(txt) { export const setTodayMarker = function (txt) {
todayMarker = txt; todayMarker = txt;
}; };
export const getTodayMarker = function() { export const getTodayMarker = function () {
return todayMarker; return todayMarker;
}; };
export const setDateFormat = function(txt) { export const setDateFormat = function (txt) {
dateFormat = txt; dateFormat = txt;
}; };
export const enableInclusiveEndDates = function() { export const enableInclusiveEndDates = function () {
inclusiveEndDates = true; inclusiveEndDates = true;
}; };
export const endDatesAreInclusive = function() { export const endDatesAreInclusive = function () {
return inclusiveEndDates; return inclusiveEndDates;
}; };
export const enableTopAxis = function() { export const enableTopAxis = function () {
topAxis = true; topAxis = true;
}; };
export const topAxisEnabled = function() { export const topAxisEnabled = function () {
return topAxis; return topAxis;
}; };
export const getDateFormat = function() { export const getDateFormat = function () {
return dateFormat; return dateFormat;
}; };
export const setExcludes = function(txt) { export const setExcludes = function (txt) {
excludes = txt.toLowerCase().split(/[\s,]+/); excludes = txt.toLowerCase().split(/[\s,]+/);
}; };
export const getExcludes = function() { export const getExcludes = function () {
return excludes; return excludes;
}; };
export const setTitle = function(txt) { export const setTitle = function (txt) {
title = txt; title = txt;
}; };
export const getTitle = function() { export const getTitle = function () {
return title; return title;
}; };
export const addSection = function(txt) { export const addSection = function (txt) {
currentSection = txt; currentSection = txt;
sections.push(txt); sections.push(txt);
}; };
export const getSections = function() { export const getSections = function () {
return sections; return sections;
}; };
export const getTasks = function() { export const getTasks = function () {
let allItemsPricessed = compileTasks(); let allItemsPricessed = compileTasks();
const maxDepth = 10; const maxDepth = 10;
let iterationCount = 0; let iterationCount = 0;
@ -123,7 +123,7 @@ export const getTasks = function() {
return tasks; return tasks;
}; };
const isInvalidDate = function(date, dateFormat, excludes) { const isInvalidDate = function (date, dateFormat, excludes) {
if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) { if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
return true; return true;
} }
@ -133,7 +133,7 @@ const isInvalidDate = function(date, dateFormat, excludes) {
return excludes.indexOf(date.format(dateFormat.trim())) >= 0; return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
}; };
const checkTaskDates = function(task, dateFormat, excludes) { const checkTaskDates = function (task, dateFormat, excludes) {
if (!excludes.length || task.manualEndTime) return; if (!excludes.length || task.manualEndTime) return;
let startTime = moment(task.startTime, dateFormat, true); let startTime = moment(task.startTime, dateFormat, true);
startTime.add(1, 'd'); startTime.add(1, 'd');
@ -143,7 +143,7 @@ const checkTaskDates = function(task, dateFormat, excludes) {
task.renderEndTime = renderEndTime; task.renderEndTime = renderEndTime;
}; };
const fixTaskDates = function(startTime, endTime, dateFormat, excludes) { const fixTaskDates = function (startTime, endTime, dateFormat, excludes) {
let invalid = false; let invalid = false;
let renderEndTime = null; let renderEndTime = null;
while (startTime <= endTime) { while (startTime <= endTime) {
@ -159,7 +159,7 @@ const fixTaskDates = function(startTime, endTime, dateFormat, excludes) {
return renderEndTime; return renderEndTime;
}; };
const getStartDate = function(prevTime, dateFormat, str) { const getStartDate = function (prevTime, dateFormat, str) {
str = str.trim(); str = str.trim();
// Test for after // Test for after
@ -169,7 +169,7 @@ const getStartDate = function(prevTime, dateFormat, str) {
if (afterStatement !== null) { if (afterStatement !== null) {
// check all after ids and take the latest // check all after ids and take the latest
let latestEndingTask = null; let latestEndingTask = null;
afterStatement[1].split(' ').forEach(function(id) { afterStatement[1].split(' ').forEach(function (id) {
let task = findTaskById(id); let task = findTaskById(id);
if (typeof task !== 'undefined') { if (typeof task !== 'undefined') {
if (!latestEndingTask) { if (!latestEndingTask) {
@ -204,7 +204,7 @@ const getStartDate = function(prevTime, dateFormat, str) {
return new Date(); return new Date();
}; };
const durationToDate = function(durationStatement, relativeTime) { const durationToDate = function (durationStatement, relativeTime) {
if (durationStatement !== null) { if (durationStatement !== null) {
switch (durationStatement[2]) { switch (durationStatement[2]) {
case 's': case 's':
@ -228,7 +228,7 @@ const durationToDate = function(durationStatement, relativeTime) {
return relativeTime.toDate(); return relativeTime.toDate();
}; };
const getEndDate = function(prevTime, dateFormat, str, inclusive) { const getEndDate = function (prevTime, dateFormat, str, inclusive) {
inclusive = inclusive || false; inclusive = inclusive || false;
str = str.trim(); str = str.trim();
@ -245,7 +245,7 @@ const getEndDate = function(prevTime, dateFormat, str, inclusive) {
}; };
let taskCnt = 0; let taskCnt = 0;
const parseId = function(idStr) { const parseId = function (idStr) {
if (typeof idStr === 'undefined') { if (typeof idStr === 'undefined') {
taskCnt = taskCnt + 1; taskCnt = taskCnt + 1;
return 'task' + taskCnt; return 'task' + taskCnt;
@ -263,7 +263,7 @@ const parseId = function(idStr) {
// endDate // endDate
// length // length
const compileData = function(prevTask, dataStr) { const compileData = function (prevTask, dataStr) {
let ds; let ds;
if (dataStr.substr(0, 1) === ':') { if (dataStr.substr(0, 1) === ':') {
@ -312,7 +312,7 @@ const compileData = function(prevTask, dataStr) {
return task; return task;
}; };
const parseData = function(prevTaskId, dataStr) { const parseData = function (prevTaskId, dataStr) {
let ds; let ds;
if (dataStr.substr(0, 1) === ':') { if (dataStr.substr(0, 1) === ':') {
ds = dataStr.substr(1, dataStr.length); ds = dataStr.substr(1, dataStr.length);
@ -336,30 +336,30 @@ const parseData = function(prevTaskId, dataStr) {
task.id = parseId(); task.id = parseId();
task.startTime = { task.startTime = {
type: 'prevTaskEnd', type: 'prevTaskEnd',
id: prevTaskId id: prevTaskId,
}; };
task.endTime = { task.endTime = {
data: data[0] data: data[0],
}; };
break; break;
case 2: case 2:
task.id = parseId(); task.id = parseId();
task.startTime = { task.startTime = {
type: 'getStartDate', type: 'getStartDate',
startData: data[0] startData: data[0],
}; };
task.endTime = { task.endTime = {
data: data[1] data: data[1],
}; };
break; break;
case 3: case 3:
task.id = parseId(data[0]); task.id = parseId(data[0]);
task.startTime = { task.startTime = {
type: 'getStartDate', type: 'getStartDate',
startData: data[1] startData: data[1],
}; };
task.endTime = { task.endTime = {
data: data[2] data: data[2],
}; };
break; break;
default: default:
@ -372,7 +372,7 @@ let lastTask;
let lastTaskID; let lastTaskID;
let rawTasks = []; let rawTasks = [];
const taskDb = {}; const taskDb = {};
export const addTask = function(descr, data) { export const addTask = function (descr, data) {
const rawTask = { const rawTask = {
section: currentSection, section: currentSection,
type: currentSection, type: currentSection,
@ -381,7 +381,7 @@ export const addTask = function(descr, data) {
renderEndTime: null, renderEndTime: null,
raw: { data: data }, raw: { data: data },
task: descr, task: descr,
classes: [] classes: [],
}; };
const taskInfo = parseData(lastTaskID, data); const taskInfo = parseData(lastTaskID, data);
rawTask.raw.startTime = taskInfo.startTime; rawTask.raw.startTime = taskInfo.startTime;
@ -403,18 +403,18 @@ export const addTask = function(descr, data) {
taskDb[rawTask.id] = pos - 1; taskDb[rawTask.id] = pos - 1;
}; };
export const findTaskById = function(id) { export const findTaskById = function (id) {
const pos = taskDb[id]; const pos = taskDb[id];
return rawTasks[pos]; return rawTasks[pos];
}; };
export const addTaskOrg = function(descr, data) { export const addTaskOrg = function (descr, data) {
const newTask = { const newTask = {
section: currentSection, section: currentSection,
type: currentSection, type: currentSection,
description: descr, description: descr,
task: descr, task: descr,
classes: [] classes: [],
}; };
const taskInfo = compileData(lastTask, data); const taskInfo = compileData(lastTask, data);
newTask.startTime = taskInfo.startTime; newTask.startTime = taskInfo.startTime;
@ -428,8 +428,8 @@ export const addTaskOrg = function(descr, data) {
tasks.push(newTask); tasks.push(newTask);
}; };
const compileTasks = function() { const compileTasks = function () {
const compileTask = function(pos) { const compileTask = function (pos) {
const task = rawTasks[pos]; const task = rawTasks[pos];
let startTime = ''; let startTime = '';
switch (rawTasks[pos].raw.startTime.type) { switch (rawTasks[pos].raw.startTime.type) {
@ -481,12 +481,12 @@ const compileTasks = function() {
* @param ids Comma separated list of ids * @param ids Comma separated list of ids
* @param linkStr URL to create a link for * @param linkStr URL to create a link for
*/ */
export const setLink = function(ids, _linkStr) { export const setLink = function (ids, _linkStr) {
let linkStr = _linkStr; let linkStr = _linkStr;
if (configApi.getConfig().securityLevel !== 'loose') { if (configApi.getConfig().securityLevel !== 'loose') {
linkStr = sanitizeUrl(_linkStr); linkStr = sanitizeUrl(_linkStr);
} }
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
let rawTask = findTaskById(id); let rawTask = findTaskById(id);
if (typeof rawTask !== 'undefined') { if (typeof rawTask !== 'undefined') {
pushFun(id, () => { pushFun(id, () => {
@ -502,8 +502,8 @@ export const setLink = function(ids, _linkStr) {
* @param ids Comma separated list of ids * @param ids Comma separated list of ids
* @param className Class to add * @param className Class to add
*/ */
export const setClass = function(ids, className) { export const setClass = function (ids, className) {
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
let rawTask = findTaskById(id); let rawTask = findTaskById(id);
if (typeof rawTask !== 'undefined') { if (typeof rawTask !== 'undefined') {
rawTask.classes.push(className); rawTask.classes.push(className);
@ -511,7 +511,7 @@ export const setClass = function(ids, className) {
}); });
}; };
const setClickFun = function(id, functionName, functionArgs) { const setClickFun = function (id, functionName, functionArgs) {
if (configApi.getConfig().securityLevel !== 'loose') { if (configApi.getConfig().securityLevel !== 'loose') {
return; return;
} }
@ -552,21 +552,21 @@ const setClickFun = function(id, functionName, functionArgs) {
* @param id The task's id * @param id The task's id
* @param callbackFunction A function to be executed when clicked on the task or the task's text * @param callbackFunction A function to be executed when clicked on the task or the task's text
*/ */
const pushFun = function(id, callbackFunction) { const pushFun = function (id, callbackFunction) {
funs.push(function() { funs.push(function () {
// const elem = d3.select(element).select(`[id="${id}"]`) // const elem = d3.select(element).select(`[id="${id}"]`)
const elem = document.querySelector(`[id="${id}"]`); const elem = document.querySelector(`[id="${id}"]`);
if (elem !== null) { if (elem !== null) {
elem.addEventListener('click', function() { elem.addEventListener('click', function () {
callbackFunction(); callbackFunction();
}); });
} }
}); });
funs.push(function() { funs.push(function () {
// const elem = d3.select(element).select(`[id="${id}-text"]`) // const elem = d3.select(element).select(`[id="${id}-text"]`)
const elem = document.querySelector(`[id="${id}-text"]`); const elem = document.querySelector(`[id="${id}-text"]`);
if (elem !== null) { if (elem !== null) {
elem.addEventListener('click', function() { elem.addEventListener('click', function () {
callbackFunction(); callbackFunction();
}); });
} }
@ -579,8 +579,8 @@ const pushFun = function(id, callbackFunction) {
* @param functionName Function to be called on click * @param functionName Function to be called on click
* @param functionArgs Function args the function should be called with * @param functionArgs Function args the function should be called with
*/ */
export const setClickEvent = function(ids, functionName, functionArgs) { export const setClickEvent = function (ids, functionName, functionArgs) {
ids.split(',').forEach(function(id) { ids.split(',').forEach(function (id) {
setClickFun(id, functionName, functionArgs); setClickFun(id, functionName, functionArgs);
}); });
setClass(ids, 'clickable'); setClass(ids, 'clickable');
@ -590,8 +590,8 @@ export const setClickEvent = function(ids, functionName, functionArgs) {
* Binds all functions previously added to fun (specified through click) to the element * Binds all functions previously added to fun (specified through click) to the element
* @param element * @param element
*/ */
export const bindFunctions = function(element) { export const bindFunctions = function (element) {
funs.forEach(function(fun) { funs.forEach(function (fun) {
fun(element); fun(element);
}); });
}; };
@ -623,14 +623,14 @@ export default {
setClickEvent, setClickEvent,
setLink, setLink,
bindFunctions, bindFunctions,
durationToDate durationToDate,
}; };
function getTaskTags(data, task, tags) { function getTaskTags(data, task, tags) {
let matchFound = true; let matchFound = true;
while (matchFound) { while (matchFound) {
matchFound = false; matchFound = false;
tags.forEach(function(t) { tags.forEach(function (t) {
const pattern = '^\\s*' + t + '\\s*$'; const pattern = '^\\s*' + t + '\\s*$';
const regex = new RegExp(pattern); const regex = new RegExp(pattern);
if (data[0].match(regex)) { if (data[0].match(regex)) {

View File

@ -7,7 +7,7 @@ import {
interpolateHcl, interpolateHcl,
axisBottom, axisBottom,
axisTop, axisTop,
timeFormat timeFormat,
} from 'd3'; } from 'd3';
import { parser } from './parser/gantt'; import { parser } from './parser/gantt';
import common from '../common/common'; import common from '../common/common';
@ -16,14 +16,14 @@ import { getConfig } from '../../config';
import { configureSvgSize } from '../../utils'; import { configureSvgSize } from '../../utils';
parser.yy = ganttDb; parser.yy = ganttDb;
export const setConf = function() { export const setConf = function () {
// const keys = Object.keys(cnf); // const keys = Object.keys(cnf);
// keys.forEach(function(key) { // keys.forEach(function(key) {
// conf[key] = cnf[key]; // conf[key] = cnf[key];
// }); // });
}; };
let w; let w;
export const draw = function(text, id) { export const draw = function (text, id) {
const conf = getConfig().gantt; const conf = getConfig().gantt;
parser.yy.clear(); parser.yy.clear();
parser.parse(text); parser.parse(text);
@ -51,12 +51,12 @@ export const draw = function(text, id) {
// Set timescale // Set timescale
const timeScale = scaleTime() const timeScale = scaleTime()
.domain([ .domain([
min(taskArray, function(d) { min(taskArray, function (d) {
return d.startTime; return d.startTime;
}), }),
max(taskArray, function(d) { max(taskArray, function (d) {
return d.endTime; return d.endTime;
}) }),
]) ])
.rangeRound([0, w - conf.leftPadding - conf.rightPadding]); .rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
@ -123,16 +123,16 @@ export const draw = function(text, id) {
.enter() .enter()
.append('rect') .append('rect')
.attr('x', 0) .attr('x', 0)
.attr('y', function(d, i) { .attr('y', function (d, i) {
// Ignore the incoming i value and use our order instead // Ignore the incoming i value and use our order instead
i = d.order; i = d.order;
return i * theGap + theTopPad - 2; return i * theGap + theTopPad - 2;
}) })
.attr('width', function() { .attr('width', function () {
return w - conf.rightPadding / 2; return w - conf.rightPadding / 2;
}) })
.attr('height', theGap) .attr('height', theGap)
.attr('class', function(d) { .attr('class', function (d) {
for (let i = 0; i < categories.length; i++) { for (let i = 0; i < categories.length; i++) {
if (d.type === categories[i]) { if (d.type === categories[i]) {
return 'section section' + (i % conf.numberSectionStyles); return 'section section' + (i % conf.numberSectionStyles);
@ -142,20 +142,16 @@ export const draw = function(text, id) {
}); });
// Draw the rects representing the tasks // Draw the rects representing the tasks
const rectangles = svg const rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
.append('g')
.selectAll('rect')
.data(theArray)
.enter();
rectangles rectangles
.append('rect') .append('rect')
.attr('id', function(d) { .attr('id', function (d) {
return d.id; return d.id;
}) })
.attr('rx', 3) .attr('rx', 3)
.attr('ry', 3) .attr('ry', 3)
.attr('x', function(d) { .attr('x', function (d) {
if (d.milestone) { if (d.milestone) {
return ( return (
timeScale(d.startTime) + timeScale(d.startTime) +
@ -166,19 +162,19 @@ export const draw = function(text, id) {
} }
return timeScale(d.startTime) + theSidePad; return timeScale(d.startTime) + theSidePad;
}) })
.attr('y', function(d, i) { .attr('y', function (d, i) {
// Ignore the incoming i value and use our order instead // Ignore the incoming i value and use our order instead
i = d.order; i = d.order;
return i * theGap + theTopPad; return i * theGap + theTopPad;
}) })
.attr('width', function(d) { .attr('width', function (d) {
if (d.milestone) { if (d.milestone) {
return theBarHeight; return theBarHeight;
} }
return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime); return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
}) })
.attr('height', theBarHeight) .attr('height', theBarHeight)
.attr('transform-origin', function(d, i) { .attr('transform-origin', function (d, i) {
// Ignore the incoming i value and use our order instead // Ignore the incoming i value and use our order instead
i = d.order; i = d.order;
@ -193,7 +189,7 @@ export const draw = function(text, id) {
'px' 'px'
); );
}) })
.attr('class', function(d) { .attr('class', function (d) {
const res = 'task'; const res = 'task';
let classStr = ''; let classStr = '';
@ -245,14 +241,14 @@ export const draw = function(text, id) {
// Append task labels // Append task labels
rectangles rectangles
.append('text') .append('text')
.attr('id', function(d) { .attr('id', function (d) {
return d.id + '-text'; return d.id + '-text';
}) })
.text(function(d) { .text(function (d) {
return d.task; return d.task;
}) })
.attr('font-size', conf.fontSize) .attr('font-size', conf.fontSize)
.attr('x', function(d) { .attr('x', function (d) {
let startX = timeScale(d.startTime); let startX = timeScale(d.startTime);
let endX = timeScale(d.renderEndTime || d.endTime); let endX = timeScale(d.renderEndTime || d.endTime);
if (d.milestone) { if (d.milestone) {
@ -274,13 +270,13 @@ export const draw = function(text, id) {
return (endX - startX) / 2 + startX + theSidePad; return (endX - startX) / 2 + startX + theSidePad;
} }
}) })
.attr('y', function(d, i) { .attr('y', function (d, i) {
// Ignore the incoming i value and use our order instead // Ignore the incoming i value and use our order instead
i = d.order; i = d.order;
return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad; return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
}) })
.attr('text-height', theBarHeight) .attr('text-height', theBarHeight)
.attr('class', function(d) { .attr('class', function (d) {
const startX = timeScale(d.startTime); const startX = timeScale(d.startTime);
let endX = timeScale(d.endTime); let endX = timeScale(d.endTime);
if (d.milestone) { if (d.milestone) {
@ -395,7 +391,7 @@ export const draw = function(text, id) {
.selectAll('text') .selectAll('text')
.data(numOccurances) .data(numOccurances)
.enter() .enter()
.append(function(d) { .append(function (d) {
const rows = d[0].split(common.lineBreakRegex); const rows = d[0].split(common.lineBreakRegex);
const dy = -(rows.length - 1) / 2; const dy = -(rows.length - 1) / 2;
@ -413,7 +409,7 @@ export const draw = function(text, id) {
return svgLabel; return svgLabel;
}) })
.attr('x', 10) .attr('x', 10)
.attr('y', function(d, i) { .attr('y', function (d, i) {
if (i > 0) { if (i > 0) {
for (let j = 0; j < i; j++) { for (let j = 0; j < i; j++) {
prevGap += numOccurances[i - 1][1]; prevGap += numOccurances[i - 1][1];
@ -425,7 +421,7 @@ export const draw = function(text, id) {
}) })
.attr('font-size', conf.sectionFontSize) .attr('font-size', conf.sectionFontSize)
.attr('font-size', conf.sectionFontSize) .attr('font-size', conf.sectionFontSize)
.attr('class', function(d) { .attr('class', function (d) {
for (let i = 0; i < categories.length; i++) { for (let i = 0; i < categories.length; i++) {
if (d[0] === categories[i]) { if (d[0] === categories[i]) {
return 'sectionTitle sectionTitle' + (i % conf.numberSectionStyles); return 'sectionTitle sectionTitle' + (i % conf.numberSectionStyles);
@ -489,5 +485,5 @@ export const draw = function(text, id) {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
` `
.mermaid-main-font { .mermaid-main-font {
font-family: "trebuchet ms", verdana, arial, sans-serif; font-family: "trebuchet ms", verdana, arial, sans-serif;

View File

@ -49,11 +49,11 @@ function uniqBy(list, fn) {
}, []); }, []);
} }
export const setDirection = function(dir) { export const setDirection = function (dir) {
direction = dir; direction = dir;
}; };
let options = {}; let options = {};
export const setOptions = function(rawOptString) { export const setOptions = function (rawOptString) {
log.debug('options str', rawOptString); log.debug('options str', rawOptString);
rawOptString = rawOptString && rawOptString.trim(); rawOptString = rawOptString && rawOptString.trim();
rawOptString = rawOptString || '{}'; rawOptString = rawOptString || '{}';
@ -64,16 +64,16 @@ export const setOptions = function(rawOptString) {
} }
}; };
export const getOptions = function() { export const getOptions = function () {
return options; return options;
}; };
export const commit = function(msg) { export const commit = function (msg) {
const commit = { const commit = {
id: getId(), id: getId(),
message: msg, message: msg,
seq: seq++, seq: seq++,
parent: head == null ? null : head.id parent: head == null ? null : head.id,
}; };
head = commit; head = commit;
commits[commit.id] = commit; commits[commit.id] = commit;
@ -81,12 +81,12 @@ export const commit = function(msg) {
log.debug('in pushCommit ' + commit.id); log.debug('in pushCommit ' + commit.id);
}; };
export const branch = function(name) { export const branch = function (name) {
branches[name] = head != null ? head.id : null; branches[name] = head != null ? head.id : null;
log.debug('in createBranch'); log.debug('in createBranch');
}; };
export const merge = function(otherBranch) { export const merge = function (otherBranch) {
const currentCommit = commits[branches[curBranch]]; const currentCommit = commits[branches[curBranch]];
const otherCommit = commits[branches[otherBranch]]; const otherCommit = commits[branches[otherBranch]];
if (isReachableFrom(currentCommit, otherCommit)) { if (isReachableFrom(currentCommit, otherCommit)) {
@ -102,7 +102,7 @@ export const merge = function(otherBranch) {
id: getId(), id: getId(),
message: 'merged branch ' + otherBranch + ' into ' + curBranch, message: 'merged branch ' + otherBranch + ' into ' + curBranch,
seq: seq++, seq: seq++,
parent: [head == null ? null : head.id, branches[otherBranch]] parent: [head == null ? null : head.id, branches[otherBranch]],
}; };
head = commit; head = commit;
commits[commit.id] = commit; commits[commit.id] = commit;
@ -112,14 +112,14 @@ export const merge = function(otherBranch) {
log.debug('in mergeBranch'); log.debug('in mergeBranch');
}; };
export const checkout = function(branch) { export const checkout = function (branch) {
log.debug('in checkout'); log.debug('in checkout');
curBranch = branch; curBranch = branch;
const id = branches[curBranch]; const id = branches[curBranch];
head = commits[id]; head = commits[id];
}; };
export const reset = function(commitRef) { export const reset = function (commitRef) {
log.debug('in reset', commitRef); log.debug('in reset', commitRef);
const ref = commitRef.split(':')[0]; const ref = commitRef.split(':')[0];
let parentCount = parseInt(commitRef.split(':')[1]); let parentCount = parseInt(commitRef.split(':')[1]);
@ -153,7 +153,7 @@ function prettyPrintCommitHistory(commitArr) {
return commit; return commit;
}, commitArr[0]); }, commitArr[0]);
let line = ''; let line = '';
commitArr.forEach(function(c) { commitArr.forEach(function (c) {
if (c === commit) { if (c === commit) {
line += '\t*'; line += '\t*';
} else { } else {
@ -175,17 +175,17 @@ function prettyPrintCommitHistory(commitArr) {
const nextCommit = commits[commit.parent]; const nextCommit = commits[commit.parent];
upsert(commitArr, commit, nextCommit); upsert(commitArr, commit, nextCommit);
} }
commitArr = uniqBy(commitArr, c => c.id); commitArr = uniqBy(commitArr, (c) => c.id);
prettyPrintCommitHistory(commitArr); prettyPrintCommitHistory(commitArr);
} }
export const prettyPrint = function() { export const prettyPrint = function () {
log.debug(commits); log.debug(commits);
const node = getCommitsArray()[0]; const node = getCommitsArray()[0];
prettyPrintCommitHistory([node]); prettyPrintCommitHistory([node]);
}; };
export const clear = function() { export const clear = function () {
commits = {}; commits = {};
head = null; head = null;
branches = { master: head }; branches = { master: head };
@ -193,7 +193,7 @@ export const clear = function() {
seq = 0; seq = 0;
}; };
export const getBranchesAsObjArray = function() { export const getBranchesAsObjArray = function () {
const branchArr = []; const branchArr = [];
for (let branch in branches) { for (let branch in branches) {
branchArr.push({ name: branch, commit: commits[branches[branch]] }); branchArr.push({ name: branch, commit: commits[branches[branch]] });
@ -201,29 +201,29 @@ export const getBranchesAsObjArray = function() {
return branchArr; return branchArr;
}; };
export const getBranches = function() { export const getBranches = function () {
return branches; return branches;
}; };
export const getCommits = function() { export const getCommits = function () {
return commits; return commits;
}; };
export const getCommitsArray = function() { export const getCommitsArray = function () {
const commitArr = Object.keys(commits).map(function(key) { const commitArr = Object.keys(commits).map(function (key) {
return commits[key]; return commits[key];
}); });
commitArr.forEach(function(o) { commitArr.forEach(function (o) {
log.debug(o.id); log.debug(o.id);
}); });
commitArr.sort((a, b) => b.seq - a.seq); commitArr.sort((a, b) => b.seq - a.seq);
return commitArr; return commitArr;
}; };
export const getCurrentBranch = function() { export const getCurrentBranch = function () {
return curBranch; return curBranch;
}; };
export const getDirection = function() { export const getDirection = function () {
return direction; return direction;
}; };
export const getHead = function() { export const getHead = function () {
return head; return head;
}; };
@ -244,5 +244,5 @@ export default {
getCommitsArray, getCommitsArray,
getCurrentBranch, getCurrentBranch,
getDirection, getDirection,
getHead getHead,
}; };

View File

@ -22,11 +22,11 @@ let config = {
width: 75, width: 75,
height: 100, height: 100,
x: -25, x: -25,
y: 0 y: 0,
} },
}; };
let apiConfig = {}; let apiConfig = {};
export const setConf = function(c) { export const setConf = function (c) {
apiConfig = c; apiConfig = c;
}; };
@ -56,10 +56,10 @@ function svgDrawLine(svg, points, colorIdx, interpolate) {
const curve = interpolateToCurve(interpolate, curveBasis); const curve = interpolateToCurve(interpolate, curveBasis);
const color = config.branchColors[colorIdx % config.branchColors.length]; const color = config.branchColors[colorIdx % config.branchColors.length];
const lineGen = line() const lineGen = line()
.x(function(d) { .x(function (d) {
return Math.round(d.x); return Math.round(d.x);
}) })
.y(function(d) { .y(function (d) {
return Math.round(d.y); return Math.round(d.y);
}) })
.curve(curve); .curve(curve);
@ -82,7 +82,7 @@ function getElementCoords(element, coords) {
left: xn, left: xn,
top: yn, top: yn,
width: coords.width, width: coords.width,
height: coords.height height: coords.height,
}; };
} }
@ -98,7 +98,7 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
if (fromBbox.left - toBbox.left > config.nodeSpacing) { if (fromBbox.left - toBbox.left > config.nodeSpacing) {
const lineStart = { const lineStart = {
x: fromBbox.left - config.nodeSpacing, x: fromBbox.left - config.nodeSpacing,
y: toBbox.top + toBbox.height / 2 y: toBbox.top + toBbox.height / 2,
}; };
const lineEnd = { x: toBbox.left + toBbox.width, y: toBbox.top + toBbox.height / 2 }; const lineEnd = { x: toBbox.left + toBbox.width, y: toBbox.top + toBbox.height / 2 };
svgDrawLine(svg, [lineStart, lineEnd], color, 'linear'); svgDrawLine(svg, [lineStart, lineEnd], color, 'linear');
@ -108,7 +108,7 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
{ x: fromBbox.left, y: fromBbox.top + fromBbox.height / 2 }, { x: fromBbox.left, y: fromBbox.top + fromBbox.height / 2 },
{ x: fromBbox.left - config.nodeSpacing / 2, y: fromBbox.top + fromBbox.height / 2 }, { x: fromBbox.left - config.nodeSpacing / 2, y: fromBbox.top + fromBbox.height / 2 },
{ x: fromBbox.left - config.nodeSpacing / 2, y: lineStart.y }, { x: fromBbox.left - config.nodeSpacing / 2, y: lineStart.y },
lineStart lineStart,
], ],
color color
); );
@ -118,20 +118,20 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
[ [
{ {
x: fromBbox.left, x: fromBbox.left,
y: fromBbox.top + fromBbox.height / 2 y: fromBbox.top + fromBbox.height / 2,
}, },
{ {
x: fromBbox.left - config.nodeSpacing / 2, x: fromBbox.left - config.nodeSpacing / 2,
y: fromBbox.top + fromBbox.height / 2 y: fromBbox.top + fromBbox.height / 2,
}, },
{ {
x: fromBbox.left - config.nodeSpacing / 2, x: fromBbox.left - config.nodeSpacing / 2,
y: toBbox.top + toBbox.height / 2 y: toBbox.top + toBbox.height / 2,
}, },
{ {
x: toBbox.left + toBbox.width, x: toBbox.left + toBbox.width,
y: toBbox.top + toBbox.height / 2 y: toBbox.top + toBbox.height / 2,
} },
], ],
color color
); );
@ -145,7 +145,7 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
if (toBbox.top - fromBbox.top > config.nodeSpacing) { if (toBbox.top - fromBbox.top > config.nodeSpacing) {
const lineStart = { const lineStart = {
x: toBbox.left + toBbox.width / 2, x: toBbox.left + toBbox.width / 2,
y: fromBbox.top + fromBbox.height + config.nodeSpacing y: fromBbox.top + fromBbox.height + config.nodeSpacing,
}; };
const lineEnd = { x: toBbox.left + toBbox.width / 2, y: toBbox.top }; const lineEnd = { x: toBbox.left + toBbox.width / 2, y: toBbox.top };
svgDrawLine(svg, [lineStart, lineEnd], color, 'linear'); svgDrawLine(svg, [lineStart, lineEnd], color, 'linear');
@ -155,10 +155,10 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
{ x: fromBbox.left + fromBbox.width / 2, y: fromBbox.top + fromBbox.height }, { x: fromBbox.left + fromBbox.width / 2, y: fromBbox.top + fromBbox.height },
{ {
x: fromBbox.left + fromBbox.width / 2, x: fromBbox.left + fromBbox.width / 2,
y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2 y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2,
}, },
{ x: toBbox.left + toBbox.width / 2, y: lineStart.y - config.nodeSpacing / 2 }, { x: toBbox.left + toBbox.width / 2, y: lineStart.y - config.nodeSpacing / 2 },
lineStart lineStart,
], ],
color color
); );
@ -168,20 +168,20 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
[ [
{ {
x: fromBbox.left + fromBbox.width / 2, x: fromBbox.left + fromBbox.width / 2,
y: fromBbox.top + fromBbox.height y: fromBbox.top + fromBbox.height,
}, },
{ {
x: fromBbox.left + fromBbox.width / 2, x: fromBbox.left + fromBbox.width / 2,
y: fromBbox.top + config.nodeSpacing / 2 y: fromBbox.top + config.nodeSpacing / 2,
}, },
{ {
x: toBbox.left + toBbox.width / 2, x: toBbox.left + toBbox.width / 2,
y: toBbox.top - config.nodeSpacing / 2 y: toBbox.top - config.nodeSpacing / 2,
}, },
{ {
x: toBbox.left + toBbox.width / 2, x: toBbox.left + toBbox.width / 2,
y: toBbox.top y: toBbox.top,
} },
], ],
color color
); );
@ -191,10 +191,7 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
} }
function cloneNode(svg, selector) { function cloneNode(svg, selector) {
return svg return svg.select(selector).node().cloneNode(true);
.select(selector)
.node()
.cloneNode(true);
} }
function renderCommitHistory(svg, commitid, branches, direction) { function renderCommitHistory(svg, commitid, branches, direction) {
@ -208,14 +205,14 @@ function renderCommitHistory(svg, commitid, branches, direction) {
return; return;
} }
svg svg
.append(function() { .append(function () {
return cloneNode(svg, '#def-commit'); return cloneNode(svg, '#def-commit');
}) })
.attr('class', 'commit') .attr('class', 'commit')
.attr('id', function() { .attr('id', function () {
return 'node-' + commit.id; return 'node-' + commit.id;
}) })
.attr('transform', function() { .attr('transform', function () {
switch (direction) { switch (direction) {
case 'LR': case 'LR':
return ( return (
@ -296,7 +293,7 @@ function renderLines(svg, commit, direction, branchColor) {
} }
} }
export const draw = function(txt, id, ver) { export const draw = function (txt, id, ver) {
try { try {
const parser = gitGraphParser.parser; const parser = gitGraphParser.parser;
parser.yy = db; parser.yy = db;
@ -325,7 +322,7 @@ export const draw = function(txt, id, ver) {
renderLines(svg, v.commit, direction); renderLines(svg, v.commit, direction);
branchNum++; branchNum++;
} }
svg.attr('height', function() { svg.attr('height', function () {
if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing; if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
return (branches.length + 1) * config.branchOffset; return (branches.length + 1) * config.branchOffset;
}); });
@ -337,5 +334,5 @@ export const draw = function(txt, id, ver) {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -6,7 +6,7 @@ import { log } from '../../logger';
var message = ''; var message = '';
var info = false; var info = false;
export const setMessage = txt => { export const setMessage = (txt) => {
log.debug('Setting message to: ' + txt); log.debug('Setting message to: ' + txt);
message = txt; message = txt;
}; };
@ -15,7 +15,7 @@ export const getMessage = () => {
return message; return message;
}; };
export const setInfo = inf => { export const setInfo = (inf) => {
info = inf; info = inf;
}; };
@ -31,6 +31,6 @@ export default {
setMessage, setMessage,
getMessage, getMessage,
setInfo, setInfo,
getInfo getInfo,
// parseError // parseError
}; };

View File

@ -7,10 +7,10 @@ import infoParser from './parser/info';
import { log } from '../../logger'; import { log } from '../../logger';
const conf = {}; const conf = {};
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
keys.forEach(function(key) { keys.forEach(function (key) {
conf[key] = cnf[key]; conf[key] = cnf[key];
}); });
}; };
@ -52,5 +52,5 @@ export const draw = (txt, id, ver) => {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -9,11 +9,11 @@ let sections = {};
let title = ''; let title = '';
let showData = false; let showData = false;
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
const addSection = function(id, value) { const addSection = function (id, value) {
if (typeof sections[id] === 'undefined') { if (typeof sections[id] === 'undefined') {
sections[id] = value; sections[id] = value;
log.debug('Added new section :', id); log.debug('Added new section :', id);
@ -21,22 +21,22 @@ const addSection = function(id, value) {
}; };
const getSections = () => sections; const getSections = () => sections;
const setTitle = function(txt) { const setTitle = function (txt) {
title = txt; title = txt;
}; };
const setShowData = function(toggle) { const setShowData = function (toggle) {
showData = toggle; showData = toggle;
}; };
const getShowData = function() { const getShowData = function () {
return showData; return showData;
}; };
const getTitle = function() { const getTitle = function () {
return title; return title;
}; };
const cleanupValue = function(value) { const cleanupValue = function (value) {
if (value.substring(0, 1) === ':') { if (value.substring(0, 1) === ':') {
value = value.substring(1).trim(); value = value.substring(1).trim();
return Number(value.trim()); return Number(value.trim());
@ -45,7 +45,7 @@ const cleanupValue = function(value) {
} }
}; };
const clear = function() { const clear = function () {
sections = {}; sections = {};
title = ''; title = '';
showData = false; showData = false;
@ -64,6 +64,6 @@ export default {
setTitle, setTitle,
getTitle, getTitle,
setShowData, setShowData,
getShowData getShowData,
// parseError // parseError
}; };

View File

@ -60,7 +60,7 @@ export const draw = (txt, id) => {
var data = pieData.getSections(); var data = pieData.getSections();
var sum = 0; var sum = 0;
Object.keys(data).forEach(function(key) { Object.keys(data).forEach(function (key) {
sum += data[key]; sum += data[key];
}); });
@ -77,24 +77,20 @@ export const draw = (txt, id) => {
themeVariables.pie9, themeVariables.pie9,
themeVariables.pie10, themeVariables.pie10,
themeVariables.pie11, themeVariables.pie11,
themeVariables.pie12 themeVariables.pie12,
]; ];
// Set the color scale // Set the color scale
var color = scaleOrdinal() var color = scaleOrdinal().domain(data).range(myGeneratedColors);
.domain(data)
.range(myGeneratedColors);
// Compute the position of each group on the pie: // Compute the position of each group on the pie:
var pie = d3pie().value(function(d) { var pie = d3pie().value(function (d) {
return d.value; return d.value;
}); });
var dataReady = pie(entries(data)); var dataReady = pie(entries(data));
// Shape helper to build arcs: // Shape helper to build arcs:
var arcGenerator = arc() var arcGenerator = arc().innerRadius(0).outerRadius(radius);
.innerRadius(0)
.outerRadius(radius);
// Build the pie chart: each part of the pie is a path that we build using the arc function. // Build the pie chart: each part of the pie is a path that we build using the arc function.
svg svg
@ -103,7 +99,7 @@ export const draw = (txt, id) => {
.enter() .enter()
.append('path') .append('path')
.attr('d', arcGenerator) .attr('d', arcGenerator)
.attr('fill', function(d) { .attr('fill', function (d) {
return color(d.data.key); return color(d.data.key);
}) })
.attr('class', 'pieCircle'); .attr('class', 'pieCircle');
@ -112,13 +108,13 @@ export const draw = (txt, id) => {
// Use the centroid method to get the best coordinates. // Use the centroid method to get the best coordinates.
svg svg
.selectAll('mySlices') .selectAll('mySlices')
.data(dataReady.filter(value => value.data.value !== 0)) .data(dataReady.filter((value) => value.data.value !== 0))
.enter() .enter()
.append('text') .append('text')
.text(function(d) { .text(function (d) {
return ((d.data.value / sum) * 100).toFixed(0) + '%'; return ((d.data.value / sum) * 100).toFixed(0) + '%';
}) })
.attr('transform', function(d) { .attr('transform', function (d) {
return 'translate(' + arcGenerator.centroid(d) + ')'; return 'translate(' + arcGenerator.centroid(d) + ')';
}) })
.style('text-anchor', 'middle') .style('text-anchor', 'middle')
@ -138,7 +134,7 @@ export const draw = (txt, id) => {
.enter() .enter()
.append('g') .append('g')
.attr('class', 'legend') .attr('class', 'legend')
.attr('transform', function(d, i) { .attr('transform', function (d, i) {
var height = legendRectSize + legendSpacing; var height = legendRectSize + legendSpacing;
var offset = (height * color.domain().length) / 2; var offset = (height * color.domain().length) / 2;
var horz = 12 * legendRectSize; var horz = 12 * legendRectSize;
@ -154,11 +150,11 @@ export const draw = (txt, id) => {
.style('stroke', color); .style('stroke', color);
legend legend
.data(dataReady.filter(value => value.data.value !== 0)) .data(dataReady.filter((value) => value.data.value !== 0))
.append('text') .append('text')
.attr('x', legendRectSize + legendSpacing) .attr('x', legendRectSize + legendSpacing)
.attr('y', legendRectSize - legendSpacing) .attr('y', legendRectSize - legendSpacing)
.text(function(d) { .text(function (d) {
if (parser.yy.getShowData() || conf.showData || conf.pie.showData) { if (parser.yy.getShowData() || conf.showData || conf.pie.showData) {
return d.data.key + ' [' + d.data.value + ']'; return d.data.key + ' [' + d.data.value + ']';
} else { } else {
@ -172,5 +168,5 @@ export const draw = (txt, id) => {
}; };
export default { export default {
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
` `
.pieCircle{ .pieCircle{
stroke: ${options.pieStrokeColor}; stroke: ${options.pieStrokeColor};

View File

@ -14,20 +14,20 @@ const RequirementType = {
INTERFACE_REQUIREMENT: 'Interface Requirement', INTERFACE_REQUIREMENT: 'Interface Requirement',
PERFORMANCE_REQUIREMENT: 'Performance Requirement', PERFORMANCE_REQUIREMENT: 'Performance Requirement',
PHYSICAL_REQUIREMENT: 'Physical Requirement', PHYSICAL_REQUIREMENT: 'Physical Requirement',
DESIGN_CONSTRAINT: 'Design Constraint' DESIGN_CONSTRAINT: 'Design Constraint',
}; };
const RiskLevel = { const RiskLevel = {
LOW_RISK: 'Low', LOW_RISK: 'Low',
MED_RISK: 'Medium', MED_RISK: 'Medium',
HIGH_RISK: 'High' HIGH_RISK: 'High',
}; };
const VerifyType = { const VerifyType = {
VERIFY_ANALYSIS: 'Analysis', VERIFY_ANALYSIS: 'Analysis',
VERIFY_DEMONSTRATION: 'Demonstration', VERIFY_DEMONSTRATION: 'Demonstration',
VERIFY_INSPECTION: 'Inspection', VERIFY_INSPECTION: 'Inspection',
VERIFY_TEST: 'Test' VERIFY_TEST: 'Test',
}; };
const Relationships = { const Relationships = {
@ -37,10 +37,10 @@ const Relationships = {
SATISFIES: 'satisfies', SATISFIES: 'satisfies',
VERIFIES: 'verifies', VERIFIES: 'verifies',
REFINES: 'refines', REFINES: 'refines',
TRACES: 'traces' TRACES: 'traces',
}; };
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
@ -53,7 +53,7 @@ const addRequirement = (name, type) => {
id: latestRequirement.id, id: latestRequirement.id,
text: latestRequirement.text, text: latestRequirement.text,
risk: latestRequirement.risk, risk: latestRequirement.risk,
verifyMethod: latestRequirement.verifyMethod verifyMethod: latestRequirement.verifyMethod,
}; };
} }
latestRequirement = {}; latestRequirement = {};
@ -63,37 +63,37 @@ const addRequirement = (name, type) => {
const getRequirements = () => requirements; const getRequirements = () => requirements;
const setNewReqId = id => { const setNewReqId = (id) => {
if (typeof latestRequirement != 'undefined') { if (typeof latestRequirement != 'undefined') {
latestRequirement.id = id; latestRequirement.id = id;
} }
}; };
const setNewReqText = text => { const setNewReqText = (text) => {
if (typeof latestRequirement != 'undefined') { if (typeof latestRequirement != 'undefined') {
latestRequirement.text = text; latestRequirement.text = text;
} }
}; };
const setNewReqRisk = risk => { const setNewReqRisk = (risk) => {
if (typeof latestRequirement != 'undefined') { if (typeof latestRequirement != 'undefined') {
latestRequirement.risk = risk; latestRequirement.risk = risk;
} }
}; };
const setNewReqVerifyMethod = verifyMethod => { const setNewReqVerifyMethod = (verifyMethod) => {
if (typeof latestRequirement != 'undefined') { if (typeof latestRequirement != 'undefined') {
latestRequirement.verifyMethod = verifyMethod; latestRequirement.verifyMethod = verifyMethod;
} }
}; };
const addElement = name => { const addElement = (name) => {
if (typeof elements[name] === 'undefined') { if (typeof elements[name] === 'undefined') {
elements[name] = { elements[name] = {
name, name,
type: latestElement.type, type: latestElement.type,
docRef: latestElement.docRef docRef: latestElement.docRef,
}; };
log.info('Added new requirement: ', name); log.info('Added new requirement: ', name);
} }
@ -104,13 +104,13 @@ const addElement = name => {
const getElements = () => elements; const getElements = () => elements;
const setNewElementType = type => { const setNewElementType = (type) => {
if (typeof latestElement != 'undefined') { if (typeof latestElement != 'undefined') {
latestElement.type = type; latestElement.type = type;
} }
}; };
const setNewElementDocRef = docRef => { const setNewElementDocRef = (docRef) => {
if (typeof latestElement != 'undefined') { if (typeof latestElement != 'undefined') {
latestElement.docRef = docRef; latestElement.docRef = docRef;
} }
@ -120,7 +120,7 @@ const addRelationship = (type, src, dst) => {
relations.push({ relations.push({
type, type,
src, src,
dst dst,
}); });
}; };
@ -158,5 +158,5 @@ export default {
addRelationship, addRelationship,
getRelationships, getRelationships,
clear clear,
}; };

View File

@ -1,6 +1,6 @@
const ReqMarkers = { const ReqMarkers = {
CONTAINS: 'contains', CONTAINS: 'contains',
ARROW: 'arrow' ARROW: 'arrow',
}; };
const insertLineEndings = (parentNode, conf) => { const insertLineEndings = (parentNode, conf) => {
@ -65,5 +65,5 @@ const insertLineEndings = (parentNode, conf) => {
export default { export default {
ReqMarkers, ReqMarkers,
insertLineEndings insertLineEndings,
}; };

View File

@ -12,7 +12,7 @@ import markers from './requirementMarkers';
const conf = {}; const conf = {};
let relCnt = 0; let relCnt = 0;
export const setConf = function(cnf) { export const setConf = function (cnf) {
if (typeof cnf === 'undefined') { if (typeof cnf === 'undefined') {
return; return;
} }
@ -47,7 +47,7 @@ const newTitleNode = (parentNode, id, txts) => {
// 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px' // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
// ) // )
let i = 0; let i = 0;
txts.forEach(textStr => { txts.forEach((textStr) => {
if (i == 0) { if (i == 0) {
title title
.append('tspan') .append('tspan')
@ -80,7 +80,7 @@ const newTitleNode = (parentNode, id, txts) => {
return { return {
titleNode: title, titleNode: title,
y: totalY y: totalY,
}; };
}; };
@ -100,7 +100,7 @@ const newBodyNode = (parentNode, id, txts, yStart) => {
let currentRow = 0; let currentRow = 0;
const charLimit = 30; const charLimit = 30;
let wrappedTxts = []; let wrappedTxts = [];
txts.forEach(textStr => { txts.forEach((textStr) => {
let currentTextLen = textStr.length; let currentTextLen = textStr.length;
while (currentTextLen > charLimit && currentRow < 3) { while (currentTextLen > charLimit && currentRow < 3) {
let firstPart = textStr.substring(0, charLimit); let firstPart = textStr.substring(0, charLimit);
@ -118,12 +118,8 @@ const newBodyNode = (parentNode, id, txts, yStart) => {
currentRow = 0; currentRow = 0;
}); });
wrappedTxts.forEach(textStr => { wrappedTxts.forEach((textStr) => {
body body.append('tspan').attr('x', conf.rect_padding).attr('dy', conf.line_height).text(textStr);
.append('tspan')
.attr('x', conf.rect_padding)
.attr('dy', conf.line_height)
.text(textStr);
}); });
return body; return body;
@ -164,16 +160,16 @@ const addEdgeLabel = (parentNode, svgPath, conf, txt) => {
.attr('fill-opacity', '85%'); .attr('fill-opacity', '85%');
}; };
const drawRelationshipFromLayout = function(svg, rel, g, insert) { const drawRelationshipFromLayout = function (svg, rel, g, insert) {
// Find the edge relating to this relationship // Find the edge relating to this relationship
const edge = g.edge(elementString(rel.src), elementString(rel.dst)); const edge = g.edge(elementString(rel.src), elementString(rel.dst));
// Get a function that will generate the line path // Get a function that will generate the line path
const lineFunction = line() const lineFunction = line()
.x(function(d) { .x(function (d) {
return d.x; return d.x;
}) })
.y(function(d) { .y(function (d) {
return d.y; return d.y;
}); });
@ -208,7 +204,7 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) {
}; };
export const drawReqs = (reqs, graph, svgNode) => { export const drawReqs = (reqs, graph, svgNode) => {
Object.keys(reqs).forEach(reqName => { Object.keys(reqs).forEach((reqName) => {
let req = reqs[reqName]; let req = reqs[reqName];
reqName = elementString(reqName); reqName = elementString(reqName);
log.info('Added new requirement: ', reqName); log.info('Added new requirement: ', reqName);
@ -221,7 +217,7 @@ export const drawReqs = (reqs, graph, svgNode) => {
let titleNodeInfo = newTitleNode(groupNode, reqName + '_title', [ let titleNodeInfo = newTitleNode(groupNode, reqName + '_title', [
`<<${req.type}>>`, `<<${req.type}>>`,
`${req.name}` `${req.name}`,
]); ]);
nodes.push(titleNodeInfo.titleNode); nodes.push(titleNodeInfo.titleNode);
@ -233,7 +229,7 @@ export const drawReqs = (reqs, graph, svgNode) => {
`Id: ${req.id}`, `Id: ${req.id}`,
`Text: ${req.text}`, `Text: ${req.text}`,
`Risk: ${req.risk}`, `Risk: ${req.risk}`,
`Verification: ${req.verifyMethod}` `Verification: ${req.verifyMethod}`,
], ],
titleNodeInfo.y titleNodeInfo.y
); );
@ -247,13 +243,13 @@ export const drawReqs = (reqs, graph, svgNode) => {
width: rectBBox.width, width: rectBBox.width,
height: rectBBox.height, height: rectBBox.height,
shape: 'rect', shape: 'rect',
id: reqName id: reqName,
}); });
}); });
}; };
export const drawElements = (els, graph, svgNode) => { export const drawElements = (els, graph, svgNode) => {
Object.keys(els).forEach(elName => { Object.keys(els).forEach((elName) => {
let el = els[elName]; let el = els[elName];
const id = elementString(elName); const id = elementString(elName);
@ -283,13 +279,13 @@ export const drawElements = (els, graph, svgNode) => {
width: rectBBox.width, width: rectBBox.width,
height: rectBBox.height, height: rectBBox.height,
shape: 'rect', shape: 'rect',
id: id id: id,
}); });
}); });
}; };
const addRelationships = (relationships, g) => { const addRelationships = (relationships, g) => {
relationships.forEach(function(r) { relationships.forEach(function (r) {
let src = elementString(r.src); let src = elementString(r.src);
let dst = elementString(r.dst); let dst = elementString(r.dst);
g.setEdge(src, dst, { relationship: r }); g.setEdge(src, dst, { relationship: r });
@ -297,8 +293,8 @@ const addRelationships = (relationships, g) => {
return relationships; return relationships;
}; };
const adjustEntities = function(svgNode, graph) { const adjustEntities = function (svgNode, graph) {
graph.nodes().forEach(function(v) { graph.nodes().forEach(function (v) {
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') { if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
svgNode.select('#' + v); svgNode.select('#' + v);
svgNode svgNode
@ -316,7 +312,7 @@ const adjustEntities = function(svgNode, graph) {
return; return;
}; };
const elementString = str => { const elementString = (str) => {
return str.replace(/\s/g, '').replace(/\./g, '_'); return str.replace(/\s/g, '').replace(/\./g, '_');
}; };
@ -331,7 +327,7 @@ export const draw = (text, id) => {
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: false, multigraph: false,
compound: false, compound: false,
directed: true directed: true,
}) })
.setGraph({ .setGraph({
rankdir: conf.layoutDirection, rankdir: conf.layoutDirection,
@ -339,9 +335,9 @@ export const draw = (text, id) => {
marginy: 20, marginy: 20,
nodesep: 100, nodesep: 100,
edgesep: 100, edgesep: 100,
ranksep: 100 ranksep: 100,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -355,7 +351,7 @@ export const draw = (text, id) => {
dagre.layout(g); dagre.layout(g);
adjustEntities(svg, g); adjustEntities(svg, g);
relationships.forEach(function(rel) { relationships.forEach(function (rel) {
drawRelationshipFromLayout(svg, rel, g, id); drawRelationshipFromLayout(svg, rel, g, id);
}); });
@ -372,5 +368,5 @@ export const draw = (text, id) => {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => ` const getStyles = (options) => `
marker { marker {
fill: ${options.relationColor}; fill: ${options.relationColor};

View File

@ -11,11 +11,11 @@ let titleWrapped = false;
let sequenceNumbersEnabled = false; let sequenceNumbersEnabled = false;
let wrapEnabled = false; let wrapEnabled = false;
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
export const addActor = function(id, name, description) { export const addActor = function (id, name, description) {
// Don't allow description nulling // Don't allow description nulling
const old = actors[id]; const old = actors[id];
if (old && name === old.name && description == null) return; if (old && name === old.name && description == null) return;
@ -29,7 +29,7 @@ export const addActor = function(id, name, description) {
name: name, name: name,
description: description.text, description: description.text,
wrap: (description.wrap === undefined && autoWrap()) || !!description.wrap, wrap: (description.wrap === undefined && autoWrap()) || !!description.wrap,
prevActor: prevActor prevActor: prevActor,
}; };
if (prevActor && actors[prevActor]) { if (prevActor && actors[prevActor]) {
actors[prevActor].nextActor = id; actors[prevActor].nextActor = id;
@ -38,7 +38,7 @@ export const addActor = function(id, name, description) {
prevActor = id; prevActor = id;
}; };
const activationCount = part => { const activationCount = (part) => {
let i; let i;
let count = 0; let count = 0;
for (i = 0; i < messages.length; i++) { for (i = 0; i < messages.length; i++) {
@ -56,17 +56,17 @@ const activationCount = part => {
return count; return count;
}; };
export const addMessage = function(idFrom, idTo, message, answer) { export const addMessage = function (idFrom, idTo, message, answer) {
messages.push({ messages.push({
from: idFrom, from: idFrom,
to: idTo, to: idTo,
message: message.text, message: message.text,
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap, wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
answer: answer answer: answer,
}); });
}; };
export const addSignal = function( export const addSignal = function (
idFrom, idFrom,
idTo, idTo,
message = { text: undefined, wrap: undefined }, message = { text: undefined, wrap: undefined },
@ -82,7 +82,7 @@ export const addSignal = function(
token: '->>-', token: '->>-',
line: '1', line: '1',
loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 }, loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
expected: ["'ACTIVE_PARTICIPANT'"] expected: ["'ACTIVE_PARTICIPANT'"],
}; };
throw error; throw error;
} }
@ -92,47 +92,47 @@ export const addSignal = function(
to: idTo, to: idTo,
message: message.text, message: message.text,
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap, wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
type: messageType type: messageType,
}); });
return true; return true;
}; };
export const getMessages = function() { export const getMessages = function () {
return messages; return messages;
}; };
export const getActors = function() { export const getActors = function () {
return actors; return actors;
}; };
export const getActor = function(id) { export const getActor = function (id) {
return actors[id]; return actors[id];
}; };
export const getActorKeys = function() { export const getActorKeys = function () {
return Object.keys(actors); return Object.keys(actors);
}; };
export const getTitle = function() { export const getTitle = function () {
return title; return title;
}; };
export const getTitleWrapped = function() { export const getTitleWrapped = function () {
return titleWrapped; return titleWrapped;
}; };
export const enableSequenceNumbers = function() { export const enableSequenceNumbers = function () {
sequenceNumbersEnabled = true; sequenceNumbersEnabled = true;
}; };
export const showSequenceNumbers = () => sequenceNumbersEnabled; export const showSequenceNumbers = () => sequenceNumbersEnabled;
export const setWrap = function(wrapSetting) { export const setWrap = function (wrapSetting) {
wrapEnabled = wrapSetting; wrapEnabled = wrapSetting;
}; };
export const autoWrap = () => wrapEnabled; export const autoWrap = () => wrapEnabled;
export const clear = function() { export const clear = function () {
actors = {}; actors = {};
messages = []; messages = [];
}; };
export const parseMessage = function(str) { export const parseMessage = function (str) {
const _str = str.trim(); const _str = str.trim();
const message = { const message = {
text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(), text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
@ -141,7 +141,7 @@ export const parseMessage = function(str) {
? true ? true
: _str.match(/^[:]?nowrap:/) !== null : _str.match(/^[:]?nowrap:/) !== null
? false ? false
: undefined : undefined,
}; };
log.debug('parseMessage:', message); log.debug('parseMessage:', message);
return message; return message;
@ -170,26 +170,26 @@ export const LINETYPE = {
RECT_START: 22, RECT_START: 22,
RECT_END: 23, RECT_END: 23,
SOLID_POINT: 24, SOLID_POINT: 24,
DOTTED_POINT: 25 DOTTED_POINT: 25,
}; };
export const ARROWTYPE = { export const ARROWTYPE = {
FILLED: 0, FILLED: 0,
OPEN: 1 OPEN: 1,
}; };
export const PLACEMENT = { export const PLACEMENT = {
LEFTOF: 0, LEFTOF: 0,
RIGHTOF: 1, RIGHTOF: 1,
OVER: 2 OVER: 2,
}; };
export const addNote = function(actor, placement, message) { export const addNote = function (actor, placement, message) {
const note = { const note = {
actor: actor, actor: actor,
placement: placement, placement: placement,
message: message.text, message: message.text,
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
}; };
// Coerce actor into a [to, from, ...] array // Coerce actor into a [to, from, ...] array
@ -202,18 +202,18 @@ export const addNote = function(actor, placement, message) {
message: message.text, message: message.text,
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap, wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
type: LINETYPE.NOTE, type: LINETYPE.NOTE,
placement: placement placement: placement,
}); });
}; };
export const setTitle = function(titleWrap) { export const setTitle = function (titleWrap) {
title = titleWrap.text; title = titleWrap.text;
titleWrapped = (titleWrap.wrap === undefined && autoWrap()) || !!titleWrap.wrap; titleWrapped = (titleWrap.wrap === undefined && autoWrap()) || !!titleWrap.wrap;
}; };
export const apply = function(param) { export const apply = function (param) {
if (param instanceof Array) { if (param instanceof Array) {
param.forEach(function(item) { param.forEach(function (item) {
apply(item); apply(item);
}); });
} else { } else {
@ -299,5 +299,5 @@ export default {
PLACEMENT, PLACEMENT,
addNote, addNote,
setTitle, setTitle,
apply apply,
}; };

View File

@ -16,65 +16,65 @@ export const bounds = {
startx: undefined, startx: undefined,
stopx: undefined, stopx: undefined,
starty: undefined, starty: undefined,
stopy: undefined stopy: undefined,
}, },
verticalPos: 0, verticalPos: 0,
sequenceItems: [], sequenceItems: [],
activations: [], activations: [],
models: { models: {
getHeight: function() { getHeight: function () {
return ( return (
Math.max.apply( Math.max.apply(
null, null,
this.actors.length === 0 ? [0] : this.actors.map(actor => actor.height || 0) this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0)
) + ) +
(this.loops.length === 0 (this.loops.length === 0
? 0 ? 0
: this.loops.map(it => it.height || 0).reduce((acc, h) => acc + h)) + : this.loops.map((it) => it.height || 0).reduce((acc, h) => acc + h)) +
(this.messages.length === 0 (this.messages.length === 0
? 0 ? 0
: this.messages.map(it => it.height || 0).reduce((acc, h) => acc + h)) + : this.messages.map((it) => it.height || 0).reduce((acc, h) => acc + h)) +
(this.notes.length === 0 (this.notes.length === 0
? 0 ? 0
: this.notes.map(it => it.height || 0).reduce((acc, h) => acc + h)) : this.notes.map((it) => it.height || 0).reduce((acc, h) => acc + h))
); );
}, },
clear: function() { clear: function () {
this.actors = []; this.actors = [];
this.loops = []; this.loops = [];
this.messages = []; this.messages = [];
this.notes = []; this.notes = [];
}, },
addActor: function(actorModel) { addActor: function (actorModel) {
this.actors.push(actorModel); this.actors.push(actorModel);
}, },
addLoop: function(loopModel) { addLoop: function (loopModel) {
this.loops.push(loopModel); this.loops.push(loopModel);
}, },
addMessage: function(msgModel) { addMessage: function (msgModel) {
this.messages.push(msgModel); this.messages.push(msgModel);
}, },
addNote: function(noteModel) { addNote: function (noteModel) {
this.notes.push(noteModel); this.notes.push(noteModel);
}, },
lastActor: function() { lastActor: function () {
return this.actors[this.actors.length - 1]; return this.actors[this.actors.length - 1];
}, },
lastLoop: function() { lastLoop: function () {
return this.loops[this.loops.length - 1]; return this.loops[this.loops.length - 1];
}, },
lastMessage: function() { lastMessage: function () {
return this.messages[this.messages.length - 1]; return this.messages[this.messages.length - 1];
}, },
lastNote: function() { lastNote: function () {
return this.notes[this.notes.length - 1]; return this.notes[this.notes.length - 1];
}, },
actors: [], actors: [],
loops: [], loops: [],
messages: [], messages: [],
notes: [] notes: [],
}, },
init: function() { init: function () {
this.sequenceItems = []; this.sequenceItems = [];
this.activations = []; this.activations = [];
this.models.clear(); this.models.clear();
@ -82,19 +82,19 @@ export const bounds = {
startx: undefined, startx: undefined,
stopx: undefined, stopx: undefined,
starty: undefined, starty: undefined,
stopy: undefined stopy: undefined,
}; };
this.verticalPos = 0; this.verticalPos = 0;
setConf(parser.yy.getConfig()); setConf(parser.yy.getConfig());
}, },
updateVal: function(obj, key, val, fun) { updateVal: function (obj, key, val, fun) {
if (typeof obj[key] === 'undefined') { if (typeof obj[key] === 'undefined') {
obj[key] = val; obj[key] = val;
} else { } else {
obj[key] = fun(val, obj[key]); obj[key] = fun(val, obj[key]);
} }
}, },
updateBounds: function(startx, starty, stopx, stopy) { updateBounds: function (startx, starty, stopx, stopy) {
const _self = this; const _self = this;
let cnt = 0; let cnt = 0;
function updateFn(type) { function updateFn(type) {
@ -122,7 +122,7 @@ export const bounds = {
this.sequenceItems.forEach(updateFn()); this.sequenceItems.forEach(updateFn());
this.activations.forEach(updateFn('activation')); this.activations.forEach(updateFn('activation'));
}, },
insert: function(startx, starty, stopx, stopy) { insert: function (startx, starty, stopx, stopy) {
const _startx = Math.min(startx, stopx); const _startx = Math.min(startx, stopx);
const _stopx = Math.max(startx, stopx); const _stopx = Math.max(startx, stopx);
const _starty = Math.min(starty, stopy); const _starty = Math.min(starty, stopy);
@ -135,7 +135,7 @@ export const bounds = {
this.updateBounds(_startx, _starty, _stopx, _stopy); this.updateBounds(_startx, _starty, _stopx, _stopy);
}, },
newActivation: function(message, diagram, actors) { newActivation: function (message, diagram, actors) {
const actorRect = actors[message.from.actor]; const actorRect = actors[message.from.actor];
const stackedSize = actorActivations(message.from.actor).length || 0; const stackedSize = actorActivations(message.from.actor).length || 0;
const x = actorRect.x + actorRect.width / 2 + ((stackedSize - 1) * conf.activationWidth) / 2; const x = actorRect.x + actorRect.width / 2 + ((stackedSize - 1) * conf.activationWidth) / 2;
@ -145,19 +145,19 @@ export const bounds = {
stopx: x + conf.activationWidth, stopx: x + conf.activationWidth,
stopy: undefined, stopy: undefined,
actor: message.from.actor, actor: message.from.actor,
anchored: svgDraw.anchorElement(diagram) anchored: svgDraw.anchorElement(diagram),
}); });
}, },
endActivation: function(message) { endActivation: function (message) {
// find most recent activation for given actor // find most recent activation for given actor
const lastActorActivationIdx = this.activations const lastActorActivationIdx = this.activations
.map(function(activation) { .map(function (activation) {
return activation.actor; return activation.actor;
}) })
.lastIndexOf(message.from.actor); .lastIndexOf(message.from.actor);
return this.activations.splice(lastActorActivationIdx, 1)[0]; return this.activations.splice(lastActorActivationIdx, 1)[0];
}, },
createLoop: function(title = { message: undefined, wrap: false, width: undefined }, fill) { createLoop: function (title = { message: undefined, wrap: false, width: undefined }, fill) {
return { return {
startx: undefined, startx: undefined,
starty: this.verticalPos, starty: this.verticalPos,
@ -167,16 +167,16 @@ export const bounds = {
wrap: title.wrap, wrap: title.wrap,
width: title.width, width: title.width,
height: 0, height: 0,
fill: fill fill: fill,
}; };
}, },
newLoop: function(title = { message: undefined, wrap: false, width: undefined }, fill) { newLoop: function (title = { message: undefined, wrap: false, width: undefined }, fill) {
this.sequenceItems.push(this.createLoop(title, fill)); this.sequenceItems.push(this.createLoop(title, fill));
}, },
endLoop: function() { endLoop: function () {
return this.sequenceItems.pop(); return this.sequenceItems.pop();
}, },
addSectionToLoop: function(message) { addSectionToLoop: function (message) {
const loop = this.sequenceItems.pop(); const loop = this.sequenceItems.pop();
loop.sections = loop.sections || []; loop.sections = loop.sections || [];
loop.sectionTitles = loop.sectionTitles || []; loop.sectionTitles = loop.sectionTitles || [];
@ -184,16 +184,16 @@ export const bounds = {
loop.sectionTitles.push(message); loop.sectionTitles.push(message);
this.sequenceItems.push(loop); this.sequenceItems.push(loop);
}, },
bumpVerticalPos: function(bump) { bumpVerticalPos: function (bump) {
this.verticalPos = this.verticalPos + bump; this.verticalPos = this.verticalPos + bump;
this.data.stopy = this.verticalPos; this.data.stopy = this.verticalPos;
}, },
getVerticalPos: function() { getVerticalPos: function () {
return this.verticalPos; return this.verticalPos;
}, },
getBounds: function() { getBounds: function () {
return { bounds: this.data, models: this.models }; return { bounds: this.data, models: this.models };
} },
}; };
/** /**
@ -201,7 +201,7 @@ export const bounds = {
* @param elem - The diagram to draw to. * @param elem - The diagram to draw to.
* @param noteModel:{x: number, y: number, message: string, width: number} - 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 noteModel:{x: number, y: number, message: string, width: number} - 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) { const drawNote = function (elem, noteModel) {
bounds.bumpVerticalPos(conf.boxMargin); bounds.bumpVerticalPos(conf.boxMargin);
noteModel.height = conf.boxMargin; noteModel.height = conf.boxMargin;
noteModel.starty = bounds.getVerticalPos(); noteModel.starty = bounds.getVerticalPos();
@ -230,7 +230,9 @@ const drawNote = function(elem, noteModel) {
let textElem = drawText(g, textObj); let textElem = drawText(g, textObj);
let textHeight = Math.round( let textHeight = Math.round(
textElem.map(te => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr) textElem
.map((te) => (te._groups || te)[0][0].getBBox().height)
.reduce((acc, curr) => acc + curr)
); );
rectElem.attr('height', textHeight + 2 * conf.noteMargin); rectElem.attr('height', textHeight + 2 * conf.noteMargin);
@ -242,25 +244,25 @@ const drawNote = function(elem, noteModel) {
bounds.models.addNote(noteModel); bounds.models.addNote(noteModel);
}; };
const messageFont = cnf => { const messageFont = (cnf) => {
return { return {
fontFamily: cnf.messageFontFamily, fontFamily: cnf.messageFontFamily,
fontSize: cnf.messageFontSize, fontSize: cnf.messageFontSize,
fontWeight: cnf.messageFontWeight fontWeight: cnf.messageFontWeight,
}; };
}; };
const noteFont = cnf => { const noteFont = (cnf) => {
return { return {
fontFamily: cnf.noteFontFamily, fontFamily: cnf.noteFontFamily,
fontSize: cnf.noteFontSize, fontSize: cnf.noteFontSize,
fontWeight: cnf.noteFontWeight fontWeight: cnf.noteFontWeight,
}; };
}; };
const actorFont = cnf => { const actorFont = (cnf) => {
return { return {
fontFamily: cnf.actorFontFamily, fontFamily: cnf.actorFontFamily,
fontSize: cnf.actorFontSize, fontSize: cnf.actorFontSize,
fontWeight: cnf.actorFontWeight fontWeight: cnf.actorFontWeight,
}; };
}; };
@ -269,7 +271,7 @@ const actorFont = cnf => {
* @param g - the parent of the message element * @param g - the parent of the message element
* @param msgModel - the model containing fields describing a message * @param msgModel - the model containing fields describing a message
*/ */
const drawMessage = function(g, msgModel) { const drawMessage = function (g, msgModel) {
bounds.bumpVerticalPos(10); bounds.bumpVerticalPos(10);
const { startx, stopx, starty, message, type, sequenceIndex } = msgModel; const { startx, stopx, starty, message, type, sequenceIndex } = msgModel;
const lines = common.splitBreaks(message).length; const lines = common.splitBreaks(message).length;
@ -307,8 +309,9 @@ const drawMessage = function(g, msgModel) {
.append('path') .append('path')
.attr( .attr(
'd', 'd',
`M ${startx},${lineStarty} H ${startx + `M ${startx},${lineStarty} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${
Math.max(conf.width / 2, textWidth / 2)} V ${lineStarty + 25} H ${startx}` lineStarty + 25
} H ${startx}`
); );
} else { } else {
totalOffset += conf.boxMargin; totalOffset += conf.boxMargin;
@ -414,7 +417,7 @@ const drawMessage = function(g, msgModel) {
bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy); bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
}; };
export const drawActors = function(diagram, actors, actorKeys, verticalPos) { export const drawActors = function (diagram, actors, actorKeys, verticalPos) {
// Draw the actors // Draw the actors
let prevWidth = 0; let prevWidth = 0;
let prevMargin = 0; let prevMargin = 0;
@ -443,7 +446,7 @@ export const drawActors = function(diagram, actors, actorKeys, verticalPos) {
bounds.bumpVerticalPos(conf.height); bounds.bumpVerticalPos(conf.height);
}; };
export const setConf = function(cnf) { export const setConf = function (cnf) {
assignWithDepth(conf, cnf); assignWithDepth(conf, cnf);
if (cnf.fontFamily) { if (cnf.fontFamily) {
@ -457,21 +460,21 @@ export const setConf = function(cnf) {
} }
}; };
const actorActivations = function(actor) { const actorActivations = function (actor) {
return bounds.activations.filter(function(activation) { return bounds.activations.filter(function (activation) {
return activation.actor === actor; return activation.actor === actor;
}); });
}; };
const activationBounds = function(actor, actors) { const activationBounds = function (actor, actors) {
// handle multiple stacked activations for same actor // handle multiple stacked activations for same actor
const actorObj = actors[actor]; const actorObj = actors[actor];
const activations = actorActivations(actor); const activations = actorActivations(actor);
const left = activations.reduce(function(acc, activation) { const left = activations.reduce(function (acc, activation) {
return Math.min(acc, activation.startx); return Math.min(acc, activation.startx);
}, actorObj.x + actorObj.width / 2); }, actorObj.x + actorObj.width / 2);
const right = activations.reduce(function(acc, activation) { const right = activations.reduce(function (acc, activation) {
return Math.max(acc, activation.stopx); return Math.max(acc, activation.stopx);
}, actorObj.x + actorObj.width / 2); }, actorObj.x + actorObj.width / 2);
return [left, right]; return [left, right];
@ -502,7 +505,7 @@ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoop
* @param text * @param text
* @param id * @param id
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
conf = configApi.getConfig().sequence; conf = configApi.getConfig().sequence;
parser.yy.clear(); parser.yy.clear();
parser.yy.setWrap(conf.wrap); parser.yy.setWrap(conf.wrap);
@ -549,7 +552,7 @@ export const draw = function(text, id) {
// Draw the messages/signals // Draw the messages/signals
let sequenceIndex = 1; let sequenceIndex = 1;
messages.forEach(function(msg) { messages.forEach(function (msg) {
let loopModel, noteModel, msgModel; let loopModel, noteModel, msgModel;
switch (msg.type) { switch (msg.type) {
@ -569,7 +572,7 @@ export const draw = function(text, id) {
msg, msg,
conf.boxMargin, conf.boxMargin,
conf.boxMargin + conf.boxTextMargin, conf.boxMargin + conf.boxTextMargin,
message => bounds.newLoop(message) (message) => bounds.newLoop(message)
); );
break; break;
case parser.yy.LINETYPE.LOOP_END: case parser.yy.LINETYPE.LOOP_END:
@ -579,7 +582,7 @@ export const draw = function(text, id) {
bounds.models.addLoop(loopModel); bounds.models.addLoop(loopModel);
break; break;
case parser.yy.LINETYPE.RECT_START: case parser.yy.LINETYPE.RECT_START:
adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, message => adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, (message) =>
bounds.newLoop(undefined, message.message) bounds.newLoop(undefined, message.message)
); );
break; break;
@ -595,7 +598,7 @@ export const draw = function(text, id) {
msg, msg,
conf.boxMargin, conf.boxMargin,
conf.boxMargin + conf.boxTextMargin, conf.boxMargin + conf.boxTextMargin,
message => bounds.newLoop(message) (message) => bounds.newLoop(message)
); );
break; break;
case parser.yy.LINETYPE.OPT_END: case parser.yy.LINETYPE.OPT_END:
@ -610,7 +613,7 @@ export const draw = function(text, id) {
msg, msg,
conf.boxMargin, conf.boxMargin,
conf.boxMargin + conf.boxTextMargin, conf.boxMargin + conf.boxTextMargin,
message => bounds.newLoop(message) (message) => bounds.newLoop(message)
); );
break; break;
case parser.yy.LINETYPE.ALT_ELSE: case parser.yy.LINETYPE.ALT_ELSE:
@ -619,7 +622,7 @@ export const draw = function(text, id) {
msg, msg,
conf.boxMargin + conf.boxTextMargin, conf.boxMargin + conf.boxTextMargin,
conf.boxMargin, conf.boxMargin,
message => bounds.addSectionToLoop(message) (message) => bounds.addSectionToLoop(message)
); );
break; break;
case parser.yy.LINETYPE.ALT_END: case parser.yy.LINETYPE.ALT_END:
@ -634,7 +637,7 @@ export const draw = function(text, id) {
msg, msg,
conf.boxMargin, conf.boxMargin,
conf.boxMargin + conf.boxTextMargin, conf.boxMargin + conf.boxTextMargin,
message => bounds.newLoop(message) (message) => bounds.newLoop(message)
); );
break; break;
case parser.yy.LINETYPE.PAR_AND: case parser.yy.LINETYPE.PAR_AND:
@ -643,7 +646,7 @@ export const draw = function(text, id) {
msg, msg,
conf.boxMargin + conf.boxTextMargin, conf.boxMargin + conf.boxTextMargin,
conf.boxMargin, conf.boxMargin,
message => bounds.addSectionToLoop(message) (message) => bounds.addSectionToLoop(message)
); );
break; break;
case parser.yy.LINETYPE.PAR_END: case parser.yy.LINETYPE.PAR_END:
@ -674,7 +677,7 @@ export const draw = function(text, id) {
parser.yy.LINETYPE.SOLID_CROSS, parser.yy.LINETYPE.SOLID_CROSS,
parser.yy.LINETYPE.DOTTED_CROSS, parser.yy.LINETYPE.DOTTED_CROSS,
parser.yy.LINETYPE.SOLID_POINT, parser.yy.LINETYPE.SOLID_POINT,
parser.yy.LINETYPE.DOTTED_POINT parser.yy.LINETYPE.DOTTED_POINT,
].includes(msg.type) ].includes(msg.type)
) { ) {
sequenceIndex++; sequenceIndex++;
@ -736,10 +739,10 @@ export const draw = function(text, id) {
* @param actors - The actors map * @param actors - The actors map
* @param messages - A list of message objects to iterate * @param messages - A list of message objects to iterate
*/ */
const getMaxMessageWidthPerActor = function(actors, messages) { const getMaxMessageWidthPerActor = function (actors, messages) {
const maxMessageWidthPerActor = {}; const maxMessageWidthPerActor = {};
messages.forEach(function(msg) { messages.forEach(function (msg) {
if (actors[msg.to] && actors[msg.from]) { if (actors[msg.to] && actors[msg.from]) {
const actor = actors[msg.to]; const actor = actors[msg.to];
@ -841,9 +844,9 @@ const getMaxMessageWidthPerActor = function(actors, messages) {
* @param actors - The actors map to calculate margins for * @param actors - The actors map to calculate margins for
* @param actorToMessageWidth - A map of actor key -> max message width it holds * @param actorToMessageWidth - A map of actor key -> max message width it holds
*/ */
const calculateActorMargins = function(actors, actorToMessageWidth) { const calculateActorMargins = function (actors, actorToMessageWidth) {
let maxHeight = 0; let maxHeight = 0;
Object.keys(actors).forEach(prop => { Object.keys(actors).forEach((prop) => {
const actor = actors[prop]; const actor = actors[prop];
if (actor.wrap) { if (actor.wrap) {
actor.description = utils.wrapLabel( actor.description = utils.wrapLabel(
@ -884,7 +887,7 @@ const calculateActorMargins = function(actors, actorToMessageWidth) {
return Math.max(maxHeight, conf.height); return Math.max(maxHeight, conf.height);
}; };
const buildNoteModel = function(msg, actors) { const buildNoteModel = function (msg, actors) {
let startx = actors[msg.from].x; let startx = actors[msg.from].x;
let stopx = actors[msg.to].x; let stopx = actors[msg.to].x;
let shouldWrap = msg.wrap && msg.message; let shouldWrap = msg.wrap && msg.message;
@ -902,7 +905,7 @@ const buildNoteModel = function(msg, actors) {
stopx: 0, stopx: 0,
starty: 0, starty: 0,
stopy: 0, stopy: 0,
message: msg.message message: msg.message,
}; };
if (msg.placement === parser.yy.PLACEMENT.RIGHTOF) { if (msg.placement === parser.yy.PLACEMENT.RIGHTOF) {
noteModel.width = shouldWrap noteModel.width = shouldWrap
@ -953,7 +956,7 @@ const buildNoteModel = function(msg, actors) {
return noteModel; return noteModel;
}; };
const buildMessageModel = function(msg, actors) { const buildMessageModel = function (msg, actors) {
let process = false; let process = false;
if ( if (
[ [
@ -964,7 +967,7 @@ const buildMessageModel = function(msg, actors) {
parser.yy.LINETYPE.SOLID_CROSS, parser.yy.LINETYPE.SOLID_CROSS,
parser.yy.LINETYPE.DOTTED_CROSS, parser.yy.LINETYPE.DOTTED_CROSS,
parser.yy.LINETYPE.SOLID_POINT, parser.yy.LINETYPE.SOLID_POINT,
parser.yy.LINETYPE.DOTTED_POINT parser.yy.LINETYPE.DOTTED_POINT,
].includes(msg.type) ].includes(msg.type)
) { ) {
process = true; process = true;
@ -1002,16 +1005,16 @@ const buildMessageModel = function(msg, actors) {
type: msg.type, type: msg.type,
wrap: msg.wrap, wrap: msg.wrap,
fromBounds: Math.min.apply(null, allBounds), fromBounds: Math.min.apply(null, allBounds),
toBounds: Math.max.apply(null, allBounds) toBounds: Math.max.apply(null, allBounds),
}; };
}; };
const calculateLoopBounds = function(messages, actors) { const calculateLoopBounds = function (messages, actors) {
const loops = {}; const loops = {};
const stack = []; const stack = [];
let current, noteModel, msgModel; let current, noteModel, msgModel;
messages.forEach(function(msg) { messages.forEach(function (msg) {
msg.id = utils.random({ length: 10 }); msg.id = utils.random({ length: 10 });
switch (msg.type) { switch (msg.type) {
case parser.yy.LINETYPE.LOOP_START: case parser.yy.LINETYPE.LOOP_START:
@ -1023,7 +1026,7 @@ const calculateLoopBounds = function(messages, actors) {
msg: msg.message, msg: msg.message,
from: Number.MAX_SAFE_INTEGER, from: Number.MAX_SAFE_INTEGER,
to: Number.MIN_SAFE_INTEGER, to: Number.MIN_SAFE_INTEGER,
width: 0 width: 0,
}); });
break; break;
case parser.yy.LINETYPE.ALT_ELSE: case parser.yy.LINETYPE.ALT_ELSE:
@ -1052,7 +1055,7 @@ const calculateLoopBounds = function(messages, actors) {
startx: x, startx: x,
stopx: x + conf.activationWidth, stopx: x + conf.activationWidth,
actor: msg.from.actor, actor: msg.from.actor,
enabled: true enabled: true,
}; };
bounds.activations.push(toAdd); bounds.activations.push(toAdd);
} }
@ -1060,7 +1063,7 @@ const calculateLoopBounds = function(messages, actors) {
case parser.yy.LINETYPE.ACTIVE_END: case parser.yy.LINETYPE.ACTIVE_END:
{ {
const lastActorActivationIdx = bounds.activations const lastActorActivationIdx = bounds.activations
.map(a => a.actor) .map((a) => a.actor)
.lastIndexOf(msg.from.actor); .lastIndexOf(msg.from.actor);
delete bounds.activations.splice(lastActorActivationIdx, 1)[0]; delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
} }
@ -1070,7 +1073,7 @@ const calculateLoopBounds = function(messages, actors) {
if (isNote) { if (isNote) {
noteModel = buildNoteModel(msg, actors); noteModel = buildNoteModel(msg, actors);
msg.noteModel = noteModel; msg.noteModel = noteModel;
stack.forEach(stk => { stack.forEach((stk) => {
current = stk; current = stk;
current.from = Math.min(current.from, noteModel.startx); current.from = Math.min(current.from, noteModel.startx);
current.to = Math.max(current.to, noteModel.startx + noteModel.width); current.to = Math.max(current.to, noteModel.startx + noteModel.width);
@ -1081,7 +1084,7 @@ const calculateLoopBounds = function(messages, actors) {
msgModel = buildMessageModel(msg, actors); msgModel = buildMessageModel(msg, actors);
msg.msgModel = msgModel; msg.msgModel = msgModel;
if (msgModel.startx && msgModel.stopx && stack.length > 0) { if (msgModel.startx && msgModel.stopx && stack.length > 0) {
stack.forEach(stk => { stack.forEach((stk) => {
current = stk; current = stk;
if (msgModel.startx === msgModel.stopx) { if (msgModel.startx === msgModel.stopx) {
let from = actors[msg.from]; let from = actors[msg.from];
@ -1112,5 +1115,5 @@ export default {
bounds, bounds,
drawActors, drawActors,
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
`.actor { `.actor {
stroke: ${options.actorBorder}; stroke: ${options.actorBorder};
fill: ${options.actorBkg}; fill: ${options.actorBkg};

View File

@ -1,6 +1,6 @@
import common from '../common/common'; import common from '../common/common';
export const drawRect = function(elem, rectData) { export const drawRect = function (elem, rectData) {
const rectElem = elem.append('rect'); const rectElem = elem.append('rect');
rectElem.attr('x', rectData.x); rectElem.attr('x', rectData.x);
rectElem.attr('y', rectData.y); rectElem.attr('y', rectData.y);
@ -18,7 +18,7 @@ export const drawRect = function(elem, rectData) {
return rectElem; return rectElem;
}; };
export const drawText = function(elem, textData) { export const drawText = function (elem, textData) {
let prevTextHeight = 0, let prevTextHeight = 0,
textHeight = 0; textHeight = 0;
const lines = textData.text.split(common.lineBreakRegex); const lines = textData.text.split(common.lineBreakRegex);
@ -146,7 +146,7 @@ export const drawText = function(elem, textData) {
return textElems; return textElems;
}; };
export const drawLabel = function(elem, txtObject) { export const drawLabel = function (elem, txtObject) {
function genPoints(x, y, width, height, cut) { function genPoints(x, y, width, height, cut) {
return ( return (
x + x +
@ -187,7 +187,7 @@ let actorCnt = -1;
* @param actor - The actor to draw. * @param actor - The actor to draw.
* @param conf - drawText implementation discriminator object * @param conf - drawText implementation discriminator object
*/ */
export const drawActor = function(elem, actor, conf) { export const drawActor = function (elem, actor, conf) {
const center = actor.x + actor.width / 2; const center = actor.x + actor.width / 2;
const g = elem.append('g'); const g = elem.append('g');
@ -227,7 +227,7 @@ export const drawActor = function(elem, actor, conf) {
); );
}; };
export const anchorElement = function(elem) { export const anchorElement = function (elem) {
return elem.append('g'); return elem.append('g');
}; };
/** /**
@ -238,7 +238,7 @@ export const anchorElement = function(elem) {
* @param conf - sequence diagram config object. * @param conf - sequence diagram config object.
* @param actorActivations - number of activations on the actor. * @param actorActivations - number of activations on the actor.
*/ */
export const drawActivation = function(elem, bounds, verticalPos, conf, actorActivations) { export const drawActivation = function (elem, bounds, verticalPos, conf, actorActivations) {
const rect = getNoteRect(); const rect = getNoteRect();
const g = bounds.anchored; const g = bounds.anchored;
rect.x = bounds.startx; rect.x = bounds.startx;
@ -256,7 +256,7 @@ export const drawActivation = function(elem, bounds, verticalPos, conf, actorAct
* @param labelText - Text within the loop. * @param labelText - Text within the loop.
* @param conf - diagrom configuration * @param conf - diagrom configuration
*/ */
export const drawLoop = function(elem, loopModel, labelText, conf) { export const drawLoop = function (elem, loopModel, labelText, conf) {
const { const {
boxMargin, boxMargin,
boxTextMargin, boxTextMargin,
@ -264,10 +264,10 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
labelBoxWidth, labelBoxWidth,
messageFontFamily: fontFamily, messageFontFamily: fontFamily,
messageFontSize: fontSize, messageFontSize: fontSize,
messageFontWeight: fontWeight messageFontWeight: fontWeight,
} = conf; } = conf;
const g = elem.append('g'); const g = elem.append('g');
const drawLoopLine = function(startx, starty, stopx, stopy) { const drawLoopLine = function (startx, starty, stopx, stopy) {
return g return g
.append('line') .append('line')
.attr('x1', startx) .attr('x1', startx)
@ -281,7 +281,7 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy); drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy); drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
if (typeof loopModel.sections !== 'undefined') { if (typeof loopModel.sections !== 'undefined') {
loopModel.sections.forEach(function(item) { loopModel.sections.forEach(function (item) {
drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style( drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
'stroke-dasharray', 'stroke-dasharray',
'3, 3' '3, 3'
@ -321,7 +321,7 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
let textElem = drawText(g, txt); let textElem = drawText(g, txt);
if (typeof loopModel.sectionTitles !== 'undefined') { if (typeof loopModel.sectionTitles !== 'undefined') {
loopModel.sectionTitles.forEach(function(item, idx) { loopModel.sectionTitles.forEach(function (item, idx) {
if (item.message) { if (item.message) {
txt.text = item.message; txt.text = item.message;
txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2; txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
@ -337,7 +337,7 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
textElem = drawText(g, txt); textElem = drawText(g, txt);
let sectionHeight = Math.round( let sectionHeight = Math.round(
textElem textElem
.map(te => (te._groups || te)[0][0].getBBox().height) .map((te) => (te._groups || te)[0][0].getBBox().height)
.reduce((acc, curr) => acc + curr) .reduce((acc, curr) => acc + curr)
); );
loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin); loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
@ -354,21 +354,21 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
* @param elem diagram (reference for bounds) * @param elem diagram (reference for bounds)
* @param bounds shape of the rectangle * @param bounds shape of the rectangle
*/ */
export const drawBackgroundRect = function(elem, bounds) { export const drawBackgroundRect = function (elem, bounds) {
const rectElem = drawRect(elem, { const rectElem = drawRect(elem, {
x: bounds.startx, x: bounds.startx,
y: bounds.starty, y: bounds.starty,
width: bounds.stopx - bounds.startx, width: bounds.stopx - bounds.startx,
height: bounds.stopy - bounds.starty, height: bounds.stopy - bounds.starty,
fill: bounds.fill, fill: bounds.fill,
class: 'rect' class: 'rect',
}); });
rectElem.lower(); rectElem.lower();
}; };
/** /**
* 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.
*/ */
export const insertArrowHead = function(elem) { export const insertArrowHead = function (elem) {
elem elem
.append('defs') .append('defs')
.append('marker') .append('marker')
@ -385,7 +385,7 @@ export const insertArrowHead = function(elem) {
/** /**
* 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.
*/ */
export const insertArrowFilledHead = function(elem) { export const insertArrowFilledHead = function (elem) {
elem elem
.append('defs') .append('defs')
.append('marker') .append('marker')
@ -401,7 +401,7 @@ export const insertArrowFilledHead = function(elem) {
/** /**
* Setup node number. The result is appended to the svg. * Setup node number. The result is appended to the svg.
*/ */
export const insertSequenceNumber = function(elem) { export const insertSequenceNumber = function (elem) {
elem elem
.append('defs') .append('defs')
.append('marker') .append('marker')
@ -420,7 +420,7 @@ export const insertSequenceNumber = function(elem) {
/** /**
* 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.
*/ */
export const insertArrowCrossHead = function(elem) { export const insertArrowCrossHead = function (elem) {
const defs = elem.append('defs'); const defs = elem.append('defs');
const marker = defs const marker = defs
.append('marker') .append('marker')
@ -451,7 +451,7 @@ export const insertArrowCrossHead = function(elem) {
// this is actual shape for arrowhead // this is actual shape for arrowhead
}; };
export const getTextObj = function() { export const getTextObj = function () {
return { return {
x: 0, x: 0,
y: 0, y: 0,
@ -464,11 +464,11 @@ export const getTextObj = function() {
rx: 0, rx: 0,
ry: 0, ry: 0,
tspan: true, tspan: true,
valign: undefined valign: undefined,
}; };
}; };
export const getNoteRect = function() { export const getNoteRect = function () {
return { return {
x: 0, x: 0,
y: 0, y: 0,
@ -478,11 +478,11 @@ export const getNoteRect = function() {
anchor: 'start', anchor: 'start',
height: 100, height: 100,
rx: 0, rx: 0,
ry: 0 ry: 0,
}; };
}; };
const _drawTextCandidateFunc = (function() { const _drawTextCandidateFunc = (function () {
function byText(content, g, x, y, width, height, textAttrs) { function byText(content, g, x, y, width, height, textAttrs) {
const text = g const text = g
.append('text') .append('text')
@ -556,7 +556,7 @@ const _drawTextCandidateFunc = (function() {
} }
} }
return function(conf) { return function (conf) {
return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan; return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
}; };
})(); })();
@ -575,5 +575,5 @@ export default {
insertSequenceNumber, insertSequenceNumber,
insertArrowCrossHead, insertArrowCrossHead,
getTextObj, getTextObj,
getNoteRect getNoteRect,
}; };

View File

@ -4,7 +4,7 @@ export const set = (key, val) => {
idCache[key] = val; idCache[key] = val;
}; };
export const get = k => idCache[k]; export const get = (k) => idCache[k];
export const keys = () => Object.keys(idCache); export const keys = () => Object.keys(idCache);
export const size = () => keys().length; export const size = () => keys().length;
@ -12,5 +12,5 @@ export default {
get, get,
set, set,
keys, keys,
size size,
}; };

View File

@ -11,7 +11,7 @@ import { log } from '../../logger';
/** /**
* Draws a start state as a black circle * Draws a start state as a black circle
*/ */
export const drawStartState = g => export const drawStartState = (g) =>
g g
.append('circle') .append('circle')
// .style('stroke', 'black') // .style('stroke', 'black')
@ -24,7 +24,7 @@ export const drawStartState = g =>
/** /**
* Draws a start state as a black circle * Draws a start state as a black circle
*/ */
export const drawDivider = g => export const drawDivider = (g) =>
g g
.append('line') .append('line')
.style('stroke', 'grey') .style('stroke', 'grey')
@ -64,7 +64,7 @@ export const drawSimpleState = (g, stateDef) => {
* @param {*} stateDef * @param {*} stateDef
*/ */
export const drawDescrState = (g, stateDef) => { export const drawDescrState = (g, stateDef) => {
const addTspan = function(textEl, txt, isFirst) { const addTspan = function (textEl, txt, isFirst) {
const tSpan = textEl const tSpan = textEl
.append('tspan') .append('tspan')
.attr('x', 2 * getConfig().state.padding) .attr('x', 2 * getConfig().state.padding)
@ -98,7 +98,7 @@ export const drawDescrState = (g, stateDef) => {
let isFirst = true; let isFirst = true;
let isSecond = true; let isSecond = true;
stateDef.descriptions.forEach(function(descr) { stateDef.descriptions.forEach(function (descr) {
if (!isFirst) { if (!isFirst) {
addTspan(description, descr, isSecond); addTspan(description, descr, isSecond);
isSecond = false; isSecond = false;
@ -239,7 +239,7 @@ export const addTitleAndBox = (g, stateDef, altBkg) => {
return g; return g;
}; };
const drawEndState = g => { const drawEndState = (g) => {
g.append('circle') g.append('circle')
// .style('stroke', 'black') // .style('stroke', 'black')
// .style('fill', 'white') // .style('fill', 'white')
@ -284,7 +284,7 @@ const drawForkJoinState = (g, stateDef) => {
.attr('y', getConfig().state.padding); .attr('y', getConfig().state.padding);
}; };
export const drawText = function(elem, textData) { export const drawText = function (elem, textData) {
// Remove and ignore br:s // Remove and ignore br:s
const nText = textData.text.replace(common.lineBreakRegex, ' '); const nText = textData.text.replace(common.lineBreakRegex, ' ');
@ -343,10 +343,7 @@ const _drawLongText = (_text, x, y, g) => {
export const drawNote = (text, g) => { export const drawNote = (text, g) => {
g.attr('class', 'state-note'); g.attr('class', 'state-note');
const note = g const note = g.append('rect').attr('x', 0).attr('y', getConfig().state.padding);
.append('rect')
.attr('x', 0)
.attr('y', getConfig().state.padding);
const rectElem = g.append('g'); const rectElem = g.append('g');
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem); const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
@ -363,19 +360,16 @@ export const drawNote = (text, g) => {
* @param {*} stateDef * @param {*} stateDef
*/ */
export const drawState = function(elem, stateDef) { export const drawState = function (elem, stateDef) {
const id = stateDef.id; const id = stateDef.id;
const stateInfo = { const stateInfo = {
id: id, id: id,
label: stateDef.id, label: stateDef.id,
width: 0, width: 0,
height: 0 height: 0,
}; };
const g = elem const g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
.append('g')
.attr('id', id)
.attr('class', 'stateGroup');
if (stateDef.type === 'start') drawStartState(g); if (stateDef.type === 'start') drawStartState(g);
if (stateDef.type === 'end') drawEndState(g); if (stateDef.type === 'end') drawEndState(g);
@ -396,8 +390,8 @@ export const drawState = function(elem, stateDef) {
}; };
let edgeCount = 0; let edgeCount = 0;
export const drawEdge = function(elem, path, relation) { export const drawEdge = function (elem, path, relation) {
const getRelationType = function(type) { const getRelationType = function (type) {
switch (type) { switch (type) {
case stateDb.relationType.AGGREGATION: case stateDb.relationType.AGGREGATION:
return 'aggregation'; return 'aggregation';
@ -410,17 +404,17 @@ export const drawEdge = function(elem, path, relation) {
} }
}; };
path.points = path.points.filter(p => !Number.isNaN(p.y)); path.points = path.points.filter((p) => !Number.isNaN(p.y));
// The data for our line // The data for our line
const lineData = path.points; const lineData = path.points;
// This is the accessor function we talked about above // This is the accessor function we talked about above
const lineFunction = line() const lineFunction = line()
.x(function(d) { .x(function (d) {
return d.x; return d.x;
}) })
.y(function(d) { .y(function (d) {
return d.y; return d.y;
}) })
.curve(curveBasis); .curve(curveBasis);

View File

@ -3,15 +3,15 @@ import { generateId } from '../../utils';
import mermaidAPI from '../../mermaidAPI'; import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config'; import * as configApi from '../../config';
const clone = o => JSON.parse(JSON.stringify(o)); const clone = (o) => JSON.parse(JSON.stringify(o));
let rootDoc = []; let rootDoc = [];
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
const setRootDoc = o => { const setRootDoc = (o) => {
log.info('Setting root doc', o); log.info('Setting root doc', o);
// rootDoc = { id: 'root', doc: o }; // rootDoc = { id: 'root', doc: o };
rootDoc = o; rootDoc = o;
@ -54,13 +54,13 @@ const docTranslator = (parent, node, first) => {
stmt: 'state', stmt: 'state',
id: generateId(), id: generateId(),
type: 'divider', type: 'divider',
doc: clone(currentDoc) doc: clone(currentDoc),
}; };
doc.push(clone(newNode)); doc.push(clone(newNode));
node.doc = doc; node.doc = doc;
} }
node.doc.forEach(docNode => docTranslator(node, docNode, true)); node.doc.forEach((docNode) => docTranslator(node, docNode, true));
} }
} }
}; };
@ -70,7 +70,7 @@ const getRootDocV2 = () => {
// Here // Here
}; };
const extract = _doc => { const extract = (_doc) => {
// const res = { states: [], relations: [] }; // const res = { states: [], relations: [] };
let doc; let doc;
if (_doc.doc) { if (_doc.doc) {
@ -87,7 +87,7 @@ const extract = _doc => {
log.info('Extract', doc); log.info('Extract', doc);
doc.forEach(item => { doc.forEach((item) => {
if (item.stmt === 'state') { if (item.stmt === 'state') {
addState(item.id, item.type, item.doc, item.description, item.note); addState(item.id, item.type, item.doc, item.description, item.note);
} }
@ -101,12 +101,12 @@ const newDoc = () => {
return { return {
relations: [], relations: [],
states: {}, states: {},
documents: {} documents: {},
}; };
}; };
let documents = { let documents = {
root: newDoc() root: newDoc(),
}; };
let currentDocument = documents.root; let currentDocument = documents.root;
@ -122,14 +122,14 @@ let endCnt = 0; // eslint-disable-line
* @param type * @param type
* @param style * @param style
*/ */
export const addState = function(id, type, doc, descr, note) { export const addState = function (id, type, doc, descr, note) {
if (typeof currentDocument.states[id] === 'undefined') { if (typeof currentDocument.states[id] === 'undefined') {
currentDocument.states[id] = { currentDocument.states[id] = {
id: id, id: id,
descriptions: [], descriptions: [],
type, type,
doc, doc,
note note,
}; };
} else { } else {
if (!currentDocument.states[id].doc) { if (!currentDocument.states[id].doc) {
@ -144,16 +144,16 @@ export const addState = function(id, type, doc, descr, note) {
if (typeof descr === 'string') addDescription(id, descr.trim()); if (typeof descr === 'string') addDescription(id, descr.trim());
if (typeof descr === 'object') { if (typeof descr === 'object') {
descr.forEach(des => addDescription(id, des.trim())); descr.forEach((des) => addDescription(id, des.trim()));
} }
} }
if (note) currentDocument.states[id].note = note; if (note) currentDocument.states[id].note = note;
}; };
export const clear = function() { export const clear = function () {
documents = { documents = {
root: newDoc() root: newDoc(),
}; };
currentDocument = documents.root; currentDocument = documents.root;
@ -164,21 +164,21 @@ export const clear = function() {
classes = []; classes = [];
}; };
export const getState = function(id) { export const getState = function (id) {
return currentDocument.states[id]; return currentDocument.states[id];
}; };
export const getStates = function() { export const getStates = function () {
return currentDocument.states; return currentDocument.states;
}; };
export const logDocuments = function() { export const logDocuments = function () {
log.info('Documents = ', documents); log.info('Documents = ', documents);
}; };
export const getRelations = function() { export const getRelations = function () {
return currentDocument.relations; return currentDocument.relations;
}; };
export const addRelation = function(_id1, _id2, title) { export const addRelation = function (_id1, _id2, title) {
let id1 = _id1; let id1 = _id1;
let id2 = _id2; let id2 = _id2;
let type1 = 'default'; let type1 = 'default';
@ -198,7 +198,7 @@ export const addRelation = function(_id1, _id2, title) {
currentDocument.relations.push({ id1, id2, title: title }); currentDocument.relations.push({ id1, id2, title: title });
}; };
const addDescription = function(id, _descr) { const addDescription = function (id, _descr) {
const theState = currentDocument.states[id]; const theState = currentDocument.states[id];
let descr = _descr; let descr = _descr;
if (descr[0] === ':') { if (descr[0] === ':') {
@ -208,7 +208,7 @@ const addDescription = function(id, _descr) {
theState.descriptions.push(descr); theState.descriptions.push(descr);
}; };
export const cleanupLabel = function(label) { export const cleanupLabel = function (label) {
if (label.substring(0, 1) === ':') { if (label.substring(0, 1) === ':') {
return label.substr(2).trim(); return label.substr(2).trim();
} else { } else {
@ -218,7 +218,7 @@ export const cleanupLabel = function(label) {
export const lineType = { export const lineType = {
LINE: 0, LINE: 0,
DOTTED_LINE: 1 DOTTED_LINE: 1,
}; };
let dividerCnt = 0; let dividerCnt = 0;
@ -233,7 +233,7 @@ const getClasses = () => classes;
let direction = 'TB'; let direction = 'TB';
const getDirection = () => direction; const getDirection = () => direction;
const setDirection = dir => { const setDirection = (dir) => {
direction = dir; direction = dir;
}; };
@ -241,10 +241,10 @@ export const relationType = {
AGGREGATION: 0, AGGREGATION: 0,
EXTENSION: 1, EXTENSION: 1,
COMPOSITION: 2, COMPOSITION: 2,
DEPENDENCY: 3 DEPENDENCY: 3,
}; };
const trimColon = str => (str && str[0] === ':' ? str.substr(1).trim() : str.trim()); const trimColon = (str) => (str && str[0] === ':' ? str.substr(1).trim() : str.trim());
export default { export default {
parseDirective, parseDirective,
@ -268,5 +268,5 @@ export default {
setRootDoc, setRootDoc,
getRootDocV2, getRootDocV2,
extract, extract,
trimColon trimColon,
}; };

View File

@ -9,7 +9,7 @@ import { log } from '../../logger';
import { configureSvgSize } from '../../utils'; import { configureSvgSize } from '../../utils';
const conf = {}; const conf = {};
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
conf[keys[i]] = cnf[keys[i]]; conf[keys[i]] = cnf[keys[i]];
@ -22,7 +22,7 @@ let nodeDb = {};
* Returns the all the styles from classDef statements in the graph definition. * Returns the all the styles from classDef statements in the graph definition.
* @returns {object} classDef styles * @returns {object} classDef styles
*/ */
export const getClasses = function(text) { export const getClasses = function (text) {
log.trace('Extracting classes'); log.trace('Extracting classes');
stateDb.clear(); stateDb.clear();
const parser = state.parser; const parser = state.parser;
@ -52,7 +52,7 @@ const setupNode = (g, parent, node, altFlag) => {
id: node.id, id: node.id,
shape, shape,
description: node.id, description: node.id,
classes: 'statediagram-state' classes: 'statediagram-state',
}; };
} }
@ -107,7 +107,7 @@ const setupNode = (g, parent, node, altFlag) => {
dir: nodeDb[node.id].dir, dir: nodeDb[node.id].dir,
domId: 'state-' + node.id + '-' + cnt, domId: 'state-' + node.id + '-' + cnt,
type: nodeDb[node.id].type, type: nodeDb[node.id].type,
padding: 15 //getConfig().flowchart.padding padding: 15, //getConfig().flowchart.padding
}; };
if (node.note) { if (node.note) {
@ -121,7 +121,7 @@ const setupNode = (g, parent, node, altFlag) => {
id: node.id + '----note-' + cnt, id: node.id + '----note-' + cnt,
domId: 'state-' + node.id + '----note-' + cnt, domId: 'state-' + node.id + '----note-' + cnt,
type: nodeDb[node.id].type, type: nodeDb[node.id].type,
padding: 15 //getConfig().flowchart.padding padding: 15, //getConfig().flowchart.padding
}; };
const groupData = { const groupData = {
labelStyle: '', labelStyle: '',
@ -132,7 +132,7 @@ const setupNode = (g, parent, node, altFlag) => {
id: node.id + '----parent', id: node.id + '----parent',
domId: 'state-' + node.id + '----parent-' + cnt, domId: 'state-' + node.id + '----parent-' + cnt,
type: 'group', type: 'group',
padding: 0 //getConfig().flowchart.padding padding: 0, //getConfig().flowchart.padding
}; };
cnt++; cnt++;
@ -160,7 +160,7 @@ const setupNode = (g, parent, node, altFlag) => {
arrowheadStyle: 'fill: #333', arrowheadStyle: 'fill: #333',
labelpos: 'c', labelpos: 'c',
labelType: 'text', labelType: 'text',
thickness: 'normal' thickness: 'normal',
}); });
} else { } else {
g.setNode(node.id, nodeData); g.setNode(node.id, nodeData);
@ -182,7 +182,7 @@ let cnt = 0;
const setupDoc = (g, parent, doc, altFlag) => { const setupDoc = (g, parent, doc, altFlag) => {
// cnt = 0; // cnt = 0;
log.trace('items', doc); log.trace('items', doc);
doc.forEach(item => { doc.forEach((item) => {
if (item.stmt === 'state' || item.stmt === 'default') { if (item.stmt === 'state' || item.stmt === 'default') {
setupNode(g, parent, item, altFlag); setupNode(g, parent, item, altFlag);
} else if (item.stmt === 'relation') { } else if (item.stmt === 'relation') {
@ -199,7 +199,7 @@ const setupDoc = (g, parent, doc, altFlag) => {
labelpos: 'c', labelpos: 'c',
labelType: 'text', labelType: 'text',
thickness: 'normal', thickness: 'normal',
classes: 'transition' classes: 'transition',
}; };
let startId = item.state1.id; let startId = item.state1.id;
let endId = item.state2.id; let endId = item.state2.id;
@ -226,7 +226,7 @@ const getDir = (nodes, defaultDir) => {
* @param text * @param text
* @param id * @param id
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
log.info('Drawing state diagram (v2)', id); log.info('Drawing state diagram (v2)', id);
stateDb.clear(); stateDb.clear();
nodeDb = {}; nodeDb = {};
@ -253,16 +253,16 @@ export const draw = function(text, id) {
// Create the input mermaid.graph // Create the input mermaid.graph
const g = new graphlib.Graph({ const g = new graphlib.Graph({
multigraph: true, multigraph: true,
compound: true compound: true,
}) })
.setGraph({ .setGraph({
rankdir: getDir(stateDb.getRootDocV2()), rankdir: getDir(stateDb.getRootDocV2()),
nodesep: nodeSpacing, nodesep: nodeSpacing,
ranksep: rankSpacing, ranksep: rankSpacing,
marginx: 8, marginx: 8,
marginy: 8 marginy: 8,
}) })
.setDefaultEdgeLabel(function() { .setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -317,5 +317,5 @@ export const draw = function(text, id) {
export default { export default {
setConf, setConf,
getClasses, getClasses,
draw draw,
}; };

View File

@ -17,14 +17,14 @@ let conf;
const transformationLog = {}; const transformationLog = {};
export const setConf = function() {}; export const setConf = function () {};
// Todo optimize // Todo optimize
/** /**
* 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.
*/ */
const insertMarkers = function(elem) { const insertMarkers = function (elem) {
elem elem
.append('defs') .append('defs')
.append('marker') .append('marker')
@ -43,7 +43,7 @@ const insertMarkers = function(elem) {
* @param text * @param text
* @param id * @param id
*/ */
export const draw = function(text, id) { export const draw = function (text, id) {
conf = getConfig().state; conf = getConfig().state;
parser.yy.clear(); parser.yy.clear();
parser.parse(text); parser.parse(text);
@ -58,12 +58,12 @@ export const draw = function(text, id) {
multigraph: true, multigraph: true,
compound: true, compound: true,
// acyclicer: 'greedy', // acyclicer: 'greedy',
rankdir: 'RL' rankdir: 'RL',
// ranksep: '20' // ranksep: '20'
}); });
// Default to assigning a new object as a label for each new edge. // Default to assigning a new object as a label for each new edge.
graph.setDefaultEdgeLabel(function() { graph.setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -85,7 +85,7 @@ export const draw = function(text, id) {
`${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + ' ' + height `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + ' ' + height
); );
}; };
const getLabelWidth = text => { const getLabelWidth = (text) => {
return text ? text.length * conf.fontSizeFactor : 1; return text ? text.length * conf.fontSizeFactor : 1;
}; };
@ -93,7 +93,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
// // Layout graph, Create a new directed graph // // Layout graph, Create a new directed graph
const graph = new graphlib.Graph({ const graph = new graphlib.Graph({
compound: true, compound: true,
multigraph: true multigraph: true,
}); });
let i; let i;
@ -115,7 +115,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
ranker: 'tight-tree', ranker: 'tight-tree',
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor, ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
nodeSep: edgeFreeDoc ? 1 : 50, nodeSep: edgeFreeDoc ? 1 : 50,
isMultiGraph: true isMultiGraph: true,
// ranksep: 5, // ranksep: 5,
// nodesep: 1 // nodesep: 1
}); });
@ -131,12 +131,12 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
nodeSep: edgeFreeDoc ? 1 : 50, nodeSep: edgeFreeDoc ? 1 : 50,
ranker: 'tight-tree', ranker: 'tight-tree',
// ranker: 'network-simplex' // ranker: 'network-simplex'
isMultiGraph: true isMultiGraph: true,
}); });
} }
// Default to assigning a new object as a label for each new edge. // Default to assigning a new object as a label for each new edge.
graph.setDefaultEdgeLabel(function() { graph.setDefaultEdgeLabel(function () {
return {}; return {};
}); });
@ -157,10 +157,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
let node; let node;
if (stateDef.doc) { if (stateDef.doc) {
let sub = diagram let sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
.append('g')
.attr('id', stateDef.id)
.attr('class', 'stateGroup');
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg); node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg);
if (first) { if (first) {
@ -187,7 +184,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
descriptions: [], descriptions: [],
id: stateDef.id + '-note', id: stateDef.id + '-note',
note: stateDef.note, note: stateDef.note,
type: 'note' type: 'note',
}; };
const note = drawState(diagram, noteDef, graph); const note = drawState(diagram, noteDef, graph);
@ -212,7 +209,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
log.debug('Count=', graph.nodeCount(), graph); log.debug('Count=', graph.nodeCount(), graph);
let cnt = 0; let cnt = 0;
relations.forEach(function(relation) { relations.forEach(function (relation) {
cnt++; cnt++;
log.debug('Setting edge', relation); log.debug('Setting edge', relation);
graph.setEdge( graph.setEdge(
@ -222,7 +219,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
relation: relation, relation: relation,
width: getLabelWidth(relation.title), width: getLabelWidth(relation.title),
height: conf.labelHeight * common.getRows(relation.title).length, height: conf.labelHeight * common.getRows(relation.title).length,
labelpos: 'c' labelpos: 'c',
}, },
'id' + cnt 'id' + cnt
); );
@ -233,7 +230,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
log.debug('Graph after layout', graph.nodes()); log.debug('Graph after layout', graph.nodes());
const svgElem = diagram.node(); const svgElem = diagram.node();
graph.nodes().forEach(function(v) { graph.nodes().forEach(function (v) {
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') { if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v))); log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
select('#' + svgElem.id + ' #' + v).attr( select('#' + svgElem.id + ' #' + v).attr(
@ -251,7 +248,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
graph.node(v).x - graph.node(v).width / 2 graph.node(v).x - graph.node(v).width / 2
); );
const dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider'); const dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
dividers.forEach(divider => { dividers.forEach((divider) => {
const parent = divider.parentElement; const parent = divider.parentElement;
let pWidth = 0; let pWidth = 0;
let pShift = 0; let pShift = 0;
@ -272,7 +269,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
let stateBox = svgElem.getBBox(); let stateBox = svgElem.getBBox();
graph.edges().forEach(function(e) { graph.edges().forEach(function (e) {
if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') { if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e))); log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
drawEdge(diagram, graph.edge(e), graph.edge(e).relation); drawEdge(diagram, graph.edge(e), graph.edge(e).relation);
@ -285,7 +282,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
id: parentId ? parentId : 'root', id: parentId ? parentId : 'root',
label: parentId ? parentId : 'root', label: parentId ? parentId : 'root',
width: 0, width: 0,
height: 0 height: 0,
}; };
stateInfo.width = stateBox.width + 2 * conf.padding; stateInfo.width = stateBox.width + 2 * conf.padding;
@ -297,5 +294,5 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
` `
defs #statediagram-barbEnd { defs #statediagram-barbEnd {
fill: ${options.transitionColor}; fill: ${options.transitionColor};

View File

@ -8,11 +8,11 @@ const sections = [];
const tasks = []; const tasks = [];
const rawTasks = []; const rawTasks = [];
export const parseDirective = function(statement, context, type) { export const parseDirective = function (statement, context, type) {
mermaidAPI.parseDirective(this, statement, context, type); mermaidAPI.parseDirective(this, statement, context, type);
}; };
export const clear = function() { export const clear = function () {
sections.length = 0; sections.length = 0;
tasks.length = 0; tasks.length = 0;
currentSection = ''; currentSection = '';
@ -20,24 +20,24 @@ export const clear = function() {
rawTasks.length = 0; rawTasks.length = 0;
}; };
export const setTitle = function(txt) { export const setTitle = function (txt) {
title = txt; title = txt;
}; };
export const getTitle = function() { export const getTitle = function () {
return title; return title;
}; };
export const addSection = function(txt) { export const addSection = function (txt) {
currentSection = txt; currentSection = txt;
sections.push(txt); sections.push(txt);
}; };
export const getSections = function() { export const getSections = function () {
return sections; return sections;
}; };
export const getTasks = function() { export const getTasks = function () {
let allItemsProcessed = compileTasks(); let allItemsProcessed = compileTasks();
const maxDepth = 100; const maxDepth = 100;
let iterationCount = 0; let iterationCount = 0;
@ -51,9 +51,9 @@ export const getTasks = function() {
return tasks; return tasks;
}; };
const updateActors = function() { const updateActors = function () {
const tempActors = []; const tempActors = [];
tasks.forEach(task => { tasks.forEach((task) => {
if (task.people) { if (task.people) {
tempActors.push(...task.people); tempActors.push(...task.people);
} }
@ -63,7 +63,7 @@ const updateActors = function() {
return [...unique].sort(); return [...unique].sort();
}; };
export const addTask = function(descr, taskData) { export const addTask = function (descr, taskData) {
const pieces = taskData.substr(1).split(':'); const pieces = taskData.substr(1).split(':');
let score = 0; let score = 0;
@ -75,32 +75,32 @@ export const addTask = function(descr, taskData) {
score = Number(pieces[0]); score = Number(pieces[0]);
peeps = pieces[1].split(','); peeps = pieces[1].split(',');
} }
const peopleList = peeps.map(s => s.trim()); const peopleList = peeps.map((s) => s.trim());
const rawTask = { const rawTask = {
section: currentSection, section: currentSection,
type: currentSection, type: currentSection,
people: peopleList, people: peopleList,
task: descr, task: descr,
score score,
}; };
rawTasks.push(rawTask); rawTasks.push(rawTask);
}; };
export const addTaskOrg = function(descr) { export const addTaskOrg = function (descr) {
const newTask = { const newTask = {
section: currentSection, section: currentSection,
type: currentSection, type: currentSection,
description: descr, description: descr,
task: descr, task: descr,
classes: [] classes: [],
}; };
tasks.push(newTask); tasks.push(newTask);
}; };
const compileTasks = function() { const compileTasks = function () {
const compileTask = function(pos) { const compileTask = function (pos) {
return rawTasks[pos].processed; return rawTasks[pos].processed;
}; };
@ -113,7 +113,7 @@ const compileTasks = function() {
return allProcessed; return allProcessed;
}; };
const getActors = function() { const getActors = function () {
return updateActors(); return updateActors();
}; };
@ -128,5 +128,5 @@ export default {
getTasks, getTasks,
addTask, addTask,
addTaskOrg, addTaskOrg,
getActors getActors,
}; };

View File

@ -7,10 +7,10 @@ import { configureSvgSize } from '../../utils';
parser.yy = journeyDb; parser.yy = journeyDb;
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
keys.forEach(function(key) { keys.forEach(function (key) {
conf[key] = cnf[key]; conf[key] = cnf[key];
}); });
}; };
@ -21,7 +21,7 @@ function drawActorLegend(diagram) {
const conf = getConfig().journey; const conf = getConfig().journey;
// Draw the actors // Draw the actors
let yPos = 60; let yPos = 60;
Object.keys(actors).forEach(person => { Object.keys(actors).forEach((person) => {
const colour = actors[person].color; const colour = actors[person].color;
const circleData = { const circleData = {
@ -30,7 +30,7 @@ function drawActorLegend(diagram) {
r: 7, r: 7,
fill: colour, fill: colour,
stroke: '#000', stroke: '#000',
pos: actors[person].position pos: actors[person].position,
}; };
svgDraw.drawCircle(diagram, circleData); svgDraw.drawCircle(diagram, circleData);
@ -39,7 +39,7 @@ function drawActorLegend(diagram) {
y: yPos + 7, y: yPos + 7,
fill: '#666', fill: '#666',
text: person, text: person,
textMargin: conf.boxTextMargin | 5 textMargin: conf.boxTextMargin | 5,
}; };
svgDraw.drawText(diagram, labelData); svgDraw.drawText(diagram, labelData);
@ -48,7 +48,7 @@ function drawActorLegend(diagram) {
} }
const conf = getConfig().journey; const conf = getConfig().journey;
const LEFT_MARGIN = getConfig().journey.leftMargin; const LEFT_MARGIN = getConfig().journey.leftMargin;
export const draw = function(text, id) { export const draw = function (text, id) {
const conf = getConfig().journey; const conf = getConfig().journey;
parser.yy.clear(); parser.yy.clear();
parser.parse(text + '\n'); parser.parse(text + '\n');
@ -65,10 +65,10 @@ export const draw = function(text, id) {
const actorNames = parser.yy.getActors(); const actorNames = parser.yy.getActors();
for (let member in actors) delete actors[member]; for (let member in actors) delete actors[member];
let actorPos = 0; let actorPos = 0;
actorNames.forEach(actorName => { actorNames.forEach((actorName) => {
actors[actorName] = { actors[actorName] = {
color: conf.actorColours[actorPos % conf.actorColours.length], color: conf.actorColours[actorPos % conf.actorColours.length],
position: actorPos position: actorPos,
}; };
actorPos++; actorPos++;
}); });
@ -114,29 +114,29 @@ export const bounds = {
startx: undefined, startx: undefined,
stopx: undefined, stopx: undefined,
starty: undefined, starty: undefined,
stopy: undefined stopy: undefined,
}, },
verticalPos: 0, verticalPos: 0,
sequenceItems: [], sequenceItems: [],
init: function() { init: function () {
this.sequenceItems = []; this.sequenceItems = [];
this.data = { this.data = {
startx: undefined, startx: undefined,
stopx: undefined, stopx: undefined,
starty: undefined, starty: undefined,
stopy: undefined stopy: undefined,
}; };
this.verticalPos = 0; this.verticalPos = 0;
}, },
updateVal: function(obj, key, val, fun) { updateVal: function (obj, key, val, fun) {
if (typeof obj[key] === 'undefined') { if (typeof obj[key] === 'undefined') {
obj[key] = val; obj[key] = val;
} else { } else {
obj[key] = fun(val, obj[key]); obj[key] = fun(val, obj[key]);
} }
}, },
updateBounds: function(startx, starty, stopx, stopy) { updateBounds: function (startx, starty, stopx, stopy) {
const conf = getConfig().journey; const conf = getConfig().journey;
const _self = this; const _self = this;
let cnt = 0; let cnt = 0;
@ -163,7 +163,7 @@ export const bounds = {
this.sequenceItems.forEach(updateFn()); this.sequenceItems.forEach(updateFn());
}, },
insert: function(startx, starty, stopx, stopy) { insert: function (startx, starty, stopx, stopy) {
const _startx = Math.min(startx, stopx); const _startx = Math.min(startx, stopx);
const _stopx = Math.max(startx, stopx); const _stopx = Math.max(startx, stopx);
const _starty = Math.min(starty, stopy); const _starty = Math.min(starty, stopy);
@ -176,22 +176,22 @@ export const bounds = {
this.updateBounds(_startx, _starty, _stopx, _stopy); this.updateBounds(_startx, _starty, _stopx, _stopy);
}, },
bumpVerticalPos: function(bump) { bumpVerticalPos: function (bump) {
this.verticalPos = this.verticalPos + bump; this.verticalPos = this.verticalPos + bump;
this.data.stopy = this.verticalPos; this.data.stopy = this.verticalPos;
}, },
getVerticalPos: function() { getVerticalPos: function () {
return this.verticalPos; return this.verticalPos;
}, },
getBounds: function() { getBounds: function () {
return this.data; return this.data;
} },
}; };
const fills = conf.sectionFills; const fills = conf.sectionFills;
const textColours = conf.sectionColours; const textColours = conf.sectionColours;
export const drawTasks = function(diagram, tasks, verticalPos) { export const drawTasks = function (diagram, tasks, verticalPos) {
const conf = getConfig().journey; const conf = getConfig().journey;
let lastSection = ''; let lastSection = '';
const sectionVHeight = conf.height * 2 + conf.diagramMarginY; const sectionVHeight = conf.height * 2 + conf.diagramMarginY;
@ -216,7 +216,7 @@ export const drawTasks = function(diagram, tasks, verticalPos) {
text: task.section, text: task.section,
fill, fill,
num, num,
colour colour,
}; };
svgDraw.drawSection(diagram, section, conf); svgDraw.drawSection(diagram, section, conf);
@ -251,5 +251,5 @@ export const drawTasks = function(diagram, tasks, verticalPos) {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -1,4 +1,4 @@
const getStyles = options => const getStyles = (options) =>
`.label { `.label {
font-family: 'trebuchet ms', verdana, arial, sans-serif; font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family); font-family: var(--mermaid-font-family);

View File

@ -1,6 +1,6 @@
import { arc as d3arc } from 'd3'; import { arc as d3arc } from 'd3';
export const drawRect = function(elem, rectData) { export const drawRect = function (elem, rectData) {
const rectElem = elem.append('rect'); const rectElem = elem.append('rect');
rectElem.attr('x', rectData.x); rectElem.attr('x', rectData.x);
rectElem.attr('y', rectData.y); rectElem.attr('y', rectData.y);
@ -18,7 +18,7 @@ export const drawRect = function(elem, rectData) {
return rectElem; return rectElem;
}; };
export const drawFace = function(element, faceData) { export const drawFace = function (element, faceData) {
const radius = 15; const radius = 15;
const circleElement = element const circleElement = element
.append('circle') .append('circle')
@ -104,7 +104,7 @@ export const drawFace = function(element, faceData) {
return circleElement; return circleElement;
}; };
export const drawCircle = function(element, circleData) { export const drawCircle = function (element, circleData) {
const circleElement = element.append('circle'); const circleElement = element.append('circle');
circleElement.attr('cx', circleData.cx); circleElement.attr('cx', circleData.cx);
circleElement.attr('cy', circleData.cy); circleElement.attr('cy', circleData.cy);
@ -124,7 +124,7 @@ export const drawCircle = function(element, circleData) {
return circleElement; return circleElement;
}; };
export const drawText = function(elem, textData) { export const drawText = function (elem, textData) {
// Remove and ignore br:s // Remove and ignore br:s
const nText = textData.text.replace(/<br\s*\/?>/gi, ' '); const nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
@ -146,7 +146,7 @@ export const drawText = function(elem, textData) {
return textElem; return textElem;
}; };
export const drawLabel = function(elem, txtObject) { export const drawLabel = function (elem, txtObject) {
function genPoints(x, y, width, height, cut) { function genPoints(x, y, width, height, cut) {
return ( return (
x + x +
@ -179,7 +179,7 @@ export const drawLabel = function(elem, txtObject) {
drawText(elem, txtObject); drawText(elem, txtObject);
}; };
export const drawSection = function(elem, section, conf) { export const drawSection = function (elem, section, conf) {
const g = elem.append('g'); const g = elem.append('g');
const rect = getNoteRect(); const rect = getNoteRect();
@ -213,7 +213,7 @@ let taskCount = -1;
* @param task The task to render * @param task The task to render
* @param conf The global configuration * @param conf The global configuration
*/ */
export const drawTask = function(elem, task, conf) { export const drawTask = function (elem, task, conf) {
const center = task.x + conf.width / 2; const center = task.x + conf.width / 2;
const g = elem.append('g'); const g = elem.append('g');
taskCount++; taskCount++;
@ -232,7 +232,7 @@ export const drawTask = function(elem, task, conf) {
drawFace(g, { drawFace(g, {
cx: center, cx: center,
cy: 300 + (5 - task.score) * 30, cy: 300 + (5 - task.score) * 30,
score: task.score score: task.score,
}); });
const rect = getNoteRect(); const rect = getNoteRect();
@ -247,7 +247,7 @@ export const drawTask = function(elem, task, conf) {
drawRect(g, rect); drawRect(g, rect);
let xPos = task.x + 14; let xPos = task.x + 14;
task.people.forEach(person => { task.people.forEach((person) => {
const colour = task.actors[person].color; const colour = task.actors[person].color;
const circle = { const circle = {
@ -257,7 +257,7 @@ export const drawTask = function(elem, task, conf) {
fill: colour, fill: colour,
stroke: '#000', stroke: '#000',
title: person, title: person,
pos: task.actors[person].position pos: task.actors[person].position,
}; };
drawCircle(g, circle); drawCircle(g, circle);
@ -282,19 +282,19 @@ export const drawTask = function(elem, task, conf) {
* @param elem The html element * @param elem The html element
* @param bounds The bounds of the drawing * @param bounds The bounds of the drawing
*/ */
export const drawBackgroundRect = function(elem, bounds) { export const drawBackgroundRect = function (elem, bounds) {
const rectElem = drawRect(elem, { const rectElem = drawRect(elem, {
x: bounds.startx, x: bounds.startx,
y: bounds.starty, y: bounds.starty,
width: bounds.stopx - bounds.startx, width: bounds.stopx - bounds.startx,
height: bounds.stopy - bounds.starty, height: bounds.stopy - bounds.starty,
fill: bounds.fill, fill: bounds.fill,
class: 'rect' class: 'rect',
}); });
rectElem.lower(); rectElem.lower();
}; };
export const getTextObj = function() { export const getTextObj = function () {
return { return {
x: 0, x: 0,
y: 0, y: 0,
@ -304,11 +304,11 @@ export const getTextObj = function() {
height: 100, height: 100,
textMargin: 0, textMargin: 0,
rx: 0, rx: 0,
ry: 0 ry: 0,
}; };
}; };
export const getNoteRect = function() { export const getNoteRect = function () {
return { return {
x: 0, x: 0,
y: 0, y: 0,
@ -316,11 +316,11 @@ export const getNoteRect = function() {
anchor: 'start', anchor: 'start',
height: 100, height: 100,
rx: 0, rx: 0,
ry: 0 ry: 0,
}; };
}; };
const _drawTextCandidateFunc = (function() { const _drawTextCandidateFunc = (function () {
function byText(content, g, x, y, width, height, textAttrs, colour) { function byText(content, g, x, y, width, height, textAttrs, colour) {
const text = g const text = g
.append('text') .append('text')
@ -400,12 +400,12 @@ const _drawTextCandidateFunc = (function() {
} }
} }
return function(conf) { return function (conf) {
return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan; return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
}; };
})(); })();
const initGraphics = function(graphics) { const initGraphics = function (graphics) {
graphics graphics
.append('defs') .append('defs')
.append('marker') .append('marker')
@ -429,5 +429,5 @@ export default {
drawBackgroundRect, drawBackgroundRect,
getTextObj, getTextObj,
getNoteRect, getNoteRect,
initGraphics initGraphics,
}; };

View File

@ -5,10 +5,10 @@ import { select } from 'd3';
import { log } from './logger'; import { log } from './logger';
const conf = {}; const conf = {};
export const setConf = function(cnf) { export const setConf = function (cnf) {
const keys = Object.keys(cnf); const keys = Object.keys(cnf);
keys.forEach(function(key) { keys.forEach(function (key) {
conf[key] = cnf[key]; conf[key] = cnf[key];
}); });
}; };
@ -94,5 +94,5 @@ export const draw = (id, ver) => {
export default { export default {
setConf, setConf,
draw draw,
}; };

View File

@ -5,7 +5,7 @@ export const LEVELS = {
info: 2, info: 2,
warn: 3, warn: 3,
error: 4, error: 4,
fatal: 5 fatal: 5,
}; };
export const log = { export const log = {
@ -13,10 +13,10 @@ export const log = {
info: () => {}, info: () => {},
warn: () => {}, warn: () => {},
error: () => {}, error: () => {},
fatal: () => {} fatal: () => {},
}; };
export const setLogLevel = function(level = 'fatal') { export const setLogLevel = function (level = 'fatal') {
if (isNaN(level)) { if (isNaN(level)) {
level = level.toLowerCase(); level = level.toLowerCase();
if (LEVELS[level] !== undefined) { if (LEVELS[level] !== undefined) {
@ -56,7 +56,7 @@ export const setLogLevel = function(level = 'fatal') {
} }
}; };
const format = level => { const format = (level) => {
const time = moment().format('ss.SSS'); const time = moment().format('ss.SSS');
return `%c${time} : ${level} : `; return `%c${time} : ${level} : `;
}; };

View File

@ -27,7 +27,7 @@ import utils from './utils';
* Renders the mermaid diagrams * Renders the mermaid diagrams
* @param nodes a css selector or an array of nodes * @param nodes a css selector or an array of nodes
*/ */
const init = function() { const init = function () {
const conf = mermaidAPI.getConfig(); const conf = mermaidAPI.getConfig();
// console.log('Starting rendering diagrams (init) - mermaid.init', conf); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
let nodes; let nodes;
@ -129,7 +129,7 @@ const init = function() {
} }
}; };
const initialize = function(config) { const initialize = function (config) {
// mermaidAPI.reset(); // mermaidAPI.reset();
if (typeof config.mermaid !== 'undefined') { if (typeof config.mermaid !== 'undefined') {
if (typeof config.mermaid.startOnLoad !== 'undefined') { if (typeof config.mermaid.startOnLoad !== 'undefined') {
@ -149,7 +149,7 @@ const initialize = function(config) {
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and * 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. * calls init for rendering the mermaid diagrams on the page.
*/ */
const contentLoaded = function() { const contentLoaded = function () {
let config; let config;
if (mermaid.startOnLoad) { if (mermaid.startOnLoad) {
@ -175,7 +175,7 @@ if (typeof document !== 'undefined') {
*/ */
window.addEventListener( window.addEventListener(
'load', 'load',
function() { function () {
contentLoaded(); contentLoaded();
}, },
false false
@ -193,7 +193,7 @@ const mermaid = {
init, init,
initialize, initialize,
contentLoaded contentLoaded,
}; };
export default mermaid; export default mermaid;

View File

@ -155,19 +155,19 @@ function parse(text) {
return parser; return parser;
} }
export const encodeEntities = function(text) { export const encodeEntities = function (text) {
let txt = text; let txt = text;
txt = txt.replace(/style.*:\S*#.*;/g, function(s) { txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
const innerTxt = s.substring(0, s.length - 1); const innerTxt = s.substring(0, s.length - 1);
return innerTxt; return innerTxt;
}); });
txt = txt.replace(/classDef.*:\S*#.*;/g, function(s) { txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
const innerTxt = s.substring(0, s.length - 1); const innerTxt = s.substring(0, s.length - 1);
return innerTxt; return innerTxt;
}); });
txt = txt.replace(/#\w+;/g, function(s) { txt = txt.replace(/#\w+;/g, function (s) {
const innerTxt = s.substring(1, s.length - 1); const innerTxt = s.substring(1, s.length - 1);
const isInt = /^\+?\d+$/.test(innerTxt); const isInt = /^\+?\d+$/.test(innerTxt);
@ -181,16 +181,16 @@ export const encodeEntities = function(text) {
return txt; return txt;
}; };
export const decodeEntities = function(text) { export const decodeEntities = function (text) {
let txt = text; let txt = text;
txt = txt.replace(/fl°°/g, function() { txt = txt.replace(/fl°°/g, function () {
return '&#'; return '&#';
}); });
txt = txt.replace(/fl°/g, function() { txt = txt.replace(/fl°/g, function () {
return '&'; return '&';
}); });
txt = txt.replace(/¶ß/g, function() { txt = txt.replace(/¶ß/g, function () {
return ';'; return ';';
}); });
@ -218,7 +218,7 @@ export const decodeEntities = function(text) {
* provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is * provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
* completed. * completed.
*/ */
const render = function(id, _txt, cb, container) { const render = function (id, _txt, cb, container) {
configApi.reset(); configApi.reset();
let txt = _txt; let txt = _txt;
const graphInit = utils.detectInit(txt); const graphInit = utils.detectInit(txt);
@ -495,7 +495,7 @@ const render = function(id, _txt, cb, container) {
let currentDirective = {}; let currentDirective = {};
const parseDirective = function(p, statement, context, type) { const parseDirective = function (p, statement, context, type) {
try { try {
if (statement !== undefined) { if (statement !== undefined) {
statement = statement.trim(); statement = statement.trim();
@ -523,12 +523,12 @@ const parseDirective = function(p, statement, context, type) {
} }
}; };
const handleDirective = function(p, directive, type) { const handleDirective = function (p, directive, type) {
log.debug(`Directive type=${directive.type} with args:`, directive.args); log.debug(`Directive type=${directive.type} with args:`, directive.args);
switch (directive.type) { switch (directive.type) {
case 'init': case 'init':
case 'initialize': { case 'initialize': {
['config'].forEach(prop => { ['config'].forEach((prop) => {
if (typeof directive.args[prop] !== 'undefined') { if (typeof directive.args[prop] !== 'undefined') {
if (type === 'flowchart-v2') { if (type === 'flowchart-v2') {
type = 'flowchart'; type = 'flowchart';
@ -646,7 +646,7 @@ const mermaidAPI = Object.freeze({
configApi.reset(configApi.defaultConfig); configApi.reset(configApi.defaultConfig);
updateRendererConfigs(configApi.getConfig()); updateRendererConfigs(configApi.getConfig());
}, },
defaultConfig: configApi.defaultConfig defaultConfig: configApi.defaultConfig,
}); });
setLogLevel(configApi.getConfig().logLevel); setLogLevel(configApi.getConfig().logLevel);

View File

@ -25,7 +25,7 @@ const themes = {
pie, pie,
er, er,
journey, journey,
requirement requirement,
}; };
export const calcThemeVariables = (theme, userOverRides) => theme.calcColors(userOverRides); export const calcThemeVariables = (theme, userOverRides) => theme.calcColors(userOverRides);

View File

@ -6,18 +6,18 @@ import { getThemeVariables as neutralThemeVariables } from './theme-neutral';
export default { export default {
base: { base: {
getThemeVariables: baseThemeVariables getThemeVariables: baseThemeVariables,
}, },
dark: { dark: {
getThemeVariables: darkThemeVariables getThemeVariables: darkThemeVariables,
}, },
default: { default: {
getThemeVariables: defaultThemeVariables getThemeVariables: defaultThemeVariables,
}, },
forest: { forest: {
getThemeVariables: forestThemeVariables getThemeVariables: forestThemeVariables,
}, },
neutral: { neutral: {
getThemeVariables: neutralThemeVariables getThemeVariables: neutralThemeVariables,
} },
}; };

View File

@ -184,20 +184,20 @@ class Theme {
const keys = Object.keys(overrides); const keys = Object.keys(overrides);
// Copy values from overrides, this is mainly for base colors // Copy values from overrides, this is mainly for base colors
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
// Calculate colors form base colors // Calculate colors form base colors
this.updateColors(); this.updateColors();
// Copy values from overrides again in case of an override of derived value // Copy values from overrides again in case of an override of derived value
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
} }
} }
export const getThemeVariables = userOverrides => { export const getThemeVariables = (userOverrides) => {
const theme = new Theme(); const theme = new Theme();
theme.calculate(userOverrides); theme.calculate(userOverrides);
return theme; return theme;

View File

@ -198,20 +198,20 @@ class Theme {
const keys = Object.keys(overrides); const keys = Object.keys(overrides);
// Copy values from overrides, this is mainly for base colors // Copy values from overrides, this is mainly for base colors
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
// Calculate colors form base colors // Calculate colors form base colors
this.updateColors(); this.updateColors();
// Copy values from overrides again in case of an override of derived value // Copy values from overrides again in case of an override of derived value
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
} }
} }
export const getThemeVariables = userOverrides => { export const getThemeVariables = (userOverrides) => {
const theme = new Theme(); const theme = new Theme();
theme.calculate(userOverrides); theme.calculate(userOverrides);
return theme; return theme;

View File

@ -209,20 +209,20 @@ class Theme {
const keys = Object.keys(overrides); const keys = Object.keys(overrides);
// Copy values from overrides, this is mainly for base colors // Copy values from overrides, this is mainly for base colors
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
// Calculate colors form base colors // Calculate colors form base colors
this.updateColors(); this.updateColors();
// Copy values from overrides again in case of an override of derived value // Copy values from overrides again in case of an override of derived value
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
} }
} }
export const getThemeVariables = userOverrides => { export const getThemeVariables = (userOverrides) => {
const theme = new Theme(); const theme = new Theme();
theme.calculate(userOverrides); theme.calculate(userOverrides);
return theme; return theme;

View File

@ -179,20 +179,20 @@ class Theme {
const keys = Object.keys(overrides); const keys = Object.keys(overrides);
// Copy values from overrides, this is mainly for base colors // Copy values from overrides, this is mainly for base colors
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
// Calculate colors form base colors // Calculate colors form base colors
this.updateColors(); this.updateColors();
// Copy values from overrides again in case of an override of derived value // Copy values from overrides again in case of an override of derived value
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
} }
} }
export const getThemeVariables = userOverrides => { export const getThemeVariables = (userOverrides) => {
const theme = new Theme(); const theme = new Theme();
theme.calculate(userOverrides); theme.calculate(userOverrides);
return theme; return theme;

View File

@ -229,20 +229,20 @@ class Theme {
const keys = Object.keys(overrides); const keys = Object.keys(overrides);
// Copy values from overrides, this is mainly for base colors // Copy values from overrides, this is mainly for base colors
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
// Calculate colors form base colors // Calculate colors form base colors
this.updateColors(); this.updateColors();
// Copy values from overrides again in case of an override of derived value // Copy values from overrides again in case of an override of derived value
keys.forEach(k => { keys.forEach((k) => {
this[k] = overrides[k]; this[k] = overrides[k];
}); });
} }
} }
export const getThemeVariables = userOverrides => { export const getThemeVariables = (userOverrides) => {
const theme = new Theme(); const theme = new Theme();
theme.calculate(userOverrides); theme.calculate(userOverrides);
return theme; return theme;

View File

@ -11,11 +11,10 @@ import {
curveStep, curveStep,
curveStepAfter, curveStepAfter,
curveStepBefore, curveStepBefore,
select select,
} from 'd3'; } from 'd3';
import common from './diagrams/common/common'; import common from './diagrams/common/common';
import { log } from './logger'; import { log } from './logger';
// import cryptoRandomString from 'crypto-random-string';
// Effectively an enum of the supported curve types, accessible by name // Effectively an enum of the supported curve types, accessible by name
const d3CurveTypes = { const d3CurveTypes = {
@ -29,10 +28,12 @@ const d3CurveTypes = {
curveNatural: curveNatural, curveNatural: curveNatural,
curveStep: curveStep, curveStep: curveStep,
curveStepAfter: curveStepAfter, curveStepAfter: curveStepAfter,
curveStepBefore: curveStepBefore curveStepBefore: curveStepBefore,
}; };
const directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; const directive =
const directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi; /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
const directiveWithoutOpen =
/\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
const anyComment = /\s*%%.*\n/gm; const anyComment = /\s*%%.*\n/gm;
/** /**
@ -65,18 +66,18 @@ const anyComment = /\s*%%.*\n/gm;
* @param {string} text The text defining the graph * @param {string} text The text defining the graph
* @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) { export const detectInit = function (text, cnf) {
let inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/); let inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
let results = {}; let results = {};
if (Array.isArray(inits)) { if (Array.isArray(inits)) {
let args = inits.map(init => init.args); let args = inits.map((init) => init.args);
results = assignWithDepth(results, [...args]); results = assignWithDepth(results, [...args]);
} else { } else {
results = inits.args; results = inits.args;
} }
if (results) { if (results) {
let type = detectType(text, cnf); let type = detectType(text, cnf);
['config'].forEach(prop => { ['config'].forEach((prop) => {
if (typeof results[prop] !== 'undefined') { if (typeof results[prop] !== 'undefined') {
if (type === 'flowchart-v2') { if (type === 'flowchart-v2') {
type = 'flowchart'; type = 'flowchart';
@ -110,16 +111,13 @@ export const detectInit = function(text, cnf) {
* @returns {object | Array} An object or Array representing the directive(s): { type: string, args: object|null } matched by the input type * @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. * if a single directive was found, that directive object will be returned.
*/ */
export const detectDirective = function(text, type = null) { export const detectDirective = function (text, type = null) {
try { try {
const commentWithoutDirectives = new RegExp( const commentWithoutDirectives = new RegExp(
`[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*\n`, `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*\n`,
'ig' 'ig'
); );
text = text text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
.trim()
.replace(commentWithoutDirectives, '')
.replace(/'/gm, '"');
log.debug( log.debug(
`Detecting diagram directive${type !== null ? ' type:' + type : ''} based on the text:${text}` `Detecting diagram directive${type !== null ? ' type:' + type : ''} based on the text:${text}`
); );
@ -173,7 +171,7 @@ export const detectDirective = function(text, type = null) {
* @param {string} text The text defining the graph * @param {string} text The text defining the graph
* @returns {string} A graph definition key * @returns {string} A graph definition key
*/ */
export const detectType = function(text, cnf) { export const detectType = function (text, cnf) {
text = text.replace(directive, '').replace(anyComment, '\n'); text = text.replace(directive, '').replace(anyComment, '\n');
log.debug('Detecting diagram type based on the text ' + text); log.debug('Detecting diagram type based on the text ' + text);
if (text.match(/^\s*sequenceDiagram/)) { if (text.match(/^\s*sequenceDiagram/)) {
@ -252,7 +250,7 @@ const memoize = (fn, resolver) => {
* @param {array} arr The array to search * @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) { export const isSubstringInArray = function (str, arr) {
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (arr[i].match(str)) return i; if (arr[i].match(str)) return i;
} }
@ -297,11 +295,11 @@ export const runFunc = (functionName, ...params) => {
const distance = (p1, p2) => const distance = (p1, p2) =>
p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0; p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
const traverseEdge = points => { const traverseEdge = (points) => {
let prevPoint; let prevPoint;
let totalDistance = 0; let totalDistance = 0;
points.forEach(point => { points.forEach((point) => {
totalDistance += distance(point, prevPoint); totalDistance += distance(point, prevPoint);
prevPoint = point; prevPoint = point;
}); });
@ -310,7 +308,7 @@ const traverseEdge = points => {
let remainingDistance = totalDistance / 2; let remainingDistance = totalDistance / 2;
let center = undefined; let center = undefined;
prevPoint = undefined; prevPoint = undefined;
points.forEach(point => { points.forEach((point) => {
if (prevPoint && !center) { if (prevPoint && !center) {
const vectorDistance = distance(point, prevPoint); const vectorDistance = distance(point, prevPoint);
if (vectorDistance < remainingDistance) { if (vectorDistance < remainingDistance) {
@ -324,7 +322,7 @@ const traverseEdge = points => {
if (distanceRatio > 0 && distanceRatio < 1) { if (distanceRatio > 0 && distanceRatio < 1) {
center = { center = {
x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y,
}; };
} }
} }
@ -334,7 +332,7 @@ const traverseEdge = points => {
return center; return center;
}; };
const calcLabelPosition = points => { const calcLabelPosition = (points) => {
return traverseEdge(points); return traverseEdge(points);
}; };
@ -345,7 +343,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
if (points[0] !== initialPosition) { if (points[0] !== initialPosition) {
points = points.reverse(); points = points.reverse();
} }
points.forEach(point => { points.forEach((point) => {
totalDistance += distance(point, prevPoint); totalDistance += distance(point, prevPoint);
prevPoint = point; prevPoint = point;
}); });
@ -356,7 +354,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
let remainingDistance = distanceToCardinalityPoint; let remainingDistance = distanceToCardinalityPoint;
let center; let center;
prevPoint = undefined; prevPoint = undefined;
points.forEach(point => { points.forEach((point) => {
if (prevPoint && !center) { if (prevPoint && !center) {
const vectorDistance = distance(point, prevPoint); const vectorDistance = distance(point, prevPoint);
if (vectorDistance < remainingDistance) { if (vectorDistance < remainingDistance) {
@ -370,7 +368,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
if (distanceRatio > 0 && distanceRatio < 1) { if (distanceRatio > 0 && distanceRatio < 1) {
center = { center = {
x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y,
}; };
} }
} }
@ -401,7 +399,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
points = points.reverse(); points = points.reverse();
} }
points.forEach(point => { points.forEach((point) => {
totalDistance += distance(point, prevPoint); totalDistance += distance(point, prevPoint);
prevPoint = point; prevPoint = point;
}); });
@ -412,7 +410,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
let remainingDistance = distanceToCardinalityPoint; let remainingDistance = distanceToCardinalityPoint;
let center; let center;
prevPoint = undefined; prevPoint = undefined;
points.forEach(point => { points.forEach((point) => {
if (prevPoint && !center) { if (prevPoint && !center) {
const vectorDistance = distance(point, prevPoint); const vectorDistance = distance(point, prevPoint);
if (vectorDistance < remainingDistance) { if (vectorDistance < remainingDistance) {
@ -426,7 +424,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
if (distanceRatio > 0 && distanceRatio < 1) { if (distanceRatio > 0 && distanceRatio < 1) {
center = { center = {
x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y,
}; };
} }
} }
@ -459,7 +457,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
return cardinalityPosition; return cardinalityPosition;
}; };
export const getStylesFromArray = arr => { export const getStylesFromArray = (arr) => {
let style = ''; let style = '';
let labelStyle = ''; let labelStyle = '';
@ -480,14 +478,7 @@ export const getStylesFromArray = arr => {
let cnt = 0; let cnt = 0;
export const generateId = () => { export const generateId = () => {
cnt++; cnt++;
return ( return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
'id-' +
Math.random()
.toString(36)
.substr(2, 12) +
'-' +
cnt
);
}; };
function makeid(length) { function makeid(length) {
@ -500,7 +491,7 @@ function makeid(length) {
return result; return result;
} }
export const random = options => { export const random = (options) => {
return makeid(options.length); return makeid(options.length);
}; };
@ -530,13 +521,13 @@ export const random = options => {
* clobber: should dissimilar types clobber (default: { depth: 2, clobber: false }) * clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
* @returns {*} * @returns {*}
*/ */
export const assignWithDepth = function(dst, src, config) { export const assignWithDepth = function (dst, src, config) {
const { depth, clobber } = Object.assign({ depth: 2, clobber: false }, config); const { depth, clobber } = Object.assign({ depth: 2, clobber: false }, config);
if (Array.isArray(src) && !Array.isArray(dst)) { if (Array.isArray(src) && !Array.isArray(dst)) {
src.forEach(s => assignWithDepth(dst, s, config)); src.forEach((s) => assignWithDepth(dst, s, config));
return dst; return dst;
} else if (Array.isArray(src) && Array.isArray(dst)) { } else if (Array.isArray(src) && Array.isArray(dst)) {
src.forEach(s => { src.forEach((s) => {
if (dst.indexOf(s) === -1) { if (dst.indexOf(s) === -1) {
dst.push(s); dst.push(s);
} }
@ -551,7 +542,7 @@ export const assignWithDepth = function(dst, src, config) {
} }
} }
if (typeof src !== 'undefined' && typeof dst === 'object' && typeof src === 'object') { if (typeof src !== 'undefined' && typeof dst === 'object' && typeof src === 'object') {
Object.keys(src).forEach(key => { Object.keys(src).forEach((key) => {
if ( if (
typeof src[key] === 'object' && typeof src[key] === 'object' &&
(dst[key] === undefined || typeof dst[key] === 'object') (dst[key] === undefined || typeof dst[key] === 'object')
@ -568,7 +559,7 @@ export const assignWithDepth = function(dst, src, config) {
return dst; return dst;
}; };
export const getTextObj = function() { export const getTextObj = function () {
return { return {
x: 0, x: 0,
y: 0, y: 0,
@ -580,11 +571,11 @@ export const getTextObj = function() {
textMargin: 0, textMargin: 0,
rx: 0, rx: 0,
ry: 0, ry: 0,
valign: undefined valign: undefined,
}; };
}; };
export const drawSimpleText = function(elem, textData) { export const drawSimpleText = function (elem, textData) {
// Remove and ignore br:s // Remove and ignore br:s
const nText = textData.text.replace(common.lineBreakRegex, ' '); const nText = textData.text.replace(common.lineBreakRegex, ' ');
@ -642,7 +633,7 @@ export const wrapLabel = memoize(
completedLines.push(nextLine); completedLines.push(nextLine);
} }
}); });
return completedLines.filter(line => line !== '').join(config.joinWith); return completedLines.filter((line) => line !== '').join(config.joinWith);
}, },
(label, maxWidth, config) => (label, maxWidth, config) =>
`${label}-${maxWidth}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}-${config.joinWith}` `${label}-${maxWidth}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}-${config.joinWith}`
@ -687,7 +678,7 @@ const breakString = memoize(
* @param text the text to measure * @param text the text to measure
* @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
*/ */
export const calculateTextHeight = function(text, config) { export const calculateTextHeight = function (text, config) {
config = Object.assign( config = Object.assign(
{ fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 15 }, { fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 15 },
config config
@ -702,7 +693,7 @@ export const calculateTextHeight = function(text, config) {
* @param text - The text to calculate the width of * @param text - The text to calculate the width of
* @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
*/ */
export const calculateTextWidth = function(text, config) { export const calculateTextWidth = function (text, config) {
config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config); config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config);
return calculateTextDimensions(text, config).width; return calculateTextDimensions(text, config).width;
}; };
@ -715,7 +706,7 @@ export const calculateTextWidth = function(text, config) {
* @param config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size * @param config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size
*/ */
export const calculateTextDimensions = memoize( export const calculateTextDimensions = memoize(
function(text, config) { function (text, config) {
config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config); config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config);
const { fontSize, fontFamily, fontWeight } = config; const { fontSize, fontFamily, fontWeight } = config;
if (!text) { if (!text) {
@ -774,13 +765,13 @@ export const calculateTextDimensions = memoize(
(text, config) => `${text}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}` (text, config) => `${text}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}`
); );
const d3Attrs = function(d3Elem, attrs) { const d3Attrs = function (d3Elem, attrs) {
for (let attr of attrs) { for (let attr of attrs) {
d3Elem.attr(attr[0], attr[1]); d3Elem.attr(attr[0], attr[1]);
} }
}; };
export const calculateSvgSizeAttrs = function(height, width, useMaxWidth) { export const calculateSvgSizeAttrs = function (height, width, useMaxWidth) {
let attrs = new Map(); let attrs = new Map();
attrs.set('height', height); attrs.set('height', height);
if (useMaxWidth) { if (useMaxWidth) {
@ -792,7 +783,7 @@ export const calculateSvgSizeAttrs = function(height, width, useMaxWidth) {
return attrs; return attrs;
}; };
export const configureSvgSize = function(svgElem, height, width, useMaxWidth) { export const configureSvgSize = function (svgElem, height, width, useMaxWidth) {
const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth); const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
d3Attrs(svgElem, attrs); d3Attrs(svgElem, attrs);
}; };
@ -814,13 +805,10 @@ export const initIdGeneratior = class iterator {
// Source https://github.com/shrpne/entity-decode/blob/master/browser.js // Source https://github.com/shrpne/entity-decode/blob/master/browser.js
let decoder; let decoder;
export const entityDecode = function(html) { export const entityDecode = function (html) {
decoder = decoder || document.createElement('div'); decoder = decoder || document.createElement('div');
// Escape HTML before decoding for HTML Entities // Escape HTML before decoding for HTML Entities
html = escape(html) html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';');
.replace(/%26/g, '&')
.replace(/%23/g, '#')
.replace(/%3B/g, ';');
// decoding // decoding
decoder.innerHTML = html; decoder.innerHTML = html;
return unescape(decoder.textContent); return unescape(decoder.textContent);
@ -849,5 +837,5 @@ export default {
memoize, memoize,
runFunc, runFunc,
entityDecode, entityDecode,
initIdGeneratior initIdGeneratior,
}; };

462
yarn.lock
View File

@ -2,6 +2,13 @@
# yarn lockfile v1 # yarn lockfile v1
"@babel/code-frame@7.12.11":
version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
dependencies:
"@babel/highlight" "^7.10.4"
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5": "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5":
version "7.14.5" version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.14.5.tgz#23b08d740e83f49c5e59945fbf1b43e80bbf4edb"
@ -242,7 +249,7 @@
"@babel/traverse" "^7.14.5" "@babel/traverse" "^7.14.5"
"@babel/types" "^7.14.5" "@babel/types" "^7.14.5"
"@babel/highlight@^7.14.5": "@babel/highlight@^7.10.4", "@babel/highlight@^7.14.5":
version "7.14.5" version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9"
integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==
@ -1155,6 +1162,21 @@
debug "^3.1.0" debug "^3.1.0"
lodash.once "^4.1.1" lodash.once "^4.1.1"
"@eslint/eslintrc@^0.4.2":
version "0.4.2"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.2.tgz#f63d0ef06f5c0c57d76c4ab5f63d3835c51b0179"
integrity sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==
dependencies:
ajv "^6.12.4"
debug "^4.1.1"
espree "^7.3.0"
globals "^13.9.0"
ignore "^4.0.6"
import-fresh "^3.2.1"
js-yaml "^3.13.1"
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@hapi/hoek@^9.0.0": "@hapi/hoek@^9.0.0":
version "9.2.0" version "9.2.0"
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
@ -1167,6 +1189,20 @@
dependencies: dependencies:
"@hapi/hoek" "^9.0.0" "@hapi/hoek" "^9.0.0"
"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9"
integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==
dependencies:
"@humanwhocodes/object-schema" "^1.2.0"
debug "^4.1.1"
minimatch "^3.0.4"
"@humanwhocodes/object-schema@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf"
integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==
"@istanbuljs/load-nyc-config@^1.0.0": "@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
@ -1976,10 +2012,10 @@ acorn-globals@^6.0.0:
acorn "^7.1.1" acorn "^7.1.1"
acorn-walk "^7.1.1" acorn-walk "^7.1.1"
acorn-jsx@^5.2.0: acorn-jsx@^5.3.1:
version "5.3.1" version "5.3.2"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
acorn-walk@^7.1.1: acorn-walk@^7.1.1:
version "7.2.0" version "7.2.0"
@ -2001,7 +2037,7 @@ acorn@^6.4.1:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
acorn@^7.1.1: acorn@^7.1.1, acorn@^7.4.0:
version "7.4.1" version "7.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
@ -2046,7 +2082,7 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4:
json-schema-traverse "^0.4.1" json-schema-traverse "^0.4.1"
uri-js "^4.2.2" uri-js "^4.2.2"
ajv@^8.0.5: ajv@^8.0.1, ajv@^8.0.5:
version "8.6.1" version "8.6.1"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.1.tgz#ae65764bf1edde8cd861281cda5057852364a295" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.1.tgz#ae65764bf1edde8cd861281cda5057852364a295"
integrity sha512-42VLtQUOLefAvKFAQIxIZDaThq6om/PrfP0CYk3/vn+y4BMNkKnbli8ON2QCiHov4KkzOSJ/xSoBJdayiiYvVQ== integrity sha512-42VLtQUOLefAvKFAQIxIZDaThq6om/PrfP0CYk3/vn+y4BMNkKnbli8ON2QCiHov4KkzOSJ/xSoBJdayiiYvVQ==
@ -2256,11 +2292,6 @@ ast-types@0.14.2:
dependencies: dependencies:
tslib "^2.0.1" tslib "^2.0.1"
astral-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==
astral-regex@^2.0.0: astral-regex@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31"
@ -2874,14 +2905,6 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
camel-case@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73"
integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=
dependencies:
no-case "^2.2.0"
upper-case "^1.1.1"
camelcase@^5.0.0, camelcase@^5.3.1: camelcase@^5.0.0, camelcase@^5.3.1:
version "5.3.1" version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
@ -2907,7 +2930,7 @@ ccount@^1.0.0:
resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043" resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043"
integrity sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg== integrity sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg==
chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.2: chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.2:
version "2.4.2" version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@ -3052,13 +3075,6 @@ class-utils@^0.3.5:
isobject "^3.0.0" isobject "^3.0.0"
static-extend "^0.1.1" static-extend "^0.1.1"
clean-css@^4.1.6, clean-css@^4.2.1:
version "4.2.3"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78"
integrity sha512-VcMWDN54ZN/DS+g58HYL5/n4Zrqe8vHJpGA8KdgUXFU4fuP/aHNw8eld9SyEIyabIMJX/0RaY/fplOo5hYLSFA==
dependencies:
source-map "~0.6.0"
clean-stack@^2.0.0: clean-stack@^2.0.0:
version "2.2.0" version "2.2.0"
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
@ -3250,7 +3266,7 @@ comma-separated-tokens@^1.0.1:
resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz#632b80b6117867a158f1080ad498b2fbe7e3f5ea" resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz#632b80b6117867a158f1080ad498b2fbe7e3f5ea"
integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw== integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==
commander@2, commander@^2.19.0, commander@^2.20.0: commander@2, commander@^2.20.0:
version "2.20.3" version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@ -3482,7 +3498,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0" shebang-command "^1.2.0"
which "^1.2.9" which "^1.2.9"
cross-spawn@^7.0.0, cross-spawn@^7.0.3: cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3" version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@ -3508,11 +3524,6 @@ crypto-browserify@^3.11.0:
randombytes "^2.0.0" randombytes "^2.0.0"
randomfill "^1.0.3" randomfill "^1.0.3"
css-b64-images@~0.2.5:
version "0.2.5"
resolved "https://registry.yarnpkg.com/css-b64-images/-/css-b64-images-0.2.5.tgz#42005d83204b2b4a5d93b6b1a5644133b5927a02"
integrity sha1-QgBdgyBLK0pdk7axpWRBM7WSegI=
css-to-string-loader@^0.1.3: css-to-string-loader@^0.1.3:
version "0.1.3" version "0.1.3"
resolved "https://registry.yarnpkg.com/css-to-string-loader/-/css-to-string-loader-0.1.3.tgz#c937175f2ec783969aefe14a4fba055f7b4f9562" resolved "https://registry.yarnpkg.com/css-to-string-loader/-/css-to-string-loader-0.1.3.tgz#c937175f2ec783969aefe14a4fba055f7b4f9562"
@ -3934,7 +3945,7 @@ deep-equal@^1.0.1:
object-keys "^1.1.1" object-keys "^1.1.1"
regexp.prototype.flags "^1.2.0" regexp.prototype.flags "^1.2.0"
deep-is@~0.1.3: deep-is@^0.1.3, deep-is@~0.1.3:
version "0.1.3" version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
@ -4322,7 +4333,7 @@ enhanced-resolve@^4.1.1, enhanced-resolve@^4.5.0:
memory-fs "^0.5.0" memory-fs "^0.5.0"
tapable "^1.0.0" tapable "^1.0.0"
enquirer@^2.3.6: enquirer@^2.3.5, enquirer@^2.3.6:
version "2.3.6" version "2.3.6"
resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==
@ -4360,7 +4371,7 @@ escape-html@~1.0.3:
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
escape-string-regexp@4.0.0: escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
@ -4398,14 +4409,12 @@ escodegen@^2.0.0:
optionalDependencies: optionalDependencies:
source-map "~0.6.1" source-map "~0.6.1"
eslint-config-prettier@^6.3.0: eslint-config-prettier@^8.3.0:
version "6.15.0" version "8.3.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==
dependencies:
get-stdin "^6.0.0"
eslint-plugin-prettier@^3.1.0: eslint-plugin-prettier@^3.4.0:
version "3.4.0" version "3.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7"
integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw== integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw==
@ -4420,7 +4429,7 @@ eslint-scope@^4.0.3:
esrecurse "^4.1.0" esrecurse "^4.1.0"
estraverse "^4.1.1" estraverse "^4.1.1"
eslint-scope@^5.0.0: eslint-scope@^5.1.1:
version "5.1.1" version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==
@ -4428,69 +4437,77 @@ eslint-scope@^5.0.0:
esrecurse "^4.3.0" esrecurse "^4.3.0"
estraverse "^4.1.1" estraverse "^4.1.1"
eslint-utils@^1.4.3: eslint-utils@^2.1.0:
version "1.4.3" version "2.1.0"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27"
integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==
dependencies: dependencies:
eslint-visitor-keys "^1.1.0" eslint-visitor-keys "^1.1.0"
eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint@^6.3.0: eslint-visitor-keys@^2.0.0:
version "6.8.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==
eslint@^7.30.0:
version "7.30.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.30.0.tgz#6d34ab51aaa56112fd97166226c9a97f505474f8"
integrity sha512-VLqz80i3as3NdloY44BQSJpFw534L9Oh+6zJOUaViV4JPd+DaHwutqP7tcpkW3YiXbK6s05RZl7yl7cQn+lijg==
dependencies: dependencies:
"@babel/code-frame" "^7.0.0" "@babel/code-frame" "7.12.11"
"@eslint/eslintrc" "^0.4.2"
"@humanwhocodes/config-array" "^0.5.0"
ajv "^6.10.0" ajv "^6.10.0"
chalk "^2.1.0" chalk "^4.0.0"
cross-spawn "^6.0.5" cross-spawn "^7.0.2"
debug "^4.0.1" debug "^4.0.1"
doctrine "^3.0.0" doctrine "^3.0.0"
eslint-scope "^5.0.0" enquirer "^2.3.5"
eslint-utils "^1.4.3" escape-string-regexp "^4.0.0"
eslint-visitor-keys "^1.1.0" eslint-scope "^5.1.1"
espree "^6.1.2" eslint-utils "^2.1.0"
esquery "^1.0.1" eslint-visitor-keys "^2.0.0"
espree "^7.3.1"
esquery "^1.4.0"
esutils "^2.0.2" esutils "^2.0.2"
file-entry-cache "^5.0.1" fast-deep-equal "^3.1.3"
file-entry-cache "^6.0.1"
functional-red-black-tree "^1.0.1" functional-red-black-tree "^1.0.1"
glob-parent "^5.0.0" glob-parent "^5.1.2"
globals "^12.1.0" globals "^13.6.0"
ignore "^4.0.6" ignore "^4.0.6"
import-fresh "^3.0.0" import-fresh "^3.0.0"
imurmurhash "^0.1.4" imurmurhash "^0.1.4"
inquirer "^7.0.0"
is-glob "^4.0.0" is-glob "^4.0.0"
js-yaml "^3.13.1" js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1" json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.3.0" levn "^0.4.1"
lodash "^4.17.14" lodash.merge "^4.6.2"
minimatch "^3.0.4" minimatch "^3.0.4"
mkdirp "^0.5.1"
natural-compare "^1.4.0" natural-compare "^1.4.0"
optionator "^0.8.3" optionator "^0.9.1"
progress "^2.0.0" progress "^2.0.0"
regexpp "^2.0.1" regexpp "^3.1.0"
semver "^6.1.2" semver "^7.2.1"
strip-ansi "^5.2.0" strip-ansi "^6.0.0"
strip-json-comments "^3.0.1" strip-json-comments "^3.1.0"
table "^5.2.3" table "^6.0.9"
text-table "^0.2.0" text-table "^0.2.0"
v8-compile-cache "^2.0.3" v8-compile-cache "^2.0.3"
espree@^6.1.2: espree@^7.3.0, espree@^7.3.1:
version "6.2.1" version "7.3.1"
resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a" resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6"
integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw== integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==
dependencies: dependencies:
acorn "^7.1.1" acorn "^7.4.0"
acorn-jsx "^5.2.0" acorn-jsx "^5.3.1"
eslint-visitor-keys "^1.1.0" eslint-visitor-keys "^1.3.0"
esprima@1.1.x, esprima@~1.1.1: esprima@1.1.x, esprima@~1.1.1:
version "1.1.1" version "1.1.1"
@ -4502,7 +4519,7 @@ esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0:
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
esquery@^1.0.1: esquery@^1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5"
integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==
@ -4776,7 +4793,7 @@ extsprintf@^1.2.0:
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=
fast-deep-equal@^3.1.1: fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3" version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
@ -4802,7 +4819,7 @@ fast-json-stable-stringify@^2.0.0:
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
fast-levenshtein@~2.0.6: fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6:
version "2.0.6" version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
@ -4861,12 +4878,12 @@ figures@^3.0.0, figures@^3.2.0:
dependencies: dependencies:
escape-string-regexp "^1.0.5" escape-string-regexp "^1.0.5"
file-entry-cache@^5.0.1: file-entry-cache@^6.0.1:
version "5.0.1" version "6.0.1"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==
dependencies: dependencies:
flat-cache "^2.0.1" flat-cache "^3.0.4"
file-uri-to-path@1.0.0: file-uri-to-path@1.0.0:
version "1.0.0" version "1.0.0"
@ -4951,19 +4968,18 @@ findup-sync@^3.0.0:
micromatch "^3.0.4" micromatch "^3.0.4"
resolve-dir "^1.0.1" resolve-dir "^1.0.1"
flat-cache@^2.0.1: flat-cache@^3.0.4:
version "2.0.1" version "3.0.4"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==
dependencies: dependencies:
flatted "^2.0.0" flatted "^3.1.0"
rimraf "2.6.3" rimraf "^3.0.2"
write "1.0.3"
flatted@^2.0.0: flatted@^3.1.0:
version "2.0.2" version "3.2.1"
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.1.tgz#bbef080d95fca6709362c73044a1634f7c6e7d05"
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== integrity sha512-OMQjaErSFHmHqZe+PSidH5n8j3O0F2DdnVh8JB4j4eUQ2k6KvB0qGfrKIhapvez5JerBbmWkaLYUYWISaESoXg==
flow-parser@0.*: flow-parser@0.*:
version "0.154.0" version "0.154.0"
@ -5227,7 +5243,7 @@ glob-parent@^3.1.0:
is-glob "^3.1.0" is-glob "^3.1.0"
path-dirname "^1.0.0" path-dirname "^1.0.0"
glob-parent@^5.0.0, glob-parent@^5.1.2, glob-parent@~5.1.2: glob-parent@^5.1.2, glob-parent@~5.1.2:
version "5.1.2" version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
@ -5315,12 +5331,12 @@ globals@^11.1.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
globals@^12.1.0: globals@^13.6.0, globals@^13.9.0:
version "12.4.0" version "13.10.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" resolved "https://registry.yarnpkg.com/globals/-/globals-13.10.0.tgz#60ba56c3ac2ca845cfbf4faeca727ad9dd204676"
integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== integrity sha512-piHC3blgLGFjvOuMmWZX60f+na1lXFDhQXBf1UYp2fXPXqvEUbOhNwi6BsQ0bQishwedgnjkwv1d9zKf+MWw3g==
dependencies: dependencies:
type-fest "^0.8.1" type-fest "^0.20.2"
globby@^11.0.1, globby@^11.0.3: globby@^11.0.1, globby@^11.0.3:
version "11.0.4" version "11.0.4"
@ -5495,7 +5511,7 @@ hast-util-whitespace@^1.0.0:
resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz#e4fe77c4a9ae1cb2e6c25e02df0043d0164f6e41" resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-1.0.4.tgz#e4fe77c4a9ae1cb2e6c25e02df0043d0164f6e41"
integrity sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A== integrity sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A==
he@^1.1.0, he@^1.2.0: he@^1.1.0:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
@ -5553,19 +5569,6 @@ html-escaper@^2.0.0:
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==
html-minifier@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-4.0.0.tgz#cca9aad8bce1175e02e17a8c33e46d8988889f56"
integrity sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==
dependencies:
camel-case "^3.0.0"
clean-css "^4.2.1"
commander "^2.19.0"
he "^1.2.0"
param-case "^2.1.1"
relateurl "^0.2.7"
uglify-js "^3.5.1"
html-void-elements@^1.0.0: html-void-elements@^1.0.0:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-1.0.5.tgz#ce9159494e86d95e45795b166c2021c2cfca4483" resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-1.0.5.tgz#ce9159494e86d95e45795b166c2021c2cfca4483"
@ -5820,25 +5823,6 @@ inquirer-glob-prompt@^0.1.0:
globby "^11.0.3" globby "^11.0.3"
rxjs "^6.6.7" rxjs "^6.6.7"
inquirer@^7.0.0:
version "7.3.3"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003"
integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==
dependencies:
ansi-escapes "^4.2.1"
chalk "^4.1.0"
cli-cursor "^3.1.0"
cli-width "^3.0.0"
external-editor "^3.0.3"
figures "^3.0.0"
lodash "^4.17.19"
mute-stream "0.0.8"
run-async "^2.4.0"
rxjs "^6.6.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
through "^2.3.6"
inquirer@^8.0.0: inquirer@^8.0.0:
version "8.1.1" version "8.1.1"
resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.1.1.tgz#7c53d94c6d03011c7bb2a947f0dca3b98246c26a" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.1.1.tgz#7c53d94c6d03011c7bb2a947f0dca3b98246c26a"
@ -7043,7 +7027,15 @@ leven@^3.1.0:
resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2"
integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==
levn@^0.3.0, levn@~0.3.0: levn@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"
integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==
dependencies:
prelude-ls "^1.2.1"
type-check "~0.4.0"
levn@~0.3.0:
version "0.3.0" version "0.3.0"
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"
integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=
@ -7133,11 +7125,21 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=
lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=
lodash.debounce@^4.0.8: lodash.debounce@^4.0.8:
version "4.0.8" version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
lodash.merge@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
lodash.once@^4.1.1: lodash.once@^4.1.1:
version "4.1.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
@ -7158,7 +7160,12 @@ lodash.templatesettings@^4.0.0:
dependencies: dependencies:
lodash._reinterpolate "^3.0.0" lodash._reinterpolate "^3.0.0"
lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0: lodash.truncate@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=
lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0:
version "4.17.21" version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@ -7196,11 +7203,6 @@ longest-streak@^2.0.1:
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4" resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4"
integrity sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg== integrity sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==
lower-case@^1.1.1:
version "1.1.4"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
lru-cache@^5.1.1: lru-cache@^5.1.1:
version "5.1.1" version "5.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
@ -7462,19 +7464,6 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
minify@^4.1.1:
version "4.1.3"
resolved "https://registry.yarnpkg.com/minify/-/minify-4.1.3.tgz#58467922d14303f55a3a28fa79641371955b8fbd"
integrity sha512-ykuscavxivSmVpcCzsXmsVTukWYLUUtPhHj0w2ILvHDGqC+hsuTCihBn9+PJBd58JNvWTNg9132J9nrrI2anzA==
dependencies:
clean-css "^4.1.6"
css-b64-images "~0.2.5"
debug "^4.1.0"
html-minifier "^4.0.0"
terser "^4.0.0"
try-catch "^2.0.0"
try-to-catch "^1.0.2"
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
@ -7678,13 +7667,6 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
no-case@^2.2.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==
dependencies:
lower-case "^1.1.1"
node-dir@^0.1.17: node-dir@^0.1.17:
version "0.1.17" version "0.1.17"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"
@ -7919,7 +7901,7 @@ opn@^5.5.0:
dependencies: dependencies:
is-wsl "^1.1.0" is-wsl "^1.1.0"
optionator@^0.8.1, optionator@^0.8.3: optionator@^0.8.1:
version "0.8.3" version "0.8.3"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495"
integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==
@ -7931,6 +7913,18 @@ optionator@^0.8.1, optionator@^0.8.3:
type-check "~0.3.2" type-check "~0.3.2"
word-wrap "~1.2.3" word-wrap "~1.2.3"
optionator@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==
dependencies:
deep-is "^0.1.3"
fast-levenshtein "^2.0.6"
levn "^0.4.1"
prelude-ls "^1.2.1"
type-check "^0.4.0"
word-wrap "^1.2.3"
ora@^5.3.0: ora@^5.3.0:
version "5.4.1" version "5.4.1"
resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18"
@ -8070,13 +8064,6 @@ parallel-transform@^1.1.0:
inherits "^2.0.3" inherits "^2.0.3"
readable-stream "^2.1.5" readable-stream "^2.1.5"
param-case@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247"
integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc=
dependencies:
no-case "^2.2.0"
parent-module@^1.0.0: parent-module@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
@ -8355,6 +8342,11 @@ posix-character-classes@^0.1.0:
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
prelude-ls@~1.1.2: prelude-ls@~1.1.2:
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
@ -8367,10 +8359,10 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^1.18.2: prettier@^2.3.2:
version "1.19.1" version "2.3.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
pretty-bytes@^5.6.0: pretty-bytes@^5.6.0:
version "5.6.0" version "5.6.0"
@ -8755,10 +8747,10 @@ regexp.prototype.flags@^1.2.0:
call-bind "^1.0.2" call-bind "^1.0.2"
define-properties "^1.1.3" define-properties "^1.1.3"
regexpp@^2.0.1: regexpp@^3.1.0:
version "2.0.1" version "3.2.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
regexpu-core@^4.7.1: regexpu-core@^4.7.1:
version "4.7.1" version "4.7.1"
@ -8784,11 +8776,6 @@ regjsparser@^0.6.4:
dependencies: dependencies:
jsesc "~0.5.0" jsesc "~0.5.0"
relateurl@^0.2.7:
version "0.2.7"
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
remark-html@^8.0.0: remark-html@^8.0.0:
version "8.0.0" version "8.0.0"
resolved "https://registry.yarnpkg.com/remark-html/-/remark-html-8.0.0.tgz#9fcb859a6f3cb40f3ef15402950f1a62ec301b3a" resolved "https://registry.yarnpkg.com/remark-html/-/remark-html-8.0.0.tgz#9fcb859a6f3cb40f3ef15402950f1a62ec301b3a"
@ -9058,13 +9045,6 @@ reusify@^1.0.4:
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
rimraf@2.6.3, rimraf@~2.6.2:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1: rimraf@^2.5.4, rimraf@^2.6.3, rimraf@^2.7.1:
version "2.7.1" version "2.7.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
@ -9079,6 +9059,13 @@ rimraf@^3.0.0, rimraf@^3.0.2:
dependencies: dependencies:
glob "^7.1.3" glob "^7.1.3"
rimraf@~2.6.2:
version "2.6.3"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"
integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==
dependencies:
glob "^7.1.3"
ripemd160@^2.0.0, ripemd160@^2.0.1: ripemd160@^2.0.0, ripemd160@^2.0.1:
version "2.0.2" version "2.0.2"
resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c"
@ -9116,7 +9103,7 @@ rw@1:
resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4"
integrity sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q= integrity sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=
rxjs@^6.6.0, rxjs@^6.6.3, rxjs@^6.6.6, rxjs@^6.6.7: rxjs@^6.6.3, rxjs@^6.6.6, rxjs@^6.6.7:
version "6.6.7" version "6.6.7"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9"
integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==
@ -9207,7 +9194,7 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
semver@^7.3.2, semver@^7.3.4: semver@^7.2.1, semver@^7.3.2, semver@^7.3.4:
version "7.3.5" version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
@ -9384,15 +9371,6 @@ slash@^3.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
slice-ansi@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636"
integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==
dependencies:
ansi-styles "^3.2.0"
astral-regex "^1.0.0"
is-fullwidth-code-point "^2.0.0"
slice-ansi@^3.0.0: slice-ansi@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787"
@ -9496,7 +9474,7 @@ source-map@^0.5.0, source-map@^0.5.6:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
@ -9853,7 +9831,7 @@ strip-json-comments@^2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
strip-json-comments@^3.0.1: strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
@ -9911,15 +9889,17 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
table@^5.2.3: table@^6.0.9:
version "5.4.6" version "6.7.1"
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2"
integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==
dependencies: dependencies:
ajv "^6.10.2" ajv "^8.0.1"
lodash "^4.17.14" lodash.clonedeep "^4.5.0"
slice-ansi "^2.1.0" lodash.truncate "^4.4.2"
string-width "^3.0.0" slice-ansi "^4.0.0"
string-width "^4.2.0"
strip-ansi "^6.0.0"
tapable@^1.0.0, tapable@^1.1.3: tapable@^1.0.0, tapable@^1.1.3:
version "1.1.3" version "1.1.3"
@ -9971,7 +9951,7 @@ terser-webpack-plugin@^2.2.2:
terser "^4.6.12" terser "^4.6.12"
webpack-sources "^1.4.3" webpack-sources "^1.4.3"
terser@^4.0.0, terser@^4.1.2, terser@^4.6.12: terser@^4.1.2, terser@^4.6.12:
version "4.8.0" version "4.8.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17" resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw== integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==
@ -10179,16 +10159,6 @@ trough@^1.0.0:
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406"
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==
try-catch@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/try-catch/-/try-catch-2.0.1.tgz#a35d354187c422f291a0bcfd9eb77e3a4f90c1e5"
integrity sha512-LsOrmObN/2WdM+y2xG+t16vhYrQsnV8wftXIcIOWZhQcBJvKGYuamJGwnU98A7Jxs2oZNkJztXlphEOoA0DWqg==
try-to-catch@^1.0.2:
version "1.1.1"
resolved "https://registry.yarnpkg.com/try-to-catch/-/try-to-catch-1.1.1.tgz#770162dd13b9a0e55da04db5b7f888956072038a"
integrity sha512-ikUlS+/BcImLhNYyIgZcEmq4byc31QpC+46/6Jm5ECWkVFhf8SM2Fp/0pMVXPX6vk45SMCwrP4Taxucne8I0VA==
tslib@^1.9.0, tslib@^1.9.3: tslib@^1.9.0, tslib@^1.9.3:
version "1.14.1" version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
@ -10216,6 +10186,13 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==
dependencies:
prelude-ls "^1.2.1"
type-check@~0.3.2: type-check@~0.3.2:
version "0.3.2" version "0.3.2"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
@ -10228,16 +10205,16 @@ type-detect@4.0.8:
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
type-fest@^0.20.2:
version "0.20.2"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
type-fest@^0.21.3: type-fest@^0.21.3:
version "0.21.3" version "0.21.3"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==
type-fest@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
type-is@~1.6.17, type-is@~1.6.18: type-is@~1.6.17, type-is@~1.6.18:
version "1.6.18" version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
@ -10258,11 +10235,6 @@ typedarray@^0.0.6, typedarray@~0.0.5:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
uglify-js@^3.5.1:
version "3.13.10"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.10.tgz#a6bd0d28d38f592c3adb6b180ea6e07e1e540a8d"
integrity sha512-57H3ACYFXeo1IaZ1w02sfA71wI60MGco/IQFjOqK+WtKoprh7Go2/yvd2HPtoJILO2Or84ncLccI4xoHMTSbGg==
unc-path-regex@^0.1.2: unc-path-regex@^0.1.2:
version "0.1.2" version "0.1.2"
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"
@ -10446,11 +10418,6 @@ upath@^1.1.1:
resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894"
integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==
upper-case@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=
uri-js@^4.2.2: uri-js@^4.2.2:
version "4.4.1" version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
@ -10944,7 +10911,7 @@ widest-line@^3.1.0:
dependencies: dependencies:
string-width "^4.0.0" string-width "^4.0.0"
word-wrap@~1.2.3: word-wrap@^1.2.3, word-wrap@~1.2.3:
version "1.2.3" version "1.2.3"
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
@ -11024,13 +10991,6 @@ write-file-atomic@^3.0.0:
signal-exit "^3.0.2" signal-exit "^3.0.2"
typedarray-to-buffer "^3.1.5" typedarray-to-buffer "^3.1.5"
write@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3"
integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==
dependencies:
mkdirp "^0.5.1"
ws@^6.2.1: ws@^6.2.1:
version "6.2.2" version "6.2.2"
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e" resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e"