UNPKG

3.6 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 showMissingIcons: boolean;
56}
57export interface AbstractElement {
58 tag: string;
59 attributes: any;
60 children?: AbstractElement[];
61}
62export interface FontawesomeObject {
63 readonly abstract: AbstractElement[];
64 readonly html: string[];
65 readonly node: HTMLCollection;
66}
67export interface Icon extends FontawesomeObject, IconDefinition {
68 readonly type: "icon";
69}
70export interface Text extends FontawesomeObject {
71 readonly type: "text";
72}
73export interface Counter extends FontawesomeObject {
74 readonly type: "counter";
75}
76export interface Layer extends FontawesomeObject {
77 readonly type: "layer";
78}
79type IconOrText = Icon | Text;
80export interface Attributes {
81 [key: string]: number | string;
82}
83export interface Styles {
84 [key: string]: string;
85}
86export interface Transform {
87 size?: number;
88 x?: number;
89 y?: number;
90 rotate?: number;
91 flipX?: boolean;
92 flipY?: boolean;
93}
94export interface Params {
95 title?: string;
96 titleId?: string;
97 classes?: string | string[];
98 attributes?: Attributes;
99 styles?: Styles;
100}
101export interface CounterParams extends Params {
102}
103export interface LayerParams {
104 classes?: string | string[];
105}
106export interface TextParams extends Params {
107 transform?: Transform;
108}
109export interface IconParams extends Params {
110 transform?: Transform;
111 symbol?: FaSymbol;
112 mask?: IconLookup;
113 maskId?: string;
114}
115export interface DOM {
116 i2svg(params?: { node: Node; callback?: () => void }): Promise<void>;
117 css(): string;
118 insertCss(): string;
119 watch(): void;
120}
121type IconDefinitionOrPack = IconDefinition | IconPack;
122export interface Library {
123 add(...definitions: IconDefinitionOrPack[]): void;
124 reset(): void;
125}