mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Merge branch 'develop' into standardized-pie-definitions
This commit is contained in:
commit
120bdabee1
@ -35,7 +35,12 @@ describe('DiagramAPI', () => {
|
|||||||
'loki',
|
'loki',
|
||||||
{
|
{
|
||||||
db: {},
|
db: {},
|
||||||
parser: {},
|
parser: {
|
||||||
|
parse: (_text) => {
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
parser: { yy: {} },
|
||||||
|
},
|
||||||
renderer: {},
|
renderer: {},
|
||||||
styles: {},
|
styles: {},
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ export interface DiagramDB {
|
|||||||
export interface DiagramDefinition {
|
export interface DiagramDefinition {
|
||||||
db: DiagramDB;
|
db: DiagramDB;
|
||||||
renderer: any;
|
renderer: any;
|
||||||
parser: any;
|
parser: ParserDefinition;
|
||||||
styles?: any;
|
styles?: any;
|
||||||
init?: (config: MermaidConfig) => void;
|
init?: (config: MermaidConfig) => void;
|
||||||
injectUtils?: (
|
injectUtils?: (
|
||||||
@ -80,6 +80,11 @@ export type DrawDefinition = (
|
|||||||
diagramObject: Diagram
|
diagramObject: Diagram
|
||||||
) => void;
|
) => void;
|
||||||
|
|
||||||
|
export interface ParserDefinition {
|
||||||
|
parse: (text: string) => void;
|
||||||
|
parser: { yy: DiagramDB };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type for function parse directive from diagram code.
|
* Type for function parse directive from diagram code.
|
||||||
*
|
*
|
||||||
|
@ -3,6 +3,7 @@ import { mermaidAPI } from './mermaidAPI.js';
|
|||||||
import './diagram-api/diagram-orchestration.js';
|
import './diagram-api/diagram-orchestration.js';
|
||||||
import { addDiagrams } from './diagram-api/diagram-orchestration.js';
|
import { addDiagrams } from './diagram-api/diagram-orchestration.js';
|
||||||
import { beforeAll, describe, it, expect, vi } from 'vitest';
|
import { beforeAll, describe, it, expect, vi } from 'vitest';
|
||||||
|
import type { DiagramDefinition } from './diagram-api/types.js';
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
addDiagrams();
|
addDiagrams();
|
||||||
@ -92,13 +93,16 @@ describe('when using mermaid and ', () => {
|
|||||||
|
|
||||||
it('should defer diagram load based on parameter', async () => {
|
it('should defer diagram load based on parameter', async () => {
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
const dummyDiagram = {
|
const dummyDiagram: DiagramDefinition = {
|
||||||
db: {},
|
db: {},
|
||||||
renderer: () => {
|
renderer: () => {
|
||||||
// do nothing
|
// do nothing
|
||||||
},
|
},
|
||||||
parser: () => {
|
parser: {
|
||||||
// do nothing
|
parse: (_text) => {
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
parser: { yy: {} },
|
||||||
},
|
},
|
||||||
styles: () => {
|
styles: () => {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user