tsConversion: fix paths, add d.ts to output

This commit is contained in:
Sidharth Vinod
2022-08-21 22:27:13 +05:30
parent d97b3807b9
commit 39aaf2f813
15 changed files with 51 additions and 183 deletions

View File

@@ -1 +0,0 @@
type DiagramDetector = (text: string) => boolean;

View File

@@ -2,7 +2,7 @@ import assignWithDepth from './assignWithDepth';
import { log } from './logger';
import theme from './themes';
import config from './defaultConfig';
import { MermaidConfig } from 'types/config';
import type { MermaidConfig } from './config.type';
export const defaultConfig: MermaidConfig = Object.freeze(config);

View File

@@ -32,7 +32,7 @@ export interface MermaidConfig {
}
// TODO: More configs needs to be moved in here
export interface BaseDiagramConfig extends BaseDiagramConfig {
export interface BaseDiagramConfig {
useWidth?: number;
useMaxWidth?: boolean;
}
@@ -340,4 +340,7 @@ export interface FontConfig {
fontFamily?: string;
fontWeight?: string | number;
}
export type FontCalculator = () => Partial<FontConfig>;
export {};

View File

@@ -1,5 +1,5 @@
import theme from './themes';
import { MermaidConfig } from 'types/config';
import { MermaidConfig } from './config.type';
/**
* **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click
* here](8.6.0_docs.md)].**

View File

@@ -1,4 +1,6 @@
import type { MermaidConfig } from 'types/config';
import { MermaidConfig } from '../config.type';
export type DiagramDetector = (text: string) => boolean;
const directive =
/[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;

View File

@@ -1,5 +1,5 @@
import DOMPurify from 'dompurify';
import { MermaidConfig } from 'types/config';
import { MermaidConfig } from '../../config.type';
/**
* Gets the rows of lines in a string

View File

@@ -1,3 +1,5 @@
import type { DiagramDetector } from '../../diagram-api/detectType';
export const gitGraphDetector: DiagramDetector = (txt) => {
return txt.match(/^\s*gitGraph/) != null;
};

View File

@@ -1,3 +1,5 @@
import { DiagramDetector } from '../../diagram-api/detectType';
export const mindmapDetector: DiagramDetector = (txt) => {
return txt.match(/^\s*mindmap/) != null;
};

View File

@@ -2,7 +2,7 @@
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid
* functionality and to render the diagrams to svg code.
*/
import { MermaidConfig } from 'types/config';
import { MermaidConfig } from './config.type';
import { log } from './logger';
import mermaidAPI from './mermaidAPI';
import utils from './utils';

View File

@@ -19,7 +19,7 @@ import { configKeys } from './defaultConfig';
import { log } from './logger';
import { detectType } from './diagram-api/detectType';
import assignWithDepth from './assignWithDepth';
import { MermaidConfig } from 'types/config';
import { MermaidConfig } from './config.type';
// Effectively an enum of the supported curve types, accessible by name
const d3CurveTypes = {