1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { BooleanInput } from '@angular/cdk/coercion';
|
---|
9 | import { AfterViewChecked, ElementRef, ErrorHandler, InjectionToken, OnDestroy, OnInit } from '@angular/core';
|
---|
10 | import { CanColor } from '@angular/material/core';
|
---|
11 | import { MatIconRegistry } from './icon-registry';
|
---|
12 | /** @docs-private */
|
---|
13 | declare const _MatIconBase: import("@angular/material/core/common-behaviors/constructor").Constructor<CanColor> & import("@angular/material/core/common-behaviors/constructor").AbstractConstructor<CanColor> & {
|
---|
14 | new (_elementRef: ElementRef): {
|
---|
15 | _elementRef: ElementRef;
|
---|
16 | };
|
---|
17 | };
|
---|
18 | /**
|
---|
19 | * Injection token used to provide the current location to `MatIcon`.
|
---|
20 | * Used to handle server-side rendering and to stub out during unit tests.
|
---|
21 | * @docs-private
|
---|
22 | */
|
---|
23 | export declare const MAT_ICON_LOCATION: InjectionToken<MatIconLocation>;
|
---|
24 | /**
|
---|
25 | * Stubbed out location for `MatIcon`.
|
---|
26 | * @docs-private
|
---|
27 | */
|
---|
28 | export interface MatIconLocation {
|
---|
29 | getPathname: () => string;
|
---|
30 | }
|
---|
31 | /** @docs-private */
|
---|
32 | export declare function MAT_ICON_LOCATION_FACTORY(): MatIconLocation;
|
---|
33 | /**
|
---|
34 | * Component to display an icon. It can be used in the following ways:
|
---|
35 | *
|
---|
36 | * - Specify the svgIcon input to load an SVG icon from a URL previously registered with the
|
---|
37 | * addSvgIcon, addSvgIconInNamespace, addSvgIconSet, or addSvgIconSetInNamespace methods of
|
---|
38 | * MatIconRegistry. If the svgIcon value contains a colon it is assumed to be in the format
|
---|
39 | * "[namespace]:[name]", if not the value will be the name of an icon in the default namespace.
|
---|
40 | * Examples:
|
---|
41 | * `<mat-icon svgIcon="left-arrow"></mat-icon>
|
---|
42 | * <mat-icon svgIcon="animals:cat"></mat-icon>`
|
---|
43 | *
|
---|
44 | * - Use a font ligature as an icon by putting the ligature text in the content of the `<mat-icon>`
|
---|
45 | * component. By default the Material icons font is used as described at
|
---|
46 | * http://google.github.io/material-design-icons/#icon-font-for-the-web. You can specify an
|
---|
47 | * alternate font by setting the fontSet input to either the CSS class to apply to use the
|
---|
48 | * desired font, or to an alias previously registered with MatIconRegistry.registerFontClassAlias.
|
---|
49 | * Examples:
|
---|
50 | * `<mat-icon>home</mat-icon>
|
---|
51 | * <mat-icon fontSet="myfont">sun</mat-icon>`
|
---|
52 | *
|
---|
53 | * - Specify a font glyph to be included via CSS rules by setting the fontSet input to specify the
|
---|
54 | * font, and the fontIcon input to specify the icon. Typically the fontIcon will specify a
|
---|
55 | * CSS class which causes the glyph to be displayed via a :before selector, as in
|
---|
56 | * https://fortawesome.github.io/Font-Awesome/examples/
|
---|
57 | * Example:
|
---|
58 | * `<mat-icon fontSet="fa" fontIcon="alarm"></mat-icon>`
|
---|
59 | */
|
---|
60 | export declare class MatIcon extends _MatIconBase implements OnInit, AfterViewChecked, CanColor, OnDestroy {
|
---|
61 | private _iconRegistry;
|
---|
62 | private _location;
|
---|
63 | private readonly _errorHandler;
|
---|
64 | /**
|
---|
65 | * Whether the icon should be inlined, automatically sizing the icon to match the font size of
|
---|
66 | * the element the icon is contained in.
|
---|
67 | */
|
---|
68 | get inline(): boolean;
|
---|
69 | set inline(inline: boolean);
|
---|
70 | private _inline;
|
---|
71 | /** Name of the icon in the SVG icon set. */
|
---|
72 | get svgIcon(): string;
|
---|
73 | set svgIcon(value: string);
|
---|
74 | private _svgIcon;
|
---|
75 | /** Font set that the icon is a part of. */
|
---|
76 | get fontSet(): string;
|
---|
77 | set fontSet(value: string);
|
---|
78 | private _fontSet;
|
---|
79 | /** Name of an icon within a font set. */
|
---|
80 | get fontIcon(): string;
|
---|
81 | set fontIcon(value: string);
|
---|
82 | private _fontIcon;
|
---|
83 | private _previousFontSetClass;
|
---|
84 | private _previousFontIconClass;
|
---|
85 | _svgName: string | null;
|
---|
86 | _svgNamespace: string | null;
|
---|
87 | /** Keeps track of the current page path. */
|
---|
88 | private _previousPath?;
|
---|
89 | /** Keeps track of the elements and attributes that we've prefixed with the current path. */
|
---|
90 | private _elementsWithExternalReferences?;
|
---|
91 | /** Subscription to the current in-progress SVG icon request. */
|
---|
92 | private _currentIconFetch;
|
---|
93 | constructor(elementRef: ElementRef<HTMLElement>, _iconRegistry: MatIconRegistry, ariaHidden: string, _location: MatIconLocation, _errorHandler: ErrorHandler);
|
---|
94 | /**
|
---|
95 | * Splits an svgIcon binding value into its icon set and icon name components.
|
---|
96 | * Returns a 2-element array of [(icon set), (icon name)].
|
---|
97 | * The separator for the two fields is ':'. If there is no separator, an empty
|
---|
98 | * string is returned for the icon set and the entire value is returned for
|
---|
99 | * the icon name. If the argument is falsy, returns an array of two empty strings.
|
---|
100 | * Throws an error if the name contains two or more ':' separators.
|
---|
101 | * Examples:
|
---|
102 | * `'social:cake' -> ['social', 'cake']
|
---|
103 | * 'penguin' -> ['', 'penguin']
|
---|
104 | * null -> ['', '']
|
---|
105 | * 'a:b:c' -> (throws Error)`
|
---|
106 | */
|
---|
107 | private _splitIconName;
|
---|
108 | ngOnInit(): void;
|
---|
109 | ngAfterViewChecked(): void;
|
---|
110 | ngOnDestroy(): void;
|
---|
111 | _usingFontIcon(): boolean;
|
---|
112 | private _setSvgElement;
|
---|
113 | private _clearSvgElement;
|
---|
114 | private _updateFontIconClasses;
|
---|
115 | /**
|
---|
116 | * Cleans up a value to be used as a fontIcon or fontSet.
|
---|
117 | * Since the value ends up being assigned as a CSS class, we
|
---|
118 | * have to trim the value and omit space-separated values.
|
---|
119 | */
|
---|
120 | private _cleanupFontValue;
|
---|
121 | /**
|
---|
122 | * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
|
---|
123 | * reference. This is required because WebKit browsers require references to be prefixed with
|
---|
124 | * the current path, if the page has a `base` tag.
|
---|
125 | */
|
---|
126 | private _prependPathToReferences;
|
---|
127 | /**
|
---|
128 | * Caches the children of an SVG element that have `url()`
|
---|
129 | * references that we need to prefix with the current path.
|
---|
130 | */
|
---|
131 | private _cacheChildrenWithExternalReferences;
|
---|
132 | /** Sets a new SVG icon with a particular name. */
|
---|
133 | private _updateSvgIcon;
|
---|
134 | static ngAcceptInputType_inline: BooleanInput;
|
---|
135 | }
|
---|
136 | export {};
|
---|