mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-06 15:49:44 +02:00
fix lint & typescript issues
This commit is contained in:
@@ -105,6 +105,26 @@ export interface ExternalDiagramDefinition {
|
|||||||
export type DiagramDetector = (text: string, config?: MermaidConfig) => boolean;
|
export type DiagramDetector = (text: string, config?: MermaidConfig) => boolean;
|
||||||
export type DiagramLoader = () => Promise<{ id: string; diagram: DiagramDefinition }>;
|
export type DiagramLoader = () => Promise<{ id: string; diagram: DiagramDefinition }>;
|
||||||
|
|
||||||
|
/* Types for the positions used in the free layout engine */
|
||||||
|
interface Point {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NodePosition extends Point {
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EdgePoints {
|
||||||
|
points: Point[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Positions {
|
||||||
|
nodes: Record<string, NodePosition>;
|
||||||
|
edges: Record<string, EdgePoints>;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type for function draws diagram in the tag with id: id based on the graph definition in text.
|
* Type for function draws diagram in the tag with id: id based on the graph definition in text.
|
||||||
*
|
*
|
||||||
|
@@ -20,7 +20,7 @@ import type { MermaidConfig } from './config.type.js';
|
|||||||
import { evaluate } from './diagrams/common/common.js';
|
import { evaluate } from './diagrams/common/common.js';
|
||||||
import isEmpty from 'lodash-es/isEmpty.js';
|
import isEmpty from 'lodash-es/isEmpty.js';
|
||||||
import { setA11yDiagramInfo, addSVGa11yTitleDescription } from './accessibility.js';
|
import { setA11yDiagramInfo, addSVGa11yTitleDescription } from './accessibility.js';
|
||||||
import type { DiagramMetadata, DiagramStyleClassDef } from './diagram-api/types.js';
|
import type { DiagramMetadata, DiagramStyleClassDef, Positions } from './diagram-api/types.js';
|
||||||
import { preprocessDiagram } from './preprocess.js';
|
import { preprocessDiagram } from './preprocess.js';
|
||||||
import { decodeEntities } from './utils.js';
|
import { decodeEntities } from './utils.js';
|
||||||
import { toBase64 } from './utils/base64.js';
|
import { toBase64 } from './utils/base64.js';
|
||||||
@@ -307,7 +307,7 @@ const render = async function (
|
|||||||
id: string,
|
id: string,
|
||||||
text: string,
|
text: string,
|
||||||
svgContainingElement?: Element,
|
svgContainingElement?: Element,
|
||||||
positions: any
|
positions?: Positions
|
||||||
): Promise<RenderResult> {
|
): Promise<RenderResult> {
|
||||||
addDiagrams();
|
addDiagrams();
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import type { SVG } from '$root/diagram-api/types.js';
|
import type { Positions, SVG } from '$root/diagram-api/types.js';
|
||||||
import type { InternalHelpers } from '$root/internals.js';
|
import type { InternalHelpers } from '$root/internals.js';
|
||||||
import { internalHelpers } from '$root/internals.js';
|
import { internalHelpers } from '$root/internals.js';
|
||||||
import { log } from '$root/logger.js';
|
import { log } from '$root/logger.js';
|
||||||
@@ -14,7 +14,7 @@ export interface LayoutAlgorithm {
|
|||||||
svg: SVG,
|
svg: SVG,
|
||||||
helpers: InternalHelpers,
|
helpers: InternalHelpers,
|
||||||
options?: RenderOptions,
|
options?: RenderOptions,
|
||||||
positions: any
|
positions?: Positions
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ export const rect_left_inv_arrow = async (
|
|||||||
): Promise<SVGAElement> => {
|
): Promise<SVGAElement> => {
|
||||||
const { labelStyles, nodeStyles } = styles2String(node);
|
const { labelStyles, nodeStyles } = styles2String(node);
|
||||||
node.labelStyle = labelStyles;
|
node.labelStyle = labelStyles;
|
||||||
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
|
const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node));
|
||||||
const nodePadding = node.padding ?? 0;
|
const nodePadding = node.padding ?? 0;
|
||||||
const labelPaddingX = node.look === 'neo' ? nodePadding * 3 : node.padding;
|
const labelPaddingX = node.look === 'neo' ? nodePadding * 3 : node.padding;
|
||||||
const labelPaddingY = node.look === 'neo' ? nodePadding * 1.5 : node.padding;
|
const labelPaddingY = node.look === 'neo' ? nodePadding * 1.5 : node.padding;
|
||||||
|
@@ -15,6 +15,9 @@ const getStyles = (
|
|||||||
errorTextColor: string;
|
errorTextColor: string;
|
||||||
lineColor: string;
|
lineColor: string;
|
||||||
useGradient: boolean;
|
useGradient: boolean;
|
||||||
|
dropShadow: string;
|
||||||
|
primaryBorderColor: string;
|
||||||
|
compositeTitleBackground: string;
|
||||||
} & FlowChartStyleOptions,
|
} & FlowChartStyleOptions,
|
||||||
svgId: string
|
svgId: string
|
||||||
) => {
|
) => {
|
||||||
|
Reference in New Issue
Block a user