mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-28 04:36:45 +02:00
Compare commits
20 Commits
@mermaid-j
...
sidv/clean
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6462f73bdb | ||
![]() |
cfe1723c6c | ||
![]() |
6d8b936319 | ||
![]() |
f992d95082 | ||
![]() |
f2276f93cd | ||
![]() |
b52f5058c9 | ||
![]() |
5e20087252 | ||
![]() |
b49036068f | ||
![]() |
5f3d4cb913 | ||
![]() |
b11eb93ab2 | ||
![]() |
e4f19480cd | ||
![]() |
a331a958c0 | ||
![]() |
134fca3f1d | ||
![]() |
ef7c0a1936 | ||
![]() |
2c5403c0f9 | ||
![]() |
3b0cb1271e | ||
![]() |
96c06a681d | ||
![]() |
ff9d26bc70 | ||
![]() |
2ddc3403de | ||
![]() |
4535911a3a |
@@ -22,7 +22,7 @@ const batchId: string =
|
|||||||
'mermaid-batch-' +
|
'mermaid-batch-' +
|
||||||
(Cypress.env('useAppli')
|
(Cypress.env('useAppli')
|
||||||
? Date.now().toString()
|
? Date.now().toString()
|
||||||
: Cypress.env('CYPRESS_COMMIT') || Date.now().toString());
|
: (Cypress.env('CYPRESS_COMMIT') ?? Date.now().toString()));
|
||||||
|
|
||||||
export const mermaidUrl = (
|
export const mermaidUrl = (
|
||||||
graphStr: string | string[],
|
graphStr: string | string[],
|
||||||
@@ -61,9 +61,7 @@ export const imgSnapshotTest = (
|
|||||||
sequence: {
|
sequence: {
|
||||||
...(_options.sequence ?? {}),
|
...(_options.sequence ?? {}),
|
||||||
actorFontFamily: 'courier',
|
actorFontFamily: 'courier',
|
||||||
noteFontFamily: _options.sequence?.noteFontFamily
|
noteFontFamily: _options.sequence?.noteFontFamily ?? 'courier',
|
||||||
? _options.sequence.noteFontFamily
|
|
||||||
: 'courier',
|
|
||||||
messageFontFamily: 'courier',
|
messageFontFamily: 'courier',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -14,7 +14,7 @@ looks.forEach((look) => {
|
|||||||
directions.forEach((direction) => {
|
directions.forEach((direction) => {
|
||||||
forms.forEach((form) => {
|
forms.forEach((form) => {
|
||||||
labelPos.forEach((pos) => {
|
labelPos.forEach((pos) => {
|
||||||
describe(`Test iconShape in ${form ? `${form} form,` : ''} ${look} look and dir ${direction} with label position ${pos ? pos : 'not defined'}`, () => {
|
describe(`Test iconShape in ${form ? `${form} form,` : ''} ${look} look and dir ${direction} with label position ${pos ?? 'not defined'}`, () => {
|
||||||
it(`without label`, () => {
|
it(`without label`, () => {
|
||||||
let flowchartCode = `flowchart ${direction}\n`;
|
let flowchartCode = `flowchart ${direction}\n`;
|
||||||
flowchartCode += ` nA --> nAA@{ icon: 'fa:bell'`;
|
flowchartCode += ` nA --> nAA@{ icon: 'fa:bell'`;
|
||||||
|
@@ -12,7 +12,7 @@ const labelPos = [undefined, 't', 'b'] as const;
|
|||||||
looks.forEach((look) => {
|
looks.forEach((look) => {
|
||||||
directions.forEach((direction) => {
|
directions.forEach((direction) => {
|
||||||
labelPos.forEach((pos) => {
|
labelPos.forEach((pos) => {
|
||||||
describe(`Test imageShape in ${look} look and dir ${direction} with label position ${pos ? pos : 'not defined'}`, () => {
|
describe(`Test imageShape in ${look} look and dir ${direction} with label position ${pos ?? 'not defined'}`, () => {
|
||||||
it(`without label`, () => {
|
it(`without label`, () => {
|
||||||
let flowchartCode = `flowchart ${direction}\n`;
|
let flowchartCode = `flowchart ${direction}\n`;
|
||||||
flowchartCode += ` nA --> A@{ img: 'https://cdn.pixabay.com/photo/2020/02/22/18/49/paper-4871356_1280.jpg', w: '100', h: '100' }\n`;
|
flowchartCode += ` nA --> A@{ img: 'https://cdn.pixabay.com/photo/2020/02/22/18/49/paper-4871356_1280.jpg', w: '100', h: '100' }\n`;
|
||||||
|
@@ -214,7 +214,7 @@ section Checkout from website
|
|||||||
$lines.each((index, el) => {
|
$lines.each((index, el) => {
|
||||||
const bbox = el.getBBox();
|
const bbox = el.getBBox();
|
||||||
expect(bbox.width).to.be.lte(320);
|
expect(bbox.width).to.be.lte(320);
|
||||||
maxLineWidth = Math.max(maxLineWidth || 0, bbox.width);
|
maxLineWidth = Math.max(maxLineWidth ?? 0, bbox.width);
|
||||||
});
|
});
|
||||||
|
|
||||||
/** The expected margin between the diagram and the legend is 150px, as defined by
|
/** The expected margin between the diagram and the legend is 150px, as defined by
|
||||||
|
@@ -190,9 +190,7 @@ export const render = async (
|
|||||||
const children = nodeArr.filter((node: { parentId: any }) => node.parentId === subgraph.id);
|
const children = nodeArr.filter((node: { parentId: any }) => node.parentId === subgraph.id);
|
||||||
children.forEach((node: any) => {
|
children.forEach((node: any) => {
|
||||||
parentLookupDb.parentById[node.id] = subgraph.id;
|
parentLookupDb.parentById[node.id] = subgraph.id;
|
||||||
if (parentLookupDb.childrenById[subgraph.id] === undefined) {
|
parentLookupDb.childrenById[subgraph.id] ??= [];
|
||||||
parentLookupDb.childrenById[subgraph.id] = [];
|
|
||||||
}
|
|
||||||
parentLookupDb.childrenById[subgraph.id].push(node);
|
parentLookupDb.childrenById[subgraph.id].push(node);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -381,10 +379,10 @@ export const render = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
edgeData.labelType = edge.labelType;
|
edgeData.labelType = edge.labelType;
|
||||||
edgeData.label = (edge?.text || '').replace(common.lineBreakRegex, '\n');
|
edgeData.label = (edge?.text ?? '').replace(common.lineBreakRegex, '\n');
|
||||||
|
|
||||||
if (edge.style === undefined) {
|
if (edge.style === undefined) {
|
||||||
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
edgeData.style = edgeData.style ?? 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
|
||||||
@@ -725,9 +723,7 @@ export const render = async (
|
|||||||
inter = inter2;
|
inter = inter2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!inter) {
|
inter ??= intersection(bounds, lastPointOutside, point);
|
||||||
inter = intersection(bounds, lastPointOutside, point);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check case where the intersection is the same as the last point
|
// Check case where the intersection is the same as the last point
|
||||||
let pointPresent = false;
|
let pointPresent = false;
|
||||||
@@ -840,8 +836,8 @@ export const render = async (
|
|||||||
node.labels = [
|
node.labels = [
|
||||||
{
|
{
|
||||||
text: node.label,
|
text: node.label,
|
||||||
width: node?.labelData?.width || 50,
|
width: node?.labelData?.width ?? 50,
|
||||||
height: node?.labelData?.height || 50,
|
height: node?.labelData?.height ?? 50,
|
||||||
},
|
},
|
||||||
(node.width = node.width + 2 * node.padding),
|
(node.width = node.width + 2 * node.padding),
|
||||||
log.debug('UIO node label', node?.labelData?.width, node.padding),
|
log.debug('UIO node label', node?.labelData?.width, node.padding),
|
||||||
@@ -917,7 +913,7 @@ export const render = async (
|
|||||||
if (edge.sections) {
|
if (edge.sections) {
|
||||||
const src = edge.sections[0].startPoint;
|
const src = edge.sections[0].startPoint;
|
||||||
const dest = edge.sections[0].endPoint;
|
const dest = edge.sections[0].endPoint;
|
||||||
const segments = edge.sections[0].bendPoints ? edge.sections[0].bendPoints : [];
|
const segments = edge.sections[0].bendPoints ?? [];
|
||||||
|
|
||||||
const segPoints = segments.map((segment: { x: any; y: any }) => {
|
const segPoints = segments.map((segment: { x: any; y: any }) => {
|
||||||
return { x: segment.x + offset.x, y: segment.y + offset.y };
|
return { x: segment.x + offset.x, y: segment.y + offset.y };
|
||||||
|
@@ -30,7 +30,7 @@ export const updateCurrentConfig = (siteCfg: MermaidConfig, _directives: Mermaid
|
|||||||
if (sumOfDirectives.theme && sumOfDirectives.theme in theme) {
|
if (sumOfDirectives.theme && sumOfDirectives.theme in theme) {
|
||||||
const tmpConfigFromInitialize = assignWithDepth({}, configFromInitialize);
|
const tmpConfigFromInitialize = assignWithDepth({}, configFromInitialize);
|
||||||
const themeVariables = assignWithDepth(
|
const themeVariables = assignWithDepth(
|
||||||
tmpConfigFromInitialize.themeVariables || {},
|
tmpConfigFromInitialize.themeVariables ?? {},
|
||||||
sumOfDirectives.themeVariables
|
sumOfDirectives.themeVariables
|
||||||
);
|
);
|
||||||
if (cfg.theme && cfg.theme in theme) {
|
if (cfg.theme && cfg.theme in theme) {
|
||||||
|
@@ -238,7 +238,7 @@ let clusterElems = {};
|
|||||||
|
|
||||||
export const insertCluster = (elem, node) => {
|
export const insertCluster = (elem, node) => {
|
||||||
log.trace('Inserting cluster');
|
log.trace('Inserting cluster');
|
||||||
const shape = node.shape || 'rect';
|
const shape = node.shape ?? 'rect';
|
||||||
clusterElems[node.id] = shapes[shape](elem, node);
|
clusterElems[node.id] = shapes[shape](elem, node);
|
||||||
};
|
};
|
||||||
export const getClusterTitleWidth = (elem, node) => {
|
export const getClusterTitleWidth = (elem, node) => {
|
||||||
|
@@ -45,7 +45,7 @@ function addHtmlLabel(node) {
|
|||||||
* @deprecated svg-util/createText instead
|
* @deprecated svg-util/createText instead
|
||||||
*/
|
*/
|
||||||
const createLabel = (_vertexText, style, isTitle, isNode) => {
|
const createLabel = (_vertexText, style, isTitle, isNode) => {
|
||||||
let vertexText = _vertexText || '';
|
let vertexText = _vertexText ?? '';
|
||||||
if (typeof vertexText === 'object') {
|
if (typeof vertexText === 'object') {
|
||||||
vertexText = vertexText[0];
|
vertexText = vertexText[0];
|
||||||
}
|
}
|
||||||
|
@@ -69,9 +69,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
fo = inner.node().appendChild(startLabelElement);
|
fo = inner.node().appendChild(startLabelElement);
|
||||||
const slBox = startLabelElement.getBBox();
|
const slBox = startLabelElement.getBBox();
|
||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
if (!terminalLabels[edge.id]) {
|
terminalLabels[edge.id] ??= {};
|
||||||
terminalLabels[edge.id] = {};
|
|
||||||
}
|
|
||||||
terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
|
terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
|
||||||
setTerminalWidth(fo, edge.startLabelLeft);
|
setTerminalWidth(fo, edge.startLabelLeft);
|
||||||
}
|
}
|
||||||
@@ -85,9 +83,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
const slBox = startLabelElement.getBBox();
|
const slBox = startLabelElement.getBBox();
|
||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
|
|
||||||
if (!terminalLabels[edge.id]) {
|
terminalLabels[edge.id] ??= {};
|
||||||
terminalLabels[edge.id] = {};
|
|
||||||
}
|
|
||||||
terminalLabels[edge.id].startRight = startEdgeLabelRight;
|
terminalLabels[edge.id].startRight = startEdgeLabelRight;
|
||||||
setTerminalWidth(fo, edge.startLabelRight);
|
setTerminalWidth(fo, edge.startLabelRight);
|
||||||
}
|
}
|
||||||
@@ -102,9 +98,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
|
|
||||||
endEdgeLabelLeft.node().appendChild(endLabelElement);
|
endEdgeLabelLeft.node().appendChild(endLabelElement);
|
||||||
|
|
||||||
if (!terminalLabels[edge.id]) {
|
terminalLabels[edge.id] ??= {};
|
||||||
terminalLabels[edge.id] = {};
|
|
||||||
}
|
|
||||||
terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
|
terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
|
||||||
setTerminalWidth(fo, edge.endLabelLeft);
|
setTerminalWidth(fo, edge.endLabelLeft);
|
||||||
}
|
}
|
||||||
@@ -119,9 +113,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
|
|
||||||
endEdgeLabelRight.node().appendChild(endLabelElement);
|
endEdgeLabelRight.node().appendChild(endLabelElement);
|
||||||
if (!terminalLabels[edge.id]) {
|
terminalLabels[edge.id] ??= {};
|
||||||
terminalLabels[edge.id] = {};
|
|
||||||
}
|
|
||||||
terminalLabels[edge.id].endRight = endEdgeLabelRight;
|
terminalLabels[edge.id].endRight = endEdgeLabelRight;
|
||||||
setTerminalWidth(fo, edge.endLabelRight);
|
setTerminalWidth(fo, edge.endLabelRight);
|
||||||
}
|
}
|
||||||
@@ -141,7 +133,7 @@ function setTerminalWidth(fo, value) {
|
|||||||
|
|
||||||
export const positionEdgeLabel = (edge, paths) => {
|
export const positionEdgeLabel = (edge, paths) => {
|
||||||
log.debug('Moving label abc88 ', edge.id, edge.label, edgeLabels[edge.id], paths);
|
log.debug('Moving label abc88 ', edge.id, edge.label, edgeLabels[edge.id], paths);
|
||||||
let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
|
let path = paths.updatedPath ?? paths.originalPath;
|
||||||
const siteConfig = getConfig();
|
const siteConfig = getConfig();
|
||||||
const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
|
const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
|
||||||
if (edge.label) {
|
if (edge.label) {
|
||||||
|
@@ -4,7 +4,9 @@ import * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';
|
|||||||
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
|
||||||
|
|
||||||
export let clusterDb = {};
|
export let clusterDb = {};
|
||||||
|
/** @type {Record<string, string[]>} */
|
||||||
let descendants = {};
|
let descendants = {};
|
||||||
|
/** @type {Record<string, string>} */
|
||||||
let parents = {};
|
let parents = {};
|
||||||
|
|
||||||
export const clear = () => {
|
export const clear = () => {
|
||||||
|
@@ -15,9 +15,7 @@ const formatClass = (str) => {
|
|||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
const getClassesFromNode = (node, otherClasses) => {
|
const getClassesFromNode = (node, otherClasses) => {
|
||||||
return `${otherClasses ? otherClasses : 'node default'}${formatClass(node.classes)} ${formatClass(
|
return `${otherClasses ?? 'node default'}${formatClass(node.classes)} ${formatClass(node.class)}`;
|
||||||
node.class
|
|
||||||
)}`;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const question = async (parent, node) => {
|
const question = async (parent, node) => {
|
||||||
@@ -57,7 +55,7 @@ const choice = (parent, node) => {
|
|||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', 'node default')
|
.attr('class', 'node default')
|
||||||
.attr('id', node.domId || node.id);
|
.attr('id', node.domId ?? node.id);
|
||||||
|
|
||||||
const s = 28;
|
const s = 28;
|
||||||
const points = [
|
const points = [
|
||||||
@@ -566,7 +564,7 @@ const rectWithTitle = (parent, node) => {
|
|||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', classes)
|
.attr('class', classes)
|
||||||
.attr('id', node.domId || node.id);
|
.attr('id', node.domId ?? node.id);
|
||||||
|
|
||||||
// Create the title label and insert it after the rect
|
// Create the title label and insert it after the rect
|
||||||
const rect = shapeSvg.insert('rect', ':first-child');
|
const rect = shapeSvg.insert('rect', ':first-child');
|
||||||
@@ -808,7 +806,7 @@ const start = (parent, node) => {
|
|||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', 'node default')
|
.attr('class', 'node default')
|
||||||
.attr('id', node.domId || node.id);
|
.attr('id', node.domId ?? node.id);
|
||||||
const circle = shapeSvg.insert('circle', ':first-child');
|
const circle = shapeSvg.insert('circle', ':first-child');
|
||||||
|
|
||||||
// center the circle around its coordinate
|
// center the circle around its coordinate
|
||||||
@@ -827,7 +825,7 @@ const forkJoin = (parent, node, dir) => {
|
|||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', 'node default')
|
.attr('class', 'node default')
|
||||||
.attr('id', node.domId || node.id);
|
.attr('id', node.domId ?? node.id);
|
||||||
|
|
||||||
let width = 70;
|
let width = 70;
|
||||||
let height = 10;
|
let height = 10;
|
||||||
@@ -859,7 +857,7 @@ const end = (parent, node) => {
|
|||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', 'node default')
|
.attr('class', 'node default')
|
||||||
.attr('id', node.domId || node.id);
|
.attr('id', node.domId ?? node.id);
|
||||||
const innerCircle = shapeSvg.insert('circle', ':first-child');
|
const innerCircle = shapeSvg.insert('circle', ':first-child');
|
||||||
const circle = shapeSvg.insert('circle', ':first-child');
|
const circle = shapeSvg.insert('circle', ':first-child');
|
||||||
|
|
||||||
@@ -891,7 +889,7 @@ const class_box = (parent, node) => {
|
|||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
.attr('class', classes)
|
.attr('class', classes)
|
||||||
.attr('id', node.domId || node.id);
|
.attr('id', node.domId ?? node.id);
|
||||||
|
|
||||||
// Create the title label and insert it after the rect
|
// Create the title label and insert it after the rect
|
||||||
const rect = shapeSvg.insert('rect', ':first-child');
|
const rect = shapeSvg.insert('rect', ':first-child');
|
||||||
|
@@ -88,7 +88,7 @@ function positionNodes(db: ArchitectureDB, cy: cytoscape.Core) {
|
|||||||
data.y = node.position().y;
|
data.y = node.position().y;
|
||||||
|
|
||||||
const nodeElem = db.getElementById(data.id);
|
const nodeElem = db.getElementById(data.id);
|
||||||
nodeElem.attr('transform', 'translate(' + (data.x || 0) + ',' + (data.y || 0) + ')');
|
nodeElem.attr('transform', 'translate(' + (data.x ?? 0) + ',' + (data.y ?? 0) + ')');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,9 +82,7 @@ export const setCssClass = function (itemIds: string, cssClassName: string) {
|
|||||||
foundBlock = { id: trimmedId, type: 'na', children: [] } as Block;
|
foundBlock = { id: trimmedId, type: 'na', children: [] } as Block;
|
||||||
blockDatabase.set(trimmedId, foundBlock);
|
blockDatabase.set(trimmedId, foundBlock);
|
||||||
}
|
}
|
||||||
if (!foundBlock.classes) {
|
foundBlock.classes ??= [];
|
||||||
foundBlock.classes = [];
|
|
||||||
}
|
|
||||||
foundBlock.classes.push(cssClassName);
|
foundBlock.classes.push(cssClassName);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -10,7 +10,7 @@ function getNodeFromBlock(block: Block, db: BlockDB, positioned = false) {
|
|||||||
const vertex = block;
|
const vertex = block;
|
||||||
|
|
||||||
let classStr = 'default';
|
let classStr = 'default';
|
||||||
if ((vertex?.classes?.length || 0) > 0) {
|
if ((vertex?.classes?.length ?? 0) > 0) {
|
||||||
classStr = (vertex?.classes ?? []).join(' ');
|
classStr = (vertex?.classes ?? []).join(' ');
|
||||||
}
|
}
|
||||||
classStr = classStr + ' flowchart-label';
|
classStr = classStr + ' flowchart-label';
|
||||||
|
@@ -41,7 +41,7 @@ export class ClassDB implements DiagramDB {
|
|||||||
private namespaces = new Map<string, NamespaceNode>();
|
private namespaces = new Map<string, NamespaceNode>();
|
||||||
private namespaceCounter = 0;
|
private namespaceCounter = 0;
|
||||||
|
|
||||||
private functions: any[] = [];
|
private functions: ((element: Element) => void)[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.functions.push(this.setupToolTips.bind(this));
|
this.functions.push(this.setupToolTips.bind(this));
|
||||||
@@ -477,7 +477,7 @@ export class ClassDB implements DiagramDB {
|
|||||||
let tooltipElem: Selection<HTMLDivElement, unknown, HTMLElement, unknown> =
|
let tooltipElem: Selection<HTMLDivElement, unknown, HTMLElement, unknown> =
|
||||||
select('.mermaidTooltip');
|
select('.mermaidTooltip');
|
||||||
// @ts-expect-error - Incorrect types
|
// @ts-expect-error - Incorrect types
|
||||||
if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
|
if ((tooltipElem._groups ?? tooltipElem)[0][0] === null) {
|
||||||
tooltipElem = select('body')
|
tooltipElem = select('body')
|
||||||
.append('div')
|
.append('div')
|
||||||
.attr('class', 'mermaidTooltip')
|
.attr('class', 'mermaidTooltip')
|
||||||
|
@@ -13,9 +13,7 @@ export const diagram: DiagramDefinition = {
|
|||||||
renderer,
|
renderer,
|
||||||
styles,
|
styles,
|
||||||
init: (cnf) => {
|
init: (cnf) => {
|
||||||
if (!cnf.class) {
|
cnf.class ??= {};
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -13,9 +13,7 @@ export const diagram: DiagramDefinition = {
|
|||||||
renderer,
|
renderer,
|
||||||
styles,
|
styles,
|
||||||
init: (cnf) => {
|
init: (cnf) => {
|
||||||
if (!cnf.class) {
|
cnf.class ??= {};
|
||||||
cnf.class = {};
|
|
||||||
}
|
|
||||||
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -117,7 +117,7 @@ export const addClasses = function (
|
|||||||
style: styles.style,
|
style: styles.style,
|
||||||
id: vertex.id,
|
id: vertex.id,
|
||||||
domId: vertex.domId,
|
domId: vertex.domId,
|
||||||
tooltip: diagObj.db.getTooltip(vertex.id, parent) || '',
|
tooltip: diagObj.db.getTooltip(vertex.id, parent) ?? '',
|
||||||
haveCallback: vertex.haveCallback,
|
haveCallback: vertex.haveCallback,
|
||||||
link: vertex.link,
|
link: vertex.link,
|
||||||
width: vertex.type === 'group' ? 500 : undefined,
|
width: vertex.type === 'group' ? 500 : undefined,
|
||||||
|
@@ -50,9 +50,7 @@ const getNextFittingBlock = (
|
|||||||
row: number,
|
row: number,
|
||||||
bitsPerRow: number
|
bitsPerRow: number
|
||||||
): [Required<PacketBlock>, PacketBlock | undefined] => {
|
): [Required<PacketBlock>, PacketBlock | undefined] => {
|
||||||
if (block.end === undefined) {
|
block.end ??= block.start;
|
||||||
block.end = block.start;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (block.start > block.end) {
|
if (block.start > block.end) {
|
||||||
throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
|
throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
|
||||||
|
@@ -31,9 +31,8 @@ export abstract class AbstractMermaidValueConverter extends DefaultValueConverte
|
|||||||
): ValueType {
|
): ValueType {
|
||||||
let value: ValueType | undefined = this.runCommonConverter(rule, input, cstNode);
|
let value: ValueType | undefined = this.runCommonConverter(rule, input, cstNode);
|
||||||
|
|
||||||
if (value === undefined) {
|
value ??= this.runCustomConverter(rule, input, cstNode);
|
||||||
value = this.runCustomConverter(rule, input, cstNode);
|
|
||||||
}
|
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
return super.runConverter(rule, input, cstNode);
|
return super.runConverter(rule, input, cstNode);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user