UNPKG

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