1 | import type { CurveFactory } from 'd3';
|
2 | import type { MermaidConfig } from './config.type.js';
|
3 | import type { D3Element } from './mermaidAPI.js';
|
4 | import type { Point, TextDimensionConfig, TextDimensions } from './types.js';
|
5 | export declare const ZERO_WIDTH_SPACE = "\u200B";
|
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 |
|
38 |
|
39 |
|
40 | export declare const detectInit: (text: string, config?: MermaidConfig) => MermaidConfig | undefined;
|
41 | interface Directive {
|
42 | type?: string;
|
43 | args?: unknown;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | export declare const detectDirective: (text: string, type?: string | RegExp | null) => Directive | Directive[];
|
69 | export declare const removeDirectives: (text: string) => string;
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | export declare const isSubstringInArray: (str: string, arr: string[]) => number;
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 | export declare function interpolateToCurve(interpolate: string | undefined, defaultCurve: CurveFactory): CurveFactory;
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | export declare function formatUrl(linkStr: string, config: MermaidConfig): string | undefined;
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | export declare const runFunc: (functionName: string, ...params: unknown[]) => void;
|
101 |
|
102 |
|
103 |
|
104 | declare function calcLabelPosition(points: Point[]): Point;
|
105 | export declare const roundNumber: (num: number, precision?: number) => number;
|
106 | export declare const calculatePoint: (points: Point[], distanceToTraverse: number) => Point;
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | declare function calcTerminalLabelPosition(terminalMarkerSize: number, position: 'start_left' | 'start_right' | 'end_left' | 'end_right', _points: Point[]): Point;
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | export declare function getStylesFromArray(arr: string[]): {
|
123 | style: string;
|
124 | labelStyle: string;
|
125 | };
|
126 | export declare const generateId: () => string;
|
127 | export declare const random: (options: {
|
128 | length: number;
|
129 | }) => string;
|
130 | export declare const getTextObj: () => {
|
131 | x: number;
|
132 | y: number;
|
133 | fill: undefined;
|
134 | anchor: string;
|
135 | style: string;
|
136 | width: number;
|
137 | height: number;
|
138 | textMargin: number;
|
139 | rx: number;
|
140 | ry: number;
|
141 | valign: undefined;
|
142 | text: string;
|
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: number, 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 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | export declare const calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions;
|
201 | export declare class InitIDGenerator {
|
202 | private count;
|
203 | next: () => number;
|
204 | constructor(deterministic?: boolean, seed?: string);
|
205 | }
|
206 | /**
|
207 | * Decodes HTML, source: {@link https:
|
208 | *
|
209 | * @param html - HTML as a string
|
210 | * @returns Unescaped HTML
|
211 | */
|
212 | export declare const entityDecode: (html: string) => string;
|
213 | export interface DetailedError {
|
214 | str: string;
|
215 | hash: any;
|
216 | error?: any;
|
217 | message?: string;
|
218 | }
|
219 |
|
220 | export declare function isDetailedError(error: any): error is DetailedError;
|
221 |
|
222 | export declare function getErrorMessage(error: unknown): string;
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 | export declare const insertTitle: (parent: D3Element, cssClass: string, titleTopMargin: number, title?: string) => void;
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 | export declare const parseFontSize: (fontSize: string | number | undefined) => [number?, string?];
|
241 | export declare function cleanAndMerge<T>(defaultData: T, data?: Partial<T>): T;
|
242 | declare const _default: {
|
243 | assignWithDepth: (dst: any, src: any, { depth, clobber }?: {
|
244 | depth?: number | undefined;
|
245 | clobber?: boolean | undefined;
|
246 | }) => any;
|
247 | wrapLabel: (label: string, maxWidth: number, config: WrapLabelConfig) => string;
|
248 | calculateTextHeight: typeof calculateTextHeight;
|
249 | calculateTextWidth: typeof calculateTextWidth;
|
250 | calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions;
|
251 | cleanAndMerge: typeof cleanAndMerge;
|
252 | detectInit: (text: string, config?: MermaidConfig | undefined) => MermaidConfig | undefined;
|
253 | detectDirective: (text: string, type?: string | RegExp | null) => Directive | Directive[];
|
254 | isSubstringInArray: (str: string, arr: string[]) => number;
|
255 | interpolateToCurve: typeof interpolateToCurve;
|
256 | calcLabelPosition: typeof calcLabelPosition;
|
257 | calcCardinalityPosition: (isRelationTypePresent: boolean, points: Point[], initialPosition: Point) => {
|
258 | x: number;
|
259 | y: number;
|
260 | };
|
261 | calcTerminalLabelPosition: typeof calcTerminalLabelPosition;
|
262 | formatUrl: typeof formatUrl;
|
263 | getStylesFromArray: typeof getStylesFromArray;
|
264 | generateId: () => string;
|
265 | random: (options: {
|
266 | length: number;
|
267 | }) => string;
|
268 | runFunc: (functionName: string, ...params: unknown[]) => void;
|
269 | entityDecode: (html: string) => string;
|
270 | insertTitle: (parent: any, cssClass: string, titleTopMargin: number, title?: string | undefined) => void;
|
271 | parseFontSize: (fontSize: string | number | undefined) => [(number | undefined)?, (string | undefined)?];
|
272 | InitIDGenerator: typeof InitIDGenerator;
|
273 | };
|
274 | export default _default;
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | export declare const encodeEntities: (text: string) => string;
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 | export declare const decodeEntities: (text: string) => string;
|
286 | export declare const isString: (value: unknown) => value is string;
|