Comparing version 9.2.3-rc.1 to 9.3.0-rc.1
@@ -1,12 +0,10 @@ | ||
/** | ||
* @param text | ||
* @param parseError | ||
*/ | ||
declare function parse(text: string, parseError?: Function): boolean; | ||
import { type ParseErrorFunction } from '../Diagram'; | ||
/** {@inheritDoc mermaidAPI.parse} */ | ||
declare function parse(text: string, parseError?: ParseErrorFunction): boolean; | ||
export declare const mermaidAPI: { | ||
render: import("vitest/dist/index-6e18a03a").r<any[], any>; | ||
renderAsync: import("vitest/dist/index-6e18a03a").r<any[], any>; | ||
render: import("vitest/dist/index-9f5bc072").x<any[], any>; | ||
renderAsync: import("vitest/dist/index-9f5bc072").x<any[], any>; | ||
parse: typeof parse; | ||
parseDirective: import("vitest/dist/index-6e18a03a").r<any[], any>; | ||
initialize: import("vitest/dist/index-6e18a03a").r<any[], any>; | ||
parseDirective: import("vitest/dist/index-9f5bc072").x<any[], any>; | ||
initialize: import("vitest/dist/index-9f5bc072").x<any[], any>; | ||
getConfig: () => import("../config.type").MermaidConfig; | ||
@@ -13,0 +11,0 @@ setConfig: (conf: import("../config.type").MermaidConfig) => import("../config.type").MermaidConfig; |
/** | ||
* This method will add a basic title and description element to a chart. The yy parser will need to | ||
* respond to getAccTitle and getAccDescription, where the title is the title element on the chart, | ||
* which is generally not displayed and the accDescription is the description element on the chart, | ||
* which is never displayed. | ||
* Accessibility (a11y) functions, types, helpers | ||
* | ||
*/ | ||
import { D3Element } from './mermaidAPI'; | ||
/** | ||
* Add aria-roledescription to the svg element to the diagramType | ||
* | ||
* @param svg - d3 object that contains the SVG HTML element | ||
* @param diagramType - diagram name for to the aria-roledescription | ||
*/ | ||
export declare function setA11yDiagramInfo(svg: D3Element, diagramType: string | null | undefined): void; | ||
/** | ||
* Add an accessible title and/or description element to a chart. | ||
* The title is usually not displayed and the description is never displayed. | ||
* | ||
* The following charts display their title as a visual and accessibility element: gantt | ||
* | ||
* @param yy_parser | ||
* @param svg | ||
* @param id | ||
* @param svg - d3 node to insert the a11y title and desc info | ||
* @param a11yTitle - a11y title. null and undefined are meaningful: means to skip it | ||
* @param a11yDesc - a11y description. null and undefined are meaningful: means to skip it | ||
* @param baseId - id used to construct the a11y title and description id | ||
*/ | ||
export default function addSVGAccessibilityFields(yy_parser: any, svg: any, id: any): void; | ||
export declare function addSVGa11yTitleDescription(svg: D3Element, a11yTitle: string | null | undefined, a11yDesc: string | null | undefined, baseId: string): void; |
@@ -17,3 +17,3 @@ import type { MermaidConfig } from './config.type'; | ||
* @param conf - The base currentConfig to use as siteConfig | ||
* @returns {object} - The siteConfig | ||
* @returns The new siteConfig | ||
*/ | ||
@@ -32,3 +32,3 @@ export declare const setSiteConfig: (conf: MermaidConfig) => MermaidConfig; | ||
* | ||
* @returns {object} - The siteConfig | ||
* @returns The siteConfig | ||
*/ | ||
@@ -47,4 +47,4 @@ export declare const getSiteConfig: () => MermaidConfig; | ||
* | ||
* @param {any} conf - The potential currentConfig | ||
* @returns {any} - The currentConfig merged with the sanitized conf | ||
* @param conf - The potential currentConfig | ||
* @returns The currentConfig merged with the sanitized conf | ||
*/ | ||
@@ -61,3 +61,3 @@ export declare const setConfig: (conf: MermaidConfig) => MermaidConfig; | ||
* | ||
* @returns {any} - The currentConfig | ||
* @returns The currentConfig | ||
*/ | ||
@@ -75,3 +75,3 @@ export declare const getConfig: () => MermaidConfig; | ||
* | ||
* @param {any} options - The potential setConfig parameter | ||
* @param options - The potential setConfig parameter | ||
*/ | ||
@@ -82,3 +82,3 @@ export declare const sanitize: (options: any) => void; | ||
* | ||
* @param {object} directive The directive to push in | ||
* @param directive - The directive to push in | ||
*/ | ||
@@ -101,4 +101,5 @@ export declare const addDirective: (directive: any) => void; | ||
* | ||
* @param config | ||
* @param config - base set of values, which currentConfig could be **reset** to. | ||
* Defaults to the current siteConfig (e.g returned by {@link getSiteConfig}). | ||
*/ | ||
export declare const reset: (config?: MermaidConfig) => void; |
@@ -185,2 +185,3 @@ import DOMPurify from 'dompurify'; | ||
export interface GitGraphDiagramConfig extends BaseDiagramConfig { | ||
titleTopMargin?: number; | ||
diagramPadding?: number; | ||
@@ -219,2 +220,3 @@ nodeLabel?: NodeLabel; | ||
export interface ErDiagramConfig extends BaseDiagramConfig { | ||
titleTopMargin?: number; | ||
diagramPadding?: number; | ||
@@ -230,2 +232,3 @@ layoutDirection?: string; | ||
export interface StateDiagramConfig extends BaseDiagramConfig { | ||
titleTopMargin?: number; | ||
arrowMarkerAbsolute?: boolean; | ||
@@ -250,2 +253,3 @@ dividerMargin?: number; | ||
export interface ClassDiagramConfig extends BaseDiagramConfig { | ||
titleTopMargin?: number; | ||
arrowMarkerAbsolute?: boolean; | ||
@@ -291,2 +295,3 @@ dividerMargin?: number; | ||
axisFormat?: string; | ||
tickInterval?: string; | ||
topAxis?: boolean; | ||
@@ -332,2 +337,3 @@ } | ||
export interface FlowchartDiagramConfig extends BaseDiagramConfig { | ||
titleTopMargin?: number; | ||
arrowMarkerAbsolute?: boolean; | ||
@@ -334,0 +340,0 @@ diagramPadding?: number; |
export let clusterDb: {}; | ||
export function clear(): void; | ||
export function extractDecendants(id: any, graph: any): any[]; | ||
export function extractDescendants(id: any, graph: any): any[]; | ||
export function validate(graph: any): boolean; | ||
@@ -5,0 +5,0 @@ export function findNonClusterChild(id: any, graph: any): any; |
@@ -10,15 +10,23 @@ import { MermaidConfig } from './config.type'; | ||
* | ||
* **Example 1:**<pre> mermaid.initialize({ flowchart:{ htmlLabels: false } }); </pre> | ||
* **Example 1:** | ||
* | ||
* **Example 2:**<pre> <script> var config = { startOnLoad:true, flowchart:{ useMaxWidth:true, | ||
* htmlLabels:true, curve:'cardinal', }, | ||
* ```js | ||
* mermaid.initialize({ flowchart:{ htmlLabels: false } }); | ||
* ``` | ||
* | ||
* securityLevel:'loose', | ||
* **Example 2:** | ||
* | ||
* }; mermaid.initialize(config); </script> </pre> | ||
* ```html | ||
* <script> | ||
* const config = { | ||
* startOnLoad:true, | ||
* flowchart:{ useMaxWidth:true, htmlLabels:true, curve:'cardinal'}, | ||
* securityLevel:'loose', | ||
* }; | ||
* mermaid.initialize(config); | ||
* </script> | ||
* ``` | ||
* | ||
* A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults). | ||
* A description of each option follows below. | ||
* | ||
* @name Configuration | ||
*/ | ||
@@ -25,0 +33,0 @@ declare const config: Partial<MermaidConfig>; |
import { MermaidConfig } from '../config.type'; | ||
import { DiagramDetector, DiagramLoader } from './types'; | ||
/** | ||
* @function detectType Detects the type of the graph text. Takes into consideration the possible | ||
* existence of an %%init directive | ||
* Detects the type of the graph text. | ||
* | ||
* ```mermaid | ||
* 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" }}%% | ||
@@ -18,9 +21,5 @@ * graph LR | ||
* ``` | ||
* @param {string} text The text defining the graph | ||
* @param {{ | ||
* class: { defaultRenderer: string } | undefined; | ||
* state: { defaultRenderer: string } | undefined; | ||
* flowchart: { defaultRenderer: string } | undefined; | ||
* }} [config] | ||
* @returns {string} A graph definition key | ||
* | ||
* @param config - The mermaid config. | ||
* @returns A graph definition key | ||
*/ | ||
@@ -27,0 +26,0 @@ export declare const detectType: (text: string, config?: MermaidConfig) => string; |
@@ -24,4 +24,1 @@ import { DiagramDefinition, DiagramDetector } from './types'; | ||
export declare const getDiagram: (name: string) => DiagramDefinition; | ||
export declare class DiagramNotFoundError extends Error { | ||
constructor(message: string); | ||
} |
@@ -9,4 +9,13 @@ import { MermaidConfig } from '../config.type'; | ||
} | ||
/** | ||
* 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: any; | ||
db: DiagramDb; | ||
renderer: any; | ||
@@ -13,0 +22,0 @@ parser: any; |
@@ -0,1 +1,3 @@ | ||
import { type DetailedError } from './utils'; | ||
export declare type ParseErrorFunction = (err: string | DetailedError, hash?: any) => void; | ||
export declare class Diagram { | ||
@@ -6,11 +8,11 @@ txt: string; | ||
renderer: any; | ||
db: any; | ||
db: import("./diagram-api/types").DiagramDb; | ||
private detectTypeFailed; | ||
constructor(txt: string, parseError?: Function); | ||
parse(text: string, parseError?: Function): boolean; | ||
handleError(error: unknown, parseError?: Function): void; | ||
constructor(txt: string, parseError?: ParseErrorFunction); | ||
parse(text: string, parseError?: ParseErrorFunction): boolean; | ||
handleError(error: unknown, parseError?: ParseErrorFunction): void; | ||
getParser(): any; | ||
getType(): string; | ||
} | ||
export declare const getDiagramFromText: (txt: string, parseError?: Function) => Diagram | Promise<Diagram>; | ||
export declare const getDiagramFromText: (txt: string, parseError?: ParseErrorFunction) => Diagram | Promise<Diagram>; | ||
export default Diagram; |
export function drawRect(elem: any, rectData: any): any; | ||
export function drawImage(elem: any, width: any, height: any, x: any, y: any, link: any): void; | ||
export function drawEmbeddedImage(elem: any, x: any, y: any, link: any): void; | ||
export function drawText(elem: any, textData: any): any[]; | ||
export function drawLabel(elem: any, txtObject: any): any; | ||
export function drawRels(elem: any, rels: any, conf: any): void; | ||
@@ -16,16 +13,2 @@ export function drawC4Shape(elem: any, c4Shape: any, conf: any): any; | ||
export function insertArrowCrossHead(elem: any): void; | ||
export function getTextObj(): { | ||
x: number; | ||
y: number; | ||
fill: undefined; | ||
anchor: undefined; | ||
style: string; | ||
width: undefined; | ||
height: undefined; | ||
textMargin: number; | ||
rx: number; | ||
ry: number; | ||
tspan: boolean; | ||
valign: undefined; | ||
}; | ||
export function getNoteRect(): { | ||
@@ -44,4 +27,2 @@ x: number; | ||
export { drawRect }; | ||
export { drawText }; | ||
export { drawLabel }; | ||
export { drawBoundary }; | ||
@@ -51,3 +32,2 @@ export { drawC4Shape }; | ||
export { drawImage }; | ||
export { drawEmbeddedImage }; | ||
export { insertArrowHead }; | ||
@@ -61,3 +41,2 @@ export { insertArrowEnd }; | ||
export { insertClockIcon }; | ||
export { getTextObj }; | ||
export { getNoteRect }; | ||
@@ -64,0 +43,0 @@ export { sanitizeUrl }; |
@@ -8,2 +8,3 @@ export function parseDirective(statement: any, context: any, type: any): void; | ||
export function getRelations(): any[]; | ||
export function getNotes(): any[]; | ||
export function addRelation(relation: any): void; | ||
@@ -13,2 +14,3 @@ export function addAnnotation(className: any, annotation: any): void; | ||
export function addMembers(className: any, members: any): void; | ||
export function addNote(text: any, className: any): void; | ||
export function cleanupLabel(label: any): string; | ||
@@ -43,3 +45,5 @@ export function setCssClass(ids: any, className: any): void; | ||
export { getClasses }; | ||
export { getNotes }; | ||
export { addAnnotation }; | ||
export { addNote }; | ||
export { getRelations }; | ||
@@ -60,2 +64,4 @@ export { addRelation }; | ||
export { lookUpDomId }; | ||
export { setDiagramTitle }; | ||
export { getDiagramTitle }; | ||
} | ||
@@ -76,1 +82,3 @@ export default _default; | ||
declare function setTooltip(ids: any, tooltip: any): void; | ||
import { setDiagramTitle } from "../../commonDb"; | ||
import { getDiagramTitle } from "../../commonDb"; |
@@ -10,2 +10,7 @@ export function addClasses(classes: { | ||
}, g: SVGGElement, _id: any, diagObj: any): void; | ||
export function addNotes(notes: { | ||
text: string; | ||
class: string; | ||
placement: number; | ||
}[], g: SVGGElement, startEdgeId: number, classes: any): void; | ||
export function addRelations(relations: any, g: object): void; | ||
@@ -12,0 +17,0 @@ export function setConf(cnf: object): void; |
@@ -8,2 +8,12 @@ export function drawEdge(elem: any, path: any, relation: any, conf: any, diagObj: any): void; | ||
}; | ||
export function drawNote(elem: SVGSVGElement, note: { | ||
id: string; | ||
text: string; | ||
class: string; | ||
}, conf: any, diagObj: any): { | ||
id: string; | ||
text: string; | ||
width: number; | ||
height: number; | ||
}; | ||
export function parseMember(text: any): { | ||
@@ -16,4 +26,5 @@ displayText: string; | ||
export { drawEdge }; | ||
export { drawNote }; | ||
export { parseMember }; | ||
} | ||
export default _default; |
@@ -5,4 +5,4 @@ import { MermaidConfig } from '../../config.type'; | ||
* | ||
* @param {string | undefined} s The string to check the lines for | ||
* @returns {string[]} The rows in that string | ||
* @param s - The string to check the lines for | ||
* @returns The rows in that string | ||
*/ | ||
@@ -13,4 +13,4 @@ export declare const getRows: (s?: string) => string[]; | ||
* | ||
* @param {string} txt The text to sanitize | ||
* @returns {string} The safer text | ||
* @param txt - The text to sanitize | ||
* @returns The safer text | ||
*/ | ||
@@ -22,6 +22,6 @@ export declare const removeScript: (txt: string) => string; | ||
/** | ||
* Whether or not a text has any linebreaks | ||
* Whether or not a text has any line breaks | ||
* | ||
* @param {string} text The text to test | ||
* @returns {boolean} Whether or not the text has breaks | ||
* @param text - The text to test | ||
* @returns Whether or not the text has breaks | ||
*/ | ||
@@ -32,4 +32,4 @@ export declare const hasBreaks: (text: string) => boolean; | ||
* | ||
* @param {string} text Text to split | ||
* @returns {string[]} List of lines as strings | ||
* @param text - Text to split | ||
* @returns List of lines as strings | ||
*/ | ||
@@ -40,4 +40,4 @@ export declare const splitBreaks: (text: string) => string[]; | ||
* | ||
* @param {string | boolean} val String or boolean to convert | ||
* @returns {boolean} The result from the input | ||
* @param val - String or boolean to convert | ||
* @returns The result from the input | ||
*/ | ||
@@ -48,8 +48,11 @@ export declare const evaluate: (val?: string | boolean) => boolean; | ||
* | ||
* @example <caption>Array of array of strings in typescript syntax</caption> | ||
* // returns "Array<Array<string>>" | ||
* parseGenericTypes('Array~Array~string~~'); | ||
* @example | ||
* Array of array of strings in typescript syntax | ||
* | ||
* @param {string} text The text to convert | ||
* @returns {string} The converted string | ||
* ```js | ||
* // returns "Array<Array<string>>" | ||
* parseGenericTypes('Array~Array~string~~'); | ||
* ``` | ||
* @param text - The text to convert | ||
* @returns The converted string | ||
*/ | ||
@@ -56,0 +59,0 @@ export declare const parseGenericTypes: (text: string) => string; |
@@ -17,2 +17,4 @@ export function parseDirective(statement: any, context: any, type: any): void; | ||
export { getAccDescription }; | ||
export { setDiagramTitle }; | ||
export { getDiagramTitle }; | ||
} | ||
@@ -48,1 +50,3 @@ export default _default; | ||
import { getAccDescription } from "../../commonDb"; | ||
import { setDiagramTitle } from "../../commonDb"; | ||
import { getDiagramTitle } from "../../commonDb"; |
@@ -7,10 +7,8 @@ /** | ||
* | ||
* @param {string} [str?=''] Given string to use as the basis for the id. Default is `''` | ||
* @param {string} [prefix?=''] String to put at the start, followed by '-'. Default is `''` | ||
* @param str | ||
* @param prefix | ||
* @param {string} str Given string to use as the basis for the id. Default is `''` | ||
* @param {string} prefix String to put at the start, followed by '-'. Default is `''` | ||
* @returns {string} | ||
* @see https://www.w3.org/TR/xml/#NT-Name | ||
*/ | ||
export function generateId(str?: string | undefined, prefix?: string | undefined): string; | ||
export function generateId(str?: string, prefix?: string): string; | ||
export function setConf(cnf: any): void; | ||
@@ -17,0 +15,0 @@ export function draw(text: any, id: any, _version: any, diagObj: any): void; |
/** | ||
* Merges the value of `conf` with the passed `cnf` | ||
* | ||
* @param {object} cnf Config to merge | ||
* @param cnf - Config to merge | ||
*/ | ||
@@ -10,11 +10,11 @@ export declare const setConf: (cnf: any) => void; | ||
* | ||
* @param text | ||
* @param {string} id The text for the error | ||
* @param {string} mermaidVersion The version | ||
* @param _text - Mermaid graph definition. | ||
* @param id - The text for the error | ||
* @param mermaidVersion - The version | ||
*/ | ||
export declare const draw: (text: string, id: string, mermaidVersion: string) => void; | ||
export declare const draw: (_text: string, id: string, mermaidVersion: string) => void; | ||
declare const _default: { | ||
setConf: (cnf: any) => void; | ||
draw: (text: string, id: string, mermaidVersion: string) => void; | ||
draw: (_text: string, id: string, mermaidVersion: string) => void; | ||
}; | ||
export default _default; |
export function parseDirective(statement: any, context: any, type: any): void; | ||
export function lookUpDomId(id: any): any; | ||
export function addVertex(_id: any, text: any, type: any, style: any, classes: any, dir: any, props?: {}): void; | ||
export function addSingleLink(_start: any, _end: any, type: any, linktext: any): void; | ||
export function addSingleLink(_start: any, _end: any, type: any, linkText: any): void; | ||
export function addLink(_start: any, _end: any, type: any, linktext: any): void; | ||
@@ -18,3 +18,3 @@ export function updateLinkInterpolate(positions: any, interp: any): void; | ||
export function getEdges(): {} | any | any[]; | ||
export function getClasses(): {} | any | any[]; | ||
export function getClasses(): {} | any | any; | ||
export function clear(ver?: string): void; | ||
@@ -65,2 +65,4 @@ export function setGen(ver: any): void; | ||
export { makeUniq }; | ||
export { setDiagramTitle }; | ||
export { getDiagramTitle }; | ||
} | ||
@@ -87,1 +89,3 @@ export default _default; | ||
}; | ||
import { setDiagramTitle } from "../../commonDb"; | ||
import { getDiagramTitle } from "../../commonDb"; |
@@ -5,2 +5,4 @@ export function parseDirective(statement: any, context: any, type: any): void; | ||
export function getAxisFormat(): string; | ||
export function setTickInterval(txt: any): void; | ||
export function getTickInterval(): any; | ||
export function setTodayMarker(txt: any): void; | ||
@@ -22,3 +24,3 @@ export function getTodayMarker(): string; | ||
export function getTasks(): any[]; | ||
export function isInvalidDate(date: any, dateFormat: any, excludes: any, includes: any): boolean; | ||
export function isInvalidDate(date: any, dateFormat: any, excludes: any, includes: any): any; | ||
export function addTask(descr: any, data: any): void; | ||
@@ -43,2 +45,4 @@ export function findTaskById(id: any): any; | ||
export { getAxisFormat }; | ||
export { setTickInterval }; | ||
export { getTickInterval }; | ||
export { setTodayMarker }; | ||
@@ -80,3 +84,3 @@ export { getTodayMarker }; | ||
* The string have to be compound by a value and a shorthand duration unit. For example `5d` | ||
* representes 5 days. | ||
* represents 5 days. | ||
* | ||
@@ -83,0 +87,0 @@ * Shorthand unit supported are: |
@@ -52,2 +52,4 @@ export function parseDirective(statement: any, context: any, type: any): void; | ||
export { setAccDescription }; | ||
export { setDiagramTitle }; | ||
export { getDiagramTitle }; | ||
export { commitType }; | ||
@@ -61,1 +63,3 @@ } | ||
import { setAccDescription } from "../../commonDb"; | ||
import { setDiagramTitle } from "../../commonDb"; | ||
import { getDiagramTitle } from "../../commonDb"; |
@@ -1,2 +0,2 @@ | ||
export function draw(text: any, id: any, version: any, diagObj: any): void; | ||
export function draw(text: any, id: any, version: any): void; | ||
declare namespace _default { | ||
@@ -3,0 +3,0 @@ export { draw }; |
@@ -0,1 +1,2 @@ | ||
import Diagram from '../../Diagram'; | ||
export declare const bounds: { | ||
@@ -91,8 +92,8 @@ data: { | ||
* | ||
* @param {any} _text The text of the diagram | ||
* @param {any} id The id of the diagram which will be used as a DOM element id¨ | ||
* @param {any} _version Mermaid version from package.json | ||
* @param {any} diagObj A stanard diagram containing the db and the text and type etc of the diagram | ||
* @param _text - The text of the diagram | ||
* @param id - The id of the diagram which will be used as a DOM element id¨ | ||
* @param _version - Mermaid version from package.json | ||
* @param diagObj - A standard diagram containing the db and the text and type etc of the diagram | ||
*/ | ||
export declare const draw: (_text: any, id: any, _version: any, diagObj: any) => void; | ||
export declare const draw: (_text: string, id: string, _version: string, diagObj: Diagram) => void; | ||
declare const _default: { | ||
@@ -186,4 +187,4 @@ bounds: { | ||
setConf: (cnf: any) => void; | ||
draw: (_text: any, id: any, _version: any, diagObj: any) => void; | ||
draw: (_text: string, id: string, _version: string, diagObj: Diagram) => void; | ||
}; | ||
export default _default; |
@@ -1,10 +0,8 @@ | ||
export function parseDirective(statement: any, context: any, type: any): void; | ||
export function addState(id: any, type: any, doc: any, descr: any, note: any): void; | ||
export function clear(saveCommon: any): void; | ||
export function getState(id: any): any; | ||
export function getStates(): {}; | ||
export function logDocuments(): void; | ||
export function getRelations(): never[]; | ||
export function addRelation(_id1: any, _id2: any, title: any): void; | ||
export function cleanupLabel(label: any): any; | ||
/** | ||
* | ||
* @param item1 | ||
* @param item2 | ||
* @param relationTitle | ||
*/ | ||
export function addRelationObjs(item1: any, item2: any, relationTitle: any): void; | ||
export namespace lineType { | ||
@@ -20,2 +18,17 @@ const LINE: number; | ||
} | ||
export function parseDirective(statement: any, context: any, type: any): void; | ||
export function addState(id: null | string, type?: null | string, doc?: null | string, descr?: null | string | string[], note?: null | string, classes?: null | string | string[], styles?: null | string | string[], textStyles?: null | string | string[]): void; | ||
export function clear(saveCommon: any): void; | ||
export function getState(id: any): any; | ||
export function getStates(): {}; | ||
export function logDocuments(): void; | ||
export function getRelations(): never[]; | ||
export function addRelation(item1: string | object, item2: string | object, title: string): void; | ||
export function addDescription(id: any, descr: any): void; | ||
export function cleanupLabel(label: any): any; | ||
export function addStyleClass(id: string, styleAttributes?: string | null): void; | ||
export function getClasses(): {} | any | {}; | ||
export function setCssClass(itemIds: string | string[], cssClassName: string): void; | ||
export function setStyle(itemId: any, styleText: any): void; | ||
export function setTextStyle(itemId: any, cssClassName: any): void; | ||
declare namespace _default { | ||
@@ -47,5 +60,9 @@ export { parseDirective }; | ||
export { setAccDescription }; | ||
export { addStyleClass }; | ||
export { setCssClass }; | ||
export { addDescription }; | ||
export { setDiagramTitle }; | ||
export { getDiagramTitle }; | ||
} | ||
export default _default; | ||
declare function getClasses(): any[]; | ||
declare function getDirection(): string; | ||
@@ -60,2 +77,13 @@ declare function getDividerId(): string; | ||
}; | ||
/** | ||
* Convert all of the statements (stmts) that were parsed into states and relationships. | ||
* This is done because a state diagram may have nested sections, | ||
* where each section is a 'document' and has its own set of statements. | ||
* Ex: the section within a fork has its own statements, and incoming and outgoing statements | ||
* refer to the fork as a whole (document). | ||
* See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement. | ||
* This will push the statement into the the list of statements for the current document. | ||
* | ||
* @param _doc | ||
*/ | ||
declare function extract(_doc: any): void; | ||
@@ -67,1 +95,3 @@ declare function trimColon(str: any): any; | ||
import { setAccDescription } from "../../commonDb"; | ||
import { setDiagramTitle } from "../../commonDb"; | ||
import { getDiagramTitle } from "../../commonDb"; |
@@ -0,3 +1,14 @@ | ||
/** | ||
* Create a standard string for the dom ID of an item. | ||
* If a type is given, insert that before the counter, preceded by the type spacer | ||
* | ||
* @param itemId | ||
* @param counter | ||
* @param {string | null} type | ||
* @param typeSpacer | ||
* @returns {string} | ||
*/ | ||
export function stateDomId(itemId?: string, counter?: number, type?: string | null, typeSpacer?: string): string; | ||
export function setConf(cnf: any): void; | ||
export function getClasses(text: any, diag: any): object; | ||
export function getClasses(text: string, diagramObj: any): object; | ||
export function draw(text: any, id: any, _version: any, diag: any): void; | ||
@@ -4,0 +15,0 @@ declare namespace _default { |
@@ -7,4 +7,4 @@ export declare type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; | ||
* | ||
* @param {LogLevel} [level="fatal"] The level to set the logging to. Default is `"fatal"` | ||
* @param level - The level to set the logging to. Default is `"fatal"` | ||
*/ | ||
export declare const setLogLevel: (level?: keyof typeof LEVELS | number | string) => void; |
@@ -5,7 +5,8 @@ /** | ||
*/ | ||
import type { MermaidConfig } from './config.type'; | ||
import { MermaidConfig } from './config.type'; | ||
import { mermaidAPI } from './mermaidAPI'; | ||
import type { ParseErrorFunction } from './Diagram'; | ||
import { type DetailedError } from './utils'; | ||
import { ExternalDiagramDefinition } from './diagram-api/types'; | ||
export type { MermaidConfig, DetailedError, ExternalDiagramDefinition }; | ||
export type { MermaidConfig, DetailedError, ExternalDiagramDefinition, ParseErrorFunction }; | ||
/** | ||
@@ -20,8 +21,2 @@ * ## init | ||
* | ||
* Optionally, `init` can accept in the second argument one of the following: | ||
* | ||
* - A DOM Node | ||
* - An array of DOM nodes (as would come from a jQuery selector) | ||
* - A W3C selector, a la `.mermaid` | ||
* | ||
* ```mermaid | ||
@@ -36,5 +31,8 @@ * graph LR; | ||
* | ||
* @param config | ||
* @param nodes | ||
* @param callback | ||
* @param config - **Deprecated**, please set configuration in {@link initialize}. | ||
* @param nodes - **Default**: `.mermaid`. One of the following: | ||
* - A DOM Node | ||
* - An array of DOM nodes (as would come from a jQuery selector) | ||
* - A W3C selector, a la `.mermaid` | ||
* @param callback - Called once for each rendered diagram's id. | ||
*/ | ||
@@ -44,3 +42,3 @@ declare const init: (config?: MermaidConfig, nodes?: string | HTMLElement | NodeListOf<HTMLElement>, callback?: Function) => Promise<void>; | ||
/** | ||
* Equivalent to {@link init()}, except an error will be thrown on error. | ||
* Equivalent to {@link init}, except an error will be thrown on error. | ||
* | ||
@@ -64,4 +62,3 @@ * @alpha | ||
* @param diagrams - Array of {@link ExternalDiagramDefinition}. | ||
* @param opts | ||
* @param opts.lazyLoad - If true, the diagram will be loaded on demand. | ||
* @param opts - If opts.lazyLoad is true, the diagram will be loaded on demand. | ||
*/ | ||
@@ -89,3 +86,3 @@ declare const registerExternalDiagrams: (diagrams: ExternalDiagramDefinition[], { lazyLoad, }?: { | ||
* | ||
* @param newParseErrorHandler New parseError() callback. | ||
* @param newParseErrorHandler - New parseError() callback. | ||
*/ | ||
@@ -95,3 +92,3 @@ declare const setParseErrorHandler: (newParseErrorHandler: (err: any, hash: any) => void) => void; | ||
/** | ||
* @param txt | ||
* @param txt - The mermaid code to be parsed. | ||
* @deprecated This is an internal function and should not be used. Will be removed in v10. | ||
@@ -101,15 +98,4 @@ */ | ||
/** | ||
* @param txt | ||
* @param id | ||
* @param delay | ||
* @deprecated This is an internal function and should not be used. Will be removed in v10. | ||
*/ | ||
/** | ||
* @param txt | ||
* @param id | ||
* @param text | ||
* @param cb | ||
* @param container | ||
* @deprecated This is an internal function and should not be used. Will be removed in v10. | ||
*/ | ||
declare const renderAsync: (id: string, text: string, cb?: ((svgCode: string, bindFunctions?: ((element: Element) => void) | undefined) => void) | undefined, container?: Element) => Promise<string>; | ||
@@ -119,3 +105,3 @@ declare const mermaid: { | ||
diagrams: any; | ||
parseError?: Function; | ||
parseError?: ParseErrorFunction; | ||
mermaidAPI: typeof mermaidAPI; | ||
@@ -122,0 +108,0 @@ parse: typeof parse; |
@@ -0,39 +1,100 @@ | ||
import { type ParseErrorFunction } from './Diagram'; | ||
import { MermaidConfig } from './config.type'; | ||
interface DiagramStyleClassDef { | ||
id: string; | ||
styles?: string[]; | ||
textStyles?: string[]; | ||
} | ||
export declare type D3Element = any; | ||
/** | ||
* @param text | ||
* @param parseError | ||
* @param text - The mermaid diagram definition. | ||
* @param parseError - If set, handles errors. | ||
*/ | ||
declare function parse(text: string, parseError?: Function): boolean; | ||
declare function parse(text: string, parseError?: ParseErrorFunction): boolean; | ||
/** | ||
* @param text - The mermaid diagram definition. | ||
* @param parseError - If set, handles errors. | ||
*/ | ||
declare function parseAsync(text: string, parseError?: ParseErrorFunction): Promise<boolean>; | ||
/** | ||
* @param text - text to be encoded | ||
* @returns | ||
*/ | ||
export declare const encodeEntities: (text: string) => string; | ||
/** | ||
* | ||
* @param text | ||
* @param parseError | ||
* @param text - text to be decoded | ||
* @returns | ||
*/ | ||
declare function parseAsync(text: string, parseError?: Function): Promise<boolean>; | ||
export declare const encodeEntities: (text: string) => string; | ||
export declare const decodeEntities: (text: string) => string; | ||
/** @param {MermaidConfig} options */ | ||
/** | ||
* Create a CSS style that starts with the given class name, then the element, | ||
* with an enclosing block that has each of the cssClasses followed by !important; | ||
* @param cssClass - CSS class name | ||
* @param element - CSS element | ||
* @param cssClasses - list of CSS styles to append after the element | ||
* @returns - the constructed string | ||
*/ | ||
export declare const cssImportantStyles: (cssClass: string, element: string, cssClasses?: string[]) => string; | ||
/** | ||
* Create the user styles | ||
* | ||
* @param config - configuration that has style and theme settings to use | ||
* @param graphType - used for checking if classDefs should be applied | ||
* @param classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...) | ||
* @returns the string with all the user styles | ||
*/ | ||
export declare const createCssStyles: (config: MermaidConfig, graphType: string, classDefs?: Record<string, DiagramStyleClassDef> | null | undefined) => string; | ||
export declare const createUserStyles: (config: MermaidConfig, graphType: string, classDefs: Record<string, DiagramStyleClassDef>, svgId: string) => string; | ||
/** | ||
* Clean up svgCode. Do replacements needed | ||
* | ||
* @param svgCode - the code to clean up | ||
* @param inSandboxMode - security level | ||
* @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors) | ||
* @returns the cleaned up svgCode | ||
*/ | ||
export declare const cleanUpSvgCode: (svgCode: string | undefined, inSandboxMode: boolean, useArrowMarkerUrls: boolean) => string; | ||
/** | ||
* Put the svgCode into an iFrame. Return the iFrame code | ||
* | ||
* @param svgCode - the svg code to put inside the iFrame | ||
* @param svgElement - the d3 node that has the current svgElement so we can get the height from it | ||
* @returns - the code with the iFrame that now contains the svgCode | ||
* TODO replace btoa(). Replace with buf.toString('base64')? | ||
*/ | ||
export declare const putIntoIFrame: (svgCode?: string, svgElement?: D3Element) => string; | ||
/** | ||
* Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes. | ||
* Only set the style attribute on the enclosing div if divStyle is given. | ||
* Only set the xmlns:xlink attribute on svg if svgXlink is given. | ||
* Return the last node appended | ||
* | ||
* @param parentRoot - the d3 node to append things to | ||
* @param id - the value to set the id attr to | ||
* @param enclosingDivId - the id to set the enclosing div to | ||
* @param divStyle - if given, the style to set the enclosing div to | ||
* @param svgXlink - if given, the link to set the new svg element to | ||
* @returns - returns the parentRoot that had nodes appended | ||
*/ | ||
export declare const appendDivSvgG: (parentRoot: D3Element, id: string, enclosingDivId: string, divStyle?: string, svgXlink?: string) => D3Element; | ||
/** | ||
* Remove any existing elements from the given document | ||
* | ||
* @param doc - the document to removed elements from | ||
* @param isSandboxed - whether or not we are in sandboxed mode | ||
* @param id - id for any existing SVG element | ||
* @param divSelector - selector for any existing enclosing div element | ||
* @param iFrameSelector - selector for any existing iFrame element | ||
*/ | ||
export declare const removeExistingElements: (doc: Document, isSandboxed: boolean, id: string, divSelector: string, iFrameSelector: string) => void; | ||
/** | ||
* @param options - Initial Mermaid options | ||
*/ | ||
declare function initialize(options?: MermaidConfig): void; | ||
export declare const mermaidAPI: Readonly<{ | ||
render: (id: string, text: string, cb?: ((svgCode: string, bindFunctions?: ((element: Element) => void) | undefined) => void) | undefined, container?: Element) => string; | ||
renderAsync: (id: string, text: string, cb?: ((svgCode: string, bindFunctions?: ((element: Element) => void) | undefined) => void) | undefined, container?: Element) => Promise<string>; | ||
parse: typeof parse; | ||
parseAsync: typeof parseAsync; | ||
parseDirective: (p: any, statement: string, context: string, type: string) => void; | ||
initialize: typeof initialize; | ||
getConfig: () => MermaidConfig; | ||
setConfig: (conf: MermaidConfig) => MermaidConfig; | ||
getSiteConfig: () => MermaidConfig; | ||
updateSiteConfig: (conf: MermaidConfig) => MermaidConfig; | ||
reset: () => void; | ||
globalReset: () => void; | ||
defaultConfig: MermaidConfig; | ||
}>; | ||
export default mermaidAPI; | ||
/** | ||
* ## mermaidAPI configuration defaults | ||
* | ||
* ```html | ||
* <script> | ||
* var config = { | ||
* ```ts | ||
* const config = { | ||
* theme: 'default', | ||
@@ -93,4 +154,19 @@ * logLevel: 'fatal', | ||
* mermaid.initialize(config); | ||
* </script> | ||
* ``` | ||
*/ | ||
export declare const mermaidAPI: Readonly<{ | ||
render: (id: string, text: string, cb?: ((svgCode: string, bindFunctions?: ((element: Element) => void) | undefined) => void) | undefined, svgContainingElement?: Element) => string; | ||
renderAsync: (id: string, text: string, cb?: ((svgCode: string, bindFunctions?: ((element: Element) => void) | undefined) => void) | undefined, svgContainingElement?: Element) => Promise<string>; | ||
parse: typeof parse; | ||
parseAsync: typeof parseAsync; | ||
parseDirective: (p: any, statement: string, context: string, type: string) => void; | ||
initialize: typeof initialize; | ||
getConfig: () => MermaidConfig; | ||
setConfig: (conf: MermaidConfig) => MermaidConfig; | ||
getSiteConfig: () => MermaidConfig; | ||
updateSiteConfig: (conf: MermaidConfig) => MermaidConfig; | ||
reset: () => void; | ||
globalReset: () => void; | ||
defaultConfig: MermaidConfig; | ||
}>; | ||
export default mermaidAPI; |
@@ -1,3 +0,3 @@ | ||
export declare const convert: (template: TemplateStringsArray, ...params: any[]) => { | ||
[k: string]: any; | ||
export declare const convert: (template: TemplateStringsArray, ...params: unknown[]) => { | ||
[k: string]: unknown; | ||
}[]; |
/** | ||
* @file Values that have been hardcoded in src/diagrams/er/styles.js. These can be used by | ||
* Values that have been hardcoded in src/diagrams/er/styles.js. These can be used by | ||
* theme-_._ files to maintain display styles until themes, styles, renderers are revised. -- | ||
@@ -4,0 +4,0 @@ * 2022-09-22 |
@@ -0,10 +1,11 @@ | ||
import { CurveFactory } from 'd3'; | ||
import { MermaidConfig } from './config.type'; | ||
/** | ||
* @function detectInit Detects the init config object from the text | ||
* @param config | ||
* Detects the init config object from the text | ||
* | ||
* ```mermaid | ||
* @param text - The text defining the graph. For example: | ||
* | ||
* %%{init: {"theme": "debug", "logLevel": 1 }}%% | ||
* graph LR | ||
* ```mermaid | ||
* %%{init: {"theme": "debug", "logLevel": 1 }}%% | ||
* graph LR | ||
* a-->b | ||
@@ -19,7 +20,7 @@ * b-->c | ||
* | ||
* Or | ||
* Or | ||
* | ||
* ```mermaid | ||
* %%{initialize: {"theme": "dark", logLevel: "debug" }}%% | ||
* graph LR | ||
* ```mermaid | ||
* %%{initialize: {"theme": "dark", logLevel: "debug" }}%% | ||
* graph LR | ||
* a-->b | ||
@@ -33,13 +34,16 @@ * b-->c | ||
* ``` | ||
* @param {string} text The text defining the graph | ||
* @returns {object} The json object representing the init passed to mermaid.initialize() | ||
* | ||
* @param config - Optional mermaid configuration object. | ||
* @returns The json object representing the init passed to mermaid.initialize() | ||
*/ | ||
export declare const detectInit: (text: string, config?: MermaidConfig) => MermaidConfig; | ||
/** | ||
* @function detectDirective Detects the directive from the text. Text can be single line or | ||
* multiline. If type is null or omitted the first directive encountered in text will be returned | ||
* Detects the directive from the text. | ||
* | ||
* ```mermaid | ||
* graph LR | ||
* %%{somedirective}%% | ||
* Text can be single line or multiline. If type is null or omitted, | ||
* the first directive encountered in text will be returned | ||
* | ||
* ```mermaid | ||
* graph LR | ||
* %%{someDirective}%% | ||
* a-->b | ||
@@ -53,58 +57,75 @@ * b-->c | ||
* ``` | ||
* @param {string} text The text defining the graph | ||
* @param {string | RegExp} type The directive to return (default: null) | ||
* @returns {object | Array} An object or Array representing the directive(s): { type: string, args: | ||
* object|null } matched by the input type if a single directive was found, that directive object | ||
* will be returned. | ||
* | ||
* @param text - The text defining the graph | ||
* @param type - The directive to return (default: `null`) | ||
* @returns An object or Array representing the directive(s) matched by the input type. | ||
* If a single directive was found, that directive object will be returned. | ||
*/ | ||
export declare const detectDirective: (text: any, type?: null) => { | ||
type: string; | ||
args: any; | ||
export declare const detectDirective: (text: string, type?: string | RegExp) => { | ||
type?: string | undefined; | ||
args?: any; | ||
} | { | ||
type: any; | ||
args: null; | ||
} | ({ | ||
type: string; | ||
args: any; | ||
} | { | ||
type: any; | ||
args: null; | ||
})[]; | ||
type?: string | undefined; | ||
args?: any; | ||
}[]; | ||
/** | ||
* @function isSubstringInArray Detects whether a substring in present in a given array | ||
* @param {string} str The substring to detect | ||
* @param {Array} arr The array to search | ||
* @returns {number} The array index containing the substring or -1 if not present | ||
* Detects whether a substring in present in a given array | ||
* | ||
* @param str - The substring to detect | ||
* @param arr - The array to search | ||
* @returns The array index containing the substring or -1 if not present | ||
*/ | ||
export declare const isSubstringInArray: (str: any, arr: any) => number; | ||
export declare const isSubstringInArray: (str: string, arr: string[]) => number; | ||
/** | ||
* Returns a d3 curve given a curve name | ||
* | ||
* @param {string | undefined} interpolate The interpolation name | ||
* @param {any} defaultCurve The default curve to return | ||
* @returns {import('d3-shape').CurveFactory} The curve factory to use | ||
* @param interpolate - The interpolation name | ||
* @param defaultCurve - The default curve to return | ||
* @returns The curve factory to use | ||
*/ | ||
export declare const interpolateToCurve: (interpolate: any, defaultCurve: any) => any; | ||
export declare function interpolateToCurve(interpolate?: string, defaultCurve: CurveFactory): CurveFactory; | ||
/** | ||
* Formats a URL string | ||
* | ||
* @param {string} linkStr String of the URL | ||
* @param {{ securityLevel: string }} config Configuration passed to MermaidJS | ||
* @returns {string | undefined} The formatted URL | ||
* @param linkStr - String of the URL | ||
* @param config - Configuration passed to MermaidJS | ||
* @returns The formatted URL or `undefined`. | ||
*/ | ||
export declare const formatUrl: (linkStr: any, config: any) => any; | ||
export declare function formatUrl(linkStr: string, config: { | ||
securityLevel: string; | ||
}): string | undefined; | ||
/** | ||
* Runs a function | ||
* | ||
* @param {string} functionName A dot seperated path to the function relative to the `window` | ||
* @param {...any} params Parameters to pass to the function | ||
* @param functionName - A dot separated path to the function relative to the `window` | ||
* @param params - Parameters to pass to the function | ||
*/ | ||
export declare const runFunc: (functionName: any, ...params: any[]) => void; | ||
export declare const runFunc: (functionName: string, ...params: any[]) => void; | ||
/** A (x, y) point */ | ||
interface Point { | ||
/** The x value */ | ||
x: number; | ||
/** The y value */ | ||
y: number; | ||
} | ||
/** | ||
* {@inheritdoc traverseEdge} | ||
*/ | ||
declare function calcLabelPosition(points: Point[]): Point; | ||
/** | ||
* Calculates the terminal label position. | ||
* | ||
* @param terminalMarkerSize - Terminal marker size. | ||
* @param position - Position of label relative to points. | ||
* @param _points - Array of points. | ||
* @returns - The `cardinalityPosition`. | ||
*/ | ||
declare function calcTerminalLabelPosition(terminalMarkerSize: number, position: 'start_left' | 'start_right' | 'end_left' | 'end_right', _points: Point[]): Point; | ||
/** | ||
* Gets styles from an array of declarations | ||
* | ||
* @param {string[]} arr Declarations | ||
* @returns {{ style: string; labelStyle: string }} The styles grouped as strings | ||
* @param arr - Declarations | ||
* @returns The styles grouped as strings | ||
*/ | ||
export declare const getStylesFromArray: (arr: any) => { | ||
export declare function getStylesFromArray(arr: string[]): { | ||
style: string; | ||
@@ -131,19 +152,25 @@ labelStyle: string; | ||
* | ||
* @param {SVGElement} elem Element to add text to | ||
* @param {{ | ||
* text: string; | ||
* x: number; | ||
* y: number; | ||
* anchor: 'start' | 'middle' | 'end'; | ||
* fontFamily: string; | ||
* fontSize: string | number; | ||
* fontWeight: string | number; | ||
* fill: string; | ||
* class: string | undefined; | ||
* textMargin: number; | ||
* }} textData | ||
* @returns {SVGTextElement} Text element with given styling and content | ||
* @param elem - SVG Element to add text to | ||
* @param textData - Text options. | ||
* @returns Text element with given styling and content | ||
*/ | ||
export declare const drawSimpleText: (elem: any, textData: any) => any; | ||
export declare const wrapLabel: ((label: any, maxWidth: any, config: any) => any) & import("lodash").MemoizedFunction; | ||
export declare const drawSimpleText: (elem: SVGElement, textData: { | ||
text: string; | ||
x: number; | ||
y: number; | ||
anchor: 'start' | 'middle' | 'end'; | ||
fontFamily: string; | ||
fontSize: string | number; | ||
fontWeight: string | number; | ||
fill: string; | ||
class: string | undefined; | ||
textMargin: number; | ||
}) => SVGTextElement; | ||
interface WrapLabelConfig { | ||
fontSize: number; | ||
fontFamily: string; | ||
fontWeight: number; | ||
joinWith: string; | ||
} | ||
export declare const wrapLabel: (label: string, maxWidth: string, config: WrapLabelConfig) => string; | ||
/** | ||
@@ -155,17 +182,27 @@ * This calculates the text's height, taking into account the wrap breaks and both the statically | ||
* | ||
* @param {any} text The text to measure | ||
* @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the | ||
* @param text - The text to measure | ||
* @param config - The config for fontSize, fontFamily, and fontWeight all impacting the | ||
* resulting size | ||
* @returns {any} - The height for the given text | ||
* @returns The height for the given text | ||
*/ | ||
export declare const calculateTextHeight: (text: any, config: any) => number; | ||
export declare function calculateTextHeight(text: Parameters<typeof calculateTextDimensions>[0], config: Parameters<typeof calculateTextDimensions>[1]): ReturnType<typeof calculateTextDimensions>['height']; | ||
/** | ||
* This calculates the width of the given text, font size and family. | ||
* | ||
* @param {any} text - The text to calculate the width of | ||
* @param {any} config - The config for fontSize, fontFamily, and fontWeight all impacting the | ||
* @param text - The text to calculate the width of | ||
* @param config - The config for fontSize, fontFamily, and fontWeight all impacting the | ||
* resulting size | ||
* @returns {any} - The width for the given text | ||
* @returns The width for the given text | ||
*/ | ||
export declare const calculateTextWidth: (text: any, config: any) => number; | ||
export declare function calculateTextWidth(text: Parameters<typeof calculateTextDimensions>[0], config: Parameters<typeof calculateTextDimensions>[1]): ReturnType<typeof calculateTextDimensions>['width']; | ||
interface TextDimensionConfig { | ||
fontSize?: number; | ||
fontWeight?: number; | ||
fontFamily?: string; | ||
} | ||
interface TextDimensions { | ||
width: number; | ||
height: number; | ||
lineHeight?: number; | ||
} | ||
/** | ||
@@ -175,16 +212,8 @@ * This calculates the dimensions of the given text, font size, font family, font weight, and | ||
* | ||
* @param {any} text - The text to calculate the width of | ||
* @param {any} config - The config for fontSize, fontFamily, fontWeight, and margin all impacting | ||
* @param text - The text to calculate the width of | ||
* @param config - The config for fontSize, fontFamily, fontWeight, and margin all impacting | ||
* the resulting size | ||
* @returns - The width for the given text | ||
* @returns The dimensions for the given text | ||
*/ | ||
export declare const calculateTextDimensions: ((text: any, config: any) => { | ||
width: number; | ||
height: number; | ||
lineHeight?: undefined; | ||
} | { | ||
width: number; | ||
height: number; | ||
lineHeight: number; | ||
}) & import("lodash").MemoizedFunction; | ||
export declare const calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions; | ||
export declare const initIdGenerator: { | ||
@@ -198,10 +227,10 @@ new (deterministic: any, seed: any): { | ||
* | ||
* @param {string} html HTML as a string | ||
* @returns {string} Unescaped HTML | ||
* @param html - HTML as a string | ||
* @returns Unescaped HTML | ||
*/ | ||
export declare const entityDecode: (html: any) => string; | ||
export declare const entityDecode: (html: string) => string; | ||
/** | ||
* Sanitizes directive objects | ||
* | ||
* @param {object} args Directive's JSON | ||
* @param args - Directive's JSON | ||
*/ | ||
@@ -216,6 +245,15 @@ export declare const directiveSanitizer: (args: any) => void; | ||
} | ||
/** @param error */ | ||
/** @param error - The error to check */ | ||
export declare function isDetailedError(error: unknown): error is DetailedError; | ||
/** @param error */ | ||
/** @param error - The error to convert to an error message */ | ||
export declare function getErrorMessage(error: unknown): string; | ||
/** | ||
* Appends <text> element with the given title and css class. | ||
* | ||
* @param parent - d3 svg object to append title to | ||
* @param cssClass - CSS class for the <text> element containing the title | ||
* @param titleTopMargin - Margin in pixels between title and rest of the graph | ||
* @param title - The title. If empty, returns immediately. | ||
*/ | ||
export declare const insertTitle: (parent: any, cssClass: string, titleTopMargin: number, title?: string) => void; | ||
declare const _default: { | ||
@@ -226,31 +264,17 @@ assignWithDepth: (dst: any, src: any, config?: { | ||
} | undefined) => any; | ||
wrapLabel: ((label: any, maxWidth: any, config: any) => any) & import("lodash").MemoizedFunction; | ||
calculateTextHeight: (text: any, config: any) => number; | ||
calculateTextWidth: (text: any, config: any) => number; | ||
calculateTextDimensions: ((text: any, config: any) => { | ||
width: number; | ||
height: number; | ||
lineHeight?: undefined; | ||
} | { | ||
width: number; | ||
height: number; | ||
lineHeight: number; | ||
}) & import("lodash").MemoizedFunction; | ||
wrapLabel: (label: string, maxWidth: string, config: WrapLabelConfig) => string; | ||
calculateTextHeight: typeof calculateTextHeight; | ||
calculateTextWidth: typeof calculateTextWidth; | ||
calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions; | ||
detectInit: (text: string, config?: MermaidConfig | undefined) => MermaidConfig; | ||
detectDirective: (text: any, type?: null) => { | ||
type: string; | ||
args: any; | ||
detectDirective: (text: string, type?: string | RegExp) => { | ||
type?: string | undefined; | ||
args?: any; | ||
} | { | ||
type: any; | ||
args: null; | ||
} | ({ | ||
type: string; | ||
args: any; | ||
} | { | ||
type: any; | ||
args: null; | ||
})[]; | ||
isSubstringInArray: (str: any, arr: any) => number; | ||
interpolateToCurve: (interpolate: any, defaultCurve: any) => any; | ||
calcLabelPosition: (points: any) => any; | ||
type?: string | undefined; | ||
args?: any; | ||
}[]; | ||
isSubstringInArray: (str: string, arr: string[]) => number; | ||
interpolateToCurve: typeof interpolateToCurve; | ||
calcLabelPosition: typeof calcLabelPosition; | ||
calcCardinalityPosition: (isRelationTypePresent: any, points: any, initialPosition: any) => { | ||
@@ -260,15 +284,9 @@ x: number; | ||
}; | ||
calcTerminalLabelPosition: (terminalMarkerSize: any, position: any, _points: any) => { | ||
x: number; | ||
y: number; | ||
}; | ||
formatUrl: (linkStr: any, config: any) => any; | ||
getStylesFromArray: (arr: any) => { | ||
style: string; | ||
labelStyle: string; | ||
}; | ||
calcTerminalLabelPosition: typeof calcTerminalLabelPosition; | ||
formatUrl: typeof formatUrl; | ||
getStylesFromArray: typeof getStylesFromArray; | ||
generateId: () => string; | ||
random: (options: any) => string; | ||
runFunc: (functionName: any, ...params: any[]) => void; | ||
entityDecode: (html: any) => string; | ||
runFunc: (functionName: string, ...params: any[]) => void; | ||
entityDecode: (html: string) => string; | ||
initIdGenerator: { | ||
@@ -281,3 +299,4 @@ new (deterministic: any, seed: any): { | ||
sanitizeCss: (str: any) => any; | ||
insertTitle: (parent: any, cssClass: string, titleTopMargin: number, title?: string | undefined) => void; | ||
}; | ||
export default _default; |
{ | ||
"name": "mermaid", | ||
"version": "9.2.3-rc.1", | ||
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", | ||
"version": "9.3.0-rc.1", | ||
"description": "Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", | ||
"main": "./dist/mermaid.min.js", | ||
@@ -27,5 +27,10 @@ "module": "./dist/mermaid.core.mjs", | ||
"clean": "rimraf dist", | ||
"docs:build": "ts-node-esm src/docs.mts", | ||
"docs:verify": "pnpm docs:build --verify", | ||
"todo-postbuild": "documentation build src/mermaidAPI.ts src/config.ts src/defaultConfig.ts --shallow -f md --markdown-toc false > src/docs/Setup.md && prettier --write src/docs/Setup.md", | ||
"docs:code": "typedoc src/defaultConfig.ts src/config.ts src/mermaidAPI.ts && prettier --write ./src/docs/config/setup", | ||
"docs:build": "rimraf ../../docs && pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts", | ||
"docs:verify": "pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts --verify", | ||
"docs:pre:vitepress": "rimraf src/vitepress && pnpm docs:code && ts-node-esm src/docs.mts --vitepress", | ||
"docs:build:vitepress": "pnpm docs:pre:vitepress && vitepress build src/vitepress", | ||
"docs:dev": "pnpm docs:pre:vitepress && concurrently \"vitepress dev src/vitepress\" \"ts-node-esm src/docs.mts --watch --vitepress\"", | ||
"docs:serve": "pnpm docs:build:vitepress && vitepress serve src/vitepress", | ||
"docs:spellcheck": "cspell --config ../../cSpell.json \"src/docs/**/*.md\"", | ||
"release": "pnpm build", | ||
@@ -53,9 +58,6 @@ "prepublishOnly": "pnpm -w run build" | ||
"d3": "^7.0.0", | ||
"dagre": "^0.8.5", | ||
"dagre-d3": "^0.6.4", | ||
"dompurify": "2.4.0", | ||
"fast-clone": "^1.5.13", | ||
"graphlib": "^2.1.8", | ||
"dagre-d3-es": "7.0.4", | ||
"dompurify": "2.4.1", | ||
"khroma": "^2.0.0", | ||
"lodash": "^4.17.21", | ||
"lodash-es": "^4.17.21", | ||
"moment-mini": "^2.24.0", | ||
@@ -67,41 +69,34 @@ "non-layered-tidy-tree-layout": "^2.0.2", | ||
"devDependencies": { | ||
"@applitools/eyes-cypress": "^3.25.7", | ||
"@commitlint/cli": "^17.1.2", | ||
"@commitlint/config-conventional": "^17.0.0", | ||
"@types/d3": "^7.4.0", | ||
"@types/dompurify": "^2.3.4", | ||
"@types/eslint": "^8.4.6", | ||
"@types/express": "^4.17.13", | ||
"@types/jsdom": "^20.0.0", | ||
"@types/lodash": "^4.14.185", | ||
"@types/prettier": "^2.7.0", | ||
"@types/dompurify": "^2.4.0", | ||
"@types/jsdom": "^20.0.1", | ||
"@types/lodash-es": "^4.17.6", | ||
"@types/micromatch": "^4.0.2", | ||
"@types/prettier": "^2.7.1", | ||
"@types/stylis": "^4.0.2", | ||
"@types/uuid": "^8.3.4", | ||
"@typescript-eslint/eslint-plugin": "^5.37.0", | ||
"@typescript-eslint/parser": "^5.37.0", | ||
"concurrently": "^7.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.42.1", | ||
"@typescript-eslint/parser": "^5.42.1", | ||
"chokidar": "^3.5.3", | ||
"concurrently": "^7.5.0", | ||
"coveralls": "^3.1.1", | ||
"documentation": "13.2.0", | ||
"eslint": "^8.23.1", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-cypress": "^2.12.1", | ||
"eslint-plugin-html": "^7.1.0", | ||
"eslint-plugin-jest": "^27.0.4", | ||
"eslint-plugin-jsdoc": "^39.3.6", | ||
"eslint-plugin-json": "^3.1.0", | ||
"eslint-plugin-markdown": "^3.0.0", | ||
"identity-obj-proxy": "^3.0.0", | ||
"cspell": "^6.14.3", | ||
"globby": "^13.1.2", | ||
"jison": "^0.4.18", | ||
"js-base64": "3.7.2", | ||
"jsdom": "^20.0.0", | ||
"js-base64": "^3.7.2", | ||
"jsdom": "^20.0.2", | ||
"micromatch": "^4.0.5", | ||
"moment": "^2.29.4", | ||
"path-browserify": "^1.0.1", | ||
"prettier": "^2.7.1", | ||
"remark": "^14.0.2", | ||
"rimraf": "^3.0.2", | ||
"start-server-and-test": "^1.12.6", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.8.3", | ||
"unist-util-flatmap": "^1.0.0" | ||
"start-server-and-test": "^1.14.0", | ||
"typedoc": "^0.23.18", | ||
"typedoc-plugin-markdown": "^3.13.6", | ||
"typescript": "^4.8.4", | ||
"unist-util-flatmap": "^1.0.0", | ||
"vitepress": "^1.0.0-alpha.28", | ||
"vitepress-plugin-search": "^1.0.4-alpha.15" | ||
}, | ||
"resolutions": { | ||
"d3": "^7.0.0" | ||
}, | ||
"files": [ | ||
@@ -108,0 +103,0 @@ "dist", |
# mermaid | ||
[![Build CI Status](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![CDN Status](https://img.shields.io/jsdelivr/npm/hm/mermaid)](https://www.jsdelivr.com/package/npm/mermaid) [![NPM](https://img.shields.io/npm/dm/mermaid)](https://www.npmjs.com/package/mermaid) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![Twitter Follow](https://img.shields.io/twitter/follow/mermaidjs_?style=social)](https://twitter.com/mermaidjs_) | ||
[![Build CI Status](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![npm minified gzipped bundle size](https://img.shields.io/bundlephobia/minzip/mermaid)](https://bundlephobia.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![CDN Status](https://img.shields.io/jsdelivr/npm/hm/mermaid)](https://www.jsdelivr.com/package/npm/mermaid) [![NPM](https://img.shields.io/npm/dm/mermaid)](https://www.npmjs.com/package/mermaid) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![Twitter Follow](https://img.shields.io/twitter/follow/mermaidjs_?style=social)](https://twitter.com/mermaidjs_) | ||
# Whoa, what's going on here? | ||
We are transforming the Mermaid repository to a so called mono-repo. This is a part of the effort to decouple the diagrams from the core of mermaid. This will: | ||
- Make it possible to select which diagrams to include on your site | ||
- Open up for lazy loading | ||
- Make it possible to add diagrams from outside of the Mermaid repository | ||
- Separate the release flow between different diagrams and the Mermaid core | ||
As such be aware of some changes.. | ||
# We use pnpm now | ||
# The source code has moved | ||
It is now located in the src folder for each respective package located as subfolders in packages. | ||
English | [简体中文](./README.zh-CN.md) | ||
@@ -23,0 +6,0 @@ |
# mermaid | ||
[![Build CI Status](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![CDN Status](https://img.shields.io/jsdelivr/npm/hm/mermaid)](https://www.jsdelivr.com/package/npm/mermaid) [![NPM](https://img.shields.io/npm/dm/mermaid)](https://www.npmjs.com/package/mermaid) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![Twitter Follow](https://img.shields.io/twitter/follow/mermaidjs_?style=social)](https://twitter.com/mermaidjs_) | ||
[![Build CI Status](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml/badge.svg)](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![npm minified gzipped bundle size](https://img.shields.io/bundlephobia/minzip/mermaid)](https://bundlephobia.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![CDN Status](https://img.shields.io/jsdelivr/npm/hm/mermaid)](https://www.jsdelivr.com/package/npm/mermaid) [![NPM](https://img.shields.io/npm/dm/mermaid)](https://www.npmjs.com/package/mermaid) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![Twitter Follow](https://img.shields.io/twitter/follow/mermaidjs_?style=social)](https://twitter.com/mermaidjs_) | ||
@@ -5,0 +5,0 @@ [English](./README.md) | 简体中文 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10
31
134
21019628
150083
347
+ Addeddagre-d3-es@7.0.4
+ Addedlodash-es@^4.17.21
+ Addeddagre-d3-es@7.0.4(transitive)
+ Addeddompurify@2.4.1(transitive)
+ Addedlodash-es@4.17.21(transitive)
- Removeddagre@^0.8.5
- Removeddagre-d3@^0.6.4
- Removedfast-clone@^1.5.13
- Removedgraphlib@^2.1.8
- Removedlodash@^4.17.21
- Removedcommander@2.20.3(transitive)
- Removedd3@5.16.0(transitive)
- Removedd3-array@1.2.4(transitive)
- Removedd3-axis@1.0.12(transitive)
- Removedd3-brush@1.1.6(transitive)
- Removedd3-chord@1.0.6(transitive)
- Removedd3-collection@1.0.7(transitive)
- Removedd3-color@1.4.1(transitive)
- Removedd3-contour@1.3.2(transitive)
- Removedd3-dispatch@1.0.6(transitive)
- Removedd3-drag@1.2.5(transitive)
- Removedd3-dsv@1.2.0(transitive)
- Removedd3-ease@1.0.7(transitive)
- Removedd3-fetch@1.2.0(transitive)
- Removedd3-force@1.2.1(transitive)
- Removedd3-format@1.4.5(transitive)
- Removedd3-geo@1.12.1(transitive)
- Removedd3-hierarchy@1.1.9(transitive)
- Removedd3-interpolate@1.4.0(transitive)
- Removedd3-path@1.0.9(transitive)
- Removedd3-polygon@1.0.6(transitive)
- Removedd3-quadtree@1.0.7(transitive)
- Removedd3-random@1.1.2(transitive)
- Removedd3-scale@2.2.2(transitive)
- Removedd3-scale-chromatic@1.5.0(transitive)
- Removedd3-selection@1.4.2(transitive)
- Removedd3-shape@1.3.7(transitive)
- Removedd3-time@1.1.0(transitive)
- Removedd3-time-format@2.3.0(transitive)
- Removedd3-timer@1.0.10(transitive)
- Removedd3-transition@1.3.2(transitive)
- Removedd3-voronoi@1.1.4(transitive)
- Removedd3-zoom@1.8.3(transitive)
- Removeddagre@0.8.5(transitive)
- Removeddagre-d3@0.6.4(transitive)
- Removeddompurify@2.4.0(transitive)
- Removedfast-clone@1.5.13(transitive)
- Removedgraphlib@2.1.8(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedlodash@4.17.21(transitive)
Updateddompurify@2.4.1