mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Add MermaidConfigWithDefaults
This commit is contained in:
parent
f30c26485e
commit
ba0bddf417
@ -2,7 +2,7 @@ import assignWithDepth from './assignWithDepth.js';
|
||||
import { log } from './logger.js';
|
||||
import theme from './themes/index.js';
|
||||
import config from './defaultConfig.js';
|
||||
import type { MermaidConfig } from './config.type.js';
|
||||
import type { MermaidConfig, MermaidConfigWithDefaults } from './config.type.js';
|
||||
import { sanitizeDirective } from './utils/sanitizeDirective.js';
|
||||
|
||||
export const defaultConfig: MermaidConfig = Object.freeze(config);
|
||||
@ -128,7 +128,7 @@ export const setConfig = (conf: MermaidConfig): MermaidConfig => {
|
||||
*
|
||||
* @returns The currentConfig
|
||||
*/
|
||||
export const getConfig = (): MermaidConfig => {
|
||||
export const getConfig = (): MermaidConfigWithDefaults => {
|
||||
return assignWithDepth({}, currentConfig);
|
||||
};
|
||||
/**
|
||||
|
@ -5,6 +5,8 @@
|
||||
* and run json-schema-to-typescript to regenerate this file.
|
||||
*/
|
||||
|
||||
import { RequiredDeep } from 'type-fest';
|
||||
|
||||
/**
|
||||
* Configuration options to pass to the `dompurify` library.
|
||||
*/
|
||||
@ -165,6 +167,9 @@ export interface MermaidConfig {
|
||||
wrap?: boolean;
|
||||
fontSize?: number;
|
||||
}
|
||||
|
||||
// I'd prefer this to be named MermaidConfig, so all the functions can use the shorter name.
|
||||
export type MermaidConfigWithDefaults = RequiredDeep<MermaidConfig>;
|
||||
/**
|
||||
* This interface was referenced by `MermaidConfig`'s JSON-Schema
|
||||
* via the `definition` "BaseDiagramConfig".
|
||||
|
@ -1,6 +1,5 @@
|
||||
import type { Diagram } from '../../Diagram.js';
|
||||
import { getConfig, defaultConfig } from '../../diagram-api/diagramAPI.js';
|
||||
|
||||
import {
|
||||
select as d3select,
|
||||
scaleOrdinal as d3scaleOrdinal,
|
||||
|
Loading…
x
Reference in New Issue
Block a user