mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
config redirect
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
import { MermaidConfig } from '../config.type';
|
||||
import { DiagramDetector, DiagramLoader } from './types';
|
||||
/**
|
||||
* Detects the type of the graph text.
|
||||
*
|
||||
* Takes into consideration the possible existence of an `%%init` directive
|
||||
*
|
||||
* @param text - The text defining the graph. For example:
|
||||
*
|
||||
* ```mermaid
|
||||
* %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
|
||||
* graph LR
|
||||
* a-->b
|
||||
* b-->c
|
||||
* c-->d
|
||||
* d-->e
|
||||
* e-->f
|
||||
* f-->g
|
||||
* g-->h
|
||||
* ```
|
||||
*
|
||||
* @param config - The mermaid config.
|
||||
* @returns A graph definition key
|
||||
*/
|
||||
export declare const detectType: (text: string, config?: MermaidConfig) => string;
|
||||
export declare const addDetector: (key: string, detector: DiagramDetector, loader?: DiagramLoader) => void;
|
||||
export declare const getDiagramLoader: (key: string) => DiagramLoader | undefined;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare const addDiagrams: () => void;
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import { DiagramDefinition, DiagramDetector } from './types';
|
||||
export declare const log: Record<import("../logger").LogLevel, {
|
||||
(...data: any[]): void;
|
||||
(message?: any, ...optionalParams: any[]): void;
|
||||
}>;
|
||||
export declare const setLogLevel: (level?: string | number) => void;
|
||||
export declare const getConfig: () => import("../config.type").MermaidConfig;
|
||||
export declare const sanitizeText: (text: string) => string;
|
||||
export declare const setupGraphViewbox: (graph: any, svgElem: any, padding: any, useMaxWidth: any) => void;
|
||||
export interface Detectors {
|
||||
[key: string]: DiagramDetector;
|
||||
}
|
||||
/**
|
||||
* Registers the given diagram with Mermaid.
|
||||
*
|
||||
* Can be used for third-party custom diagrams.
|
||||
*
|
||||
* @param id - A unique ID for the given diagram.
|
||||
* @param diagram - The diagram definition.
|
||||
* @param detector - Function that returns `true` if a given mermaid text is this diagram definition.
|
||||
*/
|
||||
export declare const registerDiagram: (id: string, diagram: DiagramDefinition, detector?: DiagramDetector) => void;
|
||||
export declare const getDiagram: (name: string) => DiagramDefinition;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { DiagramDb } from './types';
|
||||
export declare const frontMatterRegex: RegExp;
|
||||
/**
|
||||
* Extract and parse frontmatter from text, if present, and sets appropriate
|
||||
* properties in the provided db.
|
||||
* @param text - The text that may have a YAML frontmatter.
|
||||
* @param db - Diagram database, could be of any diagram.
|
||||
* @returns text with frontmatter stripped out
|
||||
*/
|
||||
export declare function extractFrontMatter(text: string, db: DiagramDb): string;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
import { MermaidConfig } from '../config.type';
|
||||
export interface InjectUtils {
|
||||
_log: any;
|
||||
_setLogLevel: any;
|
||||
_getConfig: any;
|
||||
_sanitizeText: any;
|
||||
_setupGraphViewbox: any;
|
||||
}
|
||||
/**
|
||||
* Generic Diagram DB that may apply to any diagram type.
|
||||
*/
|
||||
export interface DiagramDb {
|
||||
clear?: () => void;
|
||||
setDiagramTitle?: (title: string) => void;
|
||||
getAccTitle?: () => string;
|
||||
getAccDescription?: () => string;
|
||||
}
|
||||
export interface DiagramDefinition {
|
||||
db: DiagramDb;
|
||||
renderer: any;
|
||||
parser: any;
|
||||
styles: any;
|
||||
init?: (config: MermaidConfig) => void;
|
||||
injectUtils?: (_log: InjectUtils['_log'], _setLogLevel: InjectUtils['_setLogLevel'], _getConfig: InjectUtils['_getConfig'], _sanitizeText: InjectUtils['_sanitizeText'], _setupGraphViewbox: InjectUtils['_setupGraphViewbox']) => void;
|
||||
}
|
||||
export interface DetectorRecord {
|
||||
detector: DiagramDetector;
|
||||
loader?: DiagramLoader;
|
||||
}
|
||||
export interface ExternalDiagramDefinition {
|
||||
id: string;
|
||||
detector: DiagramDetector;
|
||||
loader: DiagramLoader;
|
||||
}
|
||||
export declare type DiagramDetector = (text: string, config?: MermaidConfig) => boolean;
|
||||
export declare type DiagramLoader = () => Promise<{
|
||||
id: string;
|
||||
diagram: DiagramDefinition;
|
||||
}>;
|
||||
Reference in New Issue
Block a user