angular-line-awesome
Version:
Angular Line Awesome is an Angular component to manage Line Awesome icons.
129 lines (121 loc) • 5.58 kB
TypeScript
import * as i0 from '@angular/core';
import { OnChanges, SimpleChanges, Renderer2, OnInit, ElementRef } from '@angular/core';
import { SafeHtml, DomSanitizer } from '@angular/platform-browser';
type IconPrefix = 'las' | 'lab' | 'lar';
type FlipProp = 'horizontal' | 'vertical' | 'both';
type PullProp = 'left' | 'right';
type RotateProp = 90 | 180 | 270;
type SizeProp = 'xs' | 'lg' | 'sm' | 'lx' | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x';
type IconProp = IconName | [IconPrefix, IconName] | IconLookup;
type IconName = string;
interface Styles {
[key: string]: string;
}
interface IconLookup {
prefix: IconPrefix;
iconName: IconName;
}
interface Icon {
prefix: IconPrefix;
iconName: IconName;
}
interface Transform {
size?: number;
x?: number;
y?: number;
rotate?: number;
flipX?: boolean;
flipY?: boolean;
}
interface LineAwesomeIcon {
name: string;
data: string;
}
declare class LaStackItemSizeDirective implements OnChanges {
/**
* Specify whether icon inside {@link LaStackComponent} should be rendered in
* regular size (1x) or as a larger icon (2x).
*/
stackItemSize: '1x' | '2x';
size?: SizeProp;
ngOnChanges(changes: SimpleChanges): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LaStackItemSizeDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<LaStackItemSizeDirective, "la-icon[stackItemSize]", never, { "stackItemSize": { "alias": "stackItemSize"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, {}, never, never, false, never>;
}
declare class LaIconLibrary {
private registry;
addIcons(icons: LineAwesomeIcon[]): void;
getIcon(icon: Icon): string | undefined;
static ɵfac: i0.ɵɵFactoryDeclaration<LaIconLibrary, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<LaIconLibrary>;
}
declare class LaIconComponent implements OnChanges {
private sanitizer;
private renderer;
private iconRegistry;
private stackItem;
icon: IconProp;
size?: SizeProp;
fixedWidth?: boolean;
rotate?: RotateProp;
flip?: FlipProp;
pull?: PullProp;
spin?: boolean;
pulse?: boolean;
border?: boolean;
inverse?: boolean;
styles?: Styles;
classes?: string[];
transform?: string | Transform;
mask?: IconProp;
title?: string;
renderedIconHTML: SafeHtml;
/**
* Specify a title for the icon.
* This text will be displayed in a tooltip on hover and presented to the
* screen readers.
*/
get titleAttr(): string;
constructor(sanitizer: DomSanitizer, renderer: Renderer2, iconRegistry: LaIconLibrary, stackItem: LaStackItemSizeDirective);
/**
* Programmatically trigger rendering of the icon.
*
* This method is useful, when creating dynamically or
* changing its inputs programmatically as in these cases icon won't be
* re-rendered automatically.
*/
render(): void;
ngOnChanges(changes: SimpleChanges): void;
protected buildParams(): {
title: string;
transform: Transform;
classes: string[];
styles: Styles;
};
private renderIcon;
private svgElementFromString;
static ɵfac: i0.ɵɵFactoryDeclaration<LaIconComponent, [null, null, null, { optional: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<LaIconComponent, "la-icon", never, { "icon": { "alias": "icon"; "required": false; }; "size": { "alias": "size"; "required": false; }; "fixedWidth": { "alias": "fixedWidth"; "required": false; }; "rotate": { "alias": "rotate"; "required": false; }; "flip": { "alias": "flip"; "required": false; }; "pull": { "alias": "pull"; "required": false; }; "spin": { "alias": "spin"; "required": false; }; "pulse": { "alias": "pulse"; "required": false; }; "border": { "alias": "border"; "required": false; }; "inverse": { "alias": "inverse"; "required": false; }; "styles": { "alias": "styles"; "required": false; }; "classes": { "alias": "classes"; "required": false; }; "transform": { "alias": "transform"; "required": false; }; "mask": { "alias": "mask"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, {}, never, never, false, never>;
}
declare class LaStackComponent implements OnInit, OnChanges {
private renderer;
private elementRef;
/**
* Size of the stacked icon.
* Note that stacked icon is by default 2 times bigger, than non-stacked icon.
* You'll need to set size using custom CSS to align stacked icon with a
* simple one. E.g. `la-stack { font-size: 0.5em; }`.
*/
size?: SizeProp;
constructor(renderer: Renderer2, elementRef: ElementRef);
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LaStackComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LaStackComponent, "la-stack", never, { "size": { "alias": "size"; "required": false; }; }, {}, never, ["la-icon[stackItemSize]"], false, never>;
}
declare class AngularLineawesomeModule {
static ɵfac: i0.ɵɵFactoryDeclaration<AngularLineawesomeModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<AngularLineawesomeModule, [typeof LaIconComponent, typeof LaStackComponent, typeof LaStackItemSizeDirective], never, [typeof LaIconComponent, typeof LaStackComponent, typeof LaStackItemSizeDirective]>;
static ɵinj: i0.ɵɵInjectorDeclaration<AngularLineawesomeModule>;
}
export { AngularLineawesomeModule, LaIconComponent, LaIconLibrary, LaStackComponent, LaStackItemSizeDirective };