UNPKG

1.2 kBTypeScriptView Raw
1export interface LabelIcon {
2 name: string;
3 animation?: string;
4}
5export declare namespace LabelIcon {
6 function is(val: unknown): val is LabelIcon;
7}
8export declare type LabelPart = string | LabelIcon;
9export declare class LabelParser {
10 /**
11 * Returns an array with parts of the given text.
12 * These parts are of type LabelPart which can be either a string or a LabelIcon.
13 * For splitting up the giving text the parser follows this rule:
14 * The text gets parsed for the following pattern: $(iconName~iconAnimation).
15 * If the parser finds such pattern a new LabelIcon object
16 * { name: 'iconName', animation: 'iconAnimation'} is added to the returned array.
17 * iconName can be for instance the name of an icon of e.g. FontAwesome and the (optional) iconAnimation
18 * the name of an animation class which must be supported by the particular icon toolkit.
19 *
20 * Every string before, between or after such icon patterns gets also added to the array
21 * before, between or after the related LabelIcon.
22 *
23 * @param text - the label text to parse
24 */
25 parse(text: string): LabelPart[];
26}
27//# sourceMappingURL=label-parser.d.ts.map
\No newline at end of file