mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-15 18:24:33 +01:00
add getDiagramStyles type and use it in style.ts
This commit is contained in:
@@ -82,3 +82,5 @@ export type ParseDirectiveDefinition = (statement: string, context: string, type
|
||||
export type HTML = d3.Selection<HTMLIFrameElement, unknown, Element, unknown>;
|
||||
|
||||
export type SVG = d3.Selection<SVGSVGElement, unknown, Element, unknown>;
|
||||
|
||||
export type getDiagramStyles = (options?: unknown) => string;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';
|
||||
import { log } from './logger.js';
|
||||
import { getDiagramStyles } from './diagram-api/types.js';
|
||||
|
||||
const themes: Record<string, (options?: any) => string> = {};
|
||||
const themes: Record<string, getDiagramStyles> = {};
|
||||
|
||||
const getStyles = (
|
||||
type: string,
|
||||
@@ -73,12 +74,9 @@ const getStyles = (
|
||||
`;
|
||||
};
|
||||
|
||||
export const addStylesForDiagram = (
|
||||
type: string,
|
||||
diagramTheme?: (options?: any) => string
|
||||
): void => {
|
||||
if (diagramTheme !== undefined) {
|
||||
themes[type] = diagramTheme;
|
||||
export const addStylesForDiagram = (type: string, getDiagramStyles?: getDiagramStyles): void => {
|
||||
if (getDiagramStyles !== undefined) {
|
||||
themes[type] = getDiagramStyles;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user