icon-module.d-COXCrhrh.d.ts 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import * as i0 from '@angular/core';
  2. import { InjectionToken, OnInit, AfterViewChecked, OnDestroy, ElementRef } from '@angular/core';
  3. import { M as MatCommonModule } from './common-module.d-C8xzHJDr.js';
  4. import { T as ThemePalette } from './palette.d-BSSFKjO6.js';
  5. /** Default options for `mat-icon`. */
  6. interface MatIconDefaultOptions {
  7. /**
  8. * Theme color of the icon. This API is supported in M2 themes only, it
  9. * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/icon/styling.
  10. *
  11. * For information on applying color variants in M3, see
  12. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  13. */
  14. color?: ThemePalette;
  15. /** Font set that the icon is a part of. */
  16. fontSet?: string;
  17. }
  18. /** Injection token to be used to override the default options for `mat-icon`. */
  19. declare const MAT_ICON_DEFAULT_OPTIONS: InjectionToken<MatIconDefaultOptions>;
  20. /**
  21. * Injection token used to provide the current location to `MatIcon`.
  22. * Used to handle server-side rendering and to stub out during unit tests.
  23. * @docs-private
  24. */
  25. declare const MAT_ICON_LOCATION: InjectionToken<MatIconLocation>;
  26. /**
  27. * Stubbed out location for `MatIcon`.
  28. * @docs-private
  29. */
  30. interface MatIconLocation {
  31. getPathname: () => string;
  32. }
  33. /**
  34. * @docs-private
  35. * @deprecated No longer used, will be removed.
  36. * @breaking-change 21.0.0
  37. */
  38. declare function MAT_ICON_LOCATION_FACTORY(): MatIconLocation;
  39. /**
  40. * Component to display an icon. It can be used in the following ways:
  41. *
  42. * - Specify the svgIcon input to load an SVG icon from a URL previously registered with the
  43. * addSvgIcon, addSvgIconInNamespace, addSvgIconSet, or addSvgIconSetInNamespace methods of
  44. * MatIconRegistry. If the svgIcon value contains a colon it is assumed to be in the format
  45. * "[namespace]:[name]", if not the value will be the name of an icon in the default namespace.
  46. * Examples:
  47. * `<mat-icon svgIcon="left-arrow"></mat-icon>
  48. * <mat-icon svgIcon="animals:cat"></mat-icon>`
  49. *
  50. * - Use a font ligature as an icon by putting the ligature text in the `fontIcon` attribute or the
  51. * content of the `<mat-icon>` component. If you register a custom font class, don't forget to also
  52. * include the special class `mat-ligature-font`. It is recommended to use the attribute alternative
  53. * to prevent the ligature text to be selectable and to appear in search engine results.
  54. * By default, the Material icons font is used as described at
  55. * http://google.github.io/material-design-icons/#icon-font-for-the-web. You can specify an
  56. * alternate font by setting the fontSet input to either the CSS class to apply to use the
  57. * desired font, or to an alias previously registered with MatIconRegistry.registerFontClassAlias.
  58. * Examples:
  59. * `<mat-icon fontIcon="home"></mat-icon>
  60. * <mat-icon>home</mat-icon>
  61. * <mat-icon fontSet="myfont" fontIcon="sun"></mat-icon>
  62. * <mat-icon fontSet="myfont">sun</mat-icon>`
  63. *
  64. * - Specify a font glyph to be included via CSS rules by setting the fontSet input to specify the
  65. * font, and the fontIcon input to specify the icon. Typically the fontIcon will specify a
  66. * CSS class which causes the glyph to be displayed via a :before selector, as in
  67. * https://fontawesome-v4.github.io/examples/
  68. * Example:
  69. * `<mat-icon fontSet="fa" fontIcon="alarm"></mat-icon>`
  70. */
  71. declare class MatIcon implements OnInit, AfterViewChecked, OnDestroy {
  72. readonly _elementRef: ElementRef<HTMLElement>;
  73. private _iconRegistry;
  74. private _location;
  75. private readonly _errorHandler;
  76. private _defaultColor;
  77. /**
  78. * Theme color of the icon. This API is supported in M2 themes only, it
  79. * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/icon/styling.
  80. *
  81. * For information on applying color variants in M3, see
  82. * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants
  83. */
  84. get color(): string | null | undefined;
  85. set color(value: string | null | undefined);
  86. private _color;
  87. /**
  88. * Whether the icon should be inlined, automatically sizing the icon to match the font size of
  89. * the element the icon is contained in.
  90. */
  91. inline: boolean;
  92. /** Name of the icon in the SVG icon set. */
  93. get svgIcon(): string;
  94. set svgIcon(value: string);
  95. private _svgIcon;
  96. /** Font set that the icon is a part of. */
  97. get fontSet(): string;
  98. set fontSet(value: string);
  99. private _fontSet;
  100. /** Name of an icon within a font set. */
  101. get fontIcon(): string;
  102. set fontIcon(value: string);
  103. private _fontIcon;
  104. private _previousFontSetClass;
  105. private _previousFontIconClass;
  106. _svgName: string | null;
  107. _svgNamespace: string | null;
  108. /** Keeps track of the current page path. */
  109. private _previousPath?;
  110. /** Keeps track of the elements and attributes that we've prefixed with the current path. */
  111. private _elementsWithExternalReferences?;
  112. /** Subscription to the current in-progress SVG icon request. */
  113. private _currentIconFetch;
  114. constructor(...args: unknown[]);
  115. /**
  116. * Splits an svgIcon binding value into its icon set and icon name components.
  117. * Returns a 2-element array of [(icon set), (icon name)].
  118. * The separator for the two fields is ':'. If there is no separator, an empty
  119. * string is returned for the icon set and the entire value is returned for
  120. * the icon name. If the argument is falsy, returns an array of two empty strings.
  121. * Throws an error if the name contains two or more ':' separators.
  122. * Examples:
  123. * `'social:cake' -> ['social', 'cake']
  124. * 'penguin' -> ['', 'penguin']
  125. * null -> ['', '']
  126. * 'a:b:c' -> (throws Error)`
  127. */
  128. private _splitIconName;
  129. ngOnInit(): void;
  130. ngAfterViewChecked(): void;
  131. ngOnDestroy(): void;
  132. _usingFontIcon(): boolean;
  133. private _setSvgElement;
  134. private _clearSvgElement;
  135. private _updateFontIconClasses;
  136. /**
  137. * Cleans up a value to be used as a fontIcon or fontSet.
  138. * Since the value ends up being assigned as a CSS class, we
  139. * have to trim the value and omit space-separated values.
  140. */
  141. private _cleanupFontValue;
  142. /**
  143. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  144. * reference. This is required because WebKit browsers require references to be prefixed with
  145. * the current path, if the page has a `base` tag.
  146. */
  147. private _prependPathToReferences;
  148. /**
  149. * Caches the children of an SVG element that have `url()`
  150. * references that we need to prefix with the current path.
  151. */
  152. private _cacheChildrenWithExternalReferences;
  153. /** Sets a new SVG icon with a particular name. */
  154. private _updateSvgIcon;
  155. static ɵfac: i0.ɵɵFactoryDeclaration<MatIcon, never>;
  156. static ɵcmp: i0.ɵɵComponentDeclaration<MatIcon, "mat-icon", ["matIcon"], { "color": { "alias": "color"; "required": false; }; "inline": { "alias": "inline"; "required": false; }; "svgIcon": { "alias": "svgIcon"; "required": false; }; "fontSet": { "alias": "fontSet"; "required": false; }; "fontIcon": { "alias": "fontIcon"; "required": false; }; }, {}, never, ["*"], true, never>;
  157. static ngAcceptInputType_inline: unknown;
  158. }
  159. declare class MatIconModule {
  160. static ɵfac: i0.ɵɵFactoryDeclaration<MatIconModule, never>;
  161. static ɵmod: i0.ɵɵNgModuleDeclaration<MatIconModule, never, [typeof MatCommonModule, typeof MatIcon], [typeof MatIcon, typeof MatCommonModule]>;
  162. static ɵinj: i0.ɵɵInjectorDeclaration<MatIconModule>;
  163. }
  164. export { MatIconModule as M, MAT_ICON_DEFAULT_OPTIONS as b, MAT_ICON_LOCATION as c, MAT_ICON_LOCATION_FACTORY as e, MatIcon as f };
  165. export type { MatIconDefaultOptions as a, MatIconLocation as d };