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