UNPKG

3.66 kBTypeScriptView Raw
1import {IconDefinition, IconLookup, IconName, IconFamily, IconPrefix, CssStyleClass, IconStyle, IconPathData, IconPack} from '@fortawesome/fontawesome-common-types';
2export {IconDefinition, IconLookup, IconName, IconFamily, IconPrefix, CssStyleClass, IconStyle, IconPathData, IconPack} from '@fortawesome/fontawesome-common-types';
3export const dom: DOM;
4export const library: Library;
5export const parse: { transform(transformString: string): Transform, icon(parseIconString: string): IconLookup };
6export const config: Config;
7export function noAuto():void;
8export function findIconDefinition(iconLookup: IconLookup): IconDefinition;
9export function text(content: string, params?: TextParams): Text;
10export function counter(content: string | number, params?: CounterParams): Counter;
11export function toHtml(content: any): string;
12export function toHtml(abstractNodes: AbstractElement): string;
13export function layer(
14 assembler: (
15 addLayerCallback: (layerToAdd: IconOrText | IconOrText[]) => void
16 ) => void,
17 params?: LayerParams
18): Layer;
19export function icon(icon: IconName | IconLookup, params?: IconParams): Icon;
20export type IconProp = IconName | [IconPrefix, IconName] | IconLookup;
21export type FlipProp = "horizontal" | "vertical" | "both";
22export type SizeProp =
23 | "2xs"
24 | "xs"
25 | "sm"
26 | "lg"
27 | "xl"
28 | "2xl"
29 | "1x"
30 | "2x"
31 | "3x"
32 | "4x"
33 | "5x"
34 | "6x"
35 | "7x"
36 | "8x"
37 | "9x"
38 | "10x";
39export type PullProp = "left" | "right";
40export type RotateProp = 90 | 180 | 270;
41export type FaSymbol = string | boolean;
42export interface Config {
43 familyPrefix: string;
44 cssPrefix: string;
45 styleDefault: IconPrefix | CssStyleClass | IconStyle;
46 familyDefault: IconFamily;
47 replacementClass: string;
48 autoReplaceSvg: boolean | 'nest';
49 autoAddCss: boolean;
50 autoA11y: boolean;
51 searchPseudoElements: boolean;
52 observeMutations: boolean;
53 keepOriginalSource: boolean;
54 measurePerformance: boolean;
55 mutateApproach: "async" | "sync";
56 showMissingIcons: boolean;
57}
58export interface AbstractElement {
59 tag: string;
60 attributes: any;
61 children?: AbstractElement[];
62}
63export interface FontawesomeObject {
64 readonly abstract: AbstractElement[];
65 readonly html: string[];
66 readonly node: HTMLCollection;
67}
68export interface Icon extends FontawesomeObject, IconDefinition {
69 readonly type: "icon";
70}
71export interface Text extends FontawesomeObject {
72 readonly type: "text";
73}
74export interface Counter extends FontawesomeObject {
75 readonly type: "counter";
76}
77export interface Layer extends FontawesomeObject {
78 readonly type: "layer";
79}
80type IconOrText = Icon | Text;
81export interface Attributes {
82 [key: string]: number | string;
83}
84export interface Styles {
85 [key: string]: string;
86}
87export interface Transform {
88 size?: number;
89 x?: number;
90 y?: number;
91 rotate?: number;
92 flipX?: boolean;
93 flipY?: boolean;
94}
95export interface Params {
96 title?: string;
97 titleId?: string;
98 classes?: string | string[];
99 attributes?: Attributes;
100 styles?: Styles;
101}
102export interface CounterParams extends Params {
103}
104export interface LayerParams {
105 classes?: string | string[];
106}
107export interface TextParams extends Params {
108 transform?: Transform;
109}
110export interface IconParams extends Params {
111 transform?: Transform;
112 symbol?: FaSymbol;
113 mask?: IconLookup;
114 maskId?: string;
115}
116export interface DOM {
117 i2svg(params?: { node: Node; callback?: () => void }): Promise<void>;
118 css(): string;
119 insertCss(): string;
120 watch(): void;
121}
122type IconDefinitionOrPack = IconDefinition | IconPack;
123export interface Library {
124 add(...definitions: Array<IconDefinitionOrPack | IconDefinitionOrPack[]>): void;
125 reset(): void;
126}