mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-03 06:09:45 +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 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.
|
||||
*
|
||||
|
@@ -20,7 +20,7 @@ import type { MermaidConfig } from './config.type.js';
|
||||
import { evaluate } from './diagrams/common/common.js';
|
||||
import isEmpty from 'lodash-es/isEmpty.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 { decodeEntities } from './utils.js';
|
||||
import { toBase64 } from './utils/base64.js';
|
||||
@@ -307,7 +307,7 @@ const render = async function (
|
||||
id: string,
|
||||
text: string,
|
||||
svgContainingElement?: Element,
|
||||
positions: any
|
||||
positions?: Positions
|
||||
): Promise<RenderResult> {
|
||||
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 { internalHelpers } from '$root/internals.js';
|
||||
import { log } from '$root/logger.js';
|
||||
@@ -14,7 +14,7 @@ export interface LayoutAlgorithm {
|
||||
svg: SVG,
|
||||
helpers: InternalHelpers,
|
||||
options?: RenderOptions,
|
||||
positions: any
|
||||
positions?: Positions
|
||||
): Promise<void>;
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ export const rect_left_inv_arrow = async (
|
||||
): Promise<SVGAElement> => {
|
||||
const { labelStyles, nodeStyles } = styles2String(node);
|
||||
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 labelPaddingX = node.look === 'neo' ? nodePadding * 3 : node.padding;
|
||||
const labelPaddingY = node.look === 'neo' ? nodePadding * 1.5 : node.padding;
|
||||
|
@@ -15,6 +15,9 @@ const getStyles = (
|
||||
errorTextColor: string;
|
||||
lineColor: string;
|
||||
useGradient: boolean;
|
||||
dropShadow: string;
|
||||
primaryBorderColor: string;
|
||||
compositeTitleBackground: string;
|
||||
} & FlowChartStyleOptions,
|
||||
svgId: string
|
||||
) => {
|
||||
|
Reference in New Issue
Block a user