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
1 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';
import { log } from './logger.js';
const themes: Record<string, any> = {};
const themes: Record<string, (options?: any) => string> = {};
const getStyles = (
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) {
themes[type] = diagramTheme;
themes[type] = (options) => diagramTheme(options);
}
};