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