mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
caps DB
part in DiagramDb
and InfoDb
This commit is contained in:
parent
d0e8074de7
commit
171d7a04f4
@ -1,4 +1,4 @@
|
||||
import { DiagramDb } from './types.js';
|
||||
import { DiagramDB } from './types.js';
|
||||
// The "* as yaml" part is necessary for tree-shaking
|
||||
import * as yaml from 'js-yaml';
|
||||
|
||||
@ -22,7 +22,7 @@ type FrontMatterMetadata = {
|
||||
* @param db - Diagram database, could be of any diagram.
|
||||
* @returns text with frontmatter stripped out
|
||||
*/
|
||||
export function extractFrontMatter(text: string, db: DiagramDb): string {
|
||||
export function extractFrontMatter(text: string, db: DiagramDB): string {
|
||||
const matches = text.match(frontMatterRegex);
|
||||
if (matches) {
|
||||
const parsed: FrontMatterMetadata = yaml.load(matches[1], {
|
||||
|
@ -14,7 +14,7 @@ export interface InjectUtils {
|
||||
/**
|
||||
* Generic Diagram DB that may apply to any diagram type.
|
||||
*/
|
||||
export interface DiagramDb {
|
||||
export interface DiagramDB {
|
||||
clear?: () => void;
|
||||
setDiagramTitle?: (title: string) => void;
|
||||
setDisplayMode?: (title: string) => void;
|
||||
@ -24,7 +24,7 @@ export interface DiagramDb {
|
||||
}
|
||||
|
||||
export interface DiagramDefinition {
|
||||
db: DiagramDb;
|
||||
db: DiagramDB;
|
||||
renderer: any;
|
||||
parser: any;
|
||||
styles?: any;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** Created by knut on 15-01-14. */
|
||||
import { clear } from '../../commonDb.js';
|
||||
import type { InfoDb } from './infoTypes.js';
|
||||
import type { InfoDB } from './infoTypes.js';
|
||||
|
||||
let info = false;
|
||||
|
||||
@ -10,7 +10,7 @@ export const setInfo = (inf: boolean): void => {
|
||||
|
||||
export const getInfo = (): boolean => info;
|
||||
|
||||
const db: InfoDb = {
|
||||
const db: InfoDB = {
|
||||
clear,
|
||||
setInfo,
|
||||
getInfo,
|
||||
|
@ -1,9 +1,6 @@
|
||||
import type { DiagramDb } from '../../diagram-api/types.js';
|
||||
import type { DiagramDB } from '../../diagram-api/types.js';
|
||||
|
||||
/**
|
||||
* Info diagram DB.
|
||||
*/
|
||||
export interface InfoDb extends DiagramDb {
|
||||
export interface InfoDB extends DiagramDB {
|
||||
clear: () => void;
|
||||
setInfo: (info: boolean) => void;
|
||||
getInfo: () => boolean;
|
||||
|
Loading…
x
Reference in New Issue
Block a user