mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Update of prettier, eslint and rules
This commit is contained in:
parent
896c7eca57
commit
5399214ad8
4
dist/mermaid.core.js
vendored
4
dist/mermaid.core.js
vendored
@ -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 */
|
||||
/***/ (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 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
|
||||
// const style2 = document.createElement('style');
|
||||
// const cs = window.getComputedStyle(svg);
|
||||
|
2
dist/mermaid.core.js.map
vendored
2
dist/mermaid.core.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/mermaid.js
vendored
4
dist/mermaid.js
vendored
@ -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 */
|
||||
/***/ (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 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
|
||||
// const style2 = document.createElement('style');
|
||||
// const cs = window.getComputedStyle(svg);
|
||||
|
2
dist/mermaid.js.map
vendored
2
dist/mermaid.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/mermaid.min.js
vendored
4
dist/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.min.js.map
vendored
2
dist/mermaid.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -73,17 +73,16 @@
|
||||
"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",
|
||||
"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",
|
||||
"minify": "^4.1.1",
|
||||
"moment": "^2.23.0",
|
||||
"prettier": "^1.18.2",
|
||||
"prettier": "^2.3.2",
|
||||
"start-server-and-test": "^1.12.6",
|
||||
"terser-webpack-plugin": "^2.2.2",
|
||||
"webpack": "^4.41.2",
|
||||
|
@ -1,3 +1,3 @@
|
||||
module.exports = function(txt) {
|
||||
module.exports = function (txt) {
|
||||
return txt;
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ export const updateCurrentConfig = (siteCfg, _directives) => {
|
||||
* @param conf - the base currentConfig to use as siteConfig
|
||||
* @returns {*} - the siteConfig
|
||||
*/
|
||||
export const setSiteConfig = conf => {
|
||||
export const setSiteConfig = (conf) => {
|
||||
siteConfig = assignWithDepth({}, defaultConfig);
|
||||
siteConfig = assignWithDepth(siteConfig, conf);
|
||||
|
||||
@ -67,11 +67,11 @@ export const setSiteConfig = conf => {
|
||||
return siteConfig;
|
||||
};
|
||||
|
||||
export const saveConfigFromInitilize = conf => {
|
||||
export const saveConfigFromInitilize = (conf) => {
|
||||
configFromInitialize = assignWithDepth({}, conf);
|
||||
};
|
||||
|
||||
export const updateSiteConfig = conf => {
|
||||
export const updateSiteConfig = (conf) => {
|
||||
siteConfig = assignWithDepth(siteConfig, conf);
|
||||
updateCurrentConfig(siteConfig, directives);
|
||||
|
||||
@ -101,7 +101,7 @@ export const getSiteConfig = () => {
|
||||
* @param conf - the potential currentConfig
|
||||
* @returns {*} - the currentConfig merged with the sanitized conf
|
||||
*/
|
||||
export const setConfig = conf => {
|
||||
export const setConfig = (conf) => {
|
||||
// sanitize(conf);
|
||||
// Object.keys(conf).forEach(key => {
|
||||
// const manipulator = manipulators[key];
|
||||
@ -134,9 +134,9 @@ export const getConfig = () => {
|
||||
*Note: modifies options in-place
|
||||
* @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
|
||||
Object.keys(siteConfig.secure).forEach(key => {
|
||||
Object.keys(siteConfig.secure).forEach((key) => {
|
||||
if (typeof options[siteConfig.secure[key]] !== 'undefined') {
|
||||
// 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
|
||||
@ -149,14 +149,14 @@ export const sanitize = options => {
|
||||
});
|
||||
|
||||
// Check that there no attempts of prototype pollution
|
||||
Object.keys(options).forEach(key => {
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (key.indexOf('__') === 0) {
|
||||
delete options[key];
|
||||
}
|
||||
});
|
||||
// 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
|
||||
Object.keys(options).forEach(key => {
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (typeof options[key] === 'string') {
|
||||
if (
|
||||
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.themeVariables) {
|
||||
directive.themeVariables = { fontFamily: directive.fontFamily };
|
||||
|
@ -10,12 +10,12 @@ import config from './defaultConfig';
|
||||
// import themeForestVariables from './theme-forest';
|
||||
// import themeNeutralVariables from './theme-neutral';
|
||||
|
||||
const handleThemeVariables = value => {
|
||||
const handleThemeVariables = (value) => {
|
||||
return theme[value] ? theme[value].getThemeVariables() : theme.default.getThemeVariables();
|
||||
};
|
||||
|
||||
const manipulators = {
|
||||
themeVariables: handleThemeVariables
|
||||
themeVariables: handleThemeVariables,
|
||||
};
|
||||
|
||||
// debugger;
|
||||
@ -40,10 +40,10 @@ const currentConfig = assignWithDepth({}, defaultConfig);
|
||||
* @param conf - the base currentConfig to use as siteConfig
|
||||
* @returns {*} - the siteConfig
|
||||
*/
|
||||
export const setSiteConfig = conf => {
|
||||
export const setSiteConfig = (conf) => {
|
||||
console.log('setSiteConfig');
|
||||
|
||||
Object.keys(conf).forEach(key => {
|
||||
Object.keys(conf).forEach((key) => {
|
||||
const manipulator = manipulators[key];
|
||||
conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
|
||||
});
|
||||
@ -78,10 +78,10 @@ export const getSiteConfig = () => {
|
||||
* @param conf - the potential currentConfig
|
||||
* @returns {*} - the currentConfig merged with the sanitized conf
|
||||
*/
|
||||
export const setConfig = conf => {
|
||||
export const setConfig = (conf) => {
|
||||
console.log('setConfig');
|
||||
sanitize(conf);
|
||||
Object.keys(conf).forEach(key => {
|
||||
Object.keys(conf).forEach((key) => {
|
||||
const manipulator = manipulators[key];
|
||||
conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
|
||||
});
|
||||
@ -110,8 +110,8 @@ export const getConfig = () => {
|
||||
*Note: modifies options in-place
|
||||
* @param options - the potential setConfig parameter
|
||||
*/
|
||||
export const sanitize = options => {
|
||||
Object.keys(siteConfig.secure).forEach(key => {
|
||||
export const sanitize = (options) => {
|
||||
Object.keys(siteConfig.secure).forEach((key) => {
|
||||
if (typeof options[siteConfig.secure[key]] !== 'undefined') {
|
||||
// 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
|
||||
@ -139,8 +139,8 @@ export const sanitize = options => {
|
||||
*/
|
||||
export const reset = (conf = getSiteConfig()) => {
|
||||
console.warn('reset');
|
||||
Object.keys(siteConfig).forEach(key => delete siteConfig[key]);
|
||||
Object.keys(currentConfig).forEach(key => delete currentConfig[key]);
|
||||
Object.keys(siteConfig).forEach((key) => delete siteConfig[key]);
|
||||
Object.keys(currentConfig).forEach((key) => delete currentConfig[key]);
|
||||
assignWithDepth(siteConfig, conf, { clobber: true });
|
||||
assignWithDepth(currentConfig, conf, { clobber: true });
|
||||
};
|
||||
@ -152,6 +152,6 @@ const configApi = Object.freeze({
|
||||
setConfig,
|
||||
getConfig,
|
||||
reset,
|
||||
defaultConfig
|
||||
defaultConfig,
|
||||
});
|
||||
export default configApi;
|
||||
|
@ -70,7 +70,7 @@ const rect = (parent, node) => {
|
||||
node.width = rectBox.width;
|
||||
node.height = rectBox.height;
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersectRect(node, point);
|
||||
};
|
||||
|
||||
@ -82,10 +82,7 @@ const rect = (parent, node) => {
|
||||
*/
|
||||
const noteGroup = (parent, node) => {
|
||||
// Add outer g element
|
||||
const shapeSvg = parent
|
||||
.insert('g')
|
||||
.attr('class', 'note-cluster')
|
||||
.attr('id', node.id);
|
||||
const shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id);
|
||||
|
||||
// add the rect
|
||||
const rect = shapeSvg.insert('rect', ':first-child');
|
||||
@ -107,7 +104,7 @@ const noteGroup = (parent, node) => {
|
||||
node.width = rectBox.width;
|
||||
node.height = rectBox.height;
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersectRect(node, point);
|
||||
};
|
||||
|
||||
@ -115,10 +112,7 @@ const noteGroup = (parent, node) => {
|
||||
};
|
||||
const roundedWithTitle = (parent, node) => {
|
||||
// Add outer g element
|
||||
const shapeSvg = parent
|
||||
.insert('g')
|
||||
.attr('class', node.classes)
|
||||
.attr('id', node.id);
|
||||
const shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id);
|
||||
|
||||
// add the rect
|
||||
const rect = shapeSvg.insert('rect', ':first-child');
|
||||
@ -181,7 +175,7 @@ const roundedWithTitle = (parent, node) => {
|
||||
const rectBox = rect.node().getBBox();
|
||||
node.height = rectBox.height;
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersectRect(node, point);
|
||||
};
|
||||
|
||||
@ -190,10 +184,7 @@ const roundedWithTitle = (parent, node) => {
|
||||
|
||||
const divider = (parent, node) => {
|
||||
// Add outer g element
|
||||
const shapeSvg = parent
|
||||
.insert('g')
|
||||
.attr('class', node.classes)
|
||||
.attr('id', node.id);
|
||||
const shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id);
|
||||
|
||||
// add the rect
|
||||
const rect = shapeSvg.insert('rect', ':first-child');
|
||||
@ -213,7 +204,7 @@ const divider = (parent, node) => {
|
||||
node.width = rectBox.width;
|
||||
node.height = rectBox.height;
|
||||
node.diff = -node.padding / 2;
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersectRect(node, point);
|
||||
};
|
||||
|
||||
@ -241,7 +232,7 @@ export const clear = () => {
|
||||
clusterElems = {};
|
||||
};
|
||||
|
||||
export const positionCluster = node => {
|
||||
export const positionCluster = (node) => {
|
||||
log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')');
|
||||
const el = clusterElems[node.id];
|
||||
|
||||
|
@ -95,9 +95,9 @@ const createLabel = (_vertexText, style, isTitle, isNode) => {
|
||||
isNode,
|
||||
label: vertexText.replace(
|
||||
/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);
|
||||
// vertexNode.parentNode.removeChild(vertexNode);
|
||||
|
@ -240,7 +240,7 @@ export const intersection = (node, outsidePoint, insidePoint) => {
|
||||
r = (R * q) / Q;
|
||||
const res = {
|
||||
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) {
|
||||
@ -298,7 +298,7 @@ const cutPathAtIntersect = (_points, boundryNode) => {
|
||||
let points = [];
|
||||
let lastPointOutside = _points[0];
|
||||
let isInside = false;
|
||||
_points.forEach(point => {
|
||||
_points.forEach((point) => {
|
||||
// const node = clusterDb[edge.toCluster].node;
|
||||
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
|
||||
let pointPresent = false;
|
||||
points.forEach(p => {
|
||||
points.forEach((p) => {
|
||||
pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
|
||||
});
|
||||
// // 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);
|
||||
} else {
|
||||
log.warn('abc88 no intersect', inter, points);
|
||||
@ -336,7 +336,7 @@ const cutPathAtIntersect = (_points, boundryNode) => {
|
||||
};
|
||||
|
||||
//(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 pointsHasChanged = false;
|
||||
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
|
||||
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
|
||||
let curve;
|
||||
@ -451,10 +451,10 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
|
||||
}
|
||||
// curve = curveLinear;
|
||||
const lineFunction = line()
|
||||
.x(function(d) {
|
||||
.x(function (d) {
|
||||
return d.x;
|
||||
})
|
||||
.y(function(d) {
|
||||
.y(function (d) {
|
||||
return d.y;
|
||||
})
|
||||
.curve(curve);
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
clusterDb,
|
||||
adjustClustersAndEdges,
|
||||
findNonClusterChild,
|
||||
sortNodesByHierarchy
|
||||
sortNodesByHierarchy,
|
||||
} from './mermaid-graphlib';
|
||||
import { insertNode, positionNode, clear as clearNodes, setNodeElem } from './nodes';
|
||||
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
|
||||
// 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);
|
||||
if (typeof parentCluster !== 'undefined') {
|
||||
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
|
||||
// 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
|
||||
graph.edges().forEach(function(e) {
|
||||
graph.edges().forEach(function (e) {
|
||||
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 + ': ', e, ' ', JSON.stringify(graph.edge(e)));
|
||||
@ -88,7 +88,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
|
||||
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('#############################################');
|
||||
@ -99,7 +99,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
|
||||
log.info('Graph after layout:', graphlib.json.write(graph));
|
||||
// Move the nodes to the correct place
|
||||
let diff = 0;
|
||||
sortNodesByHierarchy(graph).forEach(function(v) {
|
||||
sortNodesByHierarchy(graph).forEach(function (v) {
|
||||
const node = graph.node(v);
|
||||
log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
|
||||
log.info(
|
||||
@ -128,7 +128,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
|
||||
});
|
||||
|
||||
// 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);
|
||||
log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
|
||||
|
||||
@ -136,7 +136,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
|
||||
positionEdgeLabel(edge, paths);
|
||||
});
|
||||
|
||||
graph.nodes().forEach(function(v) {
|
||||
graph.nodes().forEach(function (v) {
|
||||
const n = graph.node(v);
|
||||
log.info(v, n.type, n.diff);
|
||||
if (n.type === 'group') {
|
||||
|
@ -3,5 +3,5 @@ module.exports = {
|
||||
circle: require('./intersect-circle'),
|
||||
ellipse: require('./intersect-ellipse'),
|
||||
polygon: require('./intersect-polygon'),
|
||||
rect: require('./intersect-rect')
|
||||
rect: require('./intersect-rect'),
|
||||
};
|
||||
|
@ -13,5 +13,5 @@ export default {
|
||||
circle,
|
||||
ellipse,
|
||||
polygon,
|
||||
rect
|
||||
rect,
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ function intersectPolygon(node, polyPoints, point) {
|
||||
var minX = Number.POSITIVE_INFINITY;
|
||||
var minY = Number.POSITIVE_INFINITY;
|
||||
if (typeof polyPoints.forEach === 'function') {
|
||||
polyPoints.forEach(function(entry) {
|
||||
polyPoints.forEach(function (entry) {
|
||||
minX = Math.min(minX, entry.x);
|
||||
minY = Math.min(minY, entry.y);
|
||||
});
|
||||
@ -50,7 +50,7 @@ function intersectPolygon(node, polyPoints, point) {
|
||||
|
||||
if (intersections.length > 1) {
|
||||
// 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 pdy = p.y - point.y;
|
||||
var distp = Math.sqrt(pdx * pdx + pdy * pdy);
|
||||
|
@ -6,7 +6,7 @@ import { log } from '../logger';
|
||||
|
||||
// Only add the number of markers that the diagram needs
|
||||
const insertMarkers = (elem, markerArray, type, id) => {
|
||||
markerArray.forEach(markerName => {
|
||||
markerArray.forEach((markerName) => {
|
||||
markers[markerName](elem, type, id);
|
||||
});
|
||||
};
|
||||
@ -255,6 +255,6 @@ const markers = {
|
||||
point,
|
||||
circle,
|
||||
cross,
|
||||
barb
|
||||
barb,
|
||||
};
|
||||
export default insertMarkers;
|
||||
|
@ -70,7 +70,7 @@ const copy = (clusterId, graph, newGraph, rootId) => {
|
||||
|
||||
log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
|
||||
|
||||
nodes.forEach(node => {
|
||||
nodes.forEach((node) => {
|
||||
if (graph.children(node).length > 0) {
|
||||
copy(node, graph, newGraph, rootId);
|
||||
} else {
|
||||
@ -98,7 +98,7 @@ const copy = (clusterId, graph, newGraph, rootId) => {
|
||||
}
|
||||
const edges = graph.edges(node);
|
||||
log.debug('Copying Edges', edges);
|
||||
edges.forEach(edge => {
|
||||
edges.forEach((edge) => {
|
||||
log.info('Edge', edge);
|
||||
const data = graph.edge(edge.v, edge.w, edge.name);
|
||||
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.
|
||||
* @param {graphlib graph} g
|
||||
*/
|
||||
export const validate = graph => {
|
||||
export const validate = (graph) => {
|
||||
const edges = graph.edges();
|
||||
log.trace('Edges: ', edges);
|
||||
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]) {
|
||||
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
|
||||
// faking a link to a cluster
|
||||
graph.nodes().forEach(function(id) {
|
||||
graph.nodes().forEach(function (id) {
|
||||
const children = graph.children(id);
|
||||
if (children.length > 0) {
|
||||
log.warn(
|
||||
@ -227,12 +227,12 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
});
|
||||
|
||||
// Check incoming and outgoing edges for each cluster
|
||||
graph.nodes().forEach(function(id) {
|
||||
graph.nodes().forEach(function (id) {
|
||||
const children = graph.children(id);
|
||||
const edges = graph.edges();
|
||||
if (children.length > 0) {
|
||||
log.debug('Cluster identified', id, decendants);
|
||||
edges.forEach(edge => {
|
||||
edges.forEach((edge) => {
|
||||
// log.debug('Edge, decendants: ', edge, decendants[id]);
|
||||
|
||||
// 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
|
||||
// in the cluster inorder to fake the edge
|
||||
graph.edges().forEach(function(e) {
|
||||
graph.edges().forEach(function (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(graph.edge(e)));
|
||||
@ -368,16 +368,16 @@ export const extractor = (graph, depth) => {
|
||||
|
||||
const clusterGraph = new graphlib.Graph({
|
||||
multigraph: true,
|
||||
compound: true
|
||||
compound: true,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: dir, // Todo: set proper spacing
|
||||
nodesep: 50,
|
||||
ranksep: 50,
|
||||
marginx: 8,
|
||||
marginy: 8
|
||||
marginy: 8,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -388,7 +388,7 @@ export const extractor = (graph, depth) => {
|
||||
id: node,
|
||||
clusterData: clusterDb[node].clusterData,
|
||||
labelText: clusterDb[node].labelText,
|
||||
graph: clusterGraph
|
||||
graph: clusterGraph,
|
||||
});
|
||||
log.warn('New graph after copy node: (', node, ')', graphlib.json.write(clusterGraph));
|
||||
log.debug('Old graph after copy', graphlib.json.write(graph));
|
||||
@ -424,7 +424,7 @@ export const extractor = (graph, depth) => {
|
||||
const sorter = (graph, nodes) => {
|
||||
if (nodes.length === 0) return [];
|
||||
let result = Object.assign(nodes);
|
||||
nodes.forEach(node => {
|
||||
nodes.forEach((node) => {
|
||||
const children = graph.children(node);
|
||||
const sorted = sorter(graph, children);
|
||||
result = result.concat(sorted);
|
||||
@ -433,4 +433,4 @@ const sorter = (graph, nodes) => {
|
||||
return result;
|
||||
};
|
||||
|
||||
export const sortNodesByHierarchy = graph => sorter(graph, graph.children());
|
||||
export const sortNodesByHierarchy = (graph) => sorter(graph, graph.children());
|
||||
|
@ -18,7 +18,7 @@ const question = (parent, node) => {
|
||||
{ x: s / 2, y: 0 },
|
||||
{ x: s, y: -s / 2 },
|
||||
{ x: s / 2, y: -s },
|
||||
{ x: 0, y: -s / 2 }
|
||||
{ x: 0, y: -s / 2 },
|
||||
];
|
||||
|
||||
log.info('Question main (Circle)');
|
||||
@ -27,7 +27,7 @@ const question = (parent, node) => {
|
||||
questionElem.attr('style', node.style);
|
||||
updateNodeBounds(node, questionElem);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
log.warn('Intersect called');
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
@ -46,27 +46,23 @@ const choice = (parent, node) => {
|
||||
{ x: 0, y: s / 2 },
|
||||
{ x: s / 2, y: 0 },
|
||||
{ x: 0, y: -s / 2 },
|
||||
{ x: -s / 2, y: 0 }
|
||||
{ x: -s / 2, y: 0 },
|
||||
];
|
||||
|
||||
const choice = shapeSvg.insert('polygon', ':first-child').attr(
|
||||
'points',
|
||||
points
|
||||
.map(function(d) {
|
||||
.map(function (d) {
|
||||
return d.x + ',' + d.y;
|
||||
})
|
||||
.join(' ')
|
||||
);
|
||||
// center the circle around its coordinate
|
||||
choice
|
||||
.attr('class', 'state-start')
|
||||
.attr('r', 7)
|
||||
.attr('width', 28)
|
||||
.attr('height', 28);
|
||||
choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28);
|
||||
node.width = 28;
|
||||
node.height = 28;
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.circle(node, 14, point);
|
||||
};
|
||||
|
||||
@ -86,14 +82,14 @@ const hexagon = (parent, node) => {
|
||||
{ x: w, y: -h / 2 },
|
||||
{ x: w - m, y: -h },
|
||||
{ x: m, y: -h },
|
||||
{ x: 0, y: -h / 2 }
|
||||
{ x: 0, y: -h / 2 },
|
||||
];
|
||||
|
||||
const hex = insertPolygonShape(shapeSvg, w, h, points);
|
||||
hex.attr('style', node.style);
|
||||
updateNodeBounds(node, hex);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (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: -h },
|
||||
{ x: -h / 2, y: -h },
|
||||
{ x: 0, y: -h / 2 }
|
||||
{ x: 0, y: -h / 2 },
|
||||
];
|
||||
|
||||
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||
@ -119,7 +115,7 @@ const rect_left_inv_arrow = (parent, node) => {
|
||||
node.width = w + h;
|
||||
node.height = h;
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
@ -135,14 +131,14 @@ const lean_right = (parent, node) => {
|
||||
{ x: (-2 * h) / 6, y: 0 },
|
||||
{ x: w - h / 6, y: 0 },
|
||||
{ x: w + (2 * h) / 6, y: -h },
|
||||
{ x: h / 6, y: -h }
|
||||
{ x: h / 6, y: -h },
|
||||
];
|
||||
|
||||
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||
el.attr('style', node.style);
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
@ -158,14 +154,14 @@ const lean_left = (parent, node) => {
|
||||
{ x: (2 * h) / 6, y: 0 },
|
||||
{ x: w + h / 6, y: 0 },
|
||||
{ x: w - (2 * h) / 6, y: -h },
|
||||
{ x: -h / 6, y: -h }
|
||||
{ x: -h / 6, y: -h },
|
||||
];
|
||||
|
||||
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||
el.attr('style', node.style);
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
@ -181,14 +177,14 @@ const trapezoid = (parent, node) => {
|
||||
{ x: (-2 * h) / 6, y: 0 },
|
||||
{ x: w + (2 * h) / 6, y: 0 },
|
||||
{ x: w - h / 6, y: -h },
|
||||
{ x: h / 6, y: -h }
|
||||
{ x: h / 6, y: -h },
|
||||
];
|
||||
|
||||
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||
el.attr('style', node.style);
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
@ -204,14 +200,14 @@ const inv_trapezoid = (parent, node) => {
|
||||
{ x: h / 6, y: 0 },
|
||||
{ x: w - h / 6, y: 0 },
|
||||
{ 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);
|
||||
el.attr('style', node.style);
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (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, y: -h / 2 },
|
||||
{ x: w + h / 2, y: -h },
|
||||
{ x: 0, y: -h }
|
||||
{ x: 0, y: -h },
|
||||
];
|
||||
|
||||
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||
el.attr('style', node.style);
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
@ -285,7 +281,7 @@ const cylinder = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
const pos = intersect.rect(node, point);
|
||||
const x = pos.x - node.x;
|
||||
|
||||
@ -329,7 +325,7 @@ const rect = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, rect);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
};
|
||||
|
||||
@ -442,7 +438,7 @@ const rectWithTitle = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, rect);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
};
|
||||
|
||||
@ -468,7 +464,7 @@ const stadium = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, rect);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
};
|
||||
|
||||
@ -492,7 +488,7 @@ const circle = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, circle);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
log.info('Circle intersect', 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: -h },
|
||||
{ x: -8, y: -h },
|
||||
{ x: -8, y: 0 }
|
||||
{ x: -8, y: 0 },
|
||||
];
|
||||
|
||||
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||
el.attr('style', node.style);
|
||||
updateNodeBounds(node, el);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
@ -537,15 +533,11 @@ const start = (parent, node) => {
|
||||
const circle = shapeSvg.insert('circle', ':first-child');
|
||||
|
||||
// center the circle around its coordinate
|
||||
circle
|
||||
.attr('class', 'state-start')
|
||||
.attr('r', 7)
|
||||
.attr('width', 14)
|
||||
.attr('height', 14);
|
||||
circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
|
||||
|
||||
updateNodeBounds(node, circle);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.circle(node, 7, point);
|
||||
};
|
||||
|
||||
@ -577,7 +569,7 @@ const forkJoin = (parent, node, dir) => {
|
||||
updateNodeBounds(node, shape);
|
||||
node.height = node.height + node.padding / 2;
|
||||
node.width = node.width + node.padding / 2;
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
};
|
||||
|
||||
@ -592,21 +584,13 @@ const end = (parent, node) => {
|
||||
const innerCircle = shapeSvg.insert('circle', ':first-child');
|
||||
const circle = shapeSvg.insert('circle', ':first-child');
|
||||
|
||||
circle
|
||||
.attr('class', 'state-start')
|
||||
.attr('r', 7)
|
||||
.attr('width', 14)
|
||||
.attr('height', 14);
|
||||
circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
|
||||
|
||||
innerCircle
|
||||
.attr('class', 'state-end')
|
||||
.attr('r', 5)
|
||||
.attr('width', 10)
|
||||
.attr('height', 10);
|
||||
innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
|
||||
|
||||
updateNodeBounds(node, circle);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.circle(node, 7, point);
|
||||
};
|
||||
|
||||
@ -683,7 +667,7 @@ const class_box = (parent, node) => {
|
||||
maxWidth = classTitleBBox.width;
|
||||
}
|
||||
const classAttributes = [];
|
||||
node.classData.members.forEach(str => {
|
||||
node.classData.members.forEach((str) => {
|
||||
const parsedText = parseMember(str).displayText;
|
||||
const lbl = labelContainer
|
||||
.node()
|
||||
@ -706,7 +690,7 @@ const class_box = (parent, node) => {
|
||||
maxHeight += lineHeight;
|
||||
|
||||
const classMethods = [];
|
||||
node.classData.methods.forEach(str => {
|
||||
node.classData.methods.forEach((str) => {
|
||||
const parsedText = parseMember(str).displayText;
|
||||
const lbl = labelContainer
|
||||
.node()
|
||||
@ -761,7 +745,7 @@ const class_box = (parent, node) => {
|
||||
|
||||
verticalPos += lineHeight;
|
||||
|
||||
classAttributes.forEach(lbl => {
|
||||
classAttributes.forEach((lbl) => {
|
||||
select(lbl).attr(
|
||||
'transform',
|
||||
'translate( ' +
|
||||
@ -783,7 +767,7 @@ const class_box = (parent, node) => {
|
||||
|
||||
verticalPos += lineHeight;
|
||||
|
||||
classMethods.forEach(lbl => {
|
||||
classMethods.forEach((lbl) => {
|
||||
select(lbl).attr(
|
||||
'transform',
|
||||
'translate( ' + -maxWidth / 2 + ', ' + ((-1 * maxHeight) / 2 + verticalPos) + ')'
|
||||
@ -862,7 +846,7 @@ const class_box = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, rect);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
};
|
||||
|
||||
@ -890,7 +874,7 @@ const shapes = {
|
||||
subroutine,
|
||||
fork: forkJoin,
|
||||
join: forkJoin,
|
||||
class_box
|
||||
class_box,
|
||||
};
|
||||
|
||||
let nodeElems = {};
|
||||
@ -930,7 +914,7 @@ export const clear = () => {
|
||||
nodeElems = {};
|
||||
};
|
||||
|
||||
export const positionNode = node => {
|
||||
export const positionNode = (node) => {
|
||||
const el = nodeElems[node.id];
|
||||
log.trace(
|
||||
'Transforming node',
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
// Only add the number of markers that the diagram needs
|
||||
const insertPatterns = (elem, patternArray, type, id) => {
|
||||
patternArray.forEach(patternName => {
|
||||
patternArray.forEach((patternName) => {
|
||||
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
|
||||
const patterns = {
|
||||
dots
|
||||
dots,
|
||||
};
|
||||
export default insertPatterns;
|
||||
|
@ -19,7 +19,7 @@ const note = (parent, node) => {
|
||||
|
||||
updateNodeBounds(node, rect);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
};
|
||||
|
||||
|
@ -16,10 +16,7 @@ export const labelHelper = (parent, node, _classes, isNode) => {
|
||||
.attr('id', node.domId || node.id);
|
||||
|
||||
// Create the label and insert it after the rect
|
||||
const label = shapeSvg
|
||||
.insert('g')
|
||||
.attr('class', 'label')
|
||||
.attr('style', node.labelStyle);
|
||||
const label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
|
||||
|
||||
const text = label
|
||||
.node()
|
||||
@ -56,7 +53,7 @@ export function insertPolygonShape(parent, w, h, points) {
|
||||
.attr(
|
||||
'points',
|
||||
points
|
||||
.map(function(d) {
|
||||
.map(function (d) {
|
||||
return d.x + ',' + d.y;
|
||||
})
|
||||
.join(' ')
|
||||
|
@ -241,7 +241,7 @@ const config = {
|
||||
*
|
||||
* Default value: 'dagre-d3'
|
||||
*/
|
||||
defaultRenderer: 'dagre-d3'
|
||||
defaultRenderer: 'dagre-d3',
|
||||
},
|
||||
|
||||
/**
|
||||
@ -541,27 +541,27 @@ const config = {
|
||||
*/
|
||||
labelBoxHeight: 20,
|
||||
|
||||
messageFont: function() {
|
||||
messageFont: function () {
|
||||
return {
|
||||
fontFamily: this.messageFontFamily,
|
||||
fontSize: this.messageFontSize,
|
||||
fontWeight: this.messageFontWeight
|
||||
fontWeight: this.messageFontWeight,
|
||||
};
|
||||
},
|
||||
noteFont: function() {
|
||||
noteFont: function () {
|
||||
return {
|
||||
fontFamily: this.noteFontFamily,
|
||||
fontSize: this.noteFontSize,
|
||||
fontWeight: this.noteFontWeight
|
||||
fontWeight: this.noteFontWeight,
|
||||
};
|
||||
},
|
||||
actorFont: function() {
|
||||
actorFont: function () {
|
||||
return {
|
||||
fontFamily: this.actorFontFamily,
|
||||
fontSize: this.actorFontSize,
|
||||
fontWeight: this.actorFontWeight
|
||||
fontWeight: this.actorFontWeight,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
@ -709,7 +709,7 @@ top of the chart
|
||||
*/
|
||||
topAxis: false,
|
||||
|
||||
useWidth: undefined
|
||||
useWidth: undefined,
|
||||
},
|
||||
|
||||
/**
|
||||
@ -869,7 +869,7 @@ top of the chart
|
||||
actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
|
||||
|
||||
sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
|
||||
sectionColours: ['#fff']
|
||||
sectionColours: ['#fff'],
|
||||
},
|
||||
class: {
|
||||
arrowMarkerAbsolute: false,
|
||||
@ -900,7 +900,7 @@ top of the chart
|
||||
*
|
||||
* Default value: 'dagre-d3'
|
||||
*/
|
||||
defaultRenderer: 'dagre-d3'
|
||||
defaultRenderer: 'dagre-d3',
|
||||
},
|
||||
git: {
|
||||
arrowMarkerAbsolute: false,
|
||||
@ -919,7 +919,7 @@ top of the chart
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
useMaxWidth: true
|
||||
useMaxWidth: true,
|
||||
},
|
||||
state: {
|
||||
dividerMargin: 10,
|
||||
@ -966,7 +966,7 @@ top of the chart
|
||||
*
|
||||
* Default value: 'dagre-d3'
|
||||
*/
|
||||
defaultRenderer: 'dagre-wrapper'
|
||||
defaultRenderer: 'dagre-wrapper',
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1081,7 +1081,7 @@ top of the chart
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
useMaxWidth: true
|
||||
useMaxWidth: true,
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1103,7 +1103,7 @@ top of the chart
|
||||
*
|
||||
* Default value: true
|
||||
*/
|
||||
useMaxWidth: true
|
||||
useMaxWidth: true,
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1135,8 +1135,8 @@ top of the chart
|
||||
rect_min_height: 200,
|
||||
fontSize: 14,
|
||||
rect_padding: 10,
|
||||
line_height: 20
|
||||
}
|
||||
line_height: 20,
|
||||
},
|
||||
};
|
||||
|
||||
config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
|
||||
|
@ -13,11 +13,11 @@ let classCounter = 0;
|
||||
|
||||
let funs = [];
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (statement, context, type) {
|
||||
mermaidAPI.parseDirective(this, statement, context, type);
|
||||
};
|
||||
|
||||
const splitClassNameAndType = function(id) {
|
||||
const splitClassNameAndType = function (id) {
|
||||
let genericType = '';
|
||||
let className = id;
|
||||
|
||||
@ -36,7 +36,7 @@ const splitClassNameAndType = function(id) {
|
||||
* @param id
|
||||
* @public
|
||||
*/
|
||||
export const addClass = function(id) {
|
||||
export const addClass = function (id) {
|
||||
let classId = splitClassNameAndType(id);
|
||||
// Only add class if not exists
|
||||
if (typeof classes[classId.className] !== 'undefined') return;
|
||||
@ -48,7 +48,7 @@ export const addClass = function(id) {
|
||||
methods: [],
|
||||
members: [],
|
||||
annotations: [],
|
||||
domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter
|
||||
domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter,
|
||||
};
|
||||
|
||||
classCounter++;
|
||||
@ -59,7 +59,7 @@ export const addClass = function(id) {
|
||||
* @param id
|
||||
* @public
|
||||
*/
|
||||
export const lookUpDomId = function(id) {
|
||||
export const lookUpDomId = function (id) {
|
||||
const classKeys = Object.keys(classes);
|
||||
for (let i = 0; i < classKeys.length; i++) {
|
||||
if (classes[classKeys[i]].id === id) {
|
||||
@ -68,25 +68,25 @@ export const lookUpDomId = function(id) {
|
||||
}
|
||||
};
|
||||
|
||||
export const clear = function() {
|
||||
export const clear = function () {
|
||||
relations = [];
|
||||
classes = {};
|
||||
funs = [];
|
||||
funs.push(setupToolTips);
|
||||
};
|
||||
|
||||
export const getClass = function(id) {
|
||||
export const getClass = function (id) {
|
||||
return classes[id];
|
||||
};
|
||||
export const getClasses = function() {
|
||||
export const getClasses = function () {
|
||||
return classes;
|
||||
};
|
||||
|
||||
export const getRelations = function() {
|
||||
export const getRelations = function () {
|
||||
return relations;
|
||||
};
|
||||
|
||||
export const addRelation = function(relation) {
|
||||
export const addRelation = function (relation) {
|
||||
log.debug('Adding relation: ' + JSON.stringify(relation));
|
||||
addClass(relation.id1);
|
||||
addClass(relation.id2);
|
||||
@ -104,7 +104,7 @@ export const addRelation = function(relation) {
|
||||
* @param annotation The name of the annotation without any brackets
|
||||
* @public
|
||||
*/
|
||||
export const addAnnotation = function(className, annotation) {
|
||||
export const addAnnotation = function (className, annotation) {
|
||||
const validatedClassName = splitClassNameAndType(className).className;
|
||||
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
|
||||
* @public
|
||||
*/
|
||||
export const addMember = function(className, member) {
|
||||
export const addMember = function (className, member) {
|
||||
const validatedClassName = splitClassNameAndType(className).className;
|
||||
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)) {
|
||||
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) === ':') {
|
||||
return label.substr(1).trim();
|
||||
} else {
|
||||
@ -157,8 +157,8 @@ export const cleanupLabel = function(label) {
|
||||
* @param ids Comma separated list of ids
|
||||
* @param className Class to add
|
||||
*/
|
||||
export const setCssClass = function(ids, className) {
|
||||
ids.split(',').forEach(function(_id) {
|
||||
export const setCssClass = function (ids, className) {
|
||||
ids.split(',').forEach(function (_id) {
|
||||
let id = _id;
|
||||
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||
if (typeof classes[id] !== 'undefined') {
|
||||
@ -172,9 +172,9 @@ export const setCssClass = function(ids, className) {
|
||||
* @param ids Comma separated list of ids
|
||||
* @param tooltip Tooltip to add
|
||||
*/
|
||||
const setTooltip = function(ids, tooltip) {
|
||||
const setTooltip = function (ids, tooltip) {
|
||||
const config = configApi.getConfig();
|
||||
ids.split(',').forEach(function(id) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
if (typeof tooltip !== 'undefined') {
|
||||
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 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();
|
||||
ids.split(',').forEach(function(_id) {
|
||||
ids.split(',').forEach(function (_id) {
|
||||
let id = _id;
|
||||
if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||
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 functionArgs Function args the function should be called with
|
||||
*/
|
||||
export const setClickEvent = function(ids, functionName, functionArgs) {
|
||||
ids.split(',').forEach(function(id) {
|
||||
export const setClickEvent = function (ids, functionName, functionArgs) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
setClickFunc(id, functionName, functionArgs);
|
||||
classes[id].haveCallback = true;
|
||||
});
|
||||
setCssClass(ids, 'clickable');
|
||||
};
|
||||
|
||||
const setClickFunc = function(domId, functionName, functionArgs) {
|
||||
const setClickFunc = function (domId, functionName, functionArgs) {
|
||||
const config = configApi.getConfig();
|
||||
let id = domId;
|
||||
let elemId = lookUpDomId(id);
|
||||
@ -250,12 +250,12 @@ const setClickFunc = function(domId, functionName, functionArgs) {
|
||||
argList.push(elemId);
|
||||
}
|
||||
|
||||
funs.push(function() {
|
||||
funs.push(function () {
|
||||
const elem = document.querySelector(`[id="${elemId}"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener(
|
||||
'click',
|
||||
function() {
|
||||
function () {
|
||||
utils.runFunc(functionName, ...argList);
|
||||
},
|
||||
false
|
||||
@ -265,38 +265,35 @@ const setClickFunc = function(domId, functionName, functionArgs) {
|
||||
}
|
||||
};
|
||||
|
||||
export const bindFunctions = function(element) {
|
||||
funs.forEach(function(fun) {
|
||||
export const bindFunctions = function (element) {
|
||||
funs.forEach(function (fun) {
|
||||
fun(element);
|
||||
});
|
||||
};
|
||||
|
||||
export const lineType = {
|
||||
LINE: 0,
|
||||
DOTTED_LINE: 1
|
||||
DOTTED_LINE: 1,
|
||||
};
|
||||
|
||||
export const relationType = {
|
||||
AGGREGATION: 0,
|
||||
EXTENSION: 1,
|
||||
COMPOSITION: 2,
|
||||
DEPENDENCY: 3
|
||||
DEPENDENCY: 3,
|
||||
};
|
||||
|
||||
const setupToolTips = function(element) {
|
||||
const setupToolTips = function (element) {
|
||||
let tooltipElem = select('.mermaidTooltip');
|
||||
if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
||||
tooltipElem = select('body')
|
||||
.append('div')
|
||||
.attr('class', 'mermaidTooltip')
|
||||
.style('opacity', 0);
|
||||
tooltipElem = select('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
|
||||
}
|
||||
|
||||
const svg = select(element).select('svg');
|
||||
|
||||
const nodes = svg.selectAll('g.node');
|
||||
nodes
|
||||
.on('mouseover', function() {
|
||||
.on('mouseover', function () {
|
||||
const el = select(this);
|
||||
const title = el.attr('title');
|
||||
// Dont try to draw a tooltip if no data is provided
|
||||
@ -305,21 +302,15 @@ const setupToolTips = function(element) {
|
||||
}
|
||||
const rect = this.getBoundingClientRect();
|
||||
|
||||
tooltipElem
|
||||
.transition()
|
||||
.duration(200)
|
||||
.style('opacity', '.9');
|
||||
tooltipElem.transition().duration(200).style('opacity', '.9');
|
||||
tooltipElem
|
||||
.html(el.attr('title'))
|
||||
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
|
||||
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
|
||||
el.classed('hover', true);
|
||||
})
|
||||
.on('mouseout', function() {
|
||||
tooltipElem
|
||||
.transition()
|
||||
.duration(500)
|
||||
.style('opacity', 0);
|
||||
.on('mouseout', function () {
|
||||
tooltipElem.transition().duration(500).style('opacity', 0);
|
||||
const el = select(this);
|
||||
el.classed('hover', false);
|
||||
});
|
||||
@ -346,5 +337,5 @@ export default {
|
||||
setCssClass,
|
||||
setLink,
|
||||
setTooltip,
|
||||
lookUpDomId
|
||||
lookUpDomId,
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ const padding = 20;
|
||||
const conf = {
|
||||
dividerMargin: 10,
|
||||
padding: 5,
|
||||
textHeight: 10
|
||||
textHeight: 10,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -28,14 +28,14 @@ const conf = {
|
||||
* @param vert Object containing the vertices.
|
||||
* @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 keys = Object.keys(classes);
|
||||
log.info('keys:', keys);
|
||||
log.info(classes);
|
||||
|
||||
// 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];
|
||||
|
||||
/**
|
||||
@ -109,7 +109,7 @@ export const addClasses = function(classes, g) {
|
||||
link: vertex.link,
|
||||
width: vertex.type === 'group' ? 500 : undefined,
|
||||
type: vertex.type,
|
||||
padding: getConfig().flowchart.padding
|
||||
padding: getConfig().flowchart.padding,
|
||||
});
|
||||
|
||||
log.info('setNode', {
|
||||
@ -123,7 +123,7 @@ export const addClasses = function(classes, g) {
|
||||
id: vertex.id,
|
||||
width: vertex.type === 'group' ? 500 : undefined,
|
||||
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} g The graph object
|
||||
*/
|
||||
export const addRelations = function(relations, g) {
|
||||
export const addRelations = function (relations, g) {
|
||||
let cnt = 0;
|
||||
|
||||
let defaultStyle;
|
||||
@ -145,7 +145,7 @@ export const addRelations = function(relations, g) {
|
||||
// defaultLabelStyle = defaultStyles.labelStyle;
|
||||
// }
|
||||
|
||||
relations.forEach(function(edge) {
|
||||
relations.forEach(function (edge) {
|
||||
cnt++;
|
||||
const edgeData = {};
|
||||
//Set relationship style and line type
|
||||
@ -227,7 +227,7 @@ export const addRelations = function(relations, g) {
|
||||
};
|
||||
|
||||
// Todo optimize
|
||||
const getGraphId = function(label) {
|
||||
const getGraphId = function (label) {
|
||||
const keys = Object.keys(idCache);
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
@ -239,10 +239,10 @@ const getGraphId = function(label) {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
conf[key] = cnf[key];
|
||||
});
|
||||
};
|
||||
@ -252,7 +252,7 @@ export const setConf = function(cnf) {
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
export const drawOld = function(text, id) {
|
||||
export const drawOld = function (text, id) {
|
||||
idCache = {};
|
||||
parser.yy.clear();
|
||||
parser.parse(text);
|
||||
@ -265,16 +265,16 @@ export const drawOld = function(text, id) {
|
||||
|
||||
// Layout graph, Create a new directed graph
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: true
|
||||
multigraph: true,
|
||||
});
|
||||
|
||||
// Set an object for the graph label
|
||||
g.setGraph({
|
||||
isMultiGraph: true
|
||||
isMultiGraph: true,
|
||||
});
|
||||
|
||||
// Default to assigning a new object as a label for each new edge.
|
||||
g.setDefaultEdgeLabel(function() {
|
||||
g.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -297,7 +297,7 @@ export const drawOld = function(text, id) {
|
||||
|
||||
const relations = classDb.getRelations();
|
||||
log.info('relations:', relations);
|
||||
relations.forEach(function(relation) {
|
||||
relations.forEach(function (relation) {
|
||||
log.info(
|
||||
'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.id2),
|
||||
{
|
||||
relation: relation
|
||||
relation: relation,
|
||||
},
|
||||
relation.title || 'DEFAULT'
|
||||
);
|
||||
});
|
||||
|
||||
dagre.layout(g);
|
||||
g.nodes().forEach(function(v) {
|
||||
g.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
|
||||
log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
||||
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') {
|
||||
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
||||
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);
|
||||
};
|
||||
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
log.info('Drawing class');
|
||||
classDb.clear();
|
||||
// const parser = classDb.parser;
|
||||
@ -369,16 +369,16 @@ export const draw = function(text, id) {
|
||||
// Create the input mermaid.graph
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: true,
|
||||
compound: true
|
||||
compound: true,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: dir,
|
||||
nodesep: nodeSpacing,
|
||||
ranksep: rankSpacing,
|
||||
marginx: 8,
|
||||
marginy: 8
|
||||
marginy: 8,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -500,7 +500,7 @@ export const draw = function(text, id) {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
function getArrowMarker(type) {
|
||||
let marker;
|
||||
|
@ -15,11 +15,11 @@ const padding = 20;
|
||||
const conf = {
|
||||
dividerMargin: 10,
|
||||
padding: 5,
|
||||
textHeight: 10
|
||||
textHeight: 10,
|
||||
};
|
||||
|
||||
// Todo optimize
|
||||
const getGraphId = function(label) {
|
||||
const getGraphId = function (label) {
|
||||
const keys = Object.keys(idCache);
|
||||
|
||||
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.
|
||||
*/
|
||||
const insertMarkers = function(elem) {
|
||||
const insertMarkers = function (elem) {
|
||||
elem
|
||||
.append('defs')
|
||||
.append('marker')
|
||||
@ -136,10 +136,10 @@ const insertMarkers = function(elem) {
|
||||
.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);
|
||||
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
conf[key] = cnf[key];
|
||||
});
|
||||
};
|
||||
@ -149,7 +149,7 @@ export const setConf = function(cnf) {
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
idCache = {};
|
||||
parser.yy.clear();
|
||||
parser.parse(text);
|
||||
@ -163,16 +163,16 @@ export const draw = function(text, id) {
|
||||
|
||||
// Layout graph, Create a new directed graph
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: true
|
||||
multigraph: true,
|
||||
});
|
||||
|
||||
// Set an object for the graph label
|
||||
g.setGraph({
|
||||
isMultiGraph: true
|
||||
isMultiGraph: true,
|
||||
});
|
||||
|
||||
// Default to assigning a new object as a label for each new edge.
|
||||
g.setDefaultEdgeLabel(function() {
|
||||
g.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -193,7 +193,7 @@ export const draw = function(text, id) {
|
||||
}
|
||||
|
||||
const relations = classDb.getRelations();
|
||||
relations.forEach(function(relation) {
|
||||
relations.forEach(function (relation) {
|
||||
log.info(
|
||||
'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.id2),
|
||||
{
|
||||
relation: relation
|
||||
relation: relation,
|
||||
},
|
||||
relation.title || 'DEFAULT'
|
||||
);
|
||||
});
|
||||
|
||||
dagre.layout(g);
|
||||
g.nodes().forEach(function(v) {
|
||||
g.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
|
||||
log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
||||
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') {
|
||||
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
||||
svgDraw.drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
|
||||
@ -243,5 +243,5 @@ export const draw = function(text, id) {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`g.classGroup text {
|
||||
fill: ${options.nodeBorder};
|
||||
fill: ${options.classText};
|
||||
|
@ -4,8 +4,8 @@ import utils from '../../utils';
|
||||
import { log } from '../../logger';
|
||||
|
||||
let edgeCount = 0;
|
||||
export const drawEdge = function(elem, path, relation, conf) {
|
||||
const getRelationType = function(type) {
|
||||
export const drawEdge = function (elem, path, relation, conf) {
|
||||
const getRelationType = function (type) {
|
||||
switch (type) {
|
||||
case relationType.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
|
||||
const lineData = path.points;
|
||||
|
||||
// This is the accessor function we talked about above
|
||||
const lineFunction = line()
|
||||
.x(function(d) {
|
||||
.x(function (d) {
|
||||
return d.x;
|
||||
})
|
||||
.y(function(d) {
|
||||
.y(function (d) {
|
||||
return d.y;
|
||||
})
|
||||
.curve(curveBasis);
|
||||
@ -144,7 +144,7 @@ export const drawEdge = function(elem, path, relation, conf) {
|
||||
edgeCount++;
|
||||
};
|
||||
|
||||
export const drawClass = function(elem, classDef, conf) {
|
||||
export const drawClass = function (elem, classDef, conf) {
|
||||
log.info('Rendering class ' + classDef);
|
||||
|
||||
const id = classDef.id;
|
||||
@ -152,14 +152,11 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
id: id,
|
||||
label: classDef.id,
|
||||
width: 0,
|
||||
height: 0
|
||||
height: 0,
|
||||
};
|
||||
|
||||
// add class group
|
||||
const g = elem
|
||||
.append('g')
|
||||
.attr('id', lookUpDomId(id))
|
||||
.attr('class', 'classGroup');
|
||||
const g = elem.append('g').attr('id', lookUpDomId(id)).attr('class', 'classGroup');
|
||||
|
||||
// add title
|
||||
let title;
|
||||
@ -180,7 +177,7 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
|
||||
// add annotations
|
||||
let isFirst = true;
|
||||
classDef.annotations.forEach(function(member) {
|
||||
classDef.annotations.forEach(function (member) {
|
||||
const titleText2 = title.append('tspan').text('«' + member + '»');
|
||||
if (!isFirst) titleText2.attr('dy', conf.textHeight);
|
||||
isFirst = false;
|
||||
@ -192,10 +189,7 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
classTitleString += '<' + classDef.type + '>';
|
||||
}
|
||||
|
||||
const classTitle = title
|
||||
.append('tspan')
|
||||
.text(classTitleString)
|
||||
.attr('class', 'title');
|
||||
const classTitle = title.append('tspan').text(classTitleString).attr('class', 'title');
|
||||
|
||||
// If class has annotations the title needs to have an offset of the text height
|
||||
if (!isFirst) classTitle.attr('dy', conf.textHeight);
|
||||
@ -216,7 +210,7 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
.attr('class', 'classText');
|
||||
|
||||
isFirst = true;
|
||||
classDef.members.forEach(function(member) {
|
||||
classDef.members.forEach(function (member) {
|
||||
addTspan(members, member, isFirst, conf);
|
||||
isFirst = false;
|
||||
});
|
||||
@ -238,7 +232,7 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
|
||||
isFirst = true;
|
||||
|
||||
classDef.methods.forEach(function(method) {
|
||||
classDef.methods.forEach(function (method) {
|
||||
addTspan(methods, method, isFirst, conf);
|
||||
isFirst = false;
|
||||
});
|
||||
@ -262,7 +256,7 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
|
||||
// Center title
|
||||
// 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);
|
||||
});
|
||||
|
||||
@ -279,7 +273,7 @@ export const drawClass = function(elem, classDef, conf) {
|
||||
return classInfo;
|
||||
};
|
||||
|
||||
export const parseMember = function(text) {
|
||||
export const parseMember = function (text) {
|
||||
const fieldRegEx = /(\+|-|~|#)?(\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 = '';
|
||||
|
||||
try {
|
||||
@ -311,11 +305,11 @@ const buildFieldDisplay = function(parsedText) {
|
||||
|
||||
return {
|
||||
displayText: displayText,
|
||||
cssStyle: ''
|
||||
cssStyle: '',
|
||||
};
|
||||
};
|
||||
|
||||
const buildMethodDisplay = function(parsedText) {
|
||||
const buildMethodDisplay = function (parsedText) {
|
||||
let cssStyle = '';
|
||||
let displayText = '';
|
||||
|
||||
@ -335,11 +329,11 @@ const buildMethodDisplay = function(parsedText) {
|
||||
|
||||
return {
|
||||
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
|
||||
let displayText = '';
|
||||
let cssStyle = '';
|
||||
@ -382,17 +376,14 @@ const buildLegacyDisplay = function(text) {
|
||||
|
||||
return {
|
||||
displayText: displayText,
|
||||
cssStyle: cssStyle
|
||||
cssStyle: cssStyle,
|
||||
};
|
||||
};
|
||||
|
||||
const addTspan = function(textEl, txt, isFirst, conf) {
|
||||
const addTspan = function (textEl, txt, isFirst, conf) {
|
||||
let member = parseMember(txt);
|
||||
|
||||
const tSpan = textEl
|
||||
.append('tspan')
|
||||
.attr('x', conf.padding)
|
||||
.text(member.displayText);
|
||||
const tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
|
||||
|
||||
if (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;
|
||||
|
||||
if (text.indexOf('~') != -1) {
|
||||
@ -416,7 +407,7 @@ const parseGenericTypes = function(text) {
|
||||
}
|
||||
};
|
||||
|
||||
const parseClassifier = function(classifier) {
|
||||
const parseClassifier = function (classifier) {
|
||||
switch (classifier) {
|
||||
case '*':
|
||||
return 'font-style:italic;';
|
||||
@ -430,5 +421,5 @@ const parseClassifier = function(classifier) {
|
||||
export default {
|
||||
drawClass,
|
||||
drawEdge,
|
||||
parseMember
|
||||
parseMember,
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
export const getRows = s => {
|
||||
export const getRows = (s) => {
|
||||
if (!s) return 1;
|
||||
let str = breakToPlaceholder(s);
|
||||
str = str.replace(/\\n/g, '#br#');
|
||||
return str.split('#br#');
|
||||
};
|
||||
|
||||
export const removeScript = txt => {
|
||||
export const removeScript = (txt) => {
|
||||
var rs = '';
|
||||
var idx = 0;
|
||||
|
||||
@ -36,26 +36,26 @@ export const removeScript = txt => {
|
||||
return rs;
|
||||
};
|
||||
|
||||
export const sanitizeText = text => {
|
||||
export const sanitizeText = (text) => {
|
||||
const txt = DOMPurify.sanitize(text);
|
||||
return txt;
|
||||
};
|
||||
|
||||
export const lineBreakRegex = /<br\s*\/?>/gi;
|
||||
|
||||
export const hasBreaks = text => {
|
||||
export const hasBreaks = (text) => {
|
||||
return /<br\s*[/]?>/gi.test(text);
|
||||
};
|
||||
|
||||
export const splitBreaks = text => {
|
||||
export const splitBreaks = (text) => {
|
||||
return text.split(/<br\s*[/]?>/gi);
|
||||
};
|
||||
|
||||
const breakToPlaceholder = s => {
|
||||
const breakToPlaceholder = (s) => {
|
||||
return s.replace(lineBreakRegex, '#br#');
|
||||
};
|
||||
|
||||
const getUrl = useAbsolute => {
|
||||
const getUrl = (useAbsolute) => {
|
||||
let url = '';
|
||||
if (useAbsolute) {
|
||||
url =
|
||||
@ -71,7 +71,7 @@ const getUrl = useAbsolute => {
|
||||
return url;
|
||||
};
|
||||
|
||||
export const evaluate = val => (val === 'false' || val === false ? false : true);
|
||||
export const evaluate = (val) => (val === 'false' || val === false ? false : true);
|
||||
|
||||
export default {
|
||||
getRows,
|
||||
@ -81,5 +81,5 @@ export default {
|
||||
lineBreakRegex,
|
||||
removeScript,
|
||||
getUrl,
|
||||
evaluate
|
||||
evaluate,
|
||||
};
|
||||
|
@ -13,19 +13,19 @@ const Cardinality = {
|
||||
ZERO_OR_ONE: 'ZERO_OR_ONE',
|
||||
ZERO_OR_MORE: 'ZERO_OR_MORE',
|
||||
ONE_OR_MORE: 'ONE_OR_MORE',
|
||||
ONLY_ONE: 'ONLY_ONE'
|
||||
ONLY_ONE: 'ONLY_ONE',
|
||||
};
|
||||
|
||||
const Identification = {
|
||||
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);
|
||||
};
|
||||
|
||||
const addEntity = function(name) {
|
||||
const addEntity = function (name) {
|
||||
if (typeof entities[name] === 'undefined') {
|
||||
entities[name] = { attributes: [] };
|
||||
log.info('Added new entity :', name);
|
||||
@ -36,7 +36,7 @@ const addEntity = function(name) {
|
||||
|
||||
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)
|
||||
|
||||
// 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 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 = {
|
||||
entityA: entA,
|
||||
roleA: rolA,
|
||||
entityB: entB,
|
||||
relSpec: rSpec
|
||||
relSpec: rSpec,
|
||||
};
|
||||
|
||||
relationships.push(rel);
|
||||
@ -69,15 +69,15 @@ const addRelationship = function(entA, rolA, entB, rSpec) {
|
||||
const getRelationships = () => relationships;
|
||||
|
||||
// Keep this - TODO: revisit...allow the diagram to have a title
|
||||
const setTitle = function(txt) {
|
||||
const setTitle = function (txt) {
|
||||
title = txt;
|
||||
};
|
||||
|
||||
const getTitle = function() {
|
||||
const getTitle = function () {
|
||||
return title;
|
||||
};
|
||||
|
||||
const clear = function() {
|
||||
const clear = function () {
|
||||
entities = {};
|
||||
relationships = [];
|
||||
title = '';
|
||||
@ -95,5 +95,5 @@ export default {
|
||||
getRelationships,
|
||||
clear,
|
||||
setTitle,
|
||||
getTitle
|
||||
getTitle,
|
||||
};
|
||||
|
@ -6,13 +6,13 @@ const ERMarkers = {
|
||||
ONE_OR_MORE_START: 'ONE_OR_MORE_START',
|
||||
ONE_OR_MORE_END: 'ONE_OR_MORE_END',
|
||||
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
|
||||
*/
|
||||
const insertMarkers = function(elem, conf) {
|
||||
const insertMarkers = function (elem, conf) {
|
||||
let marker;
|
||||
|
||||
elem
|
||||
@ -59,11 +59,7 @@ const insertMarkers = function(elem, conf) {
|
||||
.attr('cx', 21)
|
||||
.attr('cy', 9)
|
||||
.attr('r', 6);
|
||||
marker
|
||||
.append('path')
|
||||
.attr('stroke', conf.stroke)
|
||||
.attr('fill', 'none')
|
||||
.attr('d', 'M9,0 L9,18');
|
||||
marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
|
||||
|
||||
marker = elem
|
||||
.append('defs')
|
||||
@ -81,11 +77,7 @@ const insertMarkers = function(elem, conf) {
|
||||
.attr('cx', 9)
|
||||
.attr('cy', 9)
|
||||
.attr('r', 6);
|
||||
marker
|
||||
.append('path')
|
||||
.attr('stroke', conf.stroke)
|
||||
.attr('fill', 'none')
|
||||
.attr('d', 'M21,0 L21,18');
|
||||
marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
|
||||
|
||||
elem
|
||||
.append('defs')
|
||||
@ -164,5 +156,5 @@ const insertMarkers = function(elem, conf) {
|
||||
|
||||
export default {
|
||||
ERMarkers,
|
||||
insertMarkers
|
||||
insertMarkers,
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ const conf = {};
|
||||
* storing it in the local conf object. Note that generic config still needs to be
|
||||
* retrieved using getConfig() imported from the config module
|
||||
*/
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
@ -40,7 +40,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
|
||||
let cumulativeHeight = labelBBox.height + heightPadding * 2;
|
||||
let attrNum = 1;
|
||||
|
||||
attributes.forEach(item => {
|
||||
attributes.forEach((item) => {
|
||||
const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`;
|
||||
|
||||
// Add a text node for the attribute type
|
||||
@ -98,7 +98,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
|
||||
height:
|
||||
attributes.length > 0
|
||||
? 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
|
||||
@ -115,7 +115,7 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
|
||||
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
|
||||
|
||||
attributeNodes.forEach(nodePair => {
|
||||
attributeNodes.forEach((nodePair) => {
|
||||
// Calculate the alignment y co-ordinate for the type/name of the attribute
|
||||
const alignY =
|
||||
heightOffset +
|
||||
@ -182,11 +182,11 @@ const drawAttributes = (groupNode, entityTextNode, attributes) => {
|
||||
* @param graph The graph that contains the vertex and edge definitions post-layout
|
||||
* @return The first entity that was inserted
|
||||
*/
|
||||
const drawEntities = function(svgNode, entities, graph) {
|
||||
const drawEntities = function (svgNode, entities, graph) {
|
||||
const keys = Object.keys(entities);
|
||||
let firstOne;
|
||||
|
||||
keys.forEach(function(id) {
|
||||
keys.forEach(function (id) {
|
||||
// Create a group for each entity
|
||||
const groupNode = svgNode.append('g').attr('id', id);
|
||||
|
||||
@ -234,14 +234,14 @@ const drawEntities = function(svgNode, entities, graph) {
|
||||
width: rectBBox.width,
|
||||
height: rectBBox.height,
|
||||
shape: 'rect',
|
||||
id: id
|
||||
id: id,
|
||||
});
|
||||
});
|
||||
return firstOne;
|
||||
}; // drawEntities
|
||||
|
||||
const adjustEntities = function(svgNode, graph) {
|
||||
graph.nodes().forEach(function(v) {
|
||||
const adjustEntities = function (svgNode, graph) {
|
||||
graph.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
||||
svgNode
|
||||
.select('#' + v)
|
||||
@ -258,7 +258,7 @@ const adjustEntities = function(svgNode, graph) {
|
||||
return;
|
||||
};
|
||||
|
||||
const getEdgeName = function(rel) {
|
||||
const getEdgeName = function (rel) {
|
||||
return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
|
||||
};
|
||||
|
||||
@ -268,8 +268,8 @@ const getEdgeName = function(rel) {
|
||||
* @param g the graph
|
||||
* @return {Array} The array of relationships
|
||||
*/
|
||||
const addRelationships = function(relationships, g) {
|
||||
relationships.forEach(function(r) {
|
||||
const addRelationships = function (relationships, g) {
|
||||
relationships.forEach(function (r) {
|
||||
g.setEdge(r.entityA, r.entityB, { relationship: r }, getEdgeName(r));
|
||||
});
|
||||
return relationships;
|
||||
@ -283,7 +283,7 @@ let relCnt = 0;
|
||||
* @param g the graph containing the edge information
|
||||
* @param insert the insertion point in the svg DOM (because relationships have markers that need to sit 'behind' opaque entity boxes)
|
||||
*/
|
||||
const drawRelationshipFromLayout = function(svg, rel, g, insert) {
|
||||
const drawRelationshipFromLayout = function (svg, rel, g, insert) {
|
||||
relCnt++;
|
||||
|
||||
// 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
|
||||
const lineFunction = line()
|
||||
.x(function(d) {
|
||||
.x(function (d) {
|
||||
return d.x;
|
||||
})
|
||||
.y(function(d) {
|
||||
.y(function (d) {
|
||||
return d.y;
|
||||
})
|
||||
.curve(curveBasis);
|
||||
@ -413,7 +413,7 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) {
|
||||
* @param text the text of the diagram
|
||||
* @param id the unique id of the DOM node that contains the diagram
|
||||
*/
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
log.info('Drawing ER diagram');
|
||||
erDb.clear();
|
||||
const parser = erParser.parser;
|
||||
@ -457,7 +457,7 @@ export const draw = function(text, id) {
|
||||
g = new graphlib.Graph({
|
||||
multigraph: true,
|
||||
directed: true,
|
||||
compound: false
|
||||
compound: false,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: conf.layoutDirection,
|
||||
@ -465,9 +465,9 @@ export const draw = function(text, id) {
|
||||
marginy: 20,
|
||||
nodesep: 100,
|
||||
edgesep: 100,
|
||||
ranksep: 100
|
||||
ranksep: 100,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -486,7 +486,7 @@ export const draw = function(text, id) {
|
||||
adjustEntities(svg, g);
|
||||
|
||||
// Draw the relationships
|
||||
relationships.forEach(function(rel) {
|
||||
relationships.forEach(function (rel) {
|
||||
drawRelationshipFromLayout(svg, rel, g, firstEntity);
|
||||
});
|
||||
|
||||
@ -503,5 +503,5 @@ export const draw = function(text, id) {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`
|
||||
.entityBox {
|
||||
fill: ${options.mainBkg};
|
||||
|
@ -8,10 +8,10 @@ function question(parent, bbox, node) {
|
||||
{ x: s / 2, y: 0 },
|
||||
{ x: s, y: -s / 2 },
|
||||
{ x: s / 2, y: -s },
|
||||
{ x: 0, y: -s / 2 }
|
||||
{ x: 0, y: -s / 2 },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, s, s, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -28,10 +28,10 @@ function hexagon(parent, bbox, node) {
|
||||
{ x: w, y: -h / 2 },
|
||||
{ x: w - m, y: -h },
|
||||
{ x: m, y: -h },
|
||||
{ x: 0, y: -h / 2 }
|
||||
{ x: 0, y: -h / 2 },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -45,10 +45,10 @@ function rect_left_inv_arrow(parent, bbox, node) {
|
||||
{ x: w, y: 0 },
|
||||
{ x: w, y: -h },
|
||||
{ x: -h / 2, y: -h },
|
||||
{ x: 0, y: -h / 2 }
|
||||
{ x: 0, y: -h / 2 },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -61,10 +61,10 @@ function lean_right(parent, bbox, node) {
|
||||
{ x: (-2 * h) / 6, y: 0 },
|
||||
{ x: w - h / 6, y: 0 },
|
||||
{ x: w + (2 * h) / 6, y: -h },
|
||||
{ x: h / 6, y: -h }
|
||||
{ x: h / 6, y: -h },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -77,10 +77,10 @@ function lean_left(parent, bbox, node) {
|
||||
{ x: (2 * h) / 6, y: 0 },
|
||||
{ x: w + h / 6, y: 0 },
|
||||
{ x: w - (2 * h) / 6, y: -h },
|
||||
{ x: -h / 6, y: -h }
|
||||
{ x: -h / 6, y: -h },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -93,10 +93,10 @@ function trapezoid(parent, bbox, node) {
|
||||
{ x: (-2 * h) / 6, y: 0 },
|
||||
{ x: w + (2 * h) / 6, y: 0 },
|
||||
{ x: w - h / 6, y: -h },
|
||||
{ x: h / 6, y: -h }
|
||||
{ x: h / 6, y: -h },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -109,10 +109,10 @@ function inv_trapezoid(parent, bbox, node) {
|
||||
{ x: h / 6, y: 0 },
|
||||
{ x: w - h / 6, y: 0 },
|
||||
{ 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);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -126,10 +126,10 @@ function rect_right_inv_arrow(parent, bbox, node) {
|
||||
{ x: w + h / 2, y: 0 },
|
||||
{ x: w, y: -h / 2 },
|
||||
{ x: w + h / 2, y: -h },
|
||||
{ x: 0, y: -h }
|
||||
{ x: 0, y: -h },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -148,7 +148,7 @@ function stadium(parent, bbox, node) {
|
||||
.attr('width', w)
|
||||
.attr('height', h);
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.rect(node, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -167,10 +167,10 @@ function subroutine(parent, bbox, node) {
|
||||
{ x: w + 8, y: 0 },
|
||||
{ x: w + 8, y: -h },
|
||||
{ x: -8, y: -h },
|
||||
{ x: -8, y: 0 }
|
||||
{ x: -8, y: 0 },
|
||||
];
|
||||
const shapeSvg = insertPolygonShape(parent, w, h, points);
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
return shapeSvg;
|
||||
@ -214,7 +214,7 @@ function cylinder(parent, bbox, node) {
|
||||
.attr('d', shape)
|
||||
.attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
|
||||
|
||||
node.intersect = function(point) {
|
||||
node.intersect = function (point) {
|
||||
const pos = dagreD3.intersect.rect(node, point);
|
||||
const x = pos.x - node.x;
|
||||
|
||||
@ -297,7 +297,7 @@ function insertPolygonShape(parent, w, h, points) {
|
||||
.attr(
|
||||
'points',
|
||||
points
|
||||
.map(function(d) {
|
||||
.map(function (d) {
|
||||
return d.x + ',' + d.y;
|
||||
})
|
||||
.join(' ')
|
||||
@ -307,5 +307,5 @@ function insertPolygonShape(parent, w, h, points) {
|
||||
|
||||
export default {
|
||||
addToRender,
|
||||
addToRenderV2
|
||||
addToRenderV2,
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ let version; // As in graph
|
||||
// Functions to be run after graph rendering
|
||||
let funs = [];
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (statement, context, type) {
|
||||
mermaidAPI.parseDirective(this, statement, context, type);
|
||||
};
|
||||
|
||||
@ -32,7 +32,7 @@ export const parseDirective = function(statement, context, type) {
|
||||
* @param id
|
||||
* @public
|
||||
*/
|
||||
export const lookUpDomId = function(id) {
|
||||
export const lookUpDomId = function (id) {
|
||||
const veritceKeys = Object.keys(vertices);
|
||||
for (let i = 0; i < veritceKeys.length; i++) {
|
||||
if (vertices[veritceKeys[i]].id === id) {
|
||||
@ -50,7 +50,7 @@ export const lookUpDomId = function(id) {
|
||||
* @param style
|
||||
* @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 id = _id;
|
||||
if (typeof id === 'undefined') {
|
||||
@ -67,7 +67,7 @@ export const addVertex = function(_id, text, type, style, classes, dir) {
|
||||
id: id,
|
||||
domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
|
||||
styles: [],
|
||||
classes: []
|
||||
classes: [],
|
||||
};
|
||||
}
|
||||
vertexCounter++;
|
||||
@ -91,14 +91,14 @@ export const addVertex = function(_id, text, type, style, classes, dir) {
|
||||
}
|
||||
if (typeof style !== 'undefined') {
|
||||
if (style !== null) {
|
||||
style.forEach(function(s) {
|
||||
style.forEach(function (s) {
|
||||
vertices[id].styles.push(s);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (typeof classes !== 'undefined') {
|
||||
if (classes !== null) {
|
||||
classes.forEach(function(s) {
|
||||
classes.forEach(function (s) {
|
||||
vertices[id].classes.push(s);
|
||||
});
|
||||
}
|
||||
@ -115,7 +115,7 @@ export const addVertex = function(_id, text, type, style, classes, dir) {
|
||||
* @param type
|
||||
* @param linktext
|
||||
*/
|
||||
export const addSingleLink = function(_start, _end, type, linktext) {
|
||||
export const addSingleLink = function (_start, _end, type, linktext) {
|
||||
let start = _start;
|
||||
let end = _end;
|
||||
// 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);
|
||||
};
|
||||
export const addLink = function(_start, _end, type, linktext) {
|
||||
export const addLink = function (_start, _end, type, linktext) {
|
||||
let i, j;
|
||||
for (i = 0; i < _start.length; i++) {
|
||||
for (j = 0; j < _end.length; j++) {
|
||||
@ -155,8 +155,8 @@ export const addLink = function(_start, _end, type, linktext) {
|
||||
* @param pos
|
||||
* @param interpolate
|
||||
*/
|
||||
export const updateLinkInterpolate = function(positions, interp) {
|
||||
positions.forEach(function(pos) {
|
||||
export const updateLinkInterpolate = function (positions, interp) {
|
||||
positions.forEach(function (pos) {
|
||||
if (pos === 'default') {
|
||||
edges.defaultInterpolate = interp;
|
||||
} else {
|
||||
@ -170,8 +170,8 @@ export const updateLinkInterpolate = function(positions, interp) {
|
||||
* @param pos
|
||||
* @param style
|
||||
*/
|
||||
export const updateLink = function(positions, style) {
|
||||
positions.forEach(function(pos) {
|
||||
export const updateLink = function (positions, style) {
|
||||
positions.forEach(function (pos) {
|
||||
if (pos === 'default') {
|
||||
edges.defaultStyle = style;
|
||||
} 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') {
|
||||
classes[id] = { id: id, styles: [], textStyles: [] };
|
||||
}
|
||||
|
||||
if (typeof style !== 'undefined') {
|
||||
if (style !== null) {
|
||||
style.forEach(function(s) {
|
||||
style.forEach(function (s) {
|
||||
if (s.match('color')) {
|
||||
const newStyle1 = s.replace('fill', 'bgFill');
|
||||
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.
|
||||
* @param dir
|
||||
*/
|
||||
export const setDirection = function(dir) {
|
||||
export const setDirection = function (dir) {
|
||||
direction = dir;
|
||||
if (direction.match(/.*</)) {
|
||||
direction = 'RL';
|
||||
@ -227,8 +227,8 @@ export const setDirection = function(dir) {
|
||||
* @param ids Comma separated list of ids
|
||||
* @param className Class to add
|
||||
*/
|
||||
export const setClass = function(ids, className) {
|
||||
ids.split(',').forEach(function(_id) {
|
||||
export const setClass = function (ids, className) {
|
||||
ids.split(',').forEach(function (_id) {
|
||||
// let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
|
||||
let id = _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) {
|
||||
ids.split(',').forEach(function(id) {
|
||||
const setTooltip = function (ids, tooltip) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
if (typeof tooltip !== 'undefined') {
|
||||
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);
|
||||
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||
if (configApi.getConfig().securityLevel !== 'loose') {
|
||||
@ -281,12 +281,12 @@ const setClickFun = function(id, functionName, functionArgs) {
|
||||
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
vertices[id].haveCallback = true;
|
||||
funs.push(function() {
|
||||
funs.push(function () {
|
||||
const elem = document.querySelector(`[id="${domId}"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener(
|
||||
'click',
|
||||
function() {
|
||||
function () {
|
||||
utils.runFunc(functionName, ...argList);
|
||||
},
|
||||
false
|
||||
@ -301,8 +301,8 @@ const setClickFun = function(id, functionName, functionArgs) {
|
||||
* @param ids Comma separated list of ids
|
||||
* @param linkStr URL to create a link for
|
||||
*/
|
||||
export const setLink = function(ids, linkStr, target) {
|
||||
ids.split(',').forEach(function(id) {
|
||||
export const setLink = function (ids, linkStr, target) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
vertices[id].link = utils.formatUrl(linkStr, config);
|
||||
vertices[id].linkTarget = target;
|
||||
@ -310,7 +310,7 @@ export const setLink = function(ids, linkStr, target) {
|
||||
});
|
||||
setClass(ids, 'clickable');
|
||||
};
|
||||
export const getTooltip = function(id) {
|
||||
export const getTooltip = function (id) {
|
||||
return tooltips[id];
|
||||
};
|
||||
|
||||
@ -320,26 +320,26 @@ export const getTooltip = function(id) {
|
||||
* @param functionName Function to be called on click
|
||||
* @param tooltip Tooltip for the clickable element
|
||||
*/
|
||||
export const setClickEvent = function(ids, functionName, functionArgs) {
|
||||
ids.split(',').forEach(function(id) {
|
||||
export const setClickEvent = function (ids, functionName, functionArgs) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
setClickFun(id, functionName, functionArgs);
|
||||
});
|
||||
setClass(ids, 'clickable');
|
||||
};
|
||||
|
||||
export const bindFunctions = function(element) {
|
||||
funs.forEach(function(fun) {
|
||||
export const bindFunctions = function (element) {
|
||||
funs.forEach(function (fun) {
|
||||
fun(element);
|
||||
});
|
||||
};
|
||||
export const getDirection = function() {
|
||||
export const getDirection = function () {
|
||||
return direction.trim();
|
||||
};
|
||||
/**
|
||||
* Retrieval function for fetching the found nodes after parsing has completed.
|
||||
* @returns {{}|*|vertices}
|
||||
*/
|
||||
export const getVertices = function() {
|
||||
export const getVertices = function () {
|
||||
return vertices;
|
||||
};
|
||||
|
||||
@ -347,7 +347,7 @@ export const getVertices = function() {
|
||||
* Retrieval function for fetching the found links after parsing has completed.
|
||||
* @returns {{}|*|edges}
|
||||
*/
|
||||
export const getEdges = function() {
|
||||
export const getEdges = function () {
|
||||
return edges;
|
||||
};
|
||||
|
||||
@ -355,24 +355,21 @@ export const getEdges = function() {
|
||||
* Retrieval function for fetching the found class definitions after parsing has completed.
|
||||
* @returns {{}|*|classes}
|
||||
*/
|
||||
export const getClasses = function() {
|
||||
export const getClasses = function () {
|
||||
return classes;
|
||||
};
|
||||
|
||||
const setupToolTips = function(element) {
|
||||
const setupToolTips = function (element) {
|
||||
let tooltipElem = select('.mermaidTooltip');
|
||||
if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
||||
tooltipElem = select('body')
|
||||
.append('div')
|
||||
.attr('class', 'mermaidTooltip')
|
||||
.style('opacity', 0);
|
||||
tooltipElem = select('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
|
||||
}
|
||||
|
||||
const svg = select(element).select('svg');
|
||||
|
||||
const nodes = svg.selectAll('g.node');
|
||||
nodes
|
||||
.on('mouseover', function() {
|
||||
.on('mouseover', function () {
|
||||
const el = select(this);
|
||||
const title = el.attr('title');
|
||||
|
||||
@ -382,21 +379,15 @@ const setupToolTips = function(element) {
|
||||
}
|
||||
const rect = this.getBoundingClientRect();
|
||||
|
||||
tooltipElem
|
||||
.transition()
|
||||
.duration(200)
|
||||
.style('opacity', '.9');
|
||||
tooltipElem.transition().duration(200).style('opacity', '.9');
|
||||
tooltipElem
|
||||
.html(el.attr('title'))
|
||||
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
|
||||
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
|
||||
el.classed('hover', true);
|
||||
})
|
||||
.on('mouseout', function() {
|
||||
tooltipElem
|
||||
.transition()
|
||||
.duration(500)
|
||||
.style('opacity', 0);
|
||||
.on('mouseout', function () {
|
||||
tooltipElem.transition().duration(500).style('opacity', 0);
|
||||
const el = select(this);
|
||||
el.classed('hover', false);
|
||||
});
|
||||
@ -406,7 +397,7 @@ funs.push(setupToolTips);
|
||||
/**
|
||||
* Clears the internal graph db so that a new graph can be parsed.
|
||||
*/
|
||||
export const clear = function(ver) {
|
||||
export const clear = function (ver) {
|
||||
vertices = {};
|
||||
classes = {};
|
||||
edges = [];
|
||||
@ -419,21 +410,21 @@ export const clear = function(ver) {
|
||||
firstGraphFlag = true;
|
||||
version = ver || 'gen-1';
|
||||
};
|
||||
export const setGen = ver => {
|
||||
export const setGen = (ver) => {
|
||||
version = ver || 'gen-1';
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @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;';
|
||||
};
|
||||
|
||||
/**
|
||||
* 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);
|
||||
let id = _id.trim();
|
||||
let title = _title;
|
||||
@ -445,7 +436,7 @@ export const addSubGraph = function(_id, list, _title) {
|
||||
const objs = [];
|
||||
|
||||
let dir; // = unbdefined; direction.trim();
|
||||
const nodeList = a.filter(function(item) {
|
||||
const nodeList = a.filter(function (item) {
|
||||
const type = typeof item;
|
||||
if (item.stmt && item.stmt === 'dir') {
|
||||
dir = item.value;
|
||||
@ -505,7 +496,7 @@ export const addSubGraph = function(_id, list, _title) {
|
||||
return id;
|
||||
};
|
||||
|
||||
const getPosForId = function(id) {
|
||||
const getPosForId = function (id) {
|
||||
for (let i = 0; i < subGraphs.length; i++) {
|
||||
if (subGraphs[i].id === id) {
|
||||
return i;
|
||||
@ -515,7 +506,7 @@ const getPosForId = function(id) {
|
||||
};
|
||||
let secCount = -1;
|
||||
const posCrossRef = [];
|
||||
const indexNodes2 = function(id, pos) {
|
||||
const indexNodes2 = function (id, pos) {
|
||||
const nodes = subGraphs[pos].nodes;
|
||||
secCount = secCount + 1;
|
||||
if (secCount > 2000) {
|
||||
@ -526,7 +517,7 @@ const indexNodes2 = function(id, pos) {
|
||||
if (subGraphs[pos].id === id) {
|
||||
return {
|
||||
result: true,
|
||||
count: 0
|
||||
count: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@ -540,7 +531,7 @@ const indexNodes2 = function(id, pos) {
|
||||
if (res.result) {
|
||||
return {
|
||||
result: true,
|
||||
count: posCount + res.count
|
||||
count: posCount + res.count,
|
||||
};
|
||||
} else {
|
||||
posCount = posCount + res.count;
|
||||
@ -551,21 +542,21 @@ const indexNodes2 = function(id, pos) {
|
||||
|
||||
return {
|
||||
result: false,
|
||||
count: posCount
|
||||
count: posCount,
|
||||
};
|
||||
};
|
||||
|
||||
export const getDepthFirstPos = function(pos) {
|
||||
export const getDepthFirstPos = function (pos) {
|
||||
return posCrossRef[pos];
|
||||
};
|
||||
export const indexNodes = function() {
|
||||
export const indexNodes = function () {
|
||||
secCount = -1;
|
||||
if (subGraphs.length > 0) {
|
||||
indexNodes2('none', subGraphs.length - 1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
export const getSubGraphs = function() {
|
||||
export const getSubGraphs = function () {
|
||||
return subGraphs;
|
||||
};
|
||||
|
||||
@ -577,7 +568,7 @@ export const firstGraph = () => {
|
||||
return false;
|
||||
};
|
||||
|
||||
const destructStartLink = _str => {
|
||||
const destructStartLink = (_str) => {
|
||||
let str = _str.trim();
|
||||
let type = 'arrow_open';
|
||||
|
||||
@ -620,7 +611,7 @@ const countChar = (char, str) => {
|
||||
return count;
|
||||
};
|
||||
|
||||
const destructEndLink = _str => {
|
||||
const destructEndLink = (_str) => {
|
||||
const str = _str.trim();
|
||||
let line = str.slice(0, -1);
|
||||
let type = 'arrow_open';
|
||||
@ -700,7 +691,7 @@ const destructLink = (_str, _startStr) => {
|
||||
// Todo optimizer this by caching existing nodes
|
||||
const exists = (allSgs, _id) => {
|
||||
let res = false;
|
||||
allSgs.forEach(sg => {
|
||||
allSgs.forEach((sg) => {
|
||||
const pos = sg.nodes.indexOf(_id);
|
||||
if (pos >= 0) {
|
||||
res = true;
|
||||
@ -750,8 +741,8 @@ export default {
|
||||
getSubGraphs,
|
||||
destructLink,
|
||||
lex: {
|
||||
firstGraph
|
||||
firstGraph,
|
||||
},
|
||||
exists,
|
||||
makeUniq
|
||||
makeUniq,
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ import common, { evaluate } from '../common/common';
|
||||
import { interpolateToCurve, getStylesFromArray, configureSvgSize } from '../../utils';
|
||||
|
||||
const conf = {};
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
@ -24,12 +24,12 @@ export const setConf = function(cnf) {
|
||||
* @param vert Object containing the vertices.
|
||||
* @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 keys = Object.keys(vert);
|
||||
|
||||
// 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];
|
||||
|
||||
/**
|
||||
@ -53,8 +53,8 @@ export const addVertices = function(vert, g, svgId) {
|
||||
const node = {
|
||||
label: vertexText.replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
s => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
)
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
),
|
||||
};
|
||||
vertexNode = addHtmlLabel(svg, node).node();
|
||||
vertexNode.parentNode.removeChild(vertexNode);
|
||||
@ -149,7 +149,7 @@ export const addVertices = function(vert, g, svgId) {
|
||||
width: vertex.type === 'group' ? 500 : undefined,
|
||||
dir: vertex.dir,
|
||||
type: vertex.type,
|
||||
padding: getConfig().flowchart.padding
|
||||
padding: getConfig().flowchart.padding,
|
||||
});
|
||||
|
||||
log.info('setNode', {
|
||||
@ -165,7 +165,7 @@ export const addVertices = function(vert, g, svgId) {
|
||||
width: vertex.type === 'group' ? 500 : undefined,
|
||||
type: vertex.type,
|
||||
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} g The graph object
|
||||
*/
|
||||
export const addEdges = function(edges, g) {
|
||||
export const addEdges = function (edges, g) {
|
||||
log.info('abc78 edges = ', edges);
|
||||
let cnt = 0;
|
||||
let linkIdCnt = {};
|
||||
@ -189,7 +189,7 @@ export const addEdges = function(edges, g) {
|
||||
defaultLabelStyle = defaultStyles.labelStyle;
|
||||
}
|
||||
|
||||
edges.forEach(function(edge) {
|
||||
edges.forEach(function (edge) {
|
||||
cnt++;
|
||||
|
||||
// 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 {object} classDef styles
|
||||
*/
|
||||
export const getClasses = function(text) {
|
||||
export const getClasses = function (text) {
|
||||
log.info('Extracting classes');
|
||||
flowDb.clear();
|
||||
const parser = flow.parser;
|
||||
@ -341,7 +341,7 @@ export const getClasses = function(text) {
|
||||
* @param id
|
||||
*/
|
||||
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
log.info('Drawing flowchart');
|
||||
flowDb.clear();
|
||||
flowDb.setGen('gen-2');
|
||||
@ -368,16 +368,16 @@ export const draw = function(text, id) {
|
||||
// Create the input mermaid.graph
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: true,
|
||||
compound: true
|
||||
compound: true,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: dir,
|
||||
nodesep: nodeSpacing,
|
||||
ranksep: rankSpacing,
|
||||
marginx: 8,
|
||||
marginy: 8
|
||||
marginy: 8,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -463,7 +463,7 @@ export const draw = function(text, id) {
|
||||
|
||||
// If node has a link, wrap it in an anchor SVG object.
|
||||
const keys = Object.keys(vert);
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
const vertex = vert[key];
|
||||
|
||||
if (vertex.link) {
|
||||
@ -477,20 +477,20 @@ export const draw = function(text, id) {
|
||||
link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
|
||||
}
|
||||
|
||||
const linkNode = node.insert(function() {
|
||||
const linkNode = node.insert(function () {
|
||||
return link;
|
||||
}, ':first-child');
|
||||
|
||||
const shape = node.select('.label-container');
|
||||
if (shape) {
|
||||
linkNode.append(function() {
|
||||
linkNode.append(function () {
|
||||
return shape.node();
|
||||
});
|
||||
}
|
||||
|
||||
const label = node.select('.label');
|
||||
if (label) {
|
||||
linkNode.append(function() {
|
||||
linkNode.append(function () {
|
||||
return label.node();
|
||||
});
|
||||
}
|
||||
@ -504,5 +504,5 @@ export default {
|
||||
addVertices,
|
||||
addEdges,
|
||||
getClasses,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ import { interpolateToCurve, getStylesFromArray, configureSvgSize } from '../../
|
||||
import flowChartShapes from './flowChartShapes';
|
||||
|
||||
const conf = {};
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
@ -25,12 +25,12 @@ export const setConf = function(cnf) {
|
||||
* @param vert Object containing the vertices.
|
||||
* @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 keys = Object.keys(vert);
|
||||
|
||||
// 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];
|
||||
|
||||
/**
|
||||
@ -54,8 +54,8 @@ export const addVertices = function(vert, g, svgId) {
|
||||
const node = {
|
||||
label: vertexText.replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
s => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
)
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
),
|
||||
};
|
||||
vertexNode = addHtmlLabel(svg, node).node();
|
||||
vertexNode.parentNode.removeChild(vertexNode);
|
||||
@ -143,7 +143,7 @@ export const addVertices = function(vert, g, svgId) {
|
||||
ry: radious,
|
||||
class: classStr,
|
||||
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} g The graph object
|
||||
*/
|
||||
export const addEdges = function(edges, g) {
|
||||
export const addEdges = function (edges, g) {
|
||||
let cnt = 0;
|
||||
|
||||
let defaultStyle;
|
||||
@ -165,7 +165,7 @@ export const addEdges = function(edges, g) {
|
||||
defaultLabelStyle = defaultStyles.labelStyle;
|
||||
}
|
||||
|
||||
edges.forEach(function(edge) {
|
||||
edges.forEach(function (edge) {
|
||||
cnt++;
|
||||
|
||||
// Identify Link
|
||||
@ -232,7 +232,7 @@ export const addEdges = function(edges, g) {
|
||||
edgeData.labelType = 'html';
|
||||
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}">${edge.text.replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
s => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
)}</span>`;
|
||||
} else {
|
||||
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 {object} classDef styles
|
||||
*/
|
||||
export const getClasses = function(text) {
|
||||
export const getClasses = function (text) {
|
||||
log.info('Extracting classes');
|
||||
flowDb.clear();
|
||||
try {
|
||||
@ -279,7 +279,7 @@ export const getClasses = function(text) {
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
log.info('Drawing flowchart');
|
||||
flowDb.clear();
|
||||
flowDb.setGen('gen-1');
|
||||
@ -306,16 +306,16 @@ export const draw = function(text, id) {
|
||||
// Create the input mermaid.graph
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: true,
|
||||
compound: true
|
||||
compound: true,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: dir,
|
||||
nodesep: nodeSpacing,
|
||||
ranksep: rankSpacing,
|
||||
marginx: 8,
|
||||
marginy: 8
|
||||
marginy: 8,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -406,7 +406,7 @@ export const draw = function(text, id) {
|
||||
const element = select('#' + id + ' g');
|
||||
render(element, g);
|
||||
|
||||
element.selectAll('g.node').attr('title', function() {
|
||||
element.selectAll('g.node').attr('title', function () {
|
||||
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.
|
||||
const keys = Object.keys(vert);
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
const vertex = vert[key];
|
||||
|
||||
if (vertex.link) {
|
||||
@ -486,20 +486,20 @@ export const draw = function(text, id) {
|
||||
link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
|
||||
}
|
||||
|
||||
const linkNode = node.insert(function() {
|
||||
const linkNode = node.insert(function () {
|
||||
return link;
|
||||
}, ':first-child');
|
||||
|
||||
const shape = node.select('.label-container');
|
||||
if (shape) {
|
||||
linkNode.append(function() {
|
||||
linkNode.append(function () {
|
||||
return shape.node();
|
||||
});
|
||||
}
|
||||
|
||||
const label = node.select('.label');
|
||||
if (label) {
|
||||
linkNode.append(function() {
|
||||
linkNode.append(function () {
|
||||
return label.node();
|
||||
});
|
||||
}
|
||||
@ -513,5 +513,5 @@ export default {
|
||||
addVertices,
|
||||
addEdges,
|
||||
getClasses,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`.label {
|
||||
font-family: ${options.fontFamily};
|
||||
color: ${options.nodeTextColor || options.textColor};
|
||||
|
@ -21,11 +21,11 @@ let topAxis = false;
|
||||
// The serial order of the task in the script
|
||||
let lastOrder = 0;
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (statement, context, type) {
|
||||
mermaidAPI.parseDirective(this, statement, context, type);
|
||||
};
|
||||
|
||||
export const clear = function() {
|
||||
export const clear = function () {
|
||||
sections = [];
|
||||
tasks = [];
|
||||
currentSection = '';
|
||||
@ -44,72 +44,72 @@ export const clear = function() {
|
||||
lastOrder = 0;
|
||||
};
|
||||
|
||||
export const setAxisFormat = function(txt) {
|
||||
export const setAxisFormat = function (txt) {
|
||||
axisFormat = txt;
|
||||
};
|
||||
|
||||
export const getAxisFormat = function() {
|
||||
export const getAxisFormat = function () {
|
||||
return axisFormat;
|
||||
};
|
||||
|
||||
export const setTodayMarker = function(txt) {
|
||||
export const setTodayMarker = function (txt) {
|
||||
todayMarker = txt;
|
||||
};
|
||||
|
||||
export const getTodayMarker = function() {
|
||||
export const getTodayMarker = function () {
|
||||
return todayMarker;
|
||||
};
|
||||
|
||||
export const setDateFormat = function(txt) {
|
||||
export const setDateFormat = function (txt) {
|
||||
dateFormat = txt;
|
||||
};
|
||||
|
||||
export const enableInclusiveEndDates = function() {
|
||||
export const enableInclusiveEndDates = function () {
|
||||
inclusiveEndDates = true;
|
||||
};
|
||||
|
||||
export const endDatesAreInclusive = function() {
|
||||
export const endDatesAreInclusive = function () {
|
||||
return inclusiveEndDates;
|
||||
};
|
||||
|
||||
export const enableTopAxis = function() {
|
||||
export const enableTopAxis = function () {
|
||||
topAxis = true;
|
||||
};
|
||||
|
||||
export const topAxisEnabled = function() {
|
||||
export const topAxisEnabled = function () {
|
||||
return topAxis;
|
||||
};
|
||||
|
||||
export const getDateFormat = function() {
|
||||
export const getDateFormat = function () {
|
||||
return dateFormat;
|
||||
};
|
||||
|
||||
export const setExcludes = function(txt) {
|
||||
export const setExcludes = function (txt) {
|
||||
excludes = txt.toLowerCase().split(/[\s,]+/);
|
||||
};
|
||||
|
||||
export const getExcludes = function() {
|
||||
export const getExcludes = function () {
|
||||
return excludes;
|
||||
};
|
||||
|
||||
export const setTitle = function(txt) {
|
||||
export const setTitle = function (txt) {
|
||||
title = txt;
|
||||
};
|
||||
|
||||
export const getTitle = function() {
|
||||
export const getTitle = function () {
|
||||
return title;
|
||||
};
|
||||
|
||||
export const addSection = function(txt) {
|
||||
export const addSection = function (txt) {
|
||||
currentSection = txt;
|
||||
sections.push(txt);
|
||||
};
|
||||
|
||||
export const getSections = function() {
|
||||
export const getSections = function () {
|
||||
return sections;
|
||||
};
|
||||
|
||||
export const getTasks = function() {
|
||||
export const getTasks = function () {
|
||||
let allItemsPricessed = compileTasks();
|
||||
const maxDepth = 10;
|
||||
let iterationCount = 0;
|
||||
@ -123,7 +123,7 @@ export const getTasks = function() {
|
||||
return tasks;
|
||||
};
|
||||
|
||||
const isInvalidDate = function(date, dateFormat, excludes) {
|
||||
const isInvalidDate = function (date, dateFormat, excludes) {
|
||||
if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
|
||||
return true;
|
||||
}
|
||||
@ -133,7 +133,7 @@ const isInvalidDate = function(date, dateFormat, excludes) {
|
||||
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;
|
||||
let startTime = moment(task.startTime, dateFormat, true);
|
||||
startTime.add(1, 'd');
|
||||
@ -143,7 +143,7 @@ const checkTaskDates = function(task, dateFormat, excludes) {
|
||||
task.renderEndTime = renderEndTime;
|
||||
};
|
||||
|
||||
const fixTaskDates = function(startTime, endTime, dateFormat, excludes) {
|
||||
const fixTaskDates = function (startTime, endTime, dateFormat, excludes) {
|
||||
let invalid = false;
|
||||
let renderEndTime = null;
|
||||
while (startTime <= endTime) {
|
||||
@ -159,7 +159,7 @@ const fixTaskDates = function(startTime, endTime, dateFormat, excludes) {
|
||||
return renderEndTime;
|
||||
};
|
||||
|
||||
const getStartDate = function(prevTime, dateFormat, str) {
|
||||
const getStartDate = function (prevTime, dateFormat, str) {
|
||||
str = str.trim();
|
||||
|
||||
// Test for after
|
||||
@ -169,7 +169,7 @@ const getStartDate = function(prevTime, dateFormat, str) {
|
||||
if (afterStatement !== null) {
|
||||
// check all after ids and take the latest
|
||||
let latestEndingTask = null;
|
||||
afterStatement[1].split(' ').forEach(function(id) {
|
||||
afterStatement[1].split(' ').forEach(function (id) {
|
||||
let task = findTaskById(id);
|
||||
if (typeof task !== 'undefined') {
|
||||
if (!latestEndingTask) {
|
||||
@ -204,7 +204,7 @@ const getStartDate = function(prevTime, dateFormat, str) {
|
||||
return new Date();
|
||||
};
|
||||
|
||||
const durationToDate = function(durationStatement, relativeTime) {
|
||||
const durationToDate = function (durationStatement, relativeTime) {
|
||||
if (durationStatement !== null) {
|
||||
switch (durationStatement[2]) {
|
||||
case 's':
|
||||
@ -228,7 +228,7 @@ const durationToDate = function(durationStatement, relativeTime) {
|
||||
return relativeTime.toDate();
|
||||
};
|
||||
|
||||
const getEndDate = function(prevTime, dateFormat, str, inclusive) {
|
||||
const getEndDate = function (prevTime, dateFormat, str, inclusive) {
|
||||
inclusive = inclusive || false;
|
||||
str = str.trim();
|
||||
|
||||
@ -245,7 +245,7 @@ const getEndDate = function(prevTime, dateFormat, str, inclusive) {
|
||||
};
|
||||
|
||||
let taskCnt = 0;
|
||||
const parseId = function(idStr) {
|
||||
const parseId = function (idStr) {
|
||||
if (typeof idStr === 'undefined') {
|
||||
taskCnt = taskCnt + 1;
|
||||
return 'task' + taskCnt;
|
||||
@ -263,7 +263,7 @@ const parseId = function(idStr) {
|
||||
// endDate
|
||||
// length
|
||||
|
||||
const compileData = function(prevTask, dataStr) {
|
||||
const compileData = function (prevTask, dataStr) {
|
||||
let ds;
|
||||
|
||||
if (dataStr.substr(0, 1) === ':') {
|
||||
@ -312,7 +312,7 @@ const compileData = function(prevTask, dataStr) {
|
||||
return task;
|
||||
};
|
||||
|
||||
const parseData = function(prevTaskId, dataStr) {
|
||||
const parseData = function (prevTaskId, dataStr) {
|
||||
let ds;
|
||||
if (dataStr.substr(0, 1) === ':') {
|
||||
ds = dataStr.substr(1, dataStr.length);
|
||||
@ -336,30 +336,30 @@ const parseData = function(prevTaskId, dataStr) {
|
||||
task.id = parseId();
|
||||
task.startTime = {
|
||||
type: 'prevTaskEnd',
|
||||
id: prevTaskId
|
||||
id: prevTaskId,
|
||||
};
|
||||
task.endTime = {
|
||||
data: data[0]
|
||||
data: data[0],
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
task.id = parseId();
|
||||
task.startTime = {
|
||||
type: 'getStartDate',
|
||||
startData: data[0]
|
||||
startData: data[0],
|
||||
};
|
||||
task.endTime = {
|
||||
data: data[1]
|
||||
data: data[1],
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
task.id = parseId(data[0]);
|
||||
task.startTime = {
|
||||
type: 'getStartDate',
|
||||
startData: data[1]
|
||||
startData: data[1],
|
||||
};
|
||||
task.endTime = {
|
||||
data: data[2]
|
||||
data: data[2],
|
||||
};
|
||||
break;
|
||||
default:
|
||||
@ -372,7 +372,7 @@ let lastTask;
|
||||
let lastTaskID;
|
||||
let rawTasks = [];
|
||||
const taskDb = {};
|
||||
export const addTask = function(descr, data) {
|
||||
export const addTask = function (descr, data) {
|
||||
const rawTask = {
|
||||
section: currentSection,
|
||||
type: currentSection,
|
||||
@ -381,7 +381,7 @@ export const addTask = function(descr, data) {
|
||||
renderEndTime: null,
|
||||
raw: { data: data },
|
||||
task: descr,
|
||||
classes: []
|
||||
classes: [],
|
||||
};
|
||||
const taskInfo = parseData(lastTaskID, data);
|
||||
rawTask.raw.startTime = taskInfo.startTime;
|
||||
@ -403,18 +403,18 @@ export const addTask = function(descr, data) {
|
||||
taskDb[rawTask.id] = pos - 1;
|
||||
};
|
||||
|
||||
export const findTaskById = function(id) {
|
||||
export const findTaskById = function (id) {
|
||||
const pos = taskDb[id];
|
||||
return rawTasks[pos];
|
||||
};
|
||||
|
||||
export const addTaskOrg = function(descr, data) {
|
||||
export const addTaskOrg = function (descr, data) {
|
||||
const newTask = {
|
||||
section: currentSection,
|
||||
type: currentSection,
|
||||
description: descr,
|
||||
task: descr,
|
||||
classes: []
|
||||
classes: [],
|
||||
};
|
||||
const taskInfo = compileData(lastTask, data);
|
||||
newTask.startTime = taskInfo.startTime;
|
||||
@ -428,8 +428,8 @@ export const addTaskOrg = function(descr, data) {
|
||||
tasks.push(newTask);
|
||||
};
|
||||
|
||||
const compileTasks = function() {
|
||||
const compileTask = function(pos) {
|
||||
const compileTasks = function () {
|
||||
const compileTask = function (pos) {
|
||||
const task = rawTasks[pos];
|
||||
let startTime = '';
|
||||
switch (rawTasks[pos].raw.startTime.type) {
|
||||
@ -481,12 +481,12 @@ const compileTasks = function() {
|
||||
* @param ids Comma separated list of ids
|
||||
* @param linkStr URL to create a link for
|
||||
*/
|
||||
export const setLink = function(ids, _linkStr) {
|
||||
export const setLink = function (ids, _linkStr) {
|
||||
let linkStr = _linkStr;
|
||||
if (configApi.getConfig().securityLevel !== 'loose') {
|
||||
linkStr = sanitizeUrl(_linkStr);
|
||||
}
|
||||
ids.split(',').forEach(function(id) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
let rawTask = findTaskById(id);
|
||||
if (typeof rawTask !== 'undefined') {
|
||||
pushFun(id, () => {
|
||||
@ -502,8 +502,8 @@ export const setLink = function(ids, _linkStr) {
|
||||
* @param ids Comma separated list of ids
|
||||
* @param className Class to add
|
||||
*/
|
||||
export const setClass = function(ids, className) {
|
||||
ids.split(',').forEach(function(id) {
|
||||
export const setClass = function (ids, className) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
let rawTask = findTaskById(id);
|
||||
if (typeof rawTask !== 'undefined') {
|
||||
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') {
|
||||
return;
|
||||
}
|
||||
@ -552,21 +552,21 @@ const setClickFun = function(id, functionName, functionArgs) {
|
||||
* @param id The task's id
|
||||
* @param callbackFunction A function to be executed when clicked on the task or the task's text
|
||||
*/
|
||||
const pushFun = function(id, callbackFunction) {
|
||||
funs.push(function() {
|
||||
const pushFun = function (id, callbackFunction) {
|
||||
funs.push(function () {
|
||||
// const elem = d3.select(element).select(`[id="${id}"]`)
|
||||
const elem = document.querySelector(`[id="${id}"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener('click', function() {
|
||||
elem.addEventListener('click', function () {
|
||||
callbackFunction();
|
||||
});
|
||||
}
|
||||
});
|
||||
funs.push(function() {
|
||||
funs.push(function () {
|
||||
// const elem = d3.select(element).select(`[id="${id}-text"]`)
|
||||
const elem = document.querySelector(`[id="${id}-text"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener('click', function() {
|
||||
elem.addEventListener('click', function () {
|
||||
callbackFunction();
|
||||
});
|
||||
}
|
||||
@ -579,8 +579,8 @@ const pushFun = function(id, callbackFunction) {
|
||||
* @param functionName Function to be called on click
|
||||
* @param functionArgs Function args the function should be called with
|
||||
*/
|
||||
export const setClickEvent = function(ids, functionName, functionArgs) {
|
||||
ids.split(',').forEach(function(id) {
|
||||
export const setClickEvent = function (ids, functionName, functionArgs) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
setClickFun(id, functionName, functionArgs);
|
||||
});
|
||||
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
|
||||
* @param element
|
||||
*/
|
||||
export const bindFunctions = function(element) {
|
||||
funs.forEach(function(fun) {
|
||||
export const bindFunctions = function (element) {
|
||||
funs.forEach(function (fun) {
|
||||
fun(element);
|
||||
});
|
||||
};
|
||||
@ -623,14 +623,14 @@ export default {
|
||||
setClickEvent,
|
||||
setLink,
|
||||
bindFunctions,
|
||||
durationToDate
|
||||
durationToDate,
|
||||
};
|
||||
|
||||
function getTaskTags(data, task, tags) {
|
||||
let matchFound = true;
|
||||
while (matchFound) {
|
||||
matchFound = false;
|
||||
tags.forEach(function(t) {
|
||||
tags.forEach(function (t) {
|
||||
const pattern = '^\\s*' + t + '\\s*$';
|
||||
const regex = new RegExp(pattern);
|
||||
if (data[0].match(regex)) {
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
interpolateHcl,
|
||||
axisBottom,
|
||||
axisTop,
|
||||
timeFormat
|
||||
timeFormat,
|
||||
} from 'd3';
|
||||
import { parser } from './parser/gantt';
|
||||
import common from '../common/common';
|
||||
@ -16,14 +16,14 @@ import { getConfig } from '../../config';
|
||||
import { configureSvgSize } from '../../utils';
|
||||
|
||||
parser.yy = ganttDb;
|
||||
export const setConf = function() {
|
||||
export const setConf = function () {
|
||||
// const keys = Object.keys(cnf);
|
||||
// keys.forEach(function(key) {
|
||||
// conf[key] = cnf[key];
|
||||
// });
|
||||
};
|
||||
let w;
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
const conf = getConfig().gantt;
|
||||
parser.yy.clear();
|
||||
parser.parse(text);
|
||||
@ -51,12 +51,12 @@ export const draw = function(text, id) {
|
||||
// Set timescale
|
||||
const timeScale = scaleTime()
|
||||
.domain([
|
||||
min(taskArray, function(d) {
|
||||
min(taskArray, function (d) {
|
||||
return d.startTime;
|
||||
}),
|
||||
max(taskArray, function(d) {
|
||||
max(taskArray, function (d) {
|
||||
return d.endTime;
|
||||
})
|
||||
}),
|
||||
])
|
||||
.rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
|
||||
|
||||
@ -123,16 +123,16 @@ export const draw = function(text, id) {
|
||||
.enter()
|
||||
.append('rect')
|
||||
.attr('x', 0)
|
||||
.attr('y', function(d, i) {
|
||||
.attr('y', function (d, i) {
|
||||
// Ignore the incoming i value and use our order instead
|
||||
i = d.order;
|
||||
return i * theGap + theTopPad - 2;
|
||||
})
|
||||
.attr('width', function() {
|
||||
.attr('width', function () {
|
||||
return w - conf.rightPadding / 2;
|
||||
})
|
||||
.attr('height', theGap)
|
||||
.attr('class', function(d) {
|
||||
.attr('class', function (d) {
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
if (d.type === categories[i]) {
|
||||
return 'section section' + (i % conf.numberSectionStyles);
|
||||
@ -142,20 +142,16 @@ export const draw = function(text, id) {
|
||||
});
|
||||
|
||||
// Draw the rects representing the tasks
|
||||
const rectangles = svg
|
||||
.append('g')
|
||||
.selectAll('rect')
|
||||
.data(theArray)
|
||||
.enter();
|
||||
const rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
|
||||
|
||||
rectangles
|
||||
.append('rect')
|
||||
.attr('id', function(d) {
|
||||
.attr('id', function (d) {
|
||||
return d.id;
|
||||
})
|
||||
.attr('rx', 3)
|
||||
.attr('ry', 3)
|
||||
.attr('x', function(d) {
|
||||
.attr('x', function (d) {
|
||||
if (d.milestone) {
|
||||
return (
|
||||
timeScale(d.startTime) +
|
||||
@ -166,19 +162,19 @@ export const draw = function(text, id) {
|
||||
}
|
||||
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
|
||||
i = d.order;
|
||||
return i * theGap + theTopPad;
|
||||
})
|
||||
.attr('width', function(d) {
|
||||
.attr('width', function (d) {
|
||||
if (d.milestone) {
|
||||
return theBarHeight;
|
||||
}
|
||||
return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
|
||||
})
|
||||
.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
|
||||
i = d.order;
|
||||
|
||||
@ -193,7 +189,7 @@ export const draw = function(text, id) {
|
||||
'px'
|
||||
);
|
||||
})
|
||||
.attr('class', function(d) {
|
||||
.attr('class', function (d) {
|
||||
const res = 'task';
|
||||
|
||||
let classStr = '';
|
||||
@ -245,14 +241,14 @@ export const draw = function(text, id) {
|
||||
// Append task labels
|
||||
rectangles
|
||||
.append('text')
|
||||
.attr('id', function(d) {
|
||||
.attr('id', function (d) {
|
||||
return d.id + '-text';
|
||||
})
|
||||
.text(function(d) {
|
||||
.text(function (d) {
|
||||
return d.task;
|
||||
})
|
||||
.attr('font-size', conf.fontSize)
|
||||
.attr('x', function(d) {
|
||||
.attr('x', function (d) {
|
||||
let startX = timeScale(d.startTime);
|
||||
let endX = timeScale(d.renderEndTime || d.endTime);
|
||||
if (d.milestone) {
|
||||
@ -274,13 +270,13 @@ export const draw = function(text, id) {
|
||||
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
|
||||
i = d.order;
|
||||
return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
|
||||
})
|
||||
.attr('text-height', theBarHeight)
|
||||
.attr('class', function(d) {
|
||||
.attr('class', function (d) {
|
||||
const startX = timeScale(d.startTime);
|
||||
let endX = timeScale(d.endTime);
|
||||
if (d.milestone) {
|
||||
@ -395,7 +391,7 @@ export const draw = function(text, id) {
|
||||
.selectAll('text')
|
||||
.data(numOccurances)
|
||||
.enter()
|
||||
.append(function(d) {
|
||||
.append(function (d) {
|
||||
const rows = d[0].split(common.lineBreakRegex);
|
||||
const dy = -(rows.length - 1) / 2;
|
||||
|
||||
@ -413,7 +409,7 @@ export const draw = function(text, id) {
|
||||
return svgLabel;
|
||||
})
|
||||
.attr('x', 10)
|
||||
.attr('y', function(d, i) {
|
||||
.attr('y', function (d, i) {
|
||||
if (i > 0) {
|
||||
for (let j = 0; j < i; j++) {
|
||||
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('class', function(d) {
|
||||
.attr('class', function (d) {
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
if (d[0] === categories[i]) {
|
||||
return 'sectionTitle sectionTitle' + (i % conf.numberSectionStyles);
|
||||
@ -489,5 +485,5 @@ export const draw = function(text, id) {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`
|
||||
.mermaid-main-font {
|
||||
font-family: "trebuchet ms", verdana, arial, sans-serif;
|
||||
|
@ -49,11 +49,11 @@ function uniqBy(list, fn) {
|
||||
}, []);
|
||||
}
|
||||
|
||||
export const setDirection = function(dir) {
|
||||
export const setDirection = function (dir) {
|
||||
direction = dir;
|
||||
};
|
||||
let options = {};
|
||||
export const setOptions = function(rawOptString) {
|
||||
export const setOptions = function (rawOptString) {
|
||||
log.debug('options str', rawOptString);
|
||||
rawOptString = rawOptString && rawOptString.trim();
|
||||
rawOptString = rawOptString || '{}';
|
||||
@ -64,16 +64,16 @@ export const setOptions = function(rawOptString) {
|
||||
}
|
||||
};
|
||||
|
||||
export const getOptions = function() {
|
||||
export const getOptions = function () {
|
||||
return options;
|
||||
};
|
||||
|
||||
export const commit = function(msg) {
|
||||
export const commit = function (msg) {
|
||||
const commit = {
|
||||
id: getId(),
|
||||
message: msg,
|
||||
seq: seq++,
|
||||
parent: head == null ? null : head.id
|
||||
parent: head == null ? null : head.id,
|
||||
};
|
||||
head = commit;
|
||||
commits[commit.id] = commit;
|
||||
@ -81,12 +81,12 @@ export const commit = function(msg) {
|
||||
log.debug('in pushCommit ' + commit.id);
|
||||
};
|
||||
|
||||
export const branch = function(name) {
|
||||
export const branch = function (name) {
|
||||
branches[name] = head != null ? head.id : null;
|
||||
log.debug('in createBranch');
|
||||
};
|
||||
|
||||
export const merge = function(otherBranch) {
|
||||
export const merge = function (otherBranch) {
|
||||
const currentCommit = commits[branches[curBranch]];
|
||||
const otherCommit = commits[branches[otherBranch]];
|
||||
if (isReachableFrom(currentCommit, otherCommit)) {
|
||||
@ -102,7 +102,7 @@ export const merge = function(otherBranch) {
|
||||
id: getId(),
|
||||
message: 'merged branch ' + otherBranch + ' into ' + curBranch,
|
||||
seq: seq++,
|
||||
parent: [head == null ? null : head.id, branches[otherBranch]]
|
||||
parent: [head == null ? null : head.id, branches[otherBranch]],
|
||||
};
|
||||
head = commit;
|
||||
commits[commit.id] = commit;
|
||||
@ -112,14 +112,14 @@ export const merge = function(otherBranch) {
|
||||
log.debug('in mergeBranch');
|
||||
};
|
||||
|
||||
export const checkout = function(branch) {
|
||||
export const checkout = function (branch) {
|
||||
log.debug('in checkout');
|
||||
curBranch = branch;
|
||||
const id = branches[curBranch];
|
||||
head = commits[id];
|
||||
};
|
||||
|
||||
export const reset = function(commitRef) {
|
||||
export const reset = function (commitRef) {
|
||||
log.debug('in reset', commitRef);
|
||||
const ref = commitRef.split(':')[0];
|
||||
let parentCount = parseInt(commitRef.split(':')[1]);
|
||||
@ -153,7 +153,7 @@ function prettyPrintCommitHistory(commitArr) {
|
||||
return commit;
|
||||
}, commitArr[0]);
|
||||
let line = '';
|
||||
commitArr.forEach(function(c) {
|
||||
commitArr.forEach(function (c) {
|
||||
if (c === commit) {
|
||||
line += '\t*';
|
||||
} else {
|
||||
@ -175,17 +175,17 @@ function prettyPrintCommitHistory(commitArr) {
|
||||
const nextCommit = commits[commit.parent];
|
||||
upsert(commitArr, commit, nextCommit);
|
||||
}
|
||||
commitArr = uniqBy(commitArr, c => c.id);
|
||||
commitArr = uniqBy(commitArr, (c) => c.id);
|
||||
prettyPrintCommitHistory(commitArr);
|
||||
}
|
||||
|
||||
export const prettyPrint = function() {
|
||||
export const prettyPrint = function () {
|
||||
log.debug(commits);
|
||||
const node = getCommitsArray()[0];
|
||||
prettyPrintCommitHistory([node]);
|
||||
};
|
||||
|
||||
export const clear = function() {
|
||||
export const clear = function () {
|
||||
commits = {};
|
||||
head = null;
|
||||
branches = { master: head };
|
||||
@ -193,7 +193,7 @@ export const clear = function() {
|
||||
seq = 0;
|
||||
};
|
||||
|
||||
export const getBranchesAsObjArray = function() {
|
||||
export const getBranchesAsObjArray = function () {
|
||||
const branchArr = [];
|
||||
for (let branch in branches) {
|
||||
branchArr.push({ name: branch, commit: commits[branches[branch]] });
|
||||
@ -201,29 +201,29 @@ export const getBranchesAsObjArray = function() {
|
||||
return branchArr;
|
||||
};
|
||||
|
||||
export const getBranches = function() {
|
||||
export const getBranches = function () {
|
||||
return branches;
|
||||
};
|
||||
export const getCommits = function() {
|
||||
export const getCommits = function () {
|
||||
return commits;
|
||||
};
|
||||
export const getCommitsArray = function() {
|
||||
const commitArr = Object.keys(commits).map(function(key) {
|
||||
export const getCommitsArray = function () {
|
||||
const commitArr = Object.keys(commits).map(function (key) {
|
||||
return commits[key];
|
||||
});
|
||||
commitArr.forEach(function(o) {
|
||||
commitArr.forEach(function (o) {
|
||||
log.debug(o.id);
|
||||
});
|
||||
commitArr.sort((a, b) => b.seq - a.seq);
|
||||
return commitArr;
|
||||
};
|
||||
export const getCurrentBranch = function() {
|
||||
export const getCurrentBranch = function () {
|
||||
return curBranch;
|
||||
};
|
||||
export const getDirection = function() {
|
||||
export const getDirection = function () {
|
||||
return direction;
|
||||
};
|
||||
export const getHead = function() {
|
||||
export const getHead = function () {
|
||||
return head;
|
||||
};
|
||||
|
||||
@ -244,5 +244,5 @@ export default {
|
||||
getCommitsArray,
|
||||
getCurrentBranch,
|
||||
getDirection,
|
||||
getHead
|
||||
getHead,
|
||||
};
|
||||
|
@ -22,11 +22,11 @@ let config = {
|
||||
width: 75,
|
||||
height: 100,
|
||||
x: -25,
|
||||
y: 0
|
||||
}
|
||||
y: 0,
|
||||
},
|
||||
};
|
||||
let apiConfig = {};
|
||||
export const setConf = function(c) {
|
||||
export const setConf = function (c) {
|
||||
apiConfig = c;
|
||||
};
|
||||
|
||||
@ -56,10 +56,10 @@ function svgDrawLine(svg, points, colorIdx, interpolate) {
|
||||
const curve = interpolateToCurve(interpolate, curveBasis);
|
||||
const color = config.branchColors[colorIdx % config.branchColors.length];
|
||||
const lineGen = line()
|
||||
.x(function(d) {
|
||||
.x(function (d) {
|
||||
return Math.round(d.x);
|
||||
})
|
||||
.y(function(d) {
|
||||
.y(function (d) {
|
||||
return Math.round(d.y);
|
||||
})
|
||||
.curve(curve);
|
||||
@ -82,7 +82,7 @@ function getElementCoords(element, coords) {
|
||||
left: xn,
|
||||
top: yn,
|
||||
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) {
|
||||
const lineStart = {
|
||||
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 };
|
||||
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 - config.nodeSpacing / 2, y: fromBbox.top + fromBbox.height / 2 },
|
||||
{ x: fromBbox.left - config.nodeSpacing / 2, y: lineStart.y },
|
||||
lineStart
|
||||
lineStart,
|
||||
],
|
||||
color
|
||||
);
|
||||
@ -118,20 +118,20 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
|
||||
[
|
||||
{
|
||||
x: fromBbox.left,
|
||||
y: fromBbox.top + fromBbox.height / 2
|
||||
y: fromBbox.top + fromBbox.height / 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,
|
||||
y: toBbox.top + toBbox.height / 2
|
||||
y: toBbox.top + toBbox.height / 2,
|
||||
},
|
||||
{
|
||||
x: toBbox.left + toBbox.width,
|
||||
y: toBbox.top + toBbox.height / 2
|
||||
}
|
||||
y: toBbox.top + toBbox.height / 2,
|
||||
},
|
||||
],
|
||||
color
|
||||
);
|
||||
@ -145,7 +145,7 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
|
||||
if (toBbox.top - fromBbox.top > config.nodeSpacing) {
|
||||
const lineStart = {
|
||||
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 };
|
||||
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 + config.nodeSpacing / 2
|
||||
y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2,
|
||||
},
|
||||
{ x: toBbox.left + toBbox.width / 2, y: lineStart.y - config.nodeSpacing / 2 },
|
||||
lineStart
|
||||
lineStart,
|
||||
],
|
||||
color
|
||||
);
|
||||
@ -168,20 +168,20 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
|
||||
[
|
||||
{
|
||||
x: fromBbox.left + fromBbox.width / 2,
|
||||
y: fromBbox.top + fromBbox.height
|
||||
y: fromBbox.top + fromBbox.height,
|
||||
},
|
||||
{
|
||||
x: fromBbox.left + fromBbox.width / 2,
|
||||
y: fromBbox.top + config.nodeSpacing / 2
|
||||
y: fromBbox.top + config.nodeSpacing / 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,
|
||||
y: toBbox.top
|
||||
}
|
||||
y: toBbox.top,
|
||||
},
|
||||
],
|
||||
color
|
||||
);
|
||||
@ -191,10 +191,7 @@ function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
|
||||
}
|
||||
|
||||
function cloneNode(svg, selector) {
|
||||
return svg
|
||||
.select(selector)
|
||||
.node()
|
||||
.cloneNode(true);
|
||||
return svg.select(selector).node().cloneNode(true);
|
||||
}
|
||||
|
||||
function renderCommitHistory(svg, commitid, branches, direction) {
|
||||
@ -208,14 +205,14 @@ function renderCommitHistory(svg, commitid, branches, direction) {
|
||||
return;
|
||||
}
|
||||
svg
|
||||
.append(function() {
|
||||
.append(function () {
|
||||
return cloneNode(svg, '#def-commit');
|
||||
})
|
||||
.attr('class', 'commit')
|
||||
.attr('id', function() {
|
||||
.attr('id', function () {
|
||||
return 'node-' + commit.id;
|
||||
})
|
||||
.attr('transform', function() {
|
||||
.attr('transform', function () {
|
||||
switch (direction) {
|
||||
case 'LR':
|
||||
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 {
|
||||
const parser = gitGraphParser.parser;
|
||||
parser.yy = db;
|
||||
@ -325,7 +322,7 @@ export const draw = function(txt, id, ver) {
|
||||
renderLines(svg, v.commit, direction);
|
||||
branchNum++;
|
||||
}
|
||||
svg.attr('height', function() {
|
||||
svg.attr('height', function () {
|
||||
if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
|
||||
return (branches.length + 1) * config.branchOffset;
|
||||
});
|
||||
@ -337,5 +334,5 @@ export const draw = function(txt, id, ver) {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ import { log } from '../../logger';
|
||||
var message = '';
|
||||
var info = false;
|
||||
|
||||
export const setMessage = txt => {
|
||||
export const setMessage = (txt) => {
|
||||
log.debug('Setting message to: ' + txt);
|
||||
message = txt;
|
||||
};
|
||||
@ -15,7 +15,7 @@ export const getMessage = () => {
|
||||
return message;
|
||||
};
|
||||
|
||||
export const setInfo = inf => {
|
||||
export const setInfo = (inf) => {
|
||||
info = inf;
|
||||
};
|
||||
|
||||
@ -31,6 +31,6 @@ export default {
|
||||
setMessage,
|
||||
getMessage,
|
||||
setInfo,
|
||||
getInfo
|
||||
getInfo,
|
||||
// parseError
|
||||
};
|
||||
|
@ -7,10 +7,10 @@ import infoParser from './parser/info';
|
||||
import { log } from '../../logger';
|
||||
|
||||
const conf = {};
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
conf[key] = cnf[key];
|
||||
});
|
||||
};
|
||||
@ -52,5 +52,5 @@ export const draw = (txt, id, ver) => {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -9,11 +9,11 @@ let sections = {};
|
||||
let title = '';
|
||||
let showData = false;
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (statement, context, type) {
|
||||
mermaidAPI.parseDirective(this, statement, context, type);
|
||||
};
|
||||
|
||||
const addSection = function(id, value) {
|
||||
const addSection = function (id, value) {
|
||||
if (typeof sections[id] === 'undefined') {
|
||||
sections[id] = value;
|
||||
log.debug('Added new section :', id);
|
||||
@ -21,22 +21,22 @@ const addSection = function(id, value) {
|
||||
};
|
||||
const getSections = () => sections;
|
||||
|
||||
const setTitle = function(txt) {
|
||||
const setTitle = function (txt) {
|
||||
title = txt;
|
||||
};
|
||||
|
||||
const setShowData = function(toggle) {
|
||||
const setShowData = function (toggle) {
|
||||
showData = toggle;
|
||||
};
|
||||
|
||||
const getShowData = function() {
|
||||
const getShowData = function () {
|
||||
return showData;
|
||||
};
|
||||
|
||||
const getTitle = function() {
|
||||
const getTitle = function () {
|
||||
return title;
|
||||
};
|
||||
const cleanupValue = function(value) {
|
||||
const cleanupValue = function (value) {
|
||||
if (value.substring(0, 1) === ':') {
|
||||
value = value.substring(1).trim();
|
||||
return Number(value.trim());
|
||||
@ -45,7 +45,7 @@ const cleanupValue = function(value) {
|
||||
}
|
||||
};
|
||||
|
||||
const clear = function() {
|
||||
const clear = function () {
|
||||
sections = {};
|
||||
title = '';
|
||||
showData = false;
|
||||
@ -64,6 +64,6 @@ export default {
|
||||
setTitle,
|
||||
getTitle,
|
||||
setShowData,
|
||||
getShowData
|
||||
getShowData,
|
||||
// parseError
|
||||
};
|
||||
|
@ -60,7 +60,7 @@ export const draw = (txt, id) => {
|
||||
|
||||
var data = pieData.getSections();
|
||||
var sum = 0;
|
||||
Object.keys(data).forEach(function(key) {
|
||||
Object.keys(data).forEach(function (key) {
|
||||
sum += data[key];
|
||||
});
|
||||
|
||||
@ -77,24 +77,20 @@ export const draw = (txt, id) => {
|
||||
themeVariables.pie9,
|
||||
themeVariables.pie10,
|
||||
themeVariables.pie11,
|
||||
themeVariables.pie12
|
||||
themeVariables.pie12,
|
||||
];
|
||||
|
||||
// Set the color scale
|
||||
var color = scaleOrdinal()
|
||||
.domain(data)
|
||||
.range(myGeneratedColors);
|
||||
var color = scaleOrdinal().domain(data).range(myGeneratedColors);
|
||||
|
||||
// Compute the position of each group on the pie:
|
||||
var pie = d3pie().value(function(d) {
|
||||
var pie = d3pie().value(function (d) {
|
||||
return d.value;
|
||||
});
|
||||
var dataReady = pie(entries(data));
|
||||
|
||||
// Shape helper to build arcs:
|
||||
var arcGenerator = arc()
|
||||
.innerRadius(0)
|
||||
.outerRadius(radius);
|
||||
var arcGenerator = arc().innerRadius(0).outerRadius(radius);
|
||||
|
||||
// Build the pie chart: each part of the pie is a path that we build using the arc function.
|
||||
svg
|
||||
@ -103,7 +99,7 @@ export const draw = (txt, id) => {
|
||||
.enter()
|
||||
.append('path')
|
||||
.attr('d', arcGenerator)
|
||||
.attr('fill', function(d) {
|
||||
.attr('fill', function (d) {
|
||||
return color(d.data.key);
|
||||
})
|
||||
.attr('class', 'pieCircle');
|
||||
@ -112,13 +108,13 @@ export const draw = (txt, id) => {
|
||||
// Use the centroid method to get the best coordinates.
|
||||
svg
|
||||
.selectAll('mySlices')
|
||||
.data(dataReady.filter(value => value.data.value !== 0))
|
||||
.data(dataReady.filter((value) => value.data.value !== 0))
|
||||
.enter()
|
||||
.append('text')
|
||||
.text(function(d) {
|
||||
.text(function (d) {
|
||||
return ((d.data.value / sum) * 100).toFixed(0) + '%';
|
||||
})
|
||||
.attr('transform', function(d) {
|
||||
.attr('transform', function (d) {
|
||||
return 'translate(' + arcGenerator.centroid(d) + ')';
|
||||
})
|
||||
.style('text-anchor', 'middle')
|
||||
@ -138,7 +134,7 @@ export const draw = (txt, id) => {
|
||||
.enter()
|
||||
.append('g')
|
||||
.attr('class', 'legend')
|
||||
.attr('transform', function(d, i) {
|
||||
.attr('transform', function (d, i) {
|
||||
var height = legendRectSize + legendSpacing;
|
||||
var offset = (height * color.domain().length) / 2;
|
||||
var horz = 12 * legendRectSize;
|
||||
@ -154,11 +150,11 @@ export const draw = (txt, id) => {
|
||||
.style('stroke', color);
|
||||
|
||||
legend
|
||||
.data(dataReady.filter(value => value.data.value !== 0))
|
||||
.data(dataReady.filter((value) => value.data.value !== 0))
|
||||
.append('text')
|
||||
.attr('x', legendRectSize + legendSpacing)
|
||||
.attr('y', legendRectSize - legendSpacing)
|
||||
.text(function(d) {
|
||||
.text(function (d) {
|
||||
if (parser.yy.getShowData() || conf.showData || conf.pie.showData) {
|
||||
return d.data.key + ' [' + d.data.value + ']';
|
||||
} else {
|
||||
@ -172,5 +168,5 @@ export const draw = (txt, id) => {
|
||||
};
|
||||
|
||||
export default {
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`
|
||||
.pieCircle{
|
||||
stroke: ${options.pieStrokeColor};
|
||||
|
@ -14,20 +14,20 @@ const RequirementType = {
|
||||
INTERFACE_REQUIREMENT: 'Interface Requirement',
|
||||
PERFORMANCE_REQUIREMENT: 'Performance Requirement',
|
||||
PHYSICAL_REQUIREMENT: 'Physical Requirement',
|
||||
DESIGN_CONSTRAINT: 'Design Constraint'
|
||||
DESIGN_CONSTRAINT: 'Design Constraint',
|
||||
};
|
||||
|
||||
const RiskLevel = {
|
||||
LOW_RISK: 'Low',
|
||||
MED_RISK: 'Medium',
|
||||
HIGH_RISK: 'High'
|
||||
HIGH_RISK: 'High',
|
||||
};
|
||||
|
||||
const VerifyType = {
|
||||
VERIFY_ANALYSIS: 'Analysis',
|
||||
VERIFY_DEMONSTRATION: 'Demonstration',
|
||||
VERIFY_INSPECTION: 'Inspection',
|
||||
VERIFY_TEST: 'Test'
|
||||
VERIFY_TEST: 'Test',
|
||||
};
|
||||
|
||||
const Relationships = {
|
||||
@ -37,10 +37,10 @@ const Relationships = {
|
||||
SATISFIES: 'satisfies',
|
||||
VERIFIES: 'verifies',
|
||||
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);
|
||||
};
|
||||
|
||||
@ -53,7 +53,7 @@ const addRequirement = (name, type) => {
|
||||
id: latestRequirement.id,
|
||||
text: latestRequirement.text,
|
||||
risk: latestRequirement.risk,
|
||||
verifyMethod: latestRequirement.verifyMethod
|
||||
verifyMethod: latestRequirement.verifyMethod,
|
||||
};
|
||||
}
|
||||
latestRequirement = {};
|
||||
@ -63,37 +63,37 @@ const addRequirement = (name, type) => {
|
||||
|
||||
const getRequirements = () => requirements;
|
||||
|
||||
const setNewReqId = id => {
|
||||
const setNewReqId = (id) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
latestRequirement.id = id;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewReqText = text => {
|
||||
const setNewReqText = (text) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
latestRequirement.text = text;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewReqRisk = risk => {
|
||||
const setNewReqRisk = (risk) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
latestRequirement.risk = risk;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewReqVerifyMethod = verifyMethod => {
|
||||
const setNewReqVerifyMethod = (verifyMethod) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
latestRequirement.verifyMethod = verifyMethod;
|
||||
}
|
||||
};
|
||||
|
||||
const addElement = name => {
|
||||
const addElement = (name) => {
|
||||
if (typeof elements[name] === 'undefined') {
|
||||
elements[name] = {
|
||||
name,
|
||||
|
||||
type: latestElement.type,
|
||||
docRef: latestElement.docRef
|
||||
docRef: latestElement.docRef,
|
||||
};
|
||||
log.info('Added new requirement: ', name);
|
||||
}
|
||||
@ -104,13 +104,13 @@ const addElement = name => {
|
||||
|
||||
const getElements = () => elements;
|
||||
|
||||
const setNewElementType = type => {
|
||||
const setNewElementType = (type) => {
|
||||
if (typeof latestElement != 'undefined') {
|
||||
latestElement.type = type;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewElementDocRef = docRef => {
|
||||
const setNewElementDocRef = (docRef) => {
|
||||
if (typeof latestElement != 'undefined') {
|
||||
latestElement.docRef = docRef;
|
||||
}
|
||||
@ -120,7 +120,7 @@ const addRelationship = (type, src, dst) => {
|
||||
relations.push({
|
||||
type,
|
||||
src,
|
||||
dst
|
||||
dst,
|
||||
});
|
||||
};
|
||||
|
||||
@ -158,5 +158,5 @@ export default {
|
||||
addRelationship,
|
||||
getRelationships,
|
||||
|
||||
clear
|
||||
clear,
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
const ReqMarkers = {
|
||||
CONTAINS: 'contains',
|
||||
ARROW: 'arrow'
|
||||
ARROW: 'arrow',
|
||||
};
|
||||
|
||||
const insertLineEndings = (parentNode, conf) => {
|
||||
@ -65,5 +65,5 @@ const insertLineEndings = (parentNode, conf) => {
|
||||
|
||||
export default {
|
||||
ReqMarkers,
|
||||
insertLineEndings
|
||||
insertLineEndings,
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ import markers from './requirementMarkers';
|
||||
const conf = {};
|
||||
let relCnt = 0;
|
||||
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
if (typeof cnf === 'undefined') {
|
||||
return;
|
||||
}
|
||||
@ -47,7 +47,7 @@ const newTitleNode = (parentNode, id, txts) => {
|
||||
// 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
|
||||
// )
|
||||
let i = 0;
|
||||
txts.forEach(textStr => {
|
||||
txts.forEach((textStr) => {
|
||||
if (i == 0) {
|
||||
title
|
||||
.append('tspan')
|
||||
@ -80,7 +80,7 @@ const newTitleNode = (parentNode, id, txts) => {
|
||||
|
||||
return {
|
||||
titleNode: title,
|
||||
y: totalY
|
||||
y: totalY,
|
||||
};
|
||||
};
|
||||
|
||||
@ -100,7 +100,7 @@ const newBodyNode = (parentNode, id, txts, yStart) => {
|
||||
let currentRow = 0;
|
||||
const charLimit = 30;
|
||||
let wrappedTxts = [];
|
||||
txts.forEach(textStr => {
|
||||
txts.forEach((textStr) => {
|
||||
let currentTextLen = textStr.length;
|
||||
while (currentTextLen > charLimit && currentRow < 3) {
|
||||
let firstPart = textStr.substring(0, charLimit);
|
||||
@ -118,12 +118,8 @@ const newBodyNode = (parentNode, id, txts, yStart) => {
|
||||
currentRow = 0;
|
||||
});
|
||||
|
||||
wrappedTxts.forEach(textStr => {
|
||||
body
|
||||
.append('tspan')
|
||||
.attr('x', conf.rect_padding)
|
||||
.attr('dy', conf.line_height)
|
||||
.text(textStr);
|
||||
wrappedTxts.forEach((textStr) => {
|
||||
body.append('tspan').attr('x', conf.rect_padding).attr('dy', conf.line_height).text(textStr);
|
||||
});
|
||||
|
||||
return body;
|
||||
@ -164,16 +160,16 @@ const addEdgeLabel = (parentNode, svgPath, conf, txt) => {
|
||||
.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
|
||||
const edge = g.edge(elementString(rel.src), elementString(rel.dst));
|
||||
|
||||
// Get a function that will generate the line path
|
||||
const lineFunction = line()
|
||||
.x(function(d) {
|
||||
.x(function (d) {
|
||||
return d.x;
|
||||
})
|
||||
.y(function(d) {
|
||||
.y(function (d) {
|
||||
return d.y;
|
||||
});
|
||||
|
||||
@ -208,7 +204,7 @@ const drawRelationshipFromLayout = function(svg, rel, g, insert) {
|
||||
};
|
||||
|
||||
export const drawReqs = (reqs, graph, svgNode) => {
|
||||
Object.keys(reqs).forEach(reqName => {
|
||||
Object.keys(reqs).forEach((reqName) => {
|
||||
let req = reqs[reqName];
|
||||
reqName = elementString(reqName);
|
||||
log.info('Added new requirement: ', reqName);
|
||||
@ -221,7 +217,7 @@ export const drawReqs = (reqs, graph, svgNode) => {
|
||||
|
||||
let titleNodeInfo = newTitleNode(groupNode, reqName + '_title', [
|
||||
`<<${req.type}>>`,
|
||||
`${req.name}`
|
||||
`${req.name}`,
|
||||
]);
|
||||
|
||||
nodes.push(titleNodeInfo.titleNode);
|
||||
@ -233,7 +229,7 @@ export const drawReqs = (reqs, graph, svgNode) => {
|
||||
`Id: ${req.id}`,
|
||||
`Text: ${req.text}`,
|
||||
`Risk: ${req.risk}`,
|
||||
`Verification: ${req.verifyMethod}`
|
||||
`Verification: ${req.verifyMethod}`,
|
||||
],
|
||||
titleNodeInfo.y
|
||||
);
|
||||
@ -247,13 +243,13 @@ export const drawReqs = (reqs, graph, svgNode) => {
|
||||
width: rectBBox.width,
|
||||
height: rectBBox.height,
|
||||
shape: 'rect',
|
||||
id: reqName
|
||||
id: reqName,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const drawElements = (els, graph, svgNode) => {
|
||||
Object.keys(els).forEach(elName => {
|
||||
Object.keys(els).forEach((elName) => {
|
||||
let el = els[elName];
|
||||
const id = elementString(elName);
|
||||
|
||||
@ -283,13 +279,13 @@ export const drawElements = (els, graph, svgNode) => {
|
||||
width: rectBBox.width,
|
||||
height: rectBBox.height,
|
||||
shape: 'rect',
|
||||
id: id
|
||||
id: id,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const addRelationships = (relationships, g) => {
|
||||
relationships.forEach(function(r) {
|
||||
relationships.forEach(function (r) {
|
||||
let src = elementString(r.src);
|
||||
let dst = elementString(r.dst);
|
||||
g.setEdge(src, dst, { relationship: r });
|
||||
@ -297,8 +293,8 @@ const addRelationships = (relationships, g) => {
|
||||
return relationships;
|
||||
};
|
||||
|
||||
const adjustEntities = function(svgNode, graph) {
|
||||
graph.nodes().forEach(function(v) {
|
||||
const adjustEntities = function (svgNode, graph) {
|
||||
graph.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
||||
svgNode.select('#' + v);
|
||||
svgNode
|
||||
@ -316,7 +312,7 @@ const adjustEntities = function(svgNode, graph) {
|
||||
return;
|
||||
};
|
||||
|
||||
const elementString = str => {
|
||||
const elementString = (str) => {
|
||||
return str.replace(/\s/g, '').replace(/\./g, '_');
|
||||
};
|
||||
|
||||
@ -331,7 +327,7 @@ export const draw = (text, id) => {
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: false,
|
||||
compound: false,
|
||||
directed: true
|
||||
directed: true,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: conf.layoutDirection,
|
||||
@ -339,9 +335,9 @@ export const draw = (text, id) => {
|
||||
marginy: 20,
|
||||
nodesep: 100,
|
||||
edgesep: 100,
|
||||
ranksep: 100
|
||||
ranksep: 100,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -355,7 +351,7 @@ export const draw = (text, id) => {
|
||||
dagre.layout(g);
|
||||
adjustEntities(svg, g);
|
||||
|
||||
relationships.forEach(function(rel) {
|
||||
relationships.forEach(function (rel) {
|
||||
drawRelationshipFromLayout(svg, rel, g, id);
|
||||
});
|
||||
|
||||
@ -372,5 +368,5 @@ export const draw = (text, id) => {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options => `
|
||||
const getStyles = (options) => `
|
||||
|
||||
marker {
|
||||
fill: ${options.relationColor};
|
||||
|
@ -11,11 +11,11 @@ let titleWrapped = false;
|
||||
let sequenceNumbersEnabled = false;
|
||||
let wrapEnabled = false;
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (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
|
||||
const old = actors[id];
|
||||
if (old && name === old.name && description == null) return;
|
||||
@ -29,7 +29,7 @@ export const addActor = function(id, name, description) {
|
||||
name: name,
|
||||
description: description.text,
|
||||
wrap: (description.wrap === undefined && autoWrap()) || !!description.wrap,
|
||||
prevActor: prevActor
|
||||
prevActor: prevActor,
|
||||
};
|
||||
if (prevActor && actors[prevActor]) {
|
||||
actors[prevActor].nextActor = id;
|
||||
@ -38,7 +38,7 @@ export const addActor = function(id, name, description) {
|
||||
prevActor = id;
|
||||
};
|
||||
|
||||
const activationCount = part => {
|
||||
const activationCount = (part) => {
|
||||
let i;
|
||||
let count = 0;
|
||||
for (i = 0; i < messages.length; i++) {
|
||||
@ -56,17 +56,17 @@ const activationCount = part => {
|
||||
return count;
|
||||
};
|
||||
|
||||
export const addMessage = function(idFrom, idTo, message, answer) {
|
||||
export const addMessage = function (idFrom, idTo, message, answer) {
|
||||
messages.push({
|
||||
from: idFrom,
|
||||
to: idTo,
|
||||
message: message.text,
|
||||
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
||||
answer: answer
|
||||
answer: answer,
|
||||
});
|
||||
};
|
||||
|
||||
export const addSignal = function(
|
||||
export const addSignal = function (
|
||||
idFrom,
|
||||
idTo,
|
||||
message = { text: undefined, wrap: undefined },
|
||||
@ -82,7 +82,7 @@ export const addSignal = function(
|
||||
token: '->>-',
|
||||
line: '1',
|
||||
loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
|
||||
expected: ["'ACTIVE_PARTICIPANT'"]
|
||||
expected: ["'ACTIVE_PARTICIPANT'"],
|
||||
};
|
||||
throw error;
|
||||
}
|
||||
@ -92,47 +92,47 @@ export const addSignal = function(
|
||||
to: idTo,
|
||||
message: message.text,
|
||||
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
||||
type: messageType
|
||||
type: messageType,
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
export const getMessages = function() {
|
||||
export const getMessages = function () {
|
||||
return messages;
|
||||
};
|
||||
|
||||
export const getActors = function() {
|
||||
export const getActors = function () {
|
||||
return actors;
|
||||
};
|
||||
export const getActor = function(id) {
|
||||
export const getActor = function (id) {
|
||||
return actors[id];
|
||||
};
|
||||
export const getActorKeys = function() {
|
||||
export const getActorKeys = function () {
|
||||
return Object.keys(actors);
|
||||
};
|
||||
export const getTitle = function() {
|
||||
export const getTitle = function () {
|
||||
return title;
|
||||
};
|
||||
export const getTitleWrapped = function() {
|
||||
export const getTitleWrapped = function () {
|
||||
return titleWrapped;
|
||||
};
|
||||
export const enableSequenceNumbers = function() {
|
||||
export const enableSequenceNumbers = function () {
|
||||
sequenceNumbersEnabled = true;
|
||||
};
|
||||
export const showSequenceNumbers = () => sequenceNumbersEnabled;
|
||||
|
||||
export const setWrap = function(wrapSetting) {
|
||||
export const setWrap = function (wrapSetting) {
|
||||
wrapEnabled = wrapSetting;
|
||||
};
|
||||
|
||||
export const autoWrap = () => wrapEnabled;
|
||||
|
||||
export const clear = function() {
|
||||
export const clear = function () {
|
||||
actors = {};
|
||||
messages = [];
|
||||
};
|
||||
|
||||
export const parseMessage = function(str) {
|
||||
export const parseMessage = function (str) {
|
||||
const _str = str.trim();
|
||||
const message = {
|
||||
text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
|
||||
@ -141,7 +141,7 @@ export const parseMessage = function(str) {
|
||||
? true
|
||||
: _str.match(/^[:]?nowrap:/) !== null
|
||||
? false
|
||||
: undefined
|
||||
: undefined,
|
||||
};
|
||||
log.debug('parseMessage:', message);
|
||||
return message;
|
||||
@ -170,26 +170,26 @@ export const LINETYPE = {
|
||||
RECT_START: 22,
|
||||
RECT_END: 23,
|
||||
SOLID_POINT: 24,
|
||||
DOTTED_POINT: 25
|
||||
DOTTED_POINT: 25,
|
||||
};
|
||||
|
||||
export const ARROWTYPE = {
|
||||
FILLED: 0,
|
||||
OPEN: 1
|
||||
OPEN: 1,
|
||||
};
|
||||
|
||||
export const PLACEMENT = {
|
||||
LEFTOF: 0,
|
||||
RIGHTOF: 1,
|
||||
OVER: 2
|
||||
OVER: 2,
|
||||
};
|
||||
|
||||
export const addNote = function(actor, placement, message) {
|
||||
export const addNote = function (actor, placement, message) {
|
||||
const note = {
|
||||
actor: actor,
|
||||
placement: placement,
|
||||
message: message.text,
|
||||
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap
|
||||
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
||||
};
|
||||
|
||||
// Coerce actor into a [to, from, ...] array
|
||||
@ -202,18 +202,18 @@ export const addNote = function(actor, placement, message) {
|
||||
message: message.text,
|
||||
wrap: (message.wrap === undefined && autoWrap()) || !!message.wrap,
|
||||
type: LINETYPE.NOTE,
|
||||
placement: placement
|
||||
placement: placement,
|
||||
});
|
||||
};
|
||||
|
||||
export const setTitle = function(titleWrap) {
|
||||
export const setTitle = function (titleWrap) {
|
||||
title = titleWrap.text;
|
||||
titleWrapped = (titleWrap.wrap === undefined && autoWrap()) || !!titleWrap.wrap;
|
||||
};
|
||||
|
||||
export const apply = function(param) {
|
||||
export const apply = function (param) {
|
||||
if (param instanceof Array) {
|
||||
param.forEach(function(item) {
|
||||
param.forEach(function (item) {
|
||||
apply(item);
|
||||
});
|
||||
} else {
|
||||
@ -299,5 +299,5 @@ export default {
|
||||
PLACEMENT,
|
||||
addNote,
|
||||
setTitle,
|
||||
apply
|
||||
apply,
|
||||
};
|
||||
|
@ -16,65 +16,65 @@ export const bounds = {
|
||||
startx: undefined,
|
||||
stopx: undefined,
|
||||
starty: undefined,
|
||||
stopy: undefined
|
||||
stopy: undefined,
|
||||
},
|
||||
verticalPos: 0,
|
||||
sequenceItems: [],
|
||||
activations: [],
|
||||
models: {
|
||||
getHeight: function() {
|
||||
getHeight: function () {
|
||||
return (
|
||||
Math.max.apply(
|
||||
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
|
||||
? 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
|
||||
? 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
|
||||
? 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.loops = [];
|
||||
this.messages = [];
|
||||
this.notes = [];
|
||||
},
|
||||
addActor: function(actorModel) {
|
||||
addActor: function (actorModel) {
|
||||
this.actors.push(actorModel);
|
||||
},
|
||||
addLoop: function(loopModel) {
|
||||
addLoop: function (loopModel) {
|
||||
this.loops.push(loopModel);
|
||||
},
|
||||
addMessage: function(msgModel) {
|
||||
addMessage: function (msgModel) {
|
||||
this.messages.push(msgModel);
|
||||
},
|
||||
addNote: function(noteModel) {
|
||||
addNote: function (noteModel) {
|
||||
this.notes.push(noteModel);
|
||||
},
|
||||
lastActor: function() {
|
||||
lastActor: function () {
|
||||
return this.actors[this.actors.length - 1];
|
||||
},
|
||||
lastLoop: function() {
|
||||
lastLoop: function () {
|
||||
return this.loops[this.loops.length - 1];
|
||||
},
|
||||
lastMessage: function() {
|
||||
lastMessage: function () {
|
||||
return this.messages[this.messages.length - 1];
|
||||
},
|
||||
lastNote: function() {
|
||||
lastNote: function () {
|
||||
return this.notes[this.notes.length - 1];
|
||||
},
|
||||
actors: [],
|
||||
loops: [],
|
||||
messages: [],
|
||||
notes: []
|
||||
notes: [],
|
||||
},
|
||||
init: function() {
|
||||
init: function () {
|
||||
this.sequenceItems = [];
|
||||
this.activations = [];
|
||||
this.models.clear();
|
||||
@ -82,19 +82,19 @@ export const bounds = {
|
||||
startx: undefined,
|
||||
stopx: undefined,
|
||||
starty: undefined,
|
||||
stopy: undefined
|
||||
stopy: undefined,
|
||||
};
|
||||
this.verticalPos = 0;
|
||||
setConf(parser.yy.getConfig());
|
||||
},
|
||||
updateVal: function(obj, key, val, fun) {
|
||||
updateVal: function (obj, key, val, fun) {
|
||||
if (typeof obj[key] === 'undefined') {
|
||||
obj[key] = val;
|
||||
} else {
|
||||
obj[key] = fun(val, obj[key]);
|
||||
}
|
||||
},
|
||||
updateBounds: function(startx, starty, stopx, stopy) {
|
||||
updateBounds: function (startx, starty, stopx, stopy) {
|
||||
const _self = this;
|
||||
let cnt = 0;
|
||||
function updateFn(type) {
|
||||
@ -122,7 +122,7 @@ export const bounds = {
|
||||
this.sequenceItems.forEach(updateFn());
|
||||
this.activations.forEach(updateFn('activation'));
|
||||
},
|
||||
insert: function(startx, starty, stopx, stopy) {
|
||||
insert: function (startx, starty, stopx, stopy) {
|
||||
const _startx = Math.min(startx, stopx);
|
||||
const _stopx = Math.max(startx, stopx);
|
||||
const _starty = Math.min(starty, stopy);
|
||||
@ -135,7 +135,7 @@ export const bounds = {
|
||||
|
||||
this.updateBounds(_startx, _starty, _stopx, _stopy);
|
||||
},
|
||||
newActivation: function(message, diagram, actors) {
|
||||
newActivation: function (message, diagram, actors) {
|
||||
const actorRect = actors[message.from.actor];
|
||||
const stackedSize = actorActivations(message.from.actor).length || 0;
|
||||
const x = actorRect.x + actorRect.width / 2 + ((stackedSize - 1) * conf.activationWidth) / 2;
|
||||
@ -145,19 +145,19 @@ export const bounds = {
|
||||
stopx: x + conf.activationWidth,
|
||||
stopy: undefined,
|
||||
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
|
||||
const lastActorActivationIdx = this.activations
|
||||
.map(function(activation) {
|
||||
.map(function (activation) {
|
||||
return activation.actor;
|
||||
})
|
||||
.lastIndexOf(message.from.actor);
|
||||
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 {
|
||||
startx: undefined,
|
||||
starty: this.verticalPos,
|
||||
@ -167,16 +167,16 @@ export const bounds = {
|
||||
wrap: title.wrap,
|
||||
width: title.width,
|
||||
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));
|
||||
},
|
||||
endLoop: function() {
|
||||
endLoop: function () {
|
||||
return this.sequenceItems.pop();
|
||||
},
|
||||
addSectionToLoop: function(message) {
|
||||
addSectionToLoop: function (message) {
|
||||
const loop = this.sequenceItems.pop();
|
||||
loop.sections = loop.sections || [];
|
||||
loop.sectionTitles = loop.sectionTitles || [];
|
||||
@ -184,16 +184,16 @@ export const bounds = {
|
||||
loop.sectionTitles.push(message);
|
||||
this.sequenceItems.push(loop);
|
||||
},
|
||||
bumpVerticalPos: function(bump) {
|
||||
bumpVerticalPos: function (bump) {
|
||||
this.verticalPos = this.verticalPos + bump;
|
||||
this.data.stopy = this.verticalPos;
|
||||
},
|
||||
getVerticalPos: function() {
|
||||
getVerticalPos: function () {
|
||||
return this.verticalPos;
|
||||
},
|
||||
getBounds: function() {
|
||||
getBounds: function () {
|
||||
return { bounds: this.data, models: this.models };
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@ -201,7 +201,7 @@ export const bounds = {
|
||||
* @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.
|
||||
*/
|
||||
const drawNote = function(elem, noteModel) {
|
||||
const drawNote = function (elem, noteModel) {
|
||||
bounds.bumpVerticalPos(conf.boxMargin);
|
||||
noteModel.height = conf.boxMargin;
|
||||
noteModel.starty = bounds.getVerticalPos();
|
||||
@ -230,7 +230,9 @@ const drawNote = function(elem, noteModel) {
|
||||
let textElem = drawText(g, textObj);
|
||||
|
||||
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);
|
||||
@ -242,25 +244,25 @@ const drawNote = function(elem, noteModel) {
|
||||
bounds.models.addNote(noteModel);
|
||||
};
|
||||
|
||||
const messageFont = cnf => {
|
||||
const messageFont = (cnf) => {
|
||||
return {
|
||||
fontFamily: cnf.messageFontFamily,
|
||||
fontSize: cnf.messageFontSize,
|
||||
fontWeight: cnf.messageFontWeight
|
||||
fontWeight: cnf.messageFontWeight,
|
||||
};
|
||||
};
|
||||
const noteFont = cnf => {
|
||||
const noteFont = (cnf) => {
|
||||
return {
|
||||
fontFamily: cnf.noteFontFamily,
|
||||
fontSize: cnf.noteFontSize,
|
||||
fontWeight: cnf.noteFontWeight
|
||||
fontWeight: cnf.noteFontWeight,
|
||||
};
|
||||
};
|
||||
const actorFont = cnf => {
|
||||
const actorFont = (cnf) => {
|
||||
return {
|
||||
fontFamily: cnf.actorFontFamily,
|
||||
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 msgModel - the model containing fields describing a message
|
||||
*/
|
||||
const drawMessage = function(g, msgModel) {
|
||||
const drawMessage = function (g, msgModel) {
|
||||
bounds.bumpVerticalPos(10);
|
||||
const { startx, stopx, starty, message, type, sequenceIndex } = msgModel;
|
||||
const lines = common.splitBreaks(message).length;
|
||||
@ -307,8 +309,9 @@ const drawMessage = function(g, msgModel) {
|
||||
.append('path')
|
||||
.attr(
|
||||
'd',
|
||||
`M ${startx},${lineStarty} H ${startx +
|
||||
Math.max(conf.width / 2, textWidth / 2)} V ${lineStarty + 25} H ${startx}`
|
||||
`M ${startx},${lineStarty} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${
|
||||
lineStarty + 25
|
||||
} H ${startx}`
|
||||
);
|
||||
} else {
|
||||
totalOffset += conf.boxMargin;
|
||||
@ -414,7 +417,7 @@ const drawMessage = function(g, msgModel) {
|
||||
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
|
||||
let prevWidth = 0;
|
||||
let prevMargin = 0;
|
||||
@ -443,7 +446,7 @@ export const drawActors = function(diagram, actors, actorKeys, verticalPos) {
|
||||
bounds.bumpVerticalPos(conf.height);
|
||||
};
|
||||
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
assignWithDepth(conf, cnf);
|
||||
|
||||
if (cnf.fontFamily) {
|
||||
@ -457,21 +460,21 @@ export const setConf = function(cnf) {
|
||||
}
|
||||
};
|
||||
|
||||
const actorActivations = function(actor) {
|
||||
return bounds.activations.filter(function(activation) {
|
||||
const actorActivations = function (actor) {
|
||||
return bounds.activations.filter(function (activation) {
|
||||
return activation.actor === actor;
|
||||
});
|
||||
};
|
||||
|
||||
const activationBounds = function(actor, actors) {
|
||||
const activationBounds = function (actor, actors) {
|
||||
// handle multiple stacked activations for same actor
|
||||
const actorObj = actors[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);
|
||||
}, 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);
|
||||
}, actorObj.x + actorObj.width / 2);
|
||||
return [left, right];
|
||||
@ -502,7 +505,7 @@ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoop
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
conf = configApi.getConfig().sequence;
|
||||
parser.yy.clear();
|
||||
parser.yy.setWrap(conf.wrap);
|
||||
@ -549,7 +552,7 @@ export const draw = function(text, id) {
|
||||
|
||||
// Draw the messages/signals
|
||||
let sequenceIndex = 1;
|
||||
messages.forEach(function(msg) {
|
||||
messages.forEach(function (msg) {
|
||||
let loopModel, noteModel, msgModel;
|
||||
|
||||
switch (msg.type) {
|
||||
@ -569,7 +572,7 @@ export const draw = function(text, id) {
|
||||
msg,
|
||||
conf.boxMargin,
|
||||
conf.boxMargin + conf.boxTextMargin,
|
||||
message => bounds.newLoop(message)
|
||||
(message) => bounds.newLoop(message)
|
||||
);
|
||||
break;
|
||||
case parser.yy.LINETYPE.LOOP_END:
|
||||
@ -579,7 +582,7 @@ export const draw = function(text, id) {
|
||||
bounds.models.addLoop(loopModel);
|
||||
break;
|
||||
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)
|
||||
);
|
||||
break;
|
||||
@ -595,7 +598,7 @@ export const draw = function(text, id) {
|
||||
msg,
|
||||
conf.boxMargin,
|
||||
conf.boxMargin + conf.boxTextMargin,
|
||||
message => bounds.newLoop(message)
|
||||
(message) => bounds.newLoop(message)
|
||||
);
|
||||
break;
|
||||
case parser.yy.LINETYPE.OPT_END:
|
||||
@ -610,7 +613,7 @@ export const draw = function(text, id) {
|
||||
msg,
|
||||
conf.boxMargin,
|
||||
conf.boxMargin + conf.boxTextMargin,
|
||||
message => bounds.newLoop(message)
|
||||
(message) => bounds.newLoop(message)
|
||||
);
|
||||
break;
|
||||
case parser.yy.LINETYPE.ALT_ELSE:
|
||||
@ -619,7 +622,7 @@ export const draw = function(text, id) {
|
||||
msg,
|
||||
conf.boxMargin + conf.boxTextMargin,
|
||||
conf.boxMargin,
|
||||
message => bounds.addSectionToLoop(message)
|
||||
(message) => bounds.addSectionToLoop(message)
|
||||
);
|
||||
break;
|
||||
case parser.yy.LINETYPE.ALT_END:
|
||||
@ -634,7 +637,7 @@ export const draw = function(text, id) {
|
||||
msg,
|
||||
conf.boxMargin,
|
||||
conf.boxMargin + conf.boxTextMargin,
|
||||
message => bounds.newLoop(message)
|
||||
(message) => bounds.newLoop(message)
|
||||
);
|
||||
break;
|
||||
case parser.yy.LINETYPE.PAR_AND:
|
||||
@ -643,7 +646,7 @@ export const draw = function(text, id) {
|
||||
msg,
|
||||
conf.boxMargin + conf.boxTextMargin,
|
||||
conf.boxMargin,
|
||||
message => bounds.addSectionToLoop(message)
|
||||
(message) => bounds.addSectionToLoop(message)
|
||||
);
|
||||
break;
|
||||
case parser.yy.LINETYPE.PAR_END:
|
||||
@ -674,7 +677,7 @@ export const draw = function(text, id) {
|
||||
parser.yy.LINETYPE.SOLID_CROSS,
|
||||
parser.yy.LINETYPE.DOTTED_CROSS,
|
||||
parser.yy.LINETYPE.SOLID_POINT,
|
||||
parser.yy.LINETYPE.DOTTED_POINT
|
||||
parser.yy.LINETYPE.DOTTED_POINT,
|
||||
].includes(msg.type)
|
||||
) {
|
||||
sequenceIndex++;
|
||||
@ -736,10 +739,10 @@ export const draw = function(text, id) {
|
||||
* @param actors - The actors map
|
||||
* @param messages - A list of message objects to iterate
|
||||
*/
|
||||
const getMaxMessageWidthPerActor = function(actors, messages) {
|
||||
const getMaxMessageWidthPerActor = function (actors, messages) {
|
||||
const maxMessageWidthPerActor = {};
|
||||
|
||||
messages.forEach(function(msg) {
|
||||
messages.forEach(function (msg) {
|
||||
if (actors[msg.to] && actors[msg.from]) {
|
||||
const actor = actors[msg.to];
|
||||
|
||||
@ -841,9 +844,9 @@ const getMaxMessageWidthPerActor = function(actors, messages) {
|
||||
* @param actors - The actors map to calculate margins for
|
||||
* @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;
|
||||
Object.keys(actors).forEach(prop => {
|
||||
Object.keys(actors).forEach((prop) => {
|
||||
const actor = actors[prop];
|
||||
if (actor.wrap) {
|
||||
actor.description = utils.wrapLabel(
|
||||
@ -884,7 +887,7 @@ const calculateActorMargins = function(actors, actorToMessageWidth) {
|
||||
return Math.max(maxHeight, conf.height);
|
||||
};
|
||||
|
||||
const buildNoteModel = function(msg, actors) {
|
||||
const buildNoteModel = function (msg, actors) {
|
||||
let startx = actors[msg.from].x;
|
||||
let stopx = actors[msg.to].x;
|
||||
let shouldWrap = msg.wrap && msg.message;
|
||||
@ -902,7 +905,7 @@ const buildNoteModel = function(msg, actors) {
|
||||
stopx: 0,
|
||||
starty: 0,
|
||||
stopy: 0,
|
||||
message: msg.message
|
||||
message: msg.message,
|
||||
};
|
||||
if (msg.placement === parser.yy.PLACEMENT.RIGHTOF) {
|
||||
noteModel.width = shouldWrap
|
||||
@ -953,7 +956,7 @@ const buildNoteModel = function(msg, actors) {
|
||||
return noteModel;
|
||||
};
|
||||
|
||||
const buildMessageModel = function(msg, actors) {
|
||||
const buildMessageModel = function (msg, actors) {
|
||||
let process = false;
|
||||
if (
|
||||
[
|
||||
@ -964,7 +967,7 @@ const buildMessageModel = function(msg, actors) {
|
||||
parser.yy.LINETYPE.SOLID_CROSS,
|
||||
parser.yy.LINETYPE.DOTTED_CROSS,
|
||||
parser.yy.LINETYPE.SOLID_POINT,
|
||||
parser.yy.LINETYPE.DOTTED_POINT
|
||||
parser.yy.LINETYPE.DOTTED_POINT,
|
||||
].includes(msg.type)
|
||||
) {
|
||||
process = true;
|
||||
@ -1002,16 +1005,16 @@ const buildMessageModel = function(msg, actors) {
|
||||
type: msg.type,
|
||||
wrap: msg.wrap,
|
||||
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 stack = [];
|
||||
let current, noteModel, msgModel;
|
||||
|
||||
messages.forEach(function(msg) {
|
||||
messages.forEach(function (msg) {
|
||||
msg.id = utils.random({ length: 10 });
|
||||
switch (msg.type) {
|
||||
case parser.yy.LINETYPE.LOOP_START:
|
||||
@ -1023,7 +1026,7 @@ const calculateLoopBounds = function(messages, actors) {
|
||||
msg: msg.message,
|
||||
from: Number.MAX_SAFE_INTEGER,
|
||||
to: Number.MIN_SAFE_INTEGER,
|
||||
width: 0
|
||||
width: 0,
|
||||
});
|
||||
break;
|
||||
case parser.yy.LINETYPE.ALT_ELSE:
|
||||
@ -1052,7 +1055,7 @@ const calculateLoopBounds = function(messages, actors) {
|
||||
startx: x,
|
||||
stopx: x + conf.activationWidth,
|
||||
actor: msg.from.actor,
|
||||
enabled: true
|
||||
enabled: true,
|
||||
};
|
||||
bounds.activations.push(toAdd);
|
||||
}
|
||||
@ -1060,7 +1063,7 @@ const calculateLoopBounds = function(messages, actors) {
|
||||
case parser.yy.LINETYPE.ACTIVE_END:
|
||||
{
|
||||
const lastActorActivationIdx = bounds.activations
|
||||
.map(a => a.actor)
|
||||
.map((a) => a.actor)
|
||||
.lastIndexOf(msg.from.actor);
|
||||
delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
|
||||
}
|
||||
@ -1070,7 +1073,7 @@ const calculateLoopBounds = function(messages, actors) {
|
||||
if (isNote) {
|
||||
noteModel = buildNoteModel(msg, actors);
|
||||
msg.noteModel = noteModel;
|
||||
stack.forEach(stk => {
|
||||
stack.forEach((stk) => {
|
||||
current = stk;
|
||||
current.from = Math.min(current.from, noteModel.startx);
|
||||
current.to = Math.max(current.to, noteModel.startx + noteModel.width);
|
||||
@ -1081,7 +1084,7 @@ const calculateLoopBounds = function(messages, actors) {
|
||||
msgModel = buildMessageModel(msg, actors);
|
||||
msg.msgModel = msgModel;
|
||||
if (msgModel.startx && msgModel.stopx && stack.length > 0) {
|
||||
stack.forEach(stk => {
|
||||
stack.forEach((stk) => {
|
||||
current = stk;
|
||||
if (msgModel.startx === msgModel.stopx) {
|
||||
let from = actors[msg.from];
|
||||
@ -1112,5 +1115,5 @@ export default {
|
||||
bounds,
|
||||
drawActors,
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`.actor {
|
||||
stroke: ${options.actorBorder};
|
||||
fill: ${options.actorBkg};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import common from '../common/common';
|
||||
|
||||
export const drawRect = function(elem, rectData) {
|
||||
export const drawRect = function (elem, rectData) {
|
||||
const rectElem = elem.append('rect');
|
||||
rectElem.attr('x', rectData.x);
|
||||
rectElem.attr('y', rectData.y);
|
||||
@ -18,7 +18,7 @@ export const drawRect = function(elem, rectData) {
|
||||
return rectElem;
|
||||
};
|
||||
|
||||
export const drawText = function(elem, textData) {
|
||||
export const drawText = function (elem, textData) {
|
||||
let prevTextHeight = 0,
|
||||
textHeight = 0;
|
||||
const lines = textData.text.split(common.lineBreakRegex);
|
||||
@ -146,7 +146,7 @@ export const drawText = function(elem, textData) {
|
||||
return textElems;
|
||||
};
|
||||
|
||||
export const drawLabel = function(elem, txtObject) {
|
||||
export const drawLabel = function (elem, txtObject) {
|
||||
function genPoints(x, y, width, height, cut) {
|
||||
return (
|
||||
x +
|
||||
@ -187,7 +187,7 @@ let actorCnt = -1;
|
||||
* @param actor - The actor to draw.
|
||||
* @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 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');
|
||||
};
|
||||
/**
|
||||
@ -238,7 +238,7 @@ export const anchorElement = function(elem) {
|
||||
* @param conf - sequence diagram config object.
|
||||
* @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 g = bounds.anchored;
|
||||
rect.x = bounds.startx;
|
||||
@ -256,7 +256,7 @@ export const drawActivation = function(elem, bounds, verticalPos, conf, actorAct
|
||||
* @param labelText - Text within the loop.
|
||||
* @param conf - diagrom configuration
|
||||
*/
|
||||
export const drawLoop = function(elem, loopModel, labelText, conf) {
|
||||
export const drawLoop = function (elem, loopModel, labelText, conf) {
|
||||
const {
|
||||
boxMargin,
|
||||
boxTextMargin,
|
||||
@ -264,10 +264,10 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
|
||||
labelBoxWidth,
|
||||
messageFontFamily: fontFamily,
|
||||
messageFontSize: fontSize,
|
||||
messageFontWeight: fontWeight
|
||||
messageFontWeight: fontWeight,
|
||||
} = conf;
|
||||
const g = elem.append('g');
|
||||
const drawLoopLine = function(startx, starty, stopx, stopy) {
|
||||
const drawLoopLine = function (startx, starty, stopx, stopy) {
|
||||
return g
|
||||
.append('line')
|
||||
.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.starty, loopModel.startx, loopModel.stopy);
|
||||
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(
|
||||
'stroke-dasharray',
|
||||
'3, 3'
|
||||
@ -321,7 +321,7 @@ export const drawLoop = function(elem, loopModel, labelText, conf) {
|
||||
let textElem = drawText(g, txt);
|
||||
|
||||
if (typeof loopModel.sectionTitles !== 'undefined') {
|
||||
loopModel.sectionTitles.forEach(function(item, idx) {
|
||||
loopModel.sectionTitles.forEach(function (item, idx) {
|
||||
if (item.message) {
|
||||
txt.text = item.message;
|
||||
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);
|
||||
let sectionHeight = Math.round(
|
||||
textElem
|
||||
.map(te => (te._groups || te)[0][0].getBBox().height)
|
||||
.map((te) => (te._groups || te)[0][0].getBBox().height)
|
||||
.reduce((acc, curr) => acc + curr)
|
||||
);
|
||||
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 bounds shape of the rectangle
|
||||
*/
|
||||
export const drawBackgroundRect = function(elem, bounds) {
|
||||
export const drawBackgroundRect = function (elem, bounds) {
|
||||
const rectElem = drawRect(elem, {
|
||||
x: bounds.startx,
|
||||
y: bounds.starty,
|
||||
width: bounds.stopx - bounds.startx,
|
||||
height: bounds.stopy - bounds.starty,
|
||||
fill: bounds.fill,
|
||||
class: 'rect'
|
||||
class: 'rect',
|
||||
});
|
||||
rectElem.lower();
|
||||
};
|
||||
/**
|
||||
* 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
|
||||
.append('defs')
|
||||
.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.
|
||||
*/
|
||||
export const insertArrowFilledHead = function(elem) {
|
||||
export const insertArrowFilledHead = function (elem) {
|
||||
elem
|
||||
.append('defs')
|
||||
.append('marker')
|
||||
@ -401,7 +401,7 @@ export const insertArrowFilledHead = function(elem) {
|
||||
/**
|
||||
* Setup node number. The result is appended to the svg.
|
||||
*/
|
||||
export const insertSequenceNumber = function(elem) {
|
||||
export const insertSequenceNumber = function (elem) {
|
||||
elem
|
||||
.append('defs')
|
||||
.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.
|
||||
*/
|
||||
export const insertArrowCrossHead = function(elem) {
|
||||
export const insertArrowCrossHead = function (elem) {
|
||||
const defs = elem.append('defs');
|
||||
const marker = defs
|
||||
.append('marker')
|
||||
@ -451,7 +451,7 @@ export const insertArrowCrossHead = function(elem) {
|
||||
// this is actual shape for arrowhead
|
||||
};
|
||||
|
||||
export const getTextObj = function() {
|
||||
export const getTextObj = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
@ -464,11 +464,11 @@ export const getTextObj = function() {
|
||||
rx: 0,
|
||||
ry: 0,
|
||||
tspan: true,
|
||||
valign: undefined
|
||||
valign: undefined,
|
||||
};
|
||||
};
|
||||
|
||||
export const getNoteRect = function() {
|
||||
export const getNoteRect = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
@ -478,11 +478,11 @@ export const getNoteRect = function() {
|
||||
anchor: 'start',
|
||||
height: 100,
|
||||
rx: 0,
|
||||
ry: 0
|
||||
ry: 0,
|
||||
};
|
||||
};
|
||||
|
||||
const _drawTextCandidateFunc = (function() {
|
||||
const _drawTextCandidateFunc = (function () {
|
||||
function byText(content, g, x, y, width, height, textAttrs) {
|
||||
const text = g
|
||||
.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;
|
||||
};
|
||||
})();
|
||||
@ -575,5 +575,5 @@ export default {
|
||||
insertSequenceNumber,
|
||||
insertArrowCrossHead,
|
||||
getTextObj,
|
||||
getNoteRect
|
||||
getNoteRect,
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ export const set = (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 size = () => keys().length;
|
||||
|
||||
@ -12,5 +12,5 @@ export default {
|
||||
get,
|
||||
set,
|
||||
keys,
|
||||
size
|
||||
size,
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ import { log } from '../../logger';
|
||||
/**
|
||||
* Draws a start state as a black circle
|
||||
*/
|
||||
export const drawStartState = g =>
|
||||
export const drawStartState = (g) =>
|
||||
g
|
||||
.append('circle')
|
||||
// .style('stroke', 'black')
|
||||
@ -24,7 +24,7 @@ export const drawStartState = g =>
|
||||
/**
|
||||
* Draws a start state as a black circle
|
||||
*/
|
||||
export const drawDivider = g =>
|
||||
export const drawDivider = (g) =>
|
||||
g
|
||||
.append('line')
|
||||
.style('stroke', 'grey')
|
||||
@ -64,7 +64,7 @@ export const drawSimpleState = (g, stateDef) => {
|
||||
* @param {*} stateDef
|
||||
*/
|
||||
export const drawDescrState = (g, stateDef) => {
|
||||
const addTspan = function(textEl, txt, isFirst) {
|
||||
const addTspan = function (textEl, txt, isFirst) {
|
||||
const tSpan = textEl
|
||||
.append('tspan')
|
||||
.attr('x', 2 * getConfig().state.padding)
|
||||
@ -98,7 +98,7 @@ export const drawDescrState = (g, stateDef) => {
|
||||
|
||||
let isFirst = true;
|
||||
let isSecond = true;
|
||||
stateDef.descriptions.forEach(function(descr) {
|
||||
stateDef.descriptions.forEach(function (descr) {
|
||||
if (!isFirst) {
|
||||
addTspan(description, descr, isSecond);
|
||||
isSecond = false;
|
||||
@ -239,7 +239,7 @@ export const addTitleAndBox = (g, stateDef, altBkg) => {
|
||||
return g;
|
||||
};
|
||||
|
||||
const drawEndState = g => {
|
||||
const drawEndState = (g) => {
|
||||
g.append('circle')
|
||||
// .style('stroke', 'black')
|
||||
// .style('fill', 'white')
|
||||
@ -284,7 +284,7 @@ const drawForkJoinState = (g, stateDef) => {
|
||||
.attr('y', getConfig().state.padding);
|
||||
};
|
||||
|
||||
export const drawText = function(elem, textData) {
|
||||
export const drawText = function (elem, textData) {
|
||||
// Remove and ignore br:s
|
||||
const nText = textData.text.replace(common.lineBreakRegex, ' ');
|
||||
|
||||
@ -343,10 +343,7 @@ const _drawLongText = (_text, x, y, g) => {
|
||||
|
||||
export const drawNote = (text, g) => {
|
||||
g.attr('class', 'state-note');
|
||||
const note = g
|
||||
.append('rect')
|
||||
.attr('x', 0)
|
||||
.attr('y', getConfig().state.padding);
|
||||
const note = g.append('rect').attr('x', 0).attr('y', getConfig().state.padding);
|
||||
const rectElem = g.append('g');
|
||||
|
||||
const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
|
||||
@ -363,19 +360,16 @@ export const drawNote = (text, g) => {
|
||||
* @param {*} stateDef
|
||||
*/
|
||||
|
||||
export const drawState = function(elem, stateDef) {
|
||||
export const drawState = function (elem, stateDef) {
|
||||
const id = stateDef.id;
|
||||
const stateInfo = {
|
||||
id: id,
|
||||
label: stateDef.id,
|
||||
width: 0,
|
||||
height: 0
|
||||
height: 0,
|
||||
};
|
||||
|
||||
const g = elem
|
||||
.append('g')
|
||||
.attr('id', id)
|
||||
.attr('class', 'stateGroup');
|
||||
const g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
|
||||
|
||||
if (stateDef.type === 'start') drawStartState(g);
|
||||
if (stateDef.type === 'end') drawEndState(g);
|
||||
@ -396,8 +390,8 @@ export const drawState = function(elem, stateDef) {
|
||||
};
|
||||
|
||||
let edgeCount = 0;
|
||||
export const drawEdge = function(elem, path, relation) {
|
||||
const getRelationType = function(type) {
|
||||
export const drawEdge = function (elem, path, relation) {
|
||||
const getRelationType = function (type) {
|
||||
switch (type) {
|
||||
case stateDb.relationType.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
|
||||
const lineData = path.points;
|
||||
|
||||
// This is the accessor function we talked about above
|
||||
const lineFunction = line()
|
||||
.x(function(d) {
|
||||
.x(function (d) {
|
||||
return d.x;
|
||||
})
|
||||
.y(function(d) {
|
||||
.y(function (d) {
|
||||
return d.y;
|
||||
})
|
||||
.curve(curveBasis);
|
||||
|
@ -3,15 +3,15 @@ import { generateId } from '../../utils';
|
||||
import mermaidAPI from '../../mermaidAPI';
|
||||
import * as configApi from '../../config';
|
||||
|
||||
const clone = o => JSON.parse(JSON.stringify(o));
|
||||
const clone = (o) => JSON.parse(JSON.stringify(o));
|
||||
|
||||
let rootDoc = [];
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (statement, context, type) {
|
||||
mermaidAPI.parseDirective(this, statement, context, type);
|
||||
};
|
||||
|
||||
const setRootDoc = o => {
|
||||
const setRootDoc = (o) => {
|
||||
log.info('Setting root doc', o);
|
||||
// rootDoc = { id: 'root', doc: o };
|
||||
rootDoc = o;
|
||||
@ -54,13 +54,13 @@ const docTranslator = (parent, node, first) => {
|
||||
stmt: 'state',
|
||||
id: generateId(),
|
||||
type: 'divider',
|
||||
doc: clone(currentDoc)
|
||||
doc: clone(currentDoc),
|
||||
};
|
||||
doc.push(clone(newNode));
|
||||
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
|
||||
};
|
||||
|
||||
const extract = _doc => {
|
||||
const extract = (_doc) => {
|
||||
// const res = { states: [], relations: [] };
|
||||
let doc;
|
||||
if (_doc.doc) {
|
||||
@ -87,7 +87,7 @@ const extract = _doc => {
|
||||
|
||||
log.info('Extract', doc);
|
||||
|
||||
doc.forEach(item => {
|
||||
doc.forEach((item) => {
|
||||
if (item.stmt === 'state') {
|
||||
addState(item.id, item.type, item.doc, item.description, item.note);
|
||||
}
|
||||
@ -101,12 +101,12 @@ const newDoc = () => {
|
||||
return {
|
||||
relations: [],
|
||||
states: {},
|
||||
documents: {}
|
||||
documents: {},
|
||||
};
|
||||
};
|
||||
|
||||
let documents = {
|
||||
root: newDoc()
|
||||
root: newDoc(),
|
||||
};
|
||||
|
||||
let currentDocument = documents.root;
|
||||
@ -122,14 +122,14 @@ let endCnt = 0; // eslint-disable-line
|
||||
* @param type
|
||||
* @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') {
|
||||
currentDocument.states[id] = {
|
||||
id: id,
|
||||
descriptions: [],
|
||||
type,
|
||||
doc,
|
||||
note
|
||||
note,
|
||||
};
|
||||
} else {
|
||||
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 === 'object') {
|
||||
descr.forEach(des => addDescription(id, des.trim()));
|
||||
descr.forEach((des) => addDescription(id, des.trim()));
|
||||
}
|
||||
}
|
||||
|
||||
if (note) currentDocument.states[id].note = note;
|
||||
};
|
||||
|
||||
export const clear = function() {
|
||||
export const clear = function () {
|
||||
documents = {
|
||||
root: newDoc()
|
||||
root: newDoc(),
|
||||
};
|
||||
currentDocument = documents.root;
|
||||
|
||||
@ -164,21 +164,21 @@ export const clear = function() {
|
||||
classes = [];
|
||||
};
|
||||
|
||||
export const getState = function(id) {
|
||||
export const getState = function (id) {
|
||||
return currentDocument.states[id];
|
||||
};
|
||||
|
||||
export const getStates = function() {
|
||||
export const getStates = function () {
|
||||
return currentDocument.states;
|
||||
};
|
||||
export const logDocuments = function() {
|
||||
export const logDocuments = function () {
|
||||
log.info('Documents = ', documents);
|
||||
};
|
||||
export const getRelations = function() {
|
||||
export const getRelations = function () {
|
||||
return currentDocument.relations;
|
||||
};
|
||||
|
||||
export const addRelation = function(_id1, _id2, title) {
|
||||
export const addRelation = function (_id1, _id2, title) {
|
||||
let id1 = _id1;
|
||||
let id2 = _id2;
|
||||
let type1 = 'default';
|
||||
@ -198,7 +198,7 @@ export const addRelation = function(_id1, _id2, title) {
|
||||
currentDocument.relations.push({ id1, id2, title: title });
|
||||
};
|
||||
|
||||
const addDescription = function(id, _descr) {
|
||||
const addDescription = function (id, _descr) {
|
||||
const theState = currentDocument.states[id];
|
||||
let descr = _descr;
|
||||
if (descr[0] === ':') {
|
||||
@ -208,7 +208,7 @@ const addDescription = function(id, _descr) {
|
||||
theState.descriptions.push(descr);
|
||||
};
|
||||
|
||||
export const cleanupLabel = function(label) {
|
||||
export const cleanupLabel = function (label) {
|
||||
if (label.substring(0, 1) === ':') {
|
||||
return label.substr(2).trim();
|
||||
} else {
|
||||
@ -218,7 +218,7 @@ export const cleanupLabel = function(label) {
|
||||
|
||||
export const lineType = {
|
||||
LINE: 0,
|
||||
DOTTED_LINE: 1
|
||||
DOTTED_LINE: 1,
|
||||
};
|
||||
|
||||
let dividerCnt = 0;
|
||||
@ -233,7 +233,7 @@ const getClasses = () => classes;
|
||||
|
||||
let direction = 'TB';
|
||||
const getDirection = () => direction;
|
||||
const setDirection = dir => {
|
||||
const setDirection = (dir) => {
|
||||
direction = dir;
|
||||
};
|
||||
|
||||
@ -241,10 +241,10 @@ export const relationType = {
|
||||
AGGREGATION: 0,
|
||||
EXTENSION: 1,
|
||||
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 {
|
||||
parseDirective,
|
||||
@ -268,5 +268,5 @@ export default {
|
||||
setRootDoc,
|
||||
getRootDocV2,
|
||||
extract,
|
||||
trimColon
|
||||
trimColon,
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ import { log } from '../../logger';
|
||||
import { configureSvgSize } from '../../utils';
|
||||
|
||||
const conf = {};
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; 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 {object} classDef styles
|
||||
*/
|
||||
export const getClasses = function(text) {
|
||||
export const getClasses = function (text) {
|
||||
log.trace('Extracting classes');
|
||||
stateDb.clear();
|
||||
const parser = state.parser;
|
||||
@ -52,7 +52,7 @@ const setupNode = (g, parent, node, altFlag) => {
|
||||
id: node.id,
|
||||
shape,
|
||||
description: node.id,
|
||||
classes: 'statediagram-state'
|
||||
classes: 'statediagram-state',
|
||||
};
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ const setupNode = (g, parent, node, altFlag) => {
|
||||
dir: nodeDb[node.id].dir,
|
||||
domId: 'state-' + node.id + '-' + cnt,
|
||||
type: nodeDb[node.id].type,
|
||||
padding: 15 //getConfig().flowchart.padding
|
||||
padding: 15, //getConfig().flowchart.padding
|
||||
};
|
||||
|
||||
if (node.note) {
|
||||
@ -121,7 +121,7 @@ const setupNode = (g, parent, node, altFlag) => {
|
||||
id: node.id + '----note-' + cnt,
|
||||
domId: 'state-' + node.id + '----note-' + cnt,
|
||||
type: nodeDb[node.id].type,
|
||||
padding: 15 //getConfig().flowchart.padding
|
||||
padding: 15, //getConfig().flowchart.padding
|
||||
};
|
||||
const groupData = {
|
||||
labelStyle: '',
|
||||
@ -132,7 +132,7 @@ const setupNode = (g, parent, node, altFlag) => {
|
||||
id: node.id + '----parent',
|
||||
domId: 'state-' + node.id + '----parent-' + cnt,
|
||||
type: 'group',
|
||||
padding: 0 //getConfig().flowchart.padding
|
||||
padding: 0, //getConfig().flowchart.padding
|
||||
};
|
||||
cnt++;
|
||||
|
||||
@ -160,7 +160,7 @@ const setupNode = (g, parent, node, altFlag) => {
|
||||
arrowheadStyle: 'fill: #333',
|
||||
labelpos: 'c',
|
||||
labelType: 'text',
|
||||
thickness: 'normal'
|
||||
thickness: 'normal',
|
||||
});
|
||||
} else {
|
||||
g.setNode(node.id, nodeData);
|
||||
@ -182,7 +182,7 @@ let cnt = 0;
|
||||
const setupDoc = (g, parent, doc, altFlag) => {
|
||||
// cnt = 0;
|
||||
log.trace('items', doc);
|
||||
doc.forEach(item => {
|
||||
doc.forEach((item) => {
|
||||
if (item.stmt === 'state' || item.stmt === 'default') {
|
||||
setupNode(g, parent, item, altFlag);
|
||||
} else if (item.stmt === 'relation') {
|
||||
@ -199,7 +199,7 @@ const setupDoc = (g, parent, doc, altFlag) => {
|
||||
labelpos: 'c',
|
||||
labelType: 'text',
|
||||
thickness: 'normal',
|
||||
classes: 'transition'
|
||||
classes: 'transition',
|
||||
};
|
||||
let startId = item.state1.id;
|
||||
let endId = item.state2.id;
|
||||
@ -226,7 +226,7 @@ const getDir = (nodes, defaultDir) => {
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
log.info('Drawing state diagram (v2)', id);
|
||||
stateDb.clear();
|
||||
nodeDb = {};
|
||||
@ -253,16 +253,16 @@ export const draw = function(text, id) {
|
||||
// Create the input mermaid.graph
|
||||
const g = new graphlib.Graph({
|
||||
multigraph: true,
|
||||
compound: true
|
||||
compound: true,
|
||||
})
|
||||
.setGraph({
|
||||
rankdir: getDir(stateDb.getRootDocV2()),
|
||||
nodesep: nodeSpacing,
|
||||
ranksep: rankSpacing,
|
||||
marginx: 8,
|
||||
marginy: 8
|
||||
marginy: 8,
|
||||
})
|
||||
.setDefaultEdgeLabel(function() {
|
||||
.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -317,5 +317,5 @@ export const draw = function(text, id) {
|
||||
export default {
|
||||
setConf,
|
||||
getClasses,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -17,14 +17,14 @@ let conf;
|
||||
|
||||
const transformationLog = {};
|
||||
|
||||
export const setConf = function() {};
|
||||
export const setConf = function () {};
|
||||
|
||||
// Todo optimize
|
||||
|
||||
/**
|
||||
* Setup arrow head and define the marker. The result is appended to the svg.
|
||||
*/
|
||||
const insertMarkers = function(elem) {
|
||||
const insertMarkers = function (elem) {
|
||||
elem
|
||||
.append('defs')
|
||||
.append('marker')
|
||||
@ -43,7 +43,7 @@ const insertMarkers = function(elem) {
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
conf = getConfig().state;
|
||||
parser.yy.clear();
|
||||
parser.parse(text);
|
||||
@ -58,12 +58,12 @@ export const draw = function(text, id) {
|
||||
multigraph: true,
|
||||
compound: true,
|
||||
// acyclicer: 'greedy',
|
||||
rankdir: 'RL'
|
||||
rankdir: 'RL',
|
||||
// ranksep: '20'
|
||||
});
|
||||
|
||||
// Default to assigning a new object as a label for each new edge.
|
||||
graph.setDefaultEdgeLabel(function() {
|
||||
graph.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -85,7 +85,7 @@ export const draw = function(text, id) {
|
||||
`${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + ' ' + height
|
||||
);
|
||||
};
|
||||
const getLabelWidth = text => {
|
||||
const getLabelWidth = (text) => {
|
||||
return text ? text.length * conf.fontSizeFactor : 1;
|
||||
};
|
||||
|
||||
@ -93,7 +93,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
// // Layout graph, Create a new directed graph
|
||||
const graph = new graphlib.Graph({
|
||||
compound: true,
|
||||
multigraph: true
|
||||
multigraph: true,
|
||||
});
|
||||
|
||||
let i;
|
||||
@ -115,7 +115,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
ranker: 'tight-tree',
|
||||
ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
|
||||
nodeSep: edgeFreeDoc ? 1 : 50,
|
||||
isMultiGraph: true
|
||||
isMultiGraph: true,
|
||||
// ranksep: 5,
|
||||
// nodesep: 1
|
||||
});
|
||||
@ -131,12 +131,12 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
nodeSep: edgeFreeDoc ? 1 : 50,
|
||||
ranker: 'tight-tree',
|
||||
// ranker: 'network-simplex'
|
||||
isMultiGraph: true
|
||||
isMultiGraph: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Default to assigning a new object as a label for each new edge.
|
||||
graph.setDefaultEdgeLabel(function() {
|
||||
graph.setDefaultEdgeLabel(function () {
|
||||
return {};
|
||||
});
|
||||
|
||||
@ -157,10 +157,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
|
||||
let node;
|
||||
if (stateDef.doc) {
|
||||
let sub = diagram
|
||||
.append('g')
|
||||
.attr('id', stateDef.id)
|
||||
.attr('class', 'stateGroup');
|
||||
let sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
|
||||
node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg);
|
||||
|
||||
if (first) {
|
||||
@ -187,7 +184,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
descriptions: [],
|
||||
id: stateDef.id + '-note',
|
||||
note: stateDef.note,
|
||||
type: 'note'
|
||||
type: 'note',
|
||||
};
|
||||
const note = drawState(diagram, noteDef, graph);
|
||||
|
||||
@ -212,7 +209,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
|
||||
log.debug('Count=', graph.nodeCount(), graph);
|
||||
let cnt = 0;
|
||||
relations.forEach(function(relation) {
|
||||
relations.forEach(function (relation) {
|
||||
cnt++;
|
||||
log.debug('Setting edge', relation);
|
||||
graph.setEdge(
|
||||
@ -222,7 +219,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
relation: relation,
|
||||
width: getLabelWidth(relation.title),
|
||||
height: conf.labelHeight * common.getRows(relation.title).length,
|
||||
labelpos: 'c'
|
||||
labelpos: 'c',
|
||||
},
|
||||
'id' + cnt
|
||||
);
|
||||
@ -233,7 +230,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
log.debug('Graph after layout', graph.nodes());
|
||||
const svgElem = diagram.node();
|
||||
|
||||
graph.nodes().forEach(function(v) {
|
||||
graph.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
||||
log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
|
||||
select('#' + svgElem.id + ' #' + v).attr(
|
||||
@ -251,7 +248,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
graph.node(v).x - graph.node(v).width / 2
|
||||
);
|
||||
const dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
|
||||
dividers.forEach(divider => {
|
||||
dividers.forEach((divider) => {
|
||||
const parent = divider.parentElement;
|
||||
let pWidth = 0;
|
||||
let pShift = 0;
|
||||
@ -272,7 +269,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
|
||||
let stateBox = svgElem.getBBox();
|
||||
|
||||
graph.edges().forEach(function(e) {
|
||||
graph.edges().forEach(function (e) {
|
||||
if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
|
||||
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
|
||||
drawEdge(diagram, graph.edge(e), graph.edge(e).relation);
|
||||
@ -285,7 +282,7 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
id: parentId ? parentId : 'root',
|
||||
label: parentId ? parentId : 'root',
|
||||
width: 0,
|
||||
height: 0
|
||||
height: 0,
|
||||
};
|
||||
|
||||
stateInfo.width = stateBox.width + 2 * conf.padding;
|
||||
@ -297,5 +294,5 @@ const renderDoc = (doc, diagram, parentId, altBkg) => {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`
|
||||
defs #statediagram-barbEnd {
|
||||
fill: ${options.transitionColor};
|
||||
|
@ -8,11 +8,11 @@ const sections = [];
|
||||
const tasks = [];
|
||||
const rawTasks = [];
|
||||
|
||||
export const parseDirective = function(statement, context, type) {
|
||||
export const parseDirective = function (statement, context, type) {
|
||||
mermaidAPI.parseDirective(this, statement, context, type);
|
||||
};
|
||||
|
||||
export const clear = function() {
|
||||
export const clear = function () {
|
||||
sections.length = 0;
|
||||
tasks.length = 0;
|
||||
currentSection = '';
|
||||
@ -20,24 +20,24 @@ export const clear = function() {
|
||||
rawTasks.length = 0;
|
||||
};
|
||||
|
||||
export const setTitle = function(txt) {
|
||||
export const setTitle = function (txt) {
|
||||
title = txt;
|
||||
};
|
||||
|
||||
export const getTitle = function() {
|
||||
export const getTitle = function () {
|
||||
return title;
|
||||
};
|
||||
|
||||
export const addSection = function(txt) {
|
||||
export const addSection = function (txt) {
|
||||
currentSection = txt;
|
||||
sections.push(txt);
|
||||
};
|
||||
|
||||
export const getSections = function() {
|
||||
export const getSections = function () {
|
||||
return sections;
|
||||
};
|
||||
|
||||
export const getTasks = function() {
|
||||
export const getTasks = function () {
|
||||
let allItemsProcessed = compileTasks();
|
||||
const maxDepth = 100;
|
||||
let iterationCount = 0;
|
||||
@ -51,9 +51,9 @@ export const getTasks = function() {
|
||||
return tasks;
|
||||
};
|
||||
|
||||
const updateActors = function() {
|
||||
const updateActors = function () {
|
||||
const tempActors = [];
|
||||
tasks.forEach(task => {
|
||||
tasks.forEach((task) => {
|
||||
if (task.people) {
|
||||
tempActors.push(...task.people);
|
||||
}
|
||||
@ -63,7 +63,7 @@ const updateActors = function() {
|
||||
return [...unique].sort();
|
||||
};
|
||||
|
||||
export const addTask = function(descr, taskData) {
|
||||
export const addTask = function (descr, taskData) {
|
||||
const pieces = taskData.substr(1).split(':');
|
||||
|
||||
let score = 0;
|
||||
@ -75,32 +75,32 @@ export const addTask = function(descr, taskData) {
|
||||
score = Number(pieces[0]);
|
||||
peeps = pieces[1].split(',');
|
||||
}
|
||||
const peopleList = peeps.map(s => s.trim());
|
||||
const peopleList = peeps.map((s) => s.trim());
|
||||
|
||||
const rawTask = {
|
||||
section: currentSection,
|
||||
type: currentSection,
|
||||
people: peopleList,
|
||||
task: descr,
|
||||
score
|
||||
score,
|
||||
};
|
||||
|
||||
rawTasks.push(rawTask);
|
||||
};
|
||||
|
||||
export const addTaskOrg = function(descr) {
|
||||
export const addTaskOrg = function (descr) {
|
||||
const newTask = {
|
||||
section: currentSection,
|
||||
type: currentSection,
|
||||
description: descr,
|
||||
task: descr,
|
||||
classes: []
|
||||
classes: [],
|
||||
};
|
||||
tasks.push(newTask);
|
||||
};
|
||||
|
||||
const compileTasks = function() {
|
||||
const compileTask = function(pos) {
|
||||
const compileTasks = function () {
|
||||
const compileTask = function (pos) {
|
||||
return rawTasks[pos].processed;
|
||||
};
|
||||
|
||||
@ -113,7 +113,7 @@ const compileTasks = function() {
|
||||
return allProcessed;
|
||||
};
|
||||
|
||||
const getActors = function() {
|
||||
const getActors = function () {
|
||||
return updateActors();
|
||||
};
|
||||
|
||||
@ -128,5 +128,5 @@ export default {
|
||||
getTasks,
|
||||
addTask,
|
||||
addTaskOrg,
|
||||
getActors
|
||||
getActors,
|
||||
};
|
||||
|
@ -7,10 +7,10 @@ import { configureSvgSize } from '../../utils';
|
||||
|
||||
parser.yy = journeyDb;
|
||||
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
conf[key] = cnf[key];
|
||||
});
|
||||
};
|
||||
@ -21,7 +21,7 @@ function drawActorLegend(diagram) {
|
||||
const conf = getConfig().journey;
|
||||
// Draw the actors
|
||||
let yPos = 60;
|
||||
Object.keys(actors).forEach(person => {
|
||||
Object.keys(actors).forEach((person) => {
|
||||
const colour = actors[person].color;
|
||||
|
||||
const circleData = {
|
||||
@ -30,7 +30,7 @@ function drawActorLegend(diagram) {
|
||||
r: 7,
|
||||
fill: colour,
|
||||
stroke: '#000',
|
||||
pos: actors[person].position
|
||||
pos: actors[person].position,
|
||||
};
|
||||
svgDraw.drawCircle(diagram, circleData);
|
||||
|
||||
@ -39,7 +39,7 @@ function drawActorLegend(diagram) {
|
||||
y: yPos + 7,
|
||||
fill: '#666',
|
||||
text: person,
|
||||
textMargin: conf.boxTextMargin | 5
|
||||
textMargin: conf.boxTextMargin | 5,
|
||||
};
|
||||
svgDraw.drawText(diagram, labelData);
|
||||
|
||||
@ -48,7 +48,7 @@ function drawActorLegend(diagram) {
|
||||
}
|
||||
const conf = getConfig().journey;
|
||||
const LEFT_MARGIN = getConfig().journey.leftMargin;
|
||||
export const draw = function(text, id) {
|
||||
export const draw = function (text, id) {
|
||||
const conf = getConfig().journey;
|
||||
parser.yy.clear();
|
||||
parser.parse(text + '\n');
|
||||
@ -65,10 +65,10 @@ export const draw = function(text, id) {
|
||||
const actorNames = parser.yy.getActors();
|
||||
for (let member in actors) delete actors[member];
|
||||
let actorPos = 0;
|
||||
actorNames.forEach(actorName => {
|
||||
actorNames.forEach((actorName) => {
|
||||
actors[actorName] = {
|
||||
color: conf.actorColours[actorPos % conf.actorColours.length],
|
||||
position: actorPos
|
||||
position: actorPos,
|
||||
};
|
||||
actorPos++;
|
||||
});
|
||||
@ -114,29 +114,29 @@ export const bounds = {
|
||||
startx: undefined,
|
||||
stopx: undefined,
|
||||
starty: undefined,
|
||||
stopy: undefined
|
||||
stopy: undefined,
|
||||
},
|
||||
verticalPos: 0,
|
||||
|
||||
sequenceItems: [],
|
||||
init: function() {
|
||||
init: function () {
|
||||
this.sequenceItems = [];
|
||||
this.data = {
|
||||
startx: undefined,
|
||||
stopx: undefined,
|
||||
starty: undefined,
|
||||
stopy: undefined
|
||||
stopy: undefined,
|
||||
};
|
||||
this.verticalPos = 0;
|
||||
},
|
||||
updateVal: function(obj, key, val, fun) {
|
||||
updateVal: function (obj, key, val, fun) {
|
||||
if (typeof obj[key] === 'undefined') {
|
||||
obj[key] = val;
|
||||
} else {
|
||||
obj[key] = fun(val, obj[key]);
|
||||
}
|
||||
},
|
||||
updateBounds: function(startx, starty, stopx, stopy) {
|
||||
updateBounds: function (startx, starty, stopx, stopy) {
|
||||
const conf = getConfig().journey;
|
||||
const _self = this;
|
||||
let cnt = 0;
|
||||
@ -163,7 +163,7 @@ export const bounds = {
|
||||
|
||||
this.sequenceItems.forEach(updateFn());
|
||||
},
|
||||
insert: function(startx, starty, stopx, stopy) {
|
||||
insert: function (startx, starty, stopx, stopy) {
|
||||
const _startx = Math.min(startx, stopx);
|
||||
const _stopx = Math.max(startx, stopx);
|
||||
const _starty = Math.min(starty, stopy);
|
||||
@ -176,22 +176,22 @@ export const bounds = {
|
||||
|
||||
this.updateBounds(_startx, _starty, _stopx, _stopy);
|
||||
},
|
||||
bumpVerticalPos: function(bump) {
|
||||
bumpVerticalPos: function (bump) {
|
||||
this.verticalPos = this.verticalPos + bump;
|
||||
this.data.stopy = this.verticalPos;
|
||||
},
|
||||
getVerticalPos: function() {
|
||||
getVerticalPos: function () {
|
||||
return this.verticalPos;
|
||||
},
|
||||
getBounds: function() {
|
||||
getBounds: function () {
|
||||
return this.data;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const fills = conf.sectionFills;
|
||||
const textColours = conf.sectionColours;
|
||||
|
||||
export const drawTasks = function(diagram, tasks, verticalPos) {
|
||||
export const drawTasks = function (diagram, tasks, verticalPos) {
|
||||
const conf = getConfig().journey;
|
||||
let lastSection = '';
|
||||
const sectionVHeight = conf.height * 2 + conf.diagramMarginY;
|
||||
@ -216,7 +216,7 @@ export const drawTasks = function(diagram, tasks, verticalPos) {
|
||||
text: task.section,
|
||||
fill,
|
||||
num,
|
||||
colour
|
||||
colour,
|
||||
};
|
||||
|
||||
svgDraw.drawSection(diagram, section, conf);
|
||||
@ -251,5 +251,5 @@ export const drawTasks = function(diagram, tasks, verticalPos) {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const getStyles = options =>
|
||||
const getStyles = (options) =>
|
||||
`.label {
|
||||
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
||||
font-family: var(--mermaid-font-family);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { arc as d3arc } from 'd3';
|
||||
|
||||
export const drawRect = function(elem, rectData) {
|
||||
export const drawRect = function (elem, rectData) {
|
||||
const rectElem = elem.append('rect');
|
||||
rectElem.attr('x', rectData.x);
|
||||
rectElem.attr('y', rectData.y);
|
||||
@ -18,7 +18,7 @@ export const drawRect = function(elem, rectData) {
|
||||
return rectElem;
|
||||
};
|
||||
|
||||
export const drawFace = function(element, faceData) {
|
||||
export const drawFace = function (element, faceData) {
|
||||
const radius = 15;
|
||||
const circleElement = element
|
||||
.append('circle')
|
||||
@ -104,7 +104,7 @@ export const drawFace = function(element, faceData) {
|
||||
return circleElement;
|
||||
};
|
||||
|
||||
export const drawCircle = function(element, circleData) {
|
||||
export const drawCircle = function (element, circleData) {
|
||||
const circleElement = element.append('circle');
|
||||
circleElement.attr('cx', circleData.cx);
|
||||
circleElement.attr('cy', circleData.cy);
|
||||
@ -124,7 +124,7 @@ export const drawCircle = function(element, circleData) {
|
||||
return circleElement;
|
||||
};
|
||||
|
||||
export const drawText = function(elem, textData) {
|
||||
export const drawText = function (elem, textData) {
|
||||
// Remove and ignore br:s
|
||||
const nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
|
||||
|
||||
@ -146,7 +146,7 @@ export const drawText = function(elem, textData) {
|
||||
return textElem;
|
||||
};
|
||||
|
||||
export const drawLabel = function(elem, txtObject) {
|
||||
export const drawLabel = function (elem, txtObject) {
|
||||
function genPoints(x, y, width, height, cut) {
|
||||
return (
|
||||
x +
|
||||
@ -179,7 +179,7 @@ export const drawLabel = function(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 rect = getNoteRect();
|
||||
@ -213,7 +213,7 @@ let taskCount = -1;
|
||||
* @param task The task to render
|
||||
* @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 g = elem.append('g');
|
||||
taskCount++;
|
||||
@ -232,7 +232,7 @@ export const drawTask = function(elem, task, conf) {
|
||||
drawFace(g, {
|
||||
cx: center,
|
||||
cy: 300 + (5 - task.score) * 30,
|
||||
score: task.score
|
||||
score: task.score,
|
||||
});
|
||||
|
||||
const rect = getNoteRect();
|
||||
@ -247,7 +247,7 @@ export const drawTask = function(elem, task, conf) {
|
||||
drawRect(g, rect);
|
||||
|
||||
let xPos = task.x + 14;
|
||||
task.people.forEach(person => {
|
||||
task.people.forEach((person) => {
|
||||
const colour = task.actors[person].color;
|
||||
|
||||
const circle = {
|
||||
@ -257,7 +257,7 @@ export const drawTask = function(elem, task, conf) {
|
||||
fill: colour,
|
||||
stroke: '#000',
|
||||
title: person,
|
||||
pos: task.actors[person].position
|
||||
pos: task.actors[person].position,
|
||||
};
|
||||
|
||||
drawCircle(g, circle);
|
||||
@ -282,19 +282,19 @@ export const drawTask = function(elem, task, conf) {
|
||||
* @param elem The html element
|
||||
* @param bounds The bounds of the drawing
|
||||
*/
|
||||
export const drawBackgroundRect = function(elem, bounds) {
|
||||
export const drawBackgroundRect = function (elem, bounds) {
|
||||
const rectElem = drawRect(elem, {
|
||||
x: bounds.startx,
|
||||
y: bounds.starty,
|
||||
width: bounds.stopx - bounds.startx,
|
||||
height: bounds.stopy - bounds.starty,
|
||||
fill: bounds.fill,
|
||||
class: 'rect'
|
||||
class: 'rect',
|
||||
});
|
||||
rectElem.lower();
|
||||
};
|
||||
|
||||
export const getTextObj = function() {
|
||||
export const getTextObj = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
@ -304,11 +304,11 @@ export const getTextObj = function() {
|
||||
height: 100,
|
||||
textMargin: 0,
|
||||
rx: 0,
|
||||
ry: 0
|
||||
ry: 0,
|
||||
};
|
||||
};
|
||||
|
||||
export const getNoteRect = function() {
|
||||
export const getNoteRect = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
@ -316,11 +316,11 @@ export const getNoteRect = function() {
|
||||
anchor: 'start',
|
||||
height: 100,
|
||||
rx: 0,
|
||||
ry: 0
|
||||
ry: 0,
|
||||
};
|
||||
};
|
||||
|
||||
const _drawTextCandidateFunc = (function() {
|
||||
const _drawTextCandidateFunc = (function () {
|
||||
function byText(content, g, x, y, width, height, textAttrs, colour) {
|
||||
const text = g
|
||||
.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;
|
||||
};
|
||||
})();
|
||||
|
||||
const initGraphics = function(graphics) {
|
||||
const initGraphics = function (graphics) {
|
||||
graphics
|
||||
.append('defs')
|
||||
.append('marker')
|
||||
@ -429,5 +429,5 @@ export default {
|
||||
drawBackgroundRect,
|
||||
getTextObj,
|
||||
getNoteRect,
|
||||
initGraphics
|
||||
initGraphics,
|
||||
};
|
||||
|
@ -5,10 +5,10 @@ import { select } from 'd3';
|
||||
import { log } from './logger';
|
||||
|
||||
const conf = {};
|
||||
export const setConf = function(cnf) {
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
|
||||
keys.forEach(function(key) {
|
||||
keys.forEach(function (key) {
|
||||
conf[key] = cnf[key];
|
||||
});
|
||||
};
|
||||
@ -94,5 +94,5 @@ export const draw = (id, ver) => {
|
||||
|
||||
export default {
|
||||
setConf,
|
||||
draw
|
||||
draw,
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ export const LEVELS = {
|
||||
info: 2,
|
||||
warn: 3,
|
||||
error: 4,
|
||||
fatal: 5
|
||||
fatal: 5,
|
||||
};
|
||||
|
||||
export const log = {
|
||||
@ -13,10 +13,10 @@ export const log = {
|
||||
info: () => {},
|
||||
warn: () => {},
|
||||
error: () => {},
|
||||
fatal: () => {}
|
||||
fatal: () => {},
|
||||
};
|
||||
|
||||
export const setLogLevel = function(level = 'fatal') {
|
||||
export const setLogLevel = function (level = 'fatal') {
|
||||
if (isNaN(level)) {
|
||||
level = level.toLowerCase();
|
||||
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');
|
||||
return `%c${time} : ${level} : `;
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ import utils from './utils';
|
||||
* Renders the mermaid diagrams
|
||||
* @param nodes a css selector or an array of nodes
|
||||
*/
|
||||
const init = function() {
|
||||
const init = function () {
|
||||
const conf = mermaidAPI.getConfig();
|
||||
// console.log('Starting rendering diagrams (init) - mermaid.init', conf);
|
||||
let nodes;
|
||||
@ -129,7 +129,7 @@ const init = function() {
|
||||
}
|
||||
};
|
||||
|
||||
const initialize = function(config) {
|
||||
const initialize = function (config) {
|
||||
// mermaidAPI.reset();
|
||||
if (typeof config.mermaid !== '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
|
||||
* calls init for rendering the mermaid diagrams on the page.
|
||||
*/
|
||||
const contentLoaded = function() {
|
||||
const contentLoaded = function () {
|
||||
let config;
|
||||
|
||||
if (mermaid.startOnLoad) {
|
||||
@ -175,7 +175,7 @@ if (typeof document !== 'undefined') {
|
||||
*/
|
||||
window.addEventListener(
|
||||
'load',
|
||||
function() {
|
||||
function () {
|
||||
contentLoaded();
|
||||
},
|
||||
false
|
||||
@ -193,7 +193,7 @@ const mermaid = {
|
||||
init,
|
||||
initialize,
|
||||
|
||||
contentLoaded
|
||||
contentLoaded,
|
||||
};
|
||||
|
||||
export default mermaid;
|
||||
|
@ -155,19 +155,19 @@ function parse(text) {
|
||||
return parser;
|
||||
}
|
||||
|
||||
export const encodeEntities = function(text) {
|
||||
export const encodeEntities = function (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);
|
||||
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);
|
||||
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 isInt = /^\+?\d+$/.test(innerTxt);
|
||||
@ -181,16 +181,16 @@ export const encodeEntities = function(text) {
|
||||
return txt;
|
||||
};
|
||||
|
||||
export const decodeEntities = function(text) {
|
||||
export const decodeEntities = function (text) {
|
||||
let txt = text;
|
||||
|
||||
txt = txt.replace(/fl°°/g, function() {
|
||||
txt = txt.replace(/fl°°/g, function () {
|
||||
return '&#';
|
||||
});
|
||||
txt = txt.replace(/fl°/g, function() {
|
||||
txt = txt.replace(/fl°/g, function () {
|
||||
return '&';
|
||||
});
|
||||
txt = txt.replace(/¶ß/g, function() {
|
||||
txt = txt.replace(/¶ß/g, function () {
|
||||
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
|
||||
* completed.
|
||||
*/
|
||||
const render = function(id, _txt, cb, container) {
|
||||
const render = function (id, _txt, cb, container) {
|
||||
configApi.reset();
|
||||
let txt = _txt;
|
||||
const graphInit = utils.detectInit(txt);
|
||||
@ -495,7 +495,7 @@ const render = function(id, _txt, cb, container) {
|
||||
|
||||
let currentDirective = {};
|
||||
|
||||
const parseDirective = function(p, statement, context, type) {
|
||||
const parseDirective = function (p, statement, context, type) {
|
||||
try {
|
||||
if (statement !== undefined) {
|
||||
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);
|
||||
switch (directive.type) {
|
||||
case 'init':
|
||||
case 'initialize': {
|
||||
['config'].forEach(prop => {
|
||||
['config'].forEach((prop) => {
|
||||
if (typeof directive.args[prop] !== 'undefined') {
|
||||
if (type === 'flowchart-v2') {
|
||||
type = 'flowchart';
|
||||
@ -646,7 +646,7 @@ const mermaidAPI = Object.freeze({
|
||||
configApi.reset(configApi.defaultConfig);
|
||||
updateRendererConfigs(configApi.getConfig());
|
||||
},
|
||||
defaultConfig: configApi.defaultConfig
|
||||
defaultConfig: configApi.defaultConfig,
|
||||
});
|
||||
|
||||
setLogLevel(configApi.getConfig().logLevel);
|
||||
|
@ -25,7 +25,7 @@ const themes = {
|
||||
pie,
|
||||
er,
|
||||
journey,
|
||||
requirement
|
||||
requirement,
|
||||
};
|
||||
|
||||
export const calcThemeVariables = (theme, userOverRides) => theme.calcColors(userOverRides);
|
||||
|
@ -6,18 +6,18 @@ import { getThemeVariables as neutralThemeVariables } from './theme-neutral';
|
||||
|
||||
export default {
|
||||
base: {
|
||||
getThemeVariables: baseThemeVariables
|
||||
getThemeVariables: baseThemeVariables,
|
||||
},
|
||||
dark: {
|
||||
getThemeVariables: darkThemeVariables
|
||||
getThemeVariables: darkThemeVariables,
|
||||
},
|
||||
default: {
|
||||
getThemeVariables: defaultThemeVariables
|
||||
getThemeVariables: defaultThemeVariables,
|
||||
},
|
||||
forest: {
|
||||
getThemeVariables: forestThemeVariables
|
||||
getThemeVariables: forestThemeVariables,
|
||||
},
|
||||
neutral: {
|
||||
getThemeVariables: neutralThemeVariables
|
||||
}
|
||||
getThemeVariables: neutralThemeVariables,
|
||||
},
|
||||
};
|
||||
|
@ -184,20 +184,20 @@ class Theme {
|
||||
const keys = Object.keys(overrides);
|
||||
|
||||
// Copy values from overrides, this is mainly for base colors
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
|
||||
// Calculate colors form base colors
|
||||
this.updateColors();
|
||||
// Copy values from overrides again in case of an override of derived value
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const getThemeVariables = userOverrides => {
|
||||
export const getThemeVariables = (userOverrides) => {
|
||||
const theme = new Theme();
|
||||
theme.calculate(userOverrides);
|
||||
return theme;
|
||||
|
@ -198,20 +198,20 @@ class Theme {
|
||||
const keys = Object.keys(overrides);
|
||||
|
||||
// Copy values from overrides, this is mainly for base colors
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
|
||||
// Calculate colors form base colors
|
||||
this.updateColors();
|
||||
// Copy values from overrides again in case of an override of derived value
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const getThemeVariables = userOverrides => {
|
||||
export const getThemeVariables = (userOverrides) => {
|
||||
const theme = new Theme();
|
||||
theme.calculate(userOverrides);
|
||||
return theme;
|
||||
|
@ -209,20 +209,20 @@ class Theme {
|
||||
const keys = Object.keys(overrides);
|
||||
|
||||
// Copy values from overrides, this is mainly for base colors
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
|
||||
// Calculate colors form base colors
|
||||
this.updateColors();
|
||||
// Copy values from overrides again in case of an override of derived value
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const getThemeVariables = userOverrides => {
|
||||
export const getThemeVariables = (userOverrides) => {
|
||||
const theme = new Theme();
|
||||
theme.calculate(userOverrides);
|
||||
return theme;
|
||||
|
@ -179,20 +179,20 @@ class Theme {
|
||||
const keys = Object.keys(overrides);
|
||||
|
||||
// Copy values from overrides, this is mainly for base colors
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
|
||||
// Calculate colors form base colors
|
||||
this.updateColors();
|
||||
// Copy values from overrides again in case of an override of derived value
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const getThemeVariables = userOverrides => {
|
||||
export const getThemeVariables = (userOverrides) => {
|
||||
const theme = new Theme();
|
||||
theme.calculate(userOverrides);
|
||||
return theme;
|
||||
|
@ -229,20 +229,20 @@ class Theme {
|
||||
const keys = Object.keys(overrides);
|
||||
|
||||
// Copy values from overrides, this is mainly for base colors
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
|
||||
// Calculate colors form base colors
|
||||
this.updateColors();
|
||||
// Copy values from overrides again in case of an override of derived value
|
||||
keys.forEach(k => {
|
||||
keys.forEach((k) => {
|
||||
this[k] = overrides[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const getThemeVariables = userOverrides => {
|
||||
export const getThemeVariables = (userOverrides) => {
|
||||
const theme = new Theme();
|
||||
theme.calculate(userOverrides);
|
||||
return theme;
|
||||
|
100
src/utils.js
100
src/utils.js
@ -11,11 +11,10 @@ import {
|
||||
curveStep,
|
||||
curveStepAfter,
|
||||
curveStepBefore,
|
||||
select
|
||||
select,
|
||||
} from 'd3';
|
||||
import common from './diagrams/common/common';
|
||||
import { log } from './logger';
|
||||
// import cryptoRandomString from 'crypto-random-string';
|
||||
|
||||
// Effectively an enum of the supported curve types, accessible by name
|
||||
const d3CurveTypes = {
|
||||
@ -29,10 +28,12 @@ const d3CurveTypes = {
|
||||
curveNatural: curveNatural,
|
||||
curveStep: curveStep,
|
||||
curveStepAfter: curveStepAfter,
|
||||
curveStepBefore: curveStepBefore
|
||||
curveStepBefore: curveStepBefore,
|
||||
};
|
||||
const directive = /[%]{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 directive =
|
||||
/[%]{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;
|
||||
|
||||
/**
|
||||
@ -65,18 +66,18 @@ const anyComment = /\s*%%.*\n/gm;
|
||||
* @param {string} text The text defining the graph
|
||||
* @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 results = {};
|
||||
if (Array.isArray(inits)) {
|
||||
let args = inits.map(init => init.args);
|
||||
let args = inits.map((init) => init.args);
|
||||
results = assignWithDepth(results, [...args]);
|
||||
} else {
|
||||
results = inits.args;
|
||||
}
|
||||
if (results) {
|
||||
let type = detectType(text, cnf);
|
||||
['config'].forEach(prop => {
|
||||
['config'].forEach((prop) => {
|
||||
if (typeof results[prop] !== 'undefined') {
|
||||
if (type === 'flowchart-v2') {
|
||||
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
|
||||
* 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 {
|
||||
const commentWithoutDirectives = new RegExp(
|
||||
`[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*\n`,
|
||||
'ig'
|
||||
);
|
||||
text = text
|
||||
.trim()
|
||||
.replace(commentWithoutDirectives, '')
|
||||
.replace(/'/gm, '"');
|
||||
text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
|
||||
log.debug(
|
||||
`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
|
||||
* @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');
|
||||
log.debug('Detecting diagram type based on the text ' + text);
|
||||
if (text.match(/^\s*sequenceDiagram/)) {
|
||||
@ -252,7 +250,7 @@ const memoize = (fn, resolver) => {
|
||||
* @param {array} arr The array to search
|
||||
* @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++) {
|
||||
if (arr[i].match(str)) return i;
|
||||
}
|
||||
@ -297,11 +295,11 @@ export const runFunc = (functionName, ...params) => {
|
||||
const distance = (p1, p2) =>
|
||||
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 totalDistance = 0;
|
||||
|
||||
points.forEach(point => {
|
||||
points.forEach((point) => {
|
||||
totalDistance += distance(point, prevPoint);
|
||||
prevPoint = point;
|
||||
});
|
||||
@ -310,7 +308,7 @@ const traverseEdge = points => {
|
||||
let remainingDistance = totalDistance / 2;
|
||||
let center = undefined;
|
||||
prevPoint = undefined;
|
||||
points.forEach(point => {
|
||||
points.forEach((point) => {
|
||||
if (prevPoint && !center) {
|
||||
const vectorDistance = distance(point, prevPoint);
|
||||
if (vectorDistance < remainingDistance) {
|
||||
@ -324,7 +322,7 @@ const traverseEdge = points => {
|
||||
if (distanceRatio > 0 && distanceRatio < 1) {
|
||||
center = {
|
||||
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;
|
||||
};
|
||||
|
||||
const calcLabelPosition = points => {
|
||||
const calcLabelPosition = (points) => {
|
||||
return traverseEdge(points);
|
||||
};
|
||||
|
||||
@ -345,7 +343,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
|
||||
if (points[0] !== initialPosition) {
|
||||
points = points.reverse();
|
||||
}
|
||||
points.forEach(point => {
|
||||
points.forEach((point) => {
|
||||
totalDistance += distance(point, prevPoint);
|
||||
prevPoint = point;
|
||||
});
|
||||
@ -356,7 +354,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
|
||||
let remainingDistance = distanceToCardinalityPoint;
|
||||
let center;
|
||||
prevPoint = undefined;
|
||||
points.forEach(point => {
|
||||
points.forEach((point) => {
|
||||
if (prevPoint && !center) {
|
||||
const vectorDistance = distance(point, prevPoint);
|
||||
if (vectorDistance < remainingDistance) {
|
||||
@ -370,7 +368,7 @@ const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition)
|
||||
if (distanceRatio > 0 && distanceRatio < 1) {
|
||||
center = {
|
||||
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.forEach(point => {
|
||||
points.forEach((point) => {
|
||||
totalDistance += distance(point, prevPoint);
|
||||
prevPoint = point;
|
||||
});
|
||||
@ -412,7 +410,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
|
||||
let remainingDistance = distanceToCardinalityPoint;
|
||||
let center;
|
||||
prevPoint = undefined;
|
||||
points.forEach(point => {
|
||||
points.forEach((point) => {
|
||||
if (prevPoint && !center) {
|
||||
const vectorDistance = distance(point, prevPoint);
|
||||
if (vectorDistance < remainingDistance) {
|
||||
@ -426,7 +424,7 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
|
||||
if (distanceRatio > 0 && distanceRatio < 1) {
|
||||
center = {
|
||||
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;
|
||||
};
|
||||
|
||||
export const getStylesFromArray = arr => {
|
||||
export const getStylesFromArray = (arr) => {
|
||||
let style = '';
|
||||
let labelStyle = '';
|
||||
|
||||
@ -480,14 +478,7 @@ export const getStylesFromArray = arr => {
|
||||
let cnt = 0;
|
||||
export const generateId = () => {
|
||||
cnt++;
|
||||
return (
|
||||
'id-' +
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substr(2, 12) +
|
||||
'-' +
|
||||
cnt
|
||||
);
|
||||
return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
|
||||
};
|
||||
|
||||
function makeid(length) {
|
||||
@ -500,7 +491,7 @@ function makeid(length) {
|
||||
return result;
|
||||
}
|
||||
|
||||
export const random = options => {
|
||||
export const random = (options) => {
|
||||
return makeid(options.length);
|
||||
};
|
||||
|
||||
@ -530,13 +521,13 @@ export const random = options => {
|
||||
* clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
|
||||
* @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);
|
||||
if (Array.isArray(src) && !Array.isArray(dst)) {
|
||||
src.forEach(s => assignWithDepth(dst, s, config));
|
||||
src.forEach((s) => assignWithDepth(dst, s, config));
|
||||
return dst;
|
||||
} else if (Array.isArray(src) && Array.isArray(dst)) {
|
||||
src.forEach(s => {
|
||||
src.forEach((s) => {
|
||||
if (dst.indexOf(s) === -1) {
|
||||
dst.push(s);
|
||||
}
|
||||
@ -551,7 +542,7 @@ export const assignWithDepth = function(dst, src, config) {
|
||||
}
|
||||
}
|
||||
if (typeof src !== 'undefined' && typeof dst === 'object' && typeof src === 'object') {
|
||||
Object.keys(src).forEach(key => {
|
||||
Object.keys(src).forEach((key) => {
|
||||
if (
|
||||
typeof src[key] === 'object' &&
|
||||
(dst[key] === undefined || typeof dst[key] === 'object')
|
||||
@ -568,7 +559,7 @@ export const assignWithDepth = function(dst, src, config) {
|
||||
return dst;
|
||||
};
|
||||
|
||||
export const getTextObj = function() {
|
||||
export const getTextObj = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
@ -580,11 +571,11 @@ export const getTextObj = function() {
|
||||
textMargin: 0,
|
||||
rx: 0,
|
||||
ry: 0,
|
||||
valign: undefined
|
||||
valign: undefined,
|
||||
};
|
||||
};
|
||||
|
||||
export const drawSimpleText = function(elem, textData) {
|
||||
export const drawSimpleText = function (elem, textData) {
|
||||
// Remove and ignore br:s
|
||||
const nText = textData.text.replace(common.lineBreakRegex, ' ');
|
||||
|
||||
@ -642,7 +633,7 @@ export const wrapLabel = memoize(
|
||||
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.fontSize}-${config.fontWeight}-${config.fontFamily}-${config.joinWith}`
|
||||
@ -687,7 +678,7 @@ const breakString = memoize(
|
||||
* @param text the text to measure
|
||||
* @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(
|
||||
{ fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 15 },
|
||||
config
|
||||
@ -702,7 +693,7 @@ export const calculateTextHeight = function(text, config) {
|
||||
* @param text - The text to calculate the width of
|
||||
* @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);
|
||||
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
|
||||
*/
|
||||
export const calculateTextDimensions = memoize(
|
||||
function(text, config) {
|
||||
function (text, config) {
|
||||
config = Object.assign({ fontSize: 12, fontWeight: 400, fontFamily: 'Arial' }, config);
|
||||
const { fontSize, fontFamily, fontWeight } = config;
|
||||
if (!text) {
|
||||
@ -774,13 +765,13 @@ export const calculateTextDimensions = memoize(
|
||||
(text, config) => `${text}-${config.fontSize}-${config.fontWeight}-${config.fontFamily}`
|
||||
);
|
||||
|
||||
const d3Attrs = function(d3Elem, attrs) {
|
||||
const d3Attrs = function (d3Elem, attrs) {
|
||||
for (let attr of attrs) {
|
||||
d3Elem.attr(attr[0], attr[1]);
|
||||
}
|
||||
};
|
||||
|
||||
export const calculateSvgSizeAttrs = function(height, width, useMaxWidth) {
|
||||
export const calculateSvgSizeAttrs = function (height, width, useMaxWidth) {
|
||||
let attrs = new Map();
|
||||
attrs.set('height', height);
|
||||
if (useMaxWidth) {
|
||||
@ -792,7 +783,7 @@ export const calculateSvgSizeAttrs = function(height, width, useMaxWidth) {
|
||||
return attrs;
|
||||
};
|
||||
|
||||
export const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
|
||||
export const configureSvgSize = function (svgElem, height, width, useMaxWidth) {
|
||||
const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
|
||||
d3Attrs(svgElem, attrs);
|
||||
};
|
||||
@ -814,13 +805,10 @@ export const initIdGeneratior = class iterator {
|
||||
|
||||
// Source https://github.com/shrpne/entity-decode/blob/master/browser.js
|
||||
let decoder;
|
||||
export const entityDecode = function(html) {
|
||||
export const entityDecode = function (html) {
|
||||
decoder = decoder || document.createElement('div');
|
||||
// Escape HTML before decoding for HTML Entities
|
||||
html = escape(html)
|
||||
.replace(/%26/g, '&')
|
||||
.replace(/%23/g, '#')
|
||||
.replace(/%3B/g, ';');
|
||||
html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';');
|
||||
// decoding
|
||||
decoder.innerHTML = html;
|
||||
return unescape(decoder.textContent);
|
||||
@ -849,5 +837,5 @@ export default {
|
||||
memoize,
|
||||
runFunc,
|
||||
entityDecode,
|
||||
initIdGeneratior
|
||||
initIdGeneratior,
|
||||
};
|
||||
|
462
yarn.lock
462
yarn.lock
@ -2,6 +2,13 @@
|
||||
# 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":
|
||||
version "7.14.5"
|
||||
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/types" "^7.14.5"
|
||||
|
||||
"@babel/highlight@^7.14.5":
|
||||
"@babel/highlight@^7.10.4", "@babel/highlight@^7.14.5":
|
||||
version "7.14.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9"
|
||||
integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==
|
||||
@ -1155,6 +1162,21 @@
|
||||
debug "^3.1.0"
|
||||
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":
|
||||
version "9.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
|
||||
@ -1167,6 +1189,20 @@
|
||||
dependencies:
|
||||
"@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":
|
||||
version "1.1.0"
|
||||
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-walk "^7.1.1"
|
||||
|
||||
acorn-jsx@^5.2.0:
|
||||
version "5.3.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b"
|
||||
integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==
|
||||
acorn-jsx@^5.3.1:
|
||||
version "5.3.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
|
||||
integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
|
||||
|
||||
acorn-walk@^7.1.1:
|
||||
version "7.2.0"
|
||||
@ -2001,7 +2037,7 @@ acorn@^6.4.1:
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
|
||||
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
|
||||
|
||||
acorn@^7.1.1:
|
||||
acorn@^7.1.1, acorn@^7.4.0:
|
||||
version "7.4.1"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
|
||||
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"
|
||||
uri-js "^4.2.2"
|
||||
|
||||
ajv@^8.0.5:
|
||||
ajv@^8.0.1, ajv@^8.0.5:
|
||||
version "8.6.1"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.6.1.tgz#ae65764bf1edde8cd861281cda5057852364a295"
|
||||
integrity sha512-42VLtQUOLefAvKFAQIxIZDaThq6om/PrfP0CYk3/vn+y4BMNkKnbli8ON2QCiHov4KkzOSJ/xSoBJdayiiYvVQ==
|
||||
@ -2256,11 +2292,6 @@ ast-types@0.14.2:
|
||||
dependencies:
|
||||
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:
|
||||
version "2.0.0"
|
||||
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"
|
||||
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:
|
||||
version "5.3.1"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||
@ -3052,13 +3075,6 @@ class-utils@^0.3.5:
|
||||
isobject "^3.0.0"
|
||||
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:
|
||||
version "2.2.0"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||
@ -3508,11 +3524,6 @@ crypto-browserify@^3.11.0:
|
||||
randombytes "^2.0.0"
|
||||
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:
|
||||
version "0.1.3"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||
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"
|
||||
tapable "^1.0.0"
|
||||
|
||||
enquirer@^2.3.6:
|
||||
enquirer@^2.3.5, enquirer@^2.3.6:
|
||||
version "2.3.6"
|
||||
resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
|
||||
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
|
||||
@ -4398,14 +4409,12 @@ escodegen@^2.0.0:
|
||||
optionalDependencies:
|
||||
source-map "~0.6.1"
|
||||
|
||||
eslint-config-prettier@^6.3.0:
|
||||
version "6.15.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9"
|
||||
integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==
|
||||
dependencies:
|
||||
get-stdin "^6.0.0"
|
||||
eslint-config-prettier@^8.3.0:
|
||||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
|
||||
integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==
|
||||
|
||||
eslint-plugin-prettier@^3.1.0:
|
||||
eslint-plugin-prettier@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz#cdbad3bf1dbd2b177e9825737fe63b476a08f0c7"
|
||||
integrity sha512-UDK6rJT6INSfcOo545jiaOwB701uAIt2/dR7WnFQoGCVl1/EMqdANBmwUaqqQ45aXprsTGzSa39LI1PyuRBxxw==
|
||||
@ -4420,7 +4429,7 @@ eslint-scope@^4.0.3:
|
||||
esrecurse "^4.1.0"
|
||||
estraverse "^4.1.1"
|
||||
|
||||
eslint-scope@^5.0.0:
|
||||
eslint-scope@^5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
|
||||
integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==
|
||||
@ -4428,69 +4437,77 @@ eslint-scope@^5.0.0:
|
||||
esrecurse "^4.3.0"
|
||||
estraverse "^4.1.1"
|
||||
|
||||
eslint-utils@^1.4.3:
|
||||
version "1.4.3"
|
||||
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f"
|
||||
integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==
|
||||
eslint-utils@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27"
|
||||
integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==
|
||||
dependencies:
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
|
||||
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
|
||||
|
||||
eslint@^6.3.0:
|
||||
version "6.8.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb"
|
||||
integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==
|
||||
eslint-visitor-keys@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
|
||||
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:
|
||||
"@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"
|
||||
chalk "^2.1.0"
|
||||
cross-spawn "^6.0.5"
|
||||
chalk "^4.0.0"
|
||||
cross-spawn "^7.0.2"
|
||||
debug "^4.0.1"
|
||||
doctrine "^3.0.0"
|
||||
eslint-scope "^5.0.0"
|
||||
eslint-utils "^1.4.3"
|
||||
eslint-visitor-keys "^1.1.0"
|
||||
espree "^6.1.2"
|
||||
esquery "^1.0.1"
|
||||
enquirer "^2.3.5"
|
||||
escape-string-regexp "^4.0.0"
|
||||
eslint-scope "^5.1.1"
|
||||
eslint-utils "^2.1.0"
|
||||
eslint-visitor-keys "^2.0.0"
|
||||
espree "^7.3.1"
|
||||
esquery "^1.4.0"
|
||||
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"
|
||||
glob-parent "^5.0.0"
|
||||
globals "^12.1.0"
|
||||
glob-parent "^5.1.2"
|
||||
globals "^13.6.0"
|
||||
ignore "^4.0.6"
|
||||
import-fresh "^3.0.0"
|
||||
imurmurhash "^0.1.4"
|
||||
inquirer "^7.0.0"
|
||||
is-glob "^4.0.0"
|
||||
js-yaml "^3.13.1"
|
||||
json-stable-stringify-without-jsonify "^1.0.1"
|
||||
levn "^0.3.0"
|
||||
lodash "^4.17.14"
|
||||
levn "^0.4.1"
|
||||
lodash.merge "^4.6.2"
|
||||
minimatch "^3.0.4"
|
||||
mkdirp "^0.5.1"
|
||||
natural-compare "^1.4.0"
|
||||
optionator "^0.8.3"
|
||||
optionator "^0.9.1"
|
||||
progress "^2.0.0"
|
||||
regexpp "^2.0.1"
|
||||
semver "^6.1.2"
|
||||
strip-ansi "^5.2.0"
|
||||
strip-json-comments "^3.0.1"
|
||||
table "^5.2.3"
|
||||
regexpp "^3.1.0"
|
||||
semver "^7.2.1"
|
||||
strip-ansi "^6.0.0"
|
||||
strip-json-comments "^3.1.0"
|
||||
table "^6.0.9"
|
||||
text-table "^0.2.0"
|
||||
v8-compile-cache "^2.0.3"
|
||||
|
||||
espree@^6.1.2:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-6.2.1.tgz#77fc72e1fd744a2052c20f38a5b575832e82734a"
|
||||
integrity sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==
|
||||
espree@^7.3.0, espree@^7.3.1:
|
||||
version "7.3.1"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6"
|
||||
integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==
|
||||
dependencies:
|
||||
acorn "^7.1.1"
|
||||
acorn-jsx "^5.2.0"
|
||||
eslint-visitor-keys "^1.1.0"
|
||||
acorn "^7.4.0"
|
||||
acorn-jsx "^5.3.1"
|
||||
eslint-visitor-keys "^1.3.0"
|
||||
|
||||
esprima@1.1.x, esprima@~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"
|
||||
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
|
||||
|
||||
esquery@^1.0.1:
|
||||
esquery@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5"
|
||||
integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==
|
||||
@ -4776,7 +4793,7 @@ extsprintf@^1.2.0:
|
||||
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
||||
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"
|
||||
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
|
||||
|
||||
fast-levenshtein@~2.0.6:
|
||||
fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
|
||||
integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=
|
||||
@ -4861,12 +4878,12 @@ figures@^3.0.0, figures@^3.2.0:
|
||||
dependencies:
|
||||
escape-string-regexp "^1.0.5"
|
||||
|
||||
file-entry-cache@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c"
|
||||
integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==
|
||||
file-entry-cache@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
|
||||
integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==
|
||||
dependencies:
|
||||
flat-cache "^2.0.1"
|
||||
flat-cache "^3.0.4"
|
||||
|
||||
file-uri-to-path@1.0.0:
|
||||
version "1.0.0"
|
||||
@ -4951,19 +4968,18 @@ findup-sync@^3.0.0:
|
||||
micromatch "^3.0.4"
|
||||
resolve-dir "^1.0.1"
|
||||
|
||||
flat-cache@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0"
|
||||
integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==
|
||||
flat-cache@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
|
||||
integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==
|
||||
dependencies:
|
||||
flatted "^2.0.0"
|
||||
rimraf "2.6.3"
|
||||
write "1.0.3"
|
||||
flatted "^3.1.0"
|
||||
rimraf "^3.0.2"
|
||||
|
||||
flatted@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
|
||||
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
|
||||
flatted@^3.1.0:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.1.tgz#bbef080d95fca6709362c73044a1634f7c6e7d05"
|
||||
integrity sha512-OMQjaErSFHmHqZe+PSidH5n8j3O0F2DdnVh8JB4j4eUQ2k6KvB0qGfrKIhapvez5JerBbmWkaLYUYWISaESoXg==
|
||||
|
||||
flow-parser@0.*:
|
||||
version "0.154.0"
|
||||
@ -5227,7 +5243,7 @@ glob-parent@^3.1.0:
|
||||
is-glob "^3.1.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"
|
||||
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
|
||||
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"
|
||||
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
|
||||
|
||||
globals@^12.1.0:
|
||||
version "12.4.0"
|
||||
resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8"
|
||||
integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==
|
||||
globals@^13.6.0, globals@^13.9.0:
|
||||
version "13.10.0"
|
||||
resolved "https://registry.yarnpkg.com/globals/-/globals-13.10.0.tgz#60ba56c3ac2ca845cfbf4faeca727ad9dd204676"
|
||||
integrity sha512-piHC3blgLGFjvOuMmWZX60f+na1lXFDhQXBf1UYp2fXPXqvEUbOhNwi6BsQ0bQishwedgnjkwv1d9zKf+MWw3g==
|
||||
dependencies:
|
||||
type-fest "^0.8.1"
|
||||
type-fest "^0.20.2"
|
||||
|
||||
globby@^11.0.1, globby@^11.0.3:
|
||||
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"
|
||||
integrity sha512-I5GTdSfhYfAPNztx2xJRQpG8cuDSNt599/7YUn7Gx/WxNMsG+a835k97TDkFgk123cwjfwINaZknkKkphx/f2A==
|
||||
|
||||
he@^1.1.0, he@^1.2.0:
|
||||
he@^1.1.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
|
||||
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"
|
||||
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:
|
||||
version "1.0.5"
|
||||
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"
|
||||
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:
|
||||
version "8.1.1"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"
|
||||
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"
|
||||
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:
|
||||
version "4.0.8"
|
||||
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
||||
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:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
|
||||
@ -7158,7 +7160,12 @@ lodash.templatesettings@^4.0.0:
|
||||
dependencies:
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
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"
|
||||
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:
|
||||
version "5.1.1"
|
||||
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"
|
||||
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:
|
||||
version "1.0.1"
|
||||
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"
|
||||
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:
|
||||
version "0.1.17"
|
||||
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"
|
||||
@ -7919,7 +7901,7 @@ opn@^5.5.0:
|
||||
dependencies:
|
||||
is-wsl "^1.1.0"
|
||||
|
||||
optionator@^0.8.1, optionator@^0.8.3:
|
||||
optionator@^0.8.1:
|
||||
version "0.8.3"
|
||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495"
|
||||
integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==
|
||||
@ -7931,6 +7913,18 @@ optionator@^0.8.1, optionator@^0.8.3:
|
||||
type-check "~0.3.2"
|
||||
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:
|
||||
version "5.4.1"
|
||||
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"
|
||||
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:
|
||||
version "1.0.1"
|
||||
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"
|
||||
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:
|
||||
version "1.1.2"
|
||||
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:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier@^1.18.2:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
prettier@^2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
|
||||
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
|
||||
|
||||
pretty-bytes@^5.6.0:
|
||||
version "5.6.0"
|
||||
@ -8755,10 +8747,10 @@ regexp.prototype.flags@^1.2.0:
|
||||
call-bind "^1.0.2"
|
||||
define-properties "^1.1.3"
|
||||
|
||||
regexpp@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f"
|
||||
integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==
|
||||
regexpp@^3.1.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2"
|
||||
integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
|
||||
|
||||
regexpu-core@^4.7.1:
|
||||
version "4.7.1"
|
||||
@ -8784,11 +8776,6 @@ regjsparser@^0.6.4:
|
||||
dependencies:
|
||||
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:
|
||||
version "8.0.0"
|
||||
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"
|
||||
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:
|
||||
version "2.7.1"
|
||||
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:
|
||||
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:
|
||||
version "2.0.2"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
|
||||
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"
|
||||
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:
|
||||
version "3.0.0"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
||||
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"
|
||||
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
|
||||
|
||||
table@^5.2.3:
|
||||
version "5.4.6"
|
||||
resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"
|
||||
integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==
|
||||
table@^6.0.9:
|
||||
version "6.7.1"
|
||||
resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2"
|
||||
integrity sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==
|
||||
dependencies:
|
||||
ajv "^6.10.2"
|
||||
lodash "^4.17.14"
|
||||
slice-ansi "^2.1.0"
|
||||
string-width "^3.0.0"
|
||||
ajv "^8.0.1"
|
||||
lodash.clonedeep "^4.5.0"
|
||||
lodash.truncate "^4.4.2"
|
||||
slice-ansi "^4.0.0"
|
||||
string-width "^4.2.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
tapable@^1.0.0, tapable@^1.1.3:
|
||||
version "1.1.3"
|
||||
@ -9971,7 +9951,7 @@ terser-webpack-plugin@^2.2.2:
|
||||
terser "^4.6.12"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
|
||||
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"
|
||||
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:
|
||||
version "1.14.1"
|
||||
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"
|
||||
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:
|
||||
version "0.3.2"
|
||||
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"
|
||||
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:
|
||||
version "0.21.3"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
|
||||
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:
|
||||
version "1.6.18"
|
||||
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"
|
||||
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:
|
||||
version "0.1.2"
|
||||
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"
|
||||
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:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
|
||||
@ -10944,7 +10911,7 @@ widest-line@^3.1.0:
|
||||
dependencies:
|
||||
string-width "^4.0.0"
|
||||
|
||||
word-wrap@~1.2.3:
|
||||
word-wrap@^1.2.3, word-wrap@~1.2.3:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
|
||||
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
|
||||
@ -11024,13 +10991,6 @@ write-file-atomic@^3.0.0:
|
||||
signal-exit "^3.0.2"
|
||||
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:
|
||||
version "6.2.2"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e"
|
||||
|
Loading…
x
Reference in New Issue
Block a user