1 | import { CurveFactory } from 'd3';
|
2 | import { MermaidConfig } from './config.type.js';
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | export declare const detectInit: (text: string, config?: MermaidConfig) => MermaidConfig;
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | export declare const detectDirective: (text: string, type?: string | RegExp) => {
|
62 | type?: string | undefined;
|
63 | args?: any;
|
64 | } | {
|
65 | type?: string | undefined;
|
66 | args?: any;
|
67 | }[];
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | export declare const isSubstringInArray: (str: string, arr: string[]) => number;
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | export declare function interpolateToCurve(interpolate: string | undefined, defaultCurve: CurveFactory): CurveFactory;
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | export declare function formatUrl(linkStr: string, config: MermaidConfig): string | undefined;
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | export declare const runFunc: (functionName: string, ...params: any[]) => void;
|
99 |
|
100 | interface Point {
|
101 |
|
102 | x: number;
|
103 |
|
104 | y: number;
|
105 | }
|
106 |
|
107 |
|
108 |
|
109 | declare function calcLabelPosition(points: Point[]): Point;
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | declare function calcTerminalLabelPosition(terminalMarkerSize: number, position: 'start_left' | 'start_right' | 'end_left' | 'end_right', _points: Point[]): Point;
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | export declare function getStylesFromArray(arr: string[]): {
|
126 | style: string;
|
127 | labelStyle: string;
|
128 | };
|
129 | export declare const generateId: () => string;
|
130 | export declare const random: (options: any) => string;
|
131 | export declare const getTextObj: () => {
|
132 | x: number;
|
133 | y: number;
|
134 | fill: undefined;
|
135 | anchor: string;
|
136 | style: string;
|
137 | width: number;
|
138 | height: number;
|
139 | textMargin: number;
|
140 | rx: number;
|
141 | ry: number;
|
142 | valign: undefined;
|
143 | };
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 | export declare const drawSimpleText: (elem: SVGElement, textData: {
|
152 | text: string;
|
153 | x: number;
|
154 | y: number;
|
155 | anchor: 'start' | 'middle' | 'end';
|
156 | fontFamily: string;
|
157 | fontSize: string | number;
|
158 | fontWeight: string | number;
|
159 | fill: string;
|
160 | class: string | undefined;
|
161 | textMargin: number;
|
162 | }) => SVGTextElement;
|
163 | interface WrapLabelConfig {
|
164 | fontSize: number;
|
165 | fontFamily: string;
|
166 | fontWeight: number;
|
167 | joinWith: string;
|
168 | }
|
169 | export declare const wrapLabel: (label: string, maxWidth: string, config: WrapLabelConfig) => string;
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 | export declare function calculateTextHeight(text: Parameters<typeof calculateTextDimensions>[0], config: Parameters<typeof calculateTextDimensions>[1]): ReturnType<typeof calculateTextDimensions>['height'];
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | export declare function calculateTextWidth(text: Parameters<typeof calculateTextDimensions>[0], config: Parameters<typeof calculateTextDimensions>[1]): ReturnType<typeof calculateTextDimensions>['width'];
|
191 | interface TextDimensionConfig {
|
192 | fontSize?: number;
|
193 | fontWeight?: number;
|
194 | fontFamily?: string;
|
195 | }
|
196 | interface TextDimensions {
|
197 | width: number;
|
198 | height: number;
|
199 | lineHeight?: number;
|
200 | }
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | export declare const calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions;
|
211 | export declare const initIdGenerator: {
|
212 | new (deterministic: any, seed: any): {
|
213 | next(): number;
|
214 | };
|
215 | };
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 | export declare const entityDecode: (html: string) => string;
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 | export declare const directiveSanitizer: (args: any) => void;
|
229 | export declare const sanitizeCss: (str: any) => any;
|
230 | export interface DetailedError {
|
231 | str: string;
|
232 | hash: any;
|
233 | error?: any;
|
234 | message?: string;
|
235 | }
|
236 |
|
237 | export declare function isDetailedError(error: unknown): error is DetailedError;
|
238 |
|
239 | export declare function getErrorMessage(error: unknown): string;
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | export declare const insertTitle: (parent: any, cssClass: string, titleTopMargin: number, title?: string) => void;
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 | export declare const parseFontSize: (fontSize: string | number | undefined) => [number?, string?];
|
258 | declare const _default: {
|
259 | assignWithDepth: (dst: any, src: any, config?: {
|
260 | depth: number;
|
261 | clobber: boolean;
|
262 | } | undefined) => any;
|
263 | wrapLabel: (label: string, maxWidth: string, config: WrapLabelConfig) => string;
|
264 | calculateTextHeight: typeof calculateTextHeight;
|
265 | calculateTextWidth: typeof calculateTextWidth;
|
266 | calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions;
|
267 | detectInit: (text: string, config?: MermaidConfig | undefined) => MermaidConfig;
|
268 | detectDirective: (text: string, type?: string | RegExp) => {
|
269 | type?: string | undefined;
|
270 | args?: any;
|
271 | } | {
|
272 | type?: string | undefined;
|
273 | args?: any;
|
274 | }[];
|
275 | isSubstringInArray: (str: string, arr: string[]) => number;
|
276 | interpolateToCurve: typeof interpolateToCurve;
|
277 | calcLabelPosition: typeof calcLabelPosition;
|
278 | calcCardinalityPosition: (isRelationTypePresent: any, points: any, initialPosition: any) => {
|
279 | x: number;
|
280 | y: number;
|
281 | };
|
282 | calcTerminalLabelPosition: typeof calcTerminalLabelPosition;
|
283 | formatUrl: typeof formatUrl;
|
284 | getStylesFromArray: typeof getStylesFromArray;
|
285 | generateId: () => string;
|
286 | random: (options: any) => string;
|
287 | runFunc: (functionName: string, ...params: any[]) => void;
|
288 | entityDecode: (html: string) => string;
|
289 | initIdGenerator: {
|
290 | new (deterministic: any, seed: any): {
|
291 | next(): number;
|
292 | };
|
293 | };
|
294 | directiveSanitizer: (args: any) => void;
|
295 | sanitizeCss: (str: any) => any;
|
296 | insertTitle: (parent: any, cssClass: string, titleTopMargin: number, title?: string | undefined) => void;
|
297 | parseFontSize: (fontSize: string | number | undefined) => [(number | undefined)?, (string | undefined)?];
|
298 | };
|
299 | export default _default;
|