Merge branch 'develop' into standardized-pie-definitions

This commit is contained in:
Reda Al Sulais 2023-08-11 01:46:33 +03:00 committed by GitHub
commit 1721282182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 102 deletions

View File

@ -1,23 +1,15 @@
import { DiagramDefinition } from '../../diagram-api/types.js';
import styles from './styles.js';
import renderer from './errorRenderer.js';
export const diagram: DiagramDefinition = {
db: {
clear: () => {
// Quite ok, clear needs to be there for error to work as a regular diagram
},
},
styles,
import type { DiagramDefinition } from '../../diagram-api/types.js';
import { renderer } from './errorRenderer.js';
const diagram: DiagramDefinition = {
db: {},
renderer,
parser: {
parser: { yy: {} },
parse: () => {
// no op
parse: (): void => {
return;
},
},
init: () => {
// no op
},
};
export default diagram;

View File

@ -1,33 +1,23 @@
/** Created by knut on 14-12-11. */
// @ts-ignore TODO: Investigate D3 issue
import { select } from 'd3';
import { log } from '../../logger.js';
import { getErrorMessage } from '../../utils.js';
/**
* Merges the value of `conf` with the passed `cnf`
*
* @param cnf - Config to merge
*/
export const setConf = function () {
// no-op
};
import type { Group, SVG } from '../../diagram-api/types.js';
import { selectSvgElement } from '../../rendering-util/selectSvgElement.js';
import { configureSvgSize } from '../../setupGraphViewbox.js';
/**
* Draws a an info picture in the tag with id: id based on the graph definition in text.
*
* @param _text - Mermaid graph definition.
* @param id - The text for the error
* @param mermaidVersion - The version
* @param version - The version
*/
export const draw = (_text: string, id: string, mermaidVersion: string) => {
try {
log.debug('Renering svg for syntax error\n');
export const draw = (_text: string, id: string, version: string) => {
log.debug('renering svg for syntax error\n');
const svg = select('#' + id);
const g = svg.append('g');
const svg: SVG = selectSvgElement(id);
svg.attr('viewBox', '768 0 912 512');
configureSvgSize(svg, 100, 500, true);
const g: Group = svg.append('g');
g.append('path')
.attr('class', 'error-icon')
.attr(
@ -83,18 +73,9 @@ export const draw = (_text: string, id: string, mermaidVersion: string) => {
.attr('y', 400)
.attr('font-size', '100px')
.style('text-anchor', 'middle')
.text('mermaid version ' + mermaidVersion);
svg.attr('height', 100);
svg.attr('width', 500);
svg.attr('viewBox', '768 0 912 512');
} catch (e) {
log.error('Error while rendering info diagram');
log.error(getErrorMessage(e));
}
.text(`mermaid version ${version}`);
};
export default {
setConf,
draw,
};
export const renderer = { draw };
export default renderer;

View File

@ -1,3 +0,0 @@
const getStyles = () => ``;
export default getStyles;

View File

@ -19,7 +19,6 @@ import classDiagram from './diagrams/class/styles.js';
import flowchart from './diagrams/flowchart/styles.js';
import flowchartElk from './diagrams/flowchart/elk/styles.js';
import er from './diagrams/er/styles.js';
import error from './diagrams/error/styles.js';
import git from './diagrams/git/styles.js';
import gantt from './diagrams/gantt/styles.js';
import pie from './diagrams/pie/pieStyles.js';
@ -86,7 +85,6 @@ describe('styles', () => {
c4,
classDiagram,
er,
error,
flowchart,
flowchartElk,
gantt,