UNPKG

9.57 kBTypeScriptView Raw
1export declare namespace MermaidAPI {
2 enum SecurityLevel {
3 /**
4 * (default) tags in text are encoded, click functionality is disabled
5 */
6 Strict = "strict",
7 /**
8 * tags in text are allowed, click functionality is enabled
9 */
10 Loose = "loose",
11 /**
12 * html tags in text are allowed, (only script element is removed), click functionality is enabled
13 */
14 Antiscript = "antiscript",
15 /**
16 * with this security level all rendering takes place in a sandboxed iframe.
17 * This prevent any javascript running in the context.
18 * This may hinder interactive functionality of the diagram like scripts,
19 * popups in sequence diagram or links to other tabs/targets etc.
20 */
21 Sandbox = "sandbox"
22 }
23 enum Theme {
24 /**
25 * Designed to modified, as the name implies it is supposed to be used as the base for making custom themes.
26 */
27 Base = "base",
28 /**
29 * A theme full of light greens that is easy on the eyes.
30 */
31 Forest = "forest",
32 /**
33 * A theme that would go well with other dark colored elements.
34 */
35 Dark = "dark",
36 /**
37 * The default theme for all diagrams.
38 */
39 Default = "default",
40 /**
41 * The theme to be used for black and white printing
42 */
43 Neutral = "neutral"
44 }
45 enum LogLevel {
46 Debug = 1,
47 Info = 2,
48 Warn = 3,
49 Error = 4,
50 Fatal = 5
51 }
52 interface FlowChartConfig {
53 /**
54 * **diagramPadding** - amount of padding around the diagram as a whole
55 * default: 8
56 */
57 diagramPadding?: number | undefined;
58 /**
59 * **htmlLabels** - Flag for setting whether or not a html tag should be used for rendering labels
60 * on the edges
61 * default: true
62 */
63 htmlLabels?: boolean | undefined;
64 /**
65 * **nodeSpacing** - Defines the spacing between nodes on the same level
66 * default: 50
67 */
68 nodeSpacing?: number | undefined;
69 /**
70 * **rankSpacing** - Defines the spacing between nodes on different levels
71 * default: 50
72 */
73 rankSpacing?: number | undefined;
74 /**
75 * default: 'monotoneX'
76 */
77 curve?: string | undefined;
78 /**
79 * **rankSpacing** - Only used in new experimental rendering, represents the padding between the labels and the shape
80 * default: 15
81 */
82 padding?: number | undefined;
83 /**
84 * default: true
85 */
86 useMaxWidth?: boolean | undefined;
87 }
88 interface SequenceDiagramConfig {
89 /**
90 * **diagramMarginX** - margin to the right and left of the sequence diagram
91 * default: 50
92 */
93 diagramMarginX?: number | undefined;
94 /**
95 * **diagramMarginY** - margin to the over and under the sequence diagram
96 * default: 10
97 */
98 diagramMarginY?: number | undefined;
99 /**
100 * **actorMargin** - Margin between actors
101 * default: 10
102 */
103 actorMargin?: number | undefined;
104 /**
105 * **width** - Width of actor boxes
106 * default: 150
107 */
108 width?: number | undefined;
109 /**
110 * **height** - Height of actor boxes
111 * default: 65
112 */
113 height?: number | undefined;
114 /**
115 * **boxMargin** - Margin around loop boxes
116 * default: 10
117 */
118 boxMargin?: number | undefined;
119 /**
120 * **boxTextMargin** - margin around the text in loop/alt/opt boxes
121 * default: 5
122 */
123 boxTextMargin?: number | undefined;
124 /**
125 * **noteMargin** - margin around notes
126 * default: 10
127 */
128 noteMargin?: number | undefined;
129 /**
130 * **messageMargin** - Space between messages
131 * default: 35
132 */
133 messageMargin?: number | undefined;
134 /**
135 * **mirrorActors** - mirror actors under diagram
136 * default: true
137 */
138 mirrorActors?: boolean | undefined;
139 /**
140 * **bottomMarginAdj** - Depending on css styling this might need adjustment.
141 * Prolongs the edge of the diagram downwards
142 * default: 1
143 */
144 bottomMarginAdj?: number | undefined;
145 /**
146 * **useMaxWidth** - when this flag is set the height and width is set to 100% and is then scaling with the
147 * available space if not the absolute space required is used
148 * default: true
149 */
150 useMaxWidth?: boolean | undefined;
151 /**
152 * This will display arrows that start and begin at the same node as right angles, rather than a curve
153 * Default value: false
154 */
155 rightAngles?: boolean | undefined;
156 }
157 interface GanttConfig {
158 /**
159 * **titleTopMargin** - margin top for the text over the gantt diagram
160 * default: 25
161 */
162 titleTopMargin?: number | undefined;
163 /**
164 * **barHeight** - the height of the bars in the graph
165 * default: 20
166 */
167 barHeight?: number | undefined;
168 /**
169 * **barGap** - the margin between the different activities in the gantt diagram
170 * default: 4
171 */
172 barGap?: number | undefined;
173 /**
174 * **topPadding** - margin between title and gantt diagram and between axis and gantt diagram.
175 * default: 50
176 */
177 topPadding?: number | undefined;
178 /**
179 * **leftPadding** - the space allocated for the section name to the left of the activities.
180 * default: 75
181 */
182 leftPadding?: number | undefined;
183 /**
184 * **gridLineStartPadding** - Vertical starting position of the grid lines
185 * default: 35
186 */
187 gridLineStartPadding?: number | undefined;
188 /**
189 * **fontSize** - font size ...
190 * default: 11
191 */
192 fontSize?: number | undefined;
193 /**
194 * **fontFamily** - font family ...
195 * default: '"Open-Sans", "sans-serif"'
196 */
197 fontFamily?: string | undefined;
198 /**
199 * **numberSectionStyles** - the number of alternating section styles
200 * default: 4
201 */
202 numberSectionStyles?: number | undefined;
203 /**
204 * **axisFormat** - datetime format of the axis, this might need adjustment to match your locale and preferences
205 * default: '%Y-%m-%d'
206 */
207 axisFormat?: string | undefined;
208 }
209 interface RunOptions {
210 /**
211 * The query selector to use when finding elements to render. Default: `".mermaid"`.
212 */
213 querySelector?: string;
214 /**
215 * The nodes to render. If this is set, `querySelector` will be ignored.
216 */
217 nodes?: ArrayLike<HTMLElement>;
218 /**
219 * A callback to call after each diagram is rendered.
220 */
221 postRenderCallback?: (id: string) => unknown;
222 /**
223 * If `true`, errors will be logged to the console, but not thrown. Default: `false`
224 */
225 suppressErrors?: boolean;
226 }
227 interface Config {
228 /**
229 * ### securityLevel
230 * This changes the default behaviour of mermaid so that after upgrade to 8.2,
231 * unless the `securityLevel` is not changed, tags in flowcharts are encoded as tags and clicking is disabled.
232 * **sandbox** security level is still in the beta version.
233 * default: SecurityLevel.Strict
234 */
235 securityLevel?: SecurityLevel | undefined;
236 theme?: Theme | undefined;
237 themeVariables?: any;
238 themeCSS?: string | undefined;
239 maxTextSize?: number | undefined;
240 darkMode?: boolean | undefined;
241 fontFamily?: string | undefined;
242 /**
243 * logLevel , decides the amount of logging to be used.
244 * default: LogLevel.Fatal
245 */
246 logLevel?: LogLevel | undefined;
247 /**
248 * **startOnLoad** - This options controls whether or mermaid starts when the page loads
249 * default: true
250 */
251 startOnLoad?: boolean | undefined;
252 /**
253 * **arrowMarkerAbsolute** - This options controls whether or arrow markers in html code will be absolute paths or
254 * an anchor, #. This matters if you are using base tag settings.
255 * default: false
256 */
257 arrowMarkerAbsolute?: boolean | undefined;
258 secure?: Array<keyof Config> | undefined;
259 deterministicIds?: boolean | undefined;
260 deterministicIDSeed?: string | undefined;
261 /**
262 * ### flowchart
263 * *The object containing configurations specific for flowcharts*
264 */
265 flowchart?: FlowChartConfig | undefined;
266 /**
267 * ### sequenceDiagram
268 * The object containing configurations specific for sequence diagrams
269 */
270 sequence?: SequenceDiagramConfig | undefined;
271 /**
272 * ### gantt
273 * The object containing configurations specific for gantt diagrams*
274 */
275 gantt?: GanttConfig | undefined;
276 /** To supress mermaid warning **/
277 journey?: any;
278 class?: any;
279 git?: any;
280 state?: any;
281 pie?: any;
282 requirement?: any;
283 }
284}