CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
mermaidAPI.d.ts95 linesDownload Raw Back to dist
1import type { MermaidConfig } from './config.type.js';2import type { DiagramMetadata, DiagramStyleClassDef } from './diagram-api/types.js';3import { Diagram } from './Diagram.js';4import type { D3HtmlSelection, ParseOptions, ParseResult, RenderResult } from './types.js';5/**6 * Parse the text and validate the syntax.7 * @param text - The mermaid diagram definition.8 * @param parseOptions - Options for parsing. @see {@link ParseOptions}9 * @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.10 * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.11 */12declare function parse(text: string, parseOptions: ParseOptions & {13    suppressErrors: true;14}): Promise<ParseResult | false>;15declare function parse(text: string, parseOptions?: ParseOptions): Promise<ParseResult>;16/**17 * Create a CSS style that starts with the given class name, then the element,18 * with an enclosing block that has each of the cssClasses followed by !important;19 * @param cssClass - CSS class name20 * @param element - CSS element21 * @param cssClasses - list of CSS styles to append after the element22 * @returns - the constructed string23 */24export declare const cssImportantStyles: (cssClass: string, element: string, cssClasses?: string[]) => string;25/**26 * Create the user styles27 * @internal28 * @param  config - configuration that has style and theme settings to use29 * @param  classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...)30 * @returns  the string with all the user styles31 */32export declare const createCssStyles: (config: MermaidConfig, classDefs?: Map<string, DiagramStyleClassDef> | null | undefined) => string;33export declare const createUserStyles: (config: MermaidConfig, graphType: string, classDefs: Map<string, DiagramStyleClassDef> | undefined, svgId: `#${string}`) => string;34/**35 * Clean up svgCode. Do replacements needed36 *37 * @param svgCode - the code to clean up38 * @param inSandboxMode - security level39 * @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors)40 * @returns the cleaned up svgCode41 */42export declare const cleanUpSvgCode: (svgCode: string | undefined, inSandboxMode: boolean, useArrowMarkerUrls: boolean) => string;43/**44 * Put the svgCode into an iFrame. Return the iFrame code45 *46 * @param svgCode - the svg code to put inside the iFrame47 * @param svgElement - the d3 node that has the current svgElement so we can get the height from it48 * @returns  - the code with the iFrame that now contains the svgCode49 */50export declare const putIntoIFrame: (svgCode?: string, svgElement?: SVGSVGElement) => string;51/**52 * Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes.53 * Only set the style attribute on the enclosing div if divStyle is given.54 * Only set the xmlns:xlink attribute on svg if svgXlink is given.55 * Return the last node appended56 *57 * @param parentRoot - the d3 node to append things to58 * @param id - the value to set the id attr to59 * @param enclosingDivId - the id to set the enclosing div to60 * @param divStyle - if given, the style to set the enclosing div to61 * @param svgXlink - if given, the link to set the new svg element to62 * @returns - returns the parentRoot that had nodes appended63 */64export declare const appendDivSvgG: (parentRoot: D3HtmlSelection<HTMLElement> | D3HtmlSelection<Element>, id: string, enclosingDivId: string, divStyle?: string, svgXlink?: string) => D3HtmlSelection<HTMLElement> | D3HtmlSelection<Element>;65/**66 * Remove any existing elements from the given document67 *68 * @param doc - the document to removed elements from69 * @param id - id for any existing SVG element70 * @param divSelector - selector for any existing enclosing div element71 * @param iFrameSelector - selector for any existing iFrame element72 */73export declare const removeExistingElements: (doc: Document, id: string, divId: string, iFrameId: string) => void;74/**75 * @param  userOptions - Initial Mermaid options76 */77declare function initialize(userOptions?: MermaidConfig): void;78/**79 * @internal - Use mermaid.function instead of mermaid.mermaidAPI.function80 */81export declare const mermaidAPI: Readonly<{82    render: (id: string, text: string, svgContainingElement?: Element) => Promise<RenderResult>;83    parse: typeof parse;84    getDiagramFromText: (text: string, metadata?: Pick<DiagramMetadata, "title">) => Promise<Diagram>;85    initialize: typeof initialize;86    getConfig: () => MermaidConfig;87    setConfig: (conf: MermaidConfig) => MermaidConfig;88    getSiteConfig: () => MermaidConfig;89    updateSiteConfig: (conf: MermaidConfig) => MermaidConfig;90    reset: () => void;91    globalReset: () => void;92    defaultConfig: MermaidConfig;93}>;94export default mermaidAPI;95 
basant307/AI_Governance_Project · CoolFace