change diagramTheme and themes to return string

This commit is contained in:
Yokozuna59 2023-06-26 18:02:20 +03:00
parent 07f6358a80
commit f2c40271b2

View File

@ -1,7 +1,7 @@
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js'; import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';
import { log } from './logger.js'; import { log } from './logger.js';
const themes: Record<string, any> = {}; const themes: Record<string, (options?: any) => string> = {};
const getStyles = ( const getStyles = (
type: string, type: string,
@ -73,9 +73,12 @@ const getStyles = (
`; `;
}; };
export const addStylesForDiagram = (type: string, diagramTheme?: unknown): void => { export const addStylesForDiagram = (
type: string,
diagramTheme?: (options?: any) => string
): void => {
if (diagramTheme !== undefined) { if (diagramTheme !== undefined) {
themes[type] = diagramTheme; themes[type] = (options) => diagramTheme(options);
} }
}; };