mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-10 02:49:40 +02:00
Merge branch 'sidv/esbuild' into sidv/esbuildFail
* sidv/esbuild: chore(deps): bump dompurify from 2.3.10 to 2.4.0 (#3444) chore(deps): bump stylis from 4.1.1 to 4.1.2 (#3439) chore(deps-dev): bump webpack-dev-server from 4.10.1 to 4.11.0 (#3450) Cleanup fixing som lingering issues Apply suggestions from code review chore: fix eslint warnings chore: Turn off eslint rules in spec, demos, etc.
This commit is contained in:
@@ -63,6 +63,13 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"no-console": "off"
|
"no-console": "off"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["./**/*.spec.{ts,js}", "./cypress/**", "./demos/**", "./**/docs/**"],
|
||||||
|
"rules": {
|
||||||
|
"jsdoc/require-jsdoc": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": "off"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -69,14 +69,14 @@
|
|||||||
"d3": "^7.0.0",
|
"d3": "^7.0.0",
|
||||||
"dagre": "^0.8.5",
|
"dagre": "^0.8.5",
|
||||||
"dagre-d3": "^0.6.4",
|
"dagre-d3": "^0.6.4",
|
||||||
"dompurify": "2.3.10",
|
"dompurify": "2.4.0",
|
||||||
"fast-clone": "^1.5.13",
|
"fast-clone": "^1.5.13",
|
||||||
"graphlib": "^2.1.8",
|
"graphlib": "^2.1.8",
|
||||||
"khroma": "^2.0.0",
|
"khroma": "^2.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"moment-mini": "^2.24.0",
|
"moment-mini": "^2.24.0",
|
||||||
"non-layered-tidy-tree-layout": "^2.0.2",
|
"non-layered-tidy-tree-layout": "^2.0.2",
|
||||||
"stylis": "^4.0.10"
|
"stylis": "^4.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@applitools/eyes-cypress": "^3.25.7",
|
"@applitools/eyes-cypress": "^3.25.7",
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import { log } from '../logger';
|
import { log } from '../logger';
|
||||||
import { getConfig } from '../config';
|
import { getConfig } from '../config';
|
||||||
import { sanitizeText, evaluate } from '../diagrams/common/common';
|
import { evaluate } from '../diagrams/common/common';
|
||||||
import { decodeEntities } from '../mermaidAPI';
|
import { decodeEntities } from '../mermaidAPI';
|
||||||
|
|
||||||
const sanitizeTxt = (txt) => sanitizeText(txt, getConfig());
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dom
|
* @param dom
|
||||||
* @param styleFn
|
* @param styleFn
|
||||||
|
@@ -6,9 +6,7 @@ import intersect from './intersect/index.js';
|
|||||||
import createLabel from './createLabel';
|
import createLabel from './createLabel';
|
||||||
import note from './shapes/note';
|
import note from './shapes/note';
|
||||||
import { parseMember } from '../diagrams/class/svgDraw';
|
import { parseMember } from '../diagrams/class/svgDraw';
|
||||||
import { evaluate, sanitizeText as sanitize } from '../diagrams/common/common';
|
import { evaluate } from '../diagrams/common/common';
|
||||||
|
|
||||||
const sanitizeText = (txt) => sanitize(txt, getConfig());
|
|
||||||
|
|
||||||
const question = (parent, node) => {
|
const question = (parent, node) => {
|
||||||
const { shapeSvg, bbox } = labelHelper(parent, node, undefined, true);
|
const { shapeSvg, bbox } = labelHelper(parent, node, undefined, true);
|
||||||
@@ -348,7 +346,7 @@ const rect = (parent, node) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const labelRect = (parent, node) => {
|
const labelRect = (parent, node) => {
|
||||||
const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'label', true);
|
const { shapeSvg } = labelHelper(parent, node, 'label', true);
|
||||||
|
|
||||||
log.trace('Classes = ', node.classes);
|
log.trace('Classes = ', node.classes);
|
||||||
// add the rect
|
// add the rect
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import { log } from '../../logger';
|
|
||||||
import { sanitizeText } from '../common/common';
|
import { sanitizeText } from '../common/common';
|
||||||
import { setAccTitle, getAccTitle, getAccDescription, setAccDescription } from '../../commonDb';
|
import { setAccTitle, getAccTitle, getAccDescription, setAccDescription } from '../../commonDb';
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ let boundarys = [
|
|||||||
let rels = [];
|
let rels = [];
|
||||||
let title = '';
|
let title = '';
|
||||||
let wrapEnabled = false;
|
let wrapEnabled = false;
|
||||||
let description = '';
|
|
||||||
let c4ShapeInRow = 4;
|
let c4ShapeInRow = 4;
|
||||||
let c4BoundaryInRow = 2;
|
let c4BoundaryInRow = 2;
|
||||||
var c4Type;
|
var c4Type;
|
||||||
@@ -636,13 +634,13 @@ export const updateLayoutConfig = function (typeC4Shape, c4ShapeInRowParam, c4Bo
|
|||||||
let c4BoundaryInRowValue = c4BoundaryInRow;
|
let c4BoundaryInRowValue = c4BoundaryInRow;
|
||||||
|
|
||||||
if (typeof c4ShapeInRowParam === 'object') {
|
if (typeof c4ShapeInRowParam === 'object') {
|
||||||
let [key, value] = Object.entries(c4ShapeInRowParam)[0];
|
const value = Object.values(c4ShapeInRowParam)[0];
|
||||||
c4ShapeInRowValue = parseInt(value);
|
c4ShapeInRowValue = parseInt(value);
|
||||||
} else {
|
} else {
|
||||||
c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
|
c4ShapeInRowValue = parseInt(c4ShapeInRowParam);
|
||||||
}
|
}
|
||||||
if (typeof c4BoundaryInRowParam === 'object') {
|
if (typeof c4BoundaryInRowParam === 'object') {
|
||||||
let [key, value] = Object.entries(c4BoundaryInRowParam)[0];
|
const value = Object.values(c4BoundaryInRowParam)[0];
|
||||||
c4BoundaryInRowValue = parseInt(value);
|
c4BoundaryInRowValue = parseInt(value);
|
||||||
} else {
|
} else {
|
||||||
c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
|
c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam);
|
||||||
@@ -721,7 +719,6 @@ export const clear = function () {
|
|||||||
boundaryParseStack = [''];
|
boundaryParseStack = [''];
|
||||||
title = '';
|
title = '';
|
||||||
wrapEnabled = false;
|
wrapEnabled = false;
|
||||||
description = '';
|
|
||||||
c4ShapeInRow = 4;
|
c4ShapeInRow = 4;
|
||||||
c4BoundaryInRow = 2;
|
c4BoundaryInRow = 2;
|
||||||
};
|
};
|
||||||
|
@@ -298,7 +298,7 @@ export const drawC4ShapeArray = function (currentBounds, diagram, c4ShapeArray,
|
|||||||
|
|
||||||
currentBounds.insert(c4Shape);
|
currentBounds.insert(c4Shape);
|
||||||
|
|
||||||
const height = svgDraw.drawC4Shape(diagram, c4Shape, conf);
|
svgDraw.drawC4Shape(diagram, c4Shape, conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBounds.bumpLastMargin(conf.c4ShapeMargin);
|
currentBounds.bumpLastMargin(conf.c4ShapeMargin);
|
||||||
@@ -616,7 +616,6 @@ export const draw = function (_text, id, _version, diagObj) {
|
|||||||
globalBoundaryMaxY = conf.diagramMarginY;
|
globalBoundaryMaxY = conf.diagramMarginY;
|
||||||
|
|
||||||
const title = diagObj.db.getTitle();
|
const title = diagObj.db.getTitle();
|
||||||
const c4type = diagObj.db.getC4Type();
|
|
||||||
let currentBoundarys = diagObj.db.getBoundarys('');
|
let currentBoundarys = diagObj.db.getBoundarys('');
|
||||||
// switch (c4type) {
|
// switch (c4type) {
|
||||||
// case 'C4Context':
|
// case 'C4Context':
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import { addFunction } from '../../interactionDb';
|
|
||||||
import { sanitizeUrl } from '@braintree/sanitize-url';
|
import { sanitizeUrl } from '@braintree/sanitize-url';
|
||||||
|
|
||||||
export const drawRect = function (elem, rectData) {
|
export const drawRect = function (elem, rectData) {
|
||||||
|
@@ -3,7 +3,6 @@ import graphlib from 'graphlib';
|
|||||||
import { log } from '../../logger';
|
import { log } from '../../logger';
|
||||||
import { getConfig } from '../../config';
|
import { getConfig } from '../../config';
|
||||||
import { render } from '../../dagre-wrapper/index.js';
|
import { render } from '../../dagre-wrapper/index.js';
|
||||||
// import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js';
|
|
||||||
import { curveLinear } from 'd3';
|
import { curveLinear } from 'd3';
|
||||||
import { interpolateToCurve, getStylesFromArray } from '../../utils';
|
import { interpolateToCurve, getStylesFromArray } from '../../utils';
|
||||||
import { setupGraphViewbox } from '../../setupGraphViewbox';
|
import { setupGraphViewbox } from '../../setupGraphViewbox';
|
||||||
@@ -11,7 +10,6 @@ import common from '../common/common';
|
|||||||
import addSVGAccessibilityFields from '../../accessibility';
|
import addSVGAccessibilityFields from '../../accessibility';
|
||||||
|
|
||||||
let idCache = {};
|
let idCache = {};
|
||||||
const padding = 20;
|
|
||||||
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
||||||
|
|
||||||
@@ -235,20 +233,6 @@ export const addRelations = function (relations, g) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the ID with the same label as in the cache
|
|
||||||
*
|
|
||||||
* @param {string} label The label to look for
|
|
||||||
* @returns {string} The resulting ID
|
|
||||||
*/
|
|
||||||
const getGraphId = function (label) {
|
|
||||||
const foundEntry = Object.entries(idCache).find((entry) => entry[1].label === label);
|
|
||||||
|
|
||||||
if (foundEntry) {
|
|
||||||
return foundEntry[0];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges the value of `conf` with the passed `cnf`
|
* Merges the value of `conf` with the passed `cnf`
|
||||||
*
|
*
|
||||||
|
@@ -10,12 +10,6 @@ import addSVGAccessibilityFields from '../../accessibility';
|
|||||||
let idCache = {};
|
let idCache = {};
|
||||||
const padding = 20;
|
const padding = 20;
|
||||||
|
|
||||||
const confa = {
|
|
||||||
dividerMargin: 10,
|
|
||||||
padding: 5,
|
|
||||||
textHeight: 10,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ID with the same label as in the cache
|
* Gets the ID with the same label as in the cache
|
||||||
*
|
*
|
||||||
@@ -163,7 +157,6 @@ export const draw = function (text, id, _version, diagObj) {
|
|||||||
securityLevel === 'sandbox'
|
securityLevel === 'sandbox'
|
||||||
? select(sandboxElement.nodes()[0].contentDocument.body)
|
? select(sandboxElement.nodes()[0].contentDocument.body)
|
||||||
: select('body');
|
: select('body');
|
||||||
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
|
|
||||||
// Fetch the default direction, use TD if none was found
|
// Fetch the default direction, use TD if none was found
|
||||||
const diagram = root.select(`[id='${id}']`);
|
const diagram = root.select(`[id='${id}']`);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { log } from '../../logger';
|
import { log } from '../../logger';
|
||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import common from '../common/common';
|
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getAccTitle,
|
getAccTitle,
|
||||||
@@ -12,8 +12,6 @@ import {
|
|||||||
|
|
||||||
let entities = {};
|
let entities = {};
|
||||||
let relationships = [];
|
let relationships = [];
|
||||||
let title = '';
|
|
||||||
let description = '';
|
|
||||||
|
|
||||||
const Cardinality = {
|
const Cardinality = {
|
||||||
ZERO_OR_ONE: 'ZERO_OR_ONE',
|
ZERO_OR_ONE: 'ZERO_OR_ONE',
|
||||||
@@ -78,7 +76,6 @@ const getRelationships = () => relationships;
|
|||||||
const clear = function () {
|
const clear = function () {
|
||||||
entities = {};
|
entities = {};
|
||||||
relationships = [];
|
relationships = [];
|
||||||
title = '';
|
|
||||||
commonClear();
|
commonClear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,8 +29,6 @@ export const setConf = function (cnf) {
|
|||||||
* @param diagObj
|
* @param diagObj
|
||||||
*/
|
*/
|
||||||
export const addVertices = function (vert, g, svgId, root, _doc, diagObj) {
|
export const addVertices = function (vert, g, svgId, root, _doc, diagObj) {
|
||||||
const securityLevel = getConfig().securityLevel;
|
|
||||||
|
|
||||||
const svg = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`);
|
const svg = !root ? select(`[id="${svgId}"]`) : root.select(`[id="${svgId}"]`);
|
||||||
const doc = !_doc ? document : _doc;
|
const doc = !_doc ? document : _doc;
|
||||||
const keys = Object.keys(vert);
|
const keys = Object.keys(vert);
|
||||||
|
@@ -4,7 +4,7 @@ import { log } from '../../logger';
|
|||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import utils from '../../utils';
|
import utils from '../../utils';
|
||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import common from '../common/common';
|
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getAccTitle,
|
getAccTitle,
|
||||||
@@ -21,8 +21,6 @@ let todayMarker = '';
|
|||||||
let includes = [];
|
let includes = [];
|
||||||
let excludes = [];
|
let excludes = [];
|
||||||
let links = {};
|
let links = {};
|
||||||
let title = '';
|
|
||||||
let accDescription = '';
|
|
||||||
let sections = [];
|
let sections = [];
|
||||||
let tasks = [];
|
let tasks = [];
|
||||||
let currentSection = '';
|
let currentSection = '';
|
||||||
@@ -34,10 +32,6 @@ let topAxis = false;
|
|||||||
// The serial order of the task in the script
|
// The serial order of the task in the script
|
||||||
let lastOrder = 0;
|
let lastOrder = 0;
|
||||||
|
|
||||||
const sanitizeText = function (txt) {
|
|
||||||
return common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
};
|
|
||||||
|
|
||||||
export const parseDirective = function (statement, context, type) {
|
export const parseDirective = function (statement, context, type) {
|
||||||
mermaidAPI.parseDirective(this, statement, context, type);
|
mermaidAPI.parseDirective(this, statement, context, type);
|
||||||
};
|
};
|
||||||
@@ -47,7 +41,6 @@ export const clear = function () {
|
|||||||
tasks = [];
|
tasks = [];
|
||||||
currentSection = '';
|
currentSection = '';
|
||||||
funs = [];
|
funs = [];
|
||||||
title = '';
|
|
||||||
taskCnt = 0;
|
taskCnt = 0;
|
||||||
lastTask = undefined;
|
lastTask = undefined;
|
||||||
lastTaskID = undefined;
|
lastTaskID = undefined;
|
||||||
@@ -247,7 +240,8 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
|||||||
* - `ms` for milliseconds
|
* - `ms` for milliseconds
|
||||||
*
|
*
|
||||||
* @param {string} str - A string representing the duration.
|
* @param {string} str - A string representing the duration.
|
||||||
* @returns {moment.Duration} A moment duration, including an invalid moment for invalid input string.
|
* @returns {moment.Duration} A moment duration, including an invalid moment for invalid input
|
||||||
|
* string.
|
||||||
*/
|
*/
|
||||||
const parseDuration = function (str) {
|
const parseDuration = function (str) {
|
||||||
const statement = /^(\d+(?:\.\d+)?)([yMwdhms]|ms)$/.exec(str.trim());
|
const statement = /^(\d+(?:\.\d+)?)([yMwdhms]|ms)$/.exec(str.trim());
|
||||||
|
@@ -391,7 +391,6 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
if (securityLevel === 'sandbox') {
|
if (securityLevel === 'sandbox') {
|
||||||
let sandboxElement;
|
let sandboxElement;
|
||||||
sandboxElement = select('#i' + id);
|
sandboxElement = select('#i' + id);
|
||||||
const root = select(sandboxElement.nodes()[0].contentDocument.body);
|
|
||||||
const doc = sandboxElement.nodes()[0].contentDocument;
|
const doc = sandboxElement.nodes()[0].contentDocument;
|
||||||
|
|
||||||
rectangles
|
rectangles
|
||||||
|
@@ -5,7 +5,6 @@ import { getConfig } from '../../config';
|
|||||||
import addSVGAccessibilityFields from '../../accessibility';
|
import addSVGAccessibilityFields from '../../accessibility';
|
||||||
|
|
||||||
let allCommitsDict = {};
|
let allCommitsDict = {};
|
||||||
let branchNum;
|
|
||||||
|
|
||||||
const commitType = {
|
const commitType = {
|
||||||
NORMAL: 0,
|
NORMAL: 0,
|
||||||
@@ -83,7 +82,7 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
|||||||
const sortedKeys = keys.sort((a, b) => {
|
const sortedKeys = keys.sort((a, b) => {
|
||||||
return commits[a].seq - commits[b].seq;
|
return commits[a].seq - commits[b].seq;
|
||||||
});
|
});
|
||||||
sortedKeys.forEach((key, index) => {
|
sortedKeys.forEach((key) => {
|
||||||
const commit = commits[key];
|
const commit = commits[key];
|
||||||
|
|
||||||
const y = branchPos[commit.branch].pos;
|
const y = branchPos[commit.branch].pos;
|
||||||
@@ -292,18 +291,15 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect if there are other commits between commit1's x-position and commit2's x-position on the same
|
* Detect if there are other commits between commit1's x-position and commit2's x-position on the
|
||||||
* branch as commit2.
|
* same branch as commit2.
|
||||||
*
|
*
|
||||||
* @param {any} commit1
|
* @param {any} commit1
|
||||||
* @param {any} commit2
|
* @param {any} commit2
|
||||||
* @param allCommits
|
* @param allCommits
|
||||||
* @returns {boolean} if there are commits between commit1's x-position and commit2's x-position
|
* @returns {boolean} If there are commits between commit1's x-position and commit2's x-position
|
||||||
*/
|
*/
|
||||||
const hasOverlappingCommits = (commit1, commit2, allCommits) => {
|
const hasOverlappingCommits = (commit1, commit2, allCommits) => {
|
||||||
const commit1Pos = commitPos[commit2.id];
|
|
||||||
const commit2Pos = commitPos[commit1.id];
|
|
||||||
|
|
||||||
// Find commits on the same branch as commit2
|
// Find commits on the same branch as commit2
|
||||||
const keys = Object.keys(allCommits);
|
const keys = Object.keys(allCommits);
|
||||||
const overlappingComits = keys.filter((key) => {
|
const overlappingComits = keys.filter((key) => {
|
||||||
@@ -324,7 +320,7 @@ const hasOverlappingCommits = (commit1, commit2, allCommits) => {
|
|||||||
* @param {any} y1
|
* @param {any} y1
|
||||||
* @param {any} y2
|
* @param {any} y2
|
||||||
* @param {any} _depth
|
* @param {any} _depth
|
||||||
* @returns {number} y value between y1 and y2
|
* @returns {number} Y value between y1 and y2
|
||||||
*/
|
*/
|
||||||
const findLane = (y1, y2, _depth) => {
|
const findLane = (y1, y2, _depth) => {
|
||||||
const depth = _depth || 0;
|
const depth = _depth || 0;
|
||||||
@@ -357,25 +353,11 @@ const findLane = (y1, y2, _depth) => {
|
|||||||
* @param {any} allCommits
|
* @param {any} allCommits
|
||||||
*/
|
*/
|
||||||
const drawArrow = (svg, commit1, commit2, allCommits) => {
|
const drawArrow = (svg, commit1, commit2, allCommits) => {
|
||||||
const conf = getConfig();
|
|
||||||
|
|
||||||
const p1 = commitPos[commit1.id];
|
const p1 = commitPos[commit1.id];
|
||||||
const p2 = commitPos[commit2.id];
|
const p2 = commitPos[commit2.id];
|
||||||
const overlappingCommits = hasOverlappingCommits(commit1, commit2, allCommits);
|
const overlappingCommits = hasOverlappingCommits(commit1, commit2, allCommits);
|
||||||
// log.debug('drawArrow', p1, p2, overlappingCommits, commit1.id, commit2.id);
|
// log.debug('drawArrow', p1, p2, overlappingCommits, commit1.id, commit2.id);
|
||||||
|
|
||||||
let url = '';
|
|
||||||
if (conf.arrowMarkerAbsolute) {
|
|
||||||
url =
|
|
||||||
window.location.protocol +
|
|
||||||
'//' +
|
|
||||||
window.location.host +
|
|
||||||
window.location.pathname +
|
|
||||||
window.location.search;
|
|
||||||
url = url.replace(/\(/g, '\\(');
|
|
||||||
url = url.replace(/\)/g, '\\)');
|
|
||||||
}
|
|
||||||
|
|
||||||
let arc = '';
|
let arc = '';
|
||||||
let arc2 = '';
|
let arc2 = '';
|
||||||
let radius = 0;
|
let radius = 0;
|
||||||
@@ -433,7 +415,7 @@ const drawArrow = (svg, commit1, commit2, allCommits) => {
|
|||||||
} ${p2.y}`;
|
} ${p2.y}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const arrow = svg
|
svg
|
||||||
.append('path')
|
.append('path')
|
||||||
.attr('d', lineDef)
|
.attr('d', lineDef)
|
||||||
.attr('class', 'arrow arrow' + (colorClassNum % THEME_COLOR_LIMIT));
|
.attr('class', 'arrow arrow' + (colorClassNum % THEME_COLOR_LIMIT));
|
||||||
@@ -441,10 +423,7 @@ const drawArrow = (svg, commit1, commit2, allCommits) => {
|
|||||||
|
|
||||||
const drawArrows = (svg, commits) => {
|
const drawArrows = (svg, commits) => {
|
||||||
const gArrows = svg.append('g').attr('class', 'commit-arrows');
|
const gArrows = svg.append('g').attr('class', 'commit-arrows');
|
||||||
let pos = 0;
|
Object.keys(commits).forEach((key) => {
|
||||||
|
|
||||||
const k = Object.keys(commits);
|
|
||||||
k.forEach((key, index) => {
|
|
||||||
const commit = commits[key];
|
const commit = commits[key];
|
||||||
if (commit.parents && commit.parents.length > 0) {
|
if (commit.parents && commit.parents.length > 0) {
|
||||||
commit.parents.forEach((parent) => {
|
commit.parents.forEach((parent) => {
|
||||||
|
@@ -27,7 +27,6 @@ export const draw = (text, id, version, diagObj) => {
|
|||||||
securityLevel === 'sandbox'
|
securityLevel === 'sandbox'
|
||||||
? select(sandboxElement.nodes()[0].contentDocument.body)
|
? select(sandboxElement.nodes()[0].contentDocument.body)
|
||||||
: select('body');
|
: select('body');
|
||||||
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
|
|
||||||
// Parse the graph definition
|
// Parse the graph definition
|
||||||
// parser.parse(text);
|
// parser.parse(text);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import { log, getConfig, setupGraphViewbox } from '../../diagram-api/diagramAPI';
|
import { log, getConfig, setupGraphViewbox } from '../../diagram-api/diagramAPI';
|
||||||
import svgDraw from './svgDraw';
|
import svgDraw from './svgDraw';
|
||||||
import { BoundingBox, Layout, Tree } from 'non-layered-tidy-tree-layout';
|
import { BoundingBox, Layout } from 'non-layered-tidy-tree-layout';
|
||||||
import clone from 'fast-clone';
|
import clone from 'fast-clone';
|
||||||
import * as db from './mindmapDb';
|
import * as db from './mindmapDb';
|
||||||
|
|
||||||
@@ -192,8 +192,7 @@ function layoutMindmap(node, conf) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Merge the trees into a single tree
|
// Merge the trees into a single tree
|
||||||
const result = mergeTrees(node, trees);
|
mergeTrees(node, trees);
|
||||||
eachNode;
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -232,13 +231,11 @@ export const draw = (text, id, version, diagObj) => {
|
|||||||
securityLevel === 'sandbox'
|
securityLevel === 'sandbox'
|
||||||
? select(sandboxElement.nodes()[0].contentDocument.body)
|
? select(sandboxElement.nodes()[0].contentDocument.body)
|
||||||
: select('body');
|
: select('body');
|
||||||
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
|
|
||||||
// Parse the graph definition
|
// Parse the graph definition
|
||||||
|
|
||||||
const svg = root.select('#' + id);
|
const svg = root.select('#' + id);
|
||||||
|
|
||||||
const g = svg.append('g');
|
svg.append('g');
|
||||||
const mm = diagObj.db.getMindmap();
|
const mm = diagObj.db.getMindmap();
|
||||||
|
|
||||||
// Draw the graph and start with drawing the nodes without proper position
|
// Draw the graph and start with drawing the nodes without proper position
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { darken, lighten, adjust, invert, isDark } from 'khroma';
|
import { darken, lighten, isDark } from 'khroma';
|
||||||
|
|
||||||
const genSections = (options) => {
|
const genSections = (options) => {
|
||||||
let sections = '';
|
let sections = '';
|
||||||
|
@@ -13,8 +13,6 @@ import {
|
|||||||
} from '../../commonDb';
|
} from '../../commonDb';
|
||||||
|
|
||||||
let sections = {};
|
let sections = {};
|
||||||
let title = '';
|
|
||||||
let description = '';
|
|
||||||
let showData = false;
|
let showData = false;
|
||||||
|
|
||||||
export const parseDirective = function (statement, context, type) {
|
export const parseDirective = function (statement, context, type) {
|
||||||
@@ -49,7 +47,6 @@ const cleanupValue = function (value) {
|
|||||||
|
|
||||||
const clear = function () {
|
const clear = function () {
|
||||||
sections = {};
|
sections = {};
|
||||||
title = '';
|
|
||||||
showData = false;
|
showData = false;
|
||||||
commonClear();
|
commonClear();
|
||||||
};
|
};
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import { log } from '../../logger';
|
import { log } from '../../logger';
|
||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import common from '../common/common';
|
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getAccTitle,
|
getAccTitle,
|
||||||
@@ -15,10 +15,6 @@ let latestRequirement = {};
|
|||||||
let requirements = {};
|
let requirements = {};
|
||||||
let latestElement = {};
|
let latestElement = {};
|
||||||
let elements = {};
|
let elements = {};
|
||||||
let title = '';
|
|
||||||
let accDescription = '';
|
|
||||||
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
|
|
||||||
const RequirementType = {
|
const RequirementType = {
|
||||||
REQUIREMENT: 'Requirement',
|
REQUIREMENT: 'Requirement',
|
||||||
|
@@ -320,7 +320,6 @@ export const draw = (text, id, _version, diagObj) => {
|
|||||||
securityLevel === 'sandbox'
|
securityLevel === 'sandbox'
|
||||||
? select(sandboxElement.nodes()[0].contentDocument.body)
|
? select(sandboxElement.nodes()[0].contentDocument.body)
|
||||||
: select('body');
|
: select('body');
|
||||||
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
|
|
||||||
const svg = root.select(`[id='${id}']`);
|
const svg = root.select(`[id='${id}']`);
|
||||||
markers.insertLineEndings(svg, conf);
|
markers.insertLineEndings(svg, conf);
|
||||||
|
@@ -16,8 +16,6 @@ let prevActor = undefined;
|
|||||||
let actors = {};
|
let actors = {};
|
||||||
let messages = [];
|
let messages = [];
|
||||||
const notes = [];
|
const notes = [];
|
||||||
let diagramTitle = '';
|
|
||||||
let description = '';
|
|
||||||
let sequenceNumbersEnabled = false;
|
let sequenceNumbersEnabled = false;
|
||||||
let wrapEnabled;
|
let wrapEnabled;
|
||||||
|
|
||||||
@@ -153,7 +151,6 @@ export const clear = function () {
|
|||||||
actors = {};
|
actors = {};
|
||||||
messages = [];
|
messages = [];
|
||||||
sequenceNumbersEnabled = false;
|
sequenceNumbersEnabled = false;
|
||||||
diagramTitle = '';
|
|
||||||
commonClear();
|
commonClear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -11,8 +11,6 @@ import {
|
|||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
} from '../../commonDb';
|
} from '../../commonDb';
|
||||||
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
|
|
||||||
const clone = (o) => JSON.parse(JSON.stringify(o));
|
const clone = (o) => JSON.parse(JSON.stringify(o));
|
||||||
let rootDoc = [];
|
let rootDoc = [];
|
||||||
|
|
||||||
@@ -121,10 +119,6 @@ let documents = {
|
|||||||
let currentDocument = documents.root;
|
let currentDocument = documents.root;
|
||||||
|
|
||||||
let startCnt = 0;
|
let startCnt = 0;
|
||||||
let endCnt = 0; // let stateCnt = 0;
|
|
||||||
|
|
||||||
let title = 'State diagram';
|
|
||||||
let description = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called by parser when a node definition has been found.
|
* Function called by parser when a node definition has been found.
|
||||||
@@ -179,7 +173,6 @@ export const clear = function (saveCommon) {
|
|||||||
currentDocument = documents.root;
|
currentDocument = documents.root;
|
||||||
|
|
||||||
startCnt = 0;
|
startCnt = 0;
|
||||||
endCnt = 0;
|
|
||||||
classes = [];
|
classes = [];
|
||||||
if (!saveCommon) {
|
if (!saveCommon) {
|
||||||
commonClear();
|
commonClear();
|
||||||
@@ -211,7 +204,6 @@ export const addRelation = function (_id1, _id2, title) {
|
|||||||
type1 = 'start';
|
type1 = 'start';
|
||||||
}
|
}
|
||||||
if (_id2 === '[*]') {
|
if (_id2 === '[*]') {
|
||||||
endCnt++;
|
|
||||||
id2 = 'end' + startCnt;
|
id2 = 'end' + startCnt;
|
||||||
type2 = 'end';
|
type2 = 'end';
|
||||||
}
|
}
|
||||||
|
@@ -283,7 +283,6 @@ export const draw = function (text, id, _version, diag) {
|
|||||||
securityLevel === 'sandbox'
|
securityLevel === 'sandbox'
|
||||||
? select(sandboxElement.nodes()[0].contentDocument.body)
|
? select(sandboxElement.nodes()[0].contentDocument.body)
|
||||||
: select('body');
|
: select('body');
|
||||||
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
|
||||||
const svg = root.select(`[id="${id}"]`);
|
const svg = root.select(`[id="${id}"]`);
|
||||||
|
|
||||||
// Run the renderer. This is what draws the final graph.
|
// Run the renderer. This is what draws the final graph.
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import common from '../common/common';
|
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getAccTitle,
|
getAccTitle,
|
||||||
@@ -11,10 +10,6 @@ import {
|
|||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
} from '../../commonDb';
|
} from '../../commonDb';
|
||||||
|
|
||||||
const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
|
|
||||||
let title = '';
|
|
||||||
let description = '';
|
|
||||||
let currentSection = '';
|
let currentSection = '';
|
||||||
|
|
||||||
const sections = [];
|
const sections = [];
|
||||||
@@ -29,8 +24,6 @@ export const clear = function () {
|
|||||||
sections.length = 0;
|
sections.length = 0;
|
||||||
tasks.length = 0;
|
tasks.length = 0;
|
||||||
currentSection = '';
|
currentSection = '';
|
||||||
title = '';
|
|
||||||
description = '';
|
|
||||||
rawTasks.length = 0;
|
rawTasks.length = 0;
|
||||||
commonClear();
|
commonClear();
|
||||||
};
|
};
|
||||||
|
16
src/utils.ts
16
src/utils.ts
@@ -40,7 +40,6 @@ const directive =
|
|||||||
/[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
/[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
||||||
const directiveWithoutOpen =
|
const directiveWithoutOpen =
|
||||||
/\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
/\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
||||||
const anyComment = /\s*%%.*\n/gm;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function detectInit Detects the init config object from the text
|
* @function detectInit Detects the init config object from the text
|
||||||
@@ -308,7 +307,6 @@ const calcLabelPosition = (points) => {
|
|||||||
|
|
||||||
const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
|
||||||
let prevPoint;
|
let prevPoint;
|
||||||
let totalDistance = 0;
|
|
||||||
log.info('our points', points);
|
log.info('our points', points);
|
||||||
if (points[0] !== initialPosition) {
|
if (points[0] !== initialPosition) {
|
||||||
points = points.reverse();
|
points = points.reverse();
|
||||||
@@ -368,7 +366,6 @@ const calcTerminalLabelPosition = (terminalMarkerSize, position, _points) => {
|
|||||||
// Todo looking to faster cloning method
|
// Todo looking to faster cloning method
|
||||||
let points = JSON.parse(JSON.stringify(_points));
|
let points = JSON.parse(JSON.stringify(_points));
|
||||||
let prevPoint;
|
let prevPoint;
|
||||||
let totalDistance = 0;
|
|
||||||
log.info('our points', points);
|
log.info('our points', points);
|
||||||
if (position !== 'start_left' && position !== 'start_right') {
|
if (position !== 'start_left' && position !== 'start_right') {
|
||||||
points = points.reverse();
|
points = points.reverse();
|
||||||
@@ -707,19 +704,6 @@ export const calculateTextDimensions = memoize(
|
|||||||
(text, config) => `${text}${config.fontSize}${config.fontWeight}${config.fontFamily}`
|
(text, config) => `${text}${config.fontSize}${config.fontWeight}${config.fontFamily}`
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Applys d3 attributes
|
|
||||||
*
|
|
||||||
* @param {any} d3Elem D3 Element to apply the attributes onto
|
|
||||||
* @param {[string, string][]} attrs Object.keys equivalent format of key to value mapping of
|
|
||||||
* attributes
|
|
||||||
*/
|
|
||||||
const d3Attrs = function (d3Elem, attrs) {
|
|
||||||
for (const attr of attrs) {
|
|
||||||
d3Elem.attr(attr[0], attr[1]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const initIdGenerator = class iterator {
|
export const initIdGenerator = class iterator {
|
||||||
constructor(deterministic, seed) {
|
constructor(deterministic, seed) {
|
||||||
this.deterministic = deterministic;
|
this.deterministic = deterministic;
|
||||||
|
16
yarn.lock
16
yarn.lock
@@ -4955,10 +4955,10 @@ domhandler@^5.0.1, domhandler@^5.0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
domelementtype "^2.3.0"
|
domelementtype "^2.3.0"
|
||||||
|
|
||||||
dompurify@2.3.10:
|
dompurify@2.4.0:
|
||||||
version "2.3.10"
|
version "2.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.10.tgz#901f7390ffe16a91a5a556b94043314cd4850385"
|
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.0.tgz#c9c88390f024c2823332615c9e20a453cf3825dd"
|
||||||
integrity sha512-o7Fg/AgC7p/XpKjf/+RC3Ok6k4St5F7Q6q6+Nnm3p2zGWioAY6dh0CbbuwOhH2UcSzKsdniE/YnE2/92JcsA+g==
|
integrity sha512-Be9tbQMZds4a3C6xTmz68NlMfeONA//4dOavl/1rNw50E+/QO0KVpbcU0PcaW0nsQxurXls9ZocqFxk8R2mWEA==
|
||||||
|
|
||||||
domutils@^3.0.1:
|
domutils@^3.0.1:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
@@ -10789,10 +10789,10 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
|
|||||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
||||||
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
|
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
|
||||||
|
|
||||||
stylis@^4.0.10:
|
stylis@^4.1.2:
|
||||||
version "4.1.1"
|
version "4.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.1.tgz#e46c6a9bbf7c58db1e65bb730be157311ae1fe12"
|
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.2.tgz#870b3c1c2275f51b702bb3da9e94eedad87bba41"
|
||||||
integrity sha512-lVrM/bNdhVX2OgBFNa2YJ9Lxj7kPzylieHd3TNjuGE0Re9JB7joL5VUKOVH1kdNNJTgGPpT8hmwIAPLaSyEVFQ==
|
integrity sha512-Nn2CCrG2ZaFziDxaZPN43CXqn+j7tcdjPFCkRBkFue8QYXC2HdEwnw5TCBo4yQZ2WxKYeSi0fdoOrtEqgDrXbA==
|
||||||
|
|
||||||
subarg@^1.0.0:
|
subarg@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
|
Reference in New Issue
Block a user