material-icon.umd.js 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705
  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. (function (global, factory) {
  9. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/common/http'), require('@angular/core'), require('@angular/platform-browser'), require('rxjs'), require('rxjs/operators'), require('@angular/material/core'), require('@angular/cdk/coercion')) :
  10. typeof define === 'function' && define.amd ? define('@angular/material/icon', ['exports', '@angular/common', '@angular/common/http', '@angular/core', '@angular/platform-browser', 'rxjs', 'rxjs/operators', '@angular/material/core', '@angular/cdk/coercion'], factory) :
  11. (factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.icon = {}),global.ng.common,global.ng.common.http,global.ng.core,global.ng.platformBrowser,global.rxjs,global.rxjs.operators,global.ng.material.core,global.ng.cdk.coercion));
  12. }(this, (function (exports,common,http,core,platformBrowser,rxjs,operators,core$1,coercion) { 'use strict';
  13. /*! *****************************************************************************
  14. Copyright (c) Microsoft Corporation. All rights reserved.
  15. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  16. this file except in compliance with the License. You may obtain a copy of the
  17. License at http://www.apache.org/licenses/LICENSE-2.0
  18. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  19. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  20. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  21. MERCHANTABLITY OR NON-INFRINGEMENT.
  22. See the Apache Version 2.0 License for specific language governing permissions
  23. and limitations under the License.
  24. ***************************************************************************** */
  25. /* global Reflect, Promise */
  26. var extendStatics = function(d, b) {
  27. extendStatics = Object.setPrototypeOf ||
  28. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  29. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  30. return extendStatics(d, b);
  31. };
  32. function __extends(d, b) {
  33. extendStatics(d, b);
  34. function __() { this.constructor = d; }
  35. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  36. }
  37. /**
  38. * @fileoverview added by tsickle
  39. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  40. */
  41. /**
  42. * Returns an exception to be thrown in the case when attempting to
  43. * load an icon with a name that cannot be found.
  44. * \@docs-private
  45. * @param {?} iconName
  46. * @return {?}
  47. */
  48. function getMatIconNameNotFoundError(iconName) {
  49. return Error("Unable to find icon with the name \"" + iconName + "\"");
  50. }
  51. /**
  52. * Returns an exception to be thrown when the consumer attempts to use
  53. * `<mat-icon>` without including \@angular/common/http.
  54. * \@docs-private
  55. * @return {?}
  56. */
  57. function getMatIconNoHttpProviderError() {
  58. return Error('Could not find HttpClient provider for use with Angular Material icons. ' +
  59. 'Please include the HttpClientModule from @angular/common/http in your ' +
  60. 'app imports.');
  61. }
  62. /**
  63. * Returns an exception to be thrown when a URL couldn't be sanitized.
  64. * \@docs-private
  65. * @param {?} url URL that was attempted to be sanitized.
  66. * @return {?}
  67. */
  68. function getMatIconFailedToSanitizeUrlError(url) {
  69. return Error("The URL provided to MatIconRegistry was not trusted as a resource URL " +
  70. ("via Angular's DomSanitizer. Attempted URL was \"" + url + "\"."));
  71. }
  72. /**
  73. * Returns an exception to be thrown when a HTML string couldn't be sanitized.
  74. * \@docs-private
  75. * @param {?} literal HTML that was attempted to be sanitized.
  76. * @return {?}
  77. */
  78. function getMatIconFailedToSanitizeLiteralError(literal) {
  79. return Error("The literal provided to MatIconRegistry was not trusted as safe HTML by " +
  80. ("Angular's DomSanitizer. Attempted literal was \"" + literal + "\"."));
  81. }
  82. /**
  83. * Configuration for an icon, including the URL and possibly the cached SVG element.
  84. * \@docs-private
  85. */
  86. var /**
  87. * Configuration for an icon, including the URL and possibly the cached SVG element.
  88. * \@docs-private
  89. */
  90. SvgIconConfig = /** @class */ (function () {
  91. function SvgIconConfig(data) {
  92. // Note that we can't use `instanceof SVGElement` here,
  93. // because it'll break during server-side rendering.
  94. if (!!((/** @type {?} */ (data))).nodeName) {
  95. this.svgElement = (/** @type {?} */ (data));
  96. }
  97. else {
  98. this.url = (/** @type {?} */ (data));
  99. }
  100. }
  101. return SvgIconConfig;
  102. }());
  103. /**
  104. * Service to register and display icons used by the `<mat-icon>` component.
  105. * - Registers icon URLs by namespace and name.
  106. * - Registers icon set URLs by namespace.
  107. * - Registers aliases for CSS classes, for use with icon fonts.
  108. * - Loads icons from URLs and extracts individual icons from icon sets.
  109. */
  110. var MatIconRegistry = /** @class */ (function () {
  111. function MatIconRegistry(_httpClient, _sanitizer, document) {
  112. this._httpClient = _httpClient;
  113. this._sanitizer = _sanitizer;
  114. /**
  115. * URLs and cached SVG elements for individual icons. Keys are of the format "[namespace]:[icon]".
  116. */
  117. this._svgIconConfigs = new Map();
  118. /**
  119. * SvgIconConfig objects and cached SVG elements for icon sets, keyed by namespace.
  120. * Multiple icon sets can be registered under the same namespace.
  121. */
  122. this._iconSetConfigs = new Map();
  123. /**
  124. * Cache for icons loaded by direct URLs.
  125. */
  126. this._cachedIconsByUrl = new Map();
  127. /**
  128. * In-progress icon fetches. Used to coalesce multiple requests to the same URL.
  129. */
  130. this._inProgressUrlFetches = new Map();
  131. /**
  132. * Map from font identifiers to their CSS class names. Used for icon fonts.
  133. */
  134. this._fontCssClassesByAlias = new Map();
  135. /**
  136. * The CSS class to apply when an `<mat-icon>` component has no icon name, url, or font specified.
  137. * The default 'material-icons' value assumes that the material icon font has been loaded as
  138. * described at http://google.github.io/material-design-icons/#icon-font-for-the-web
  139. */
  140. this._defaultFontSetClass = 'material-icons';
  141. this._document = document;
  142. }
  143. /**
  144. * Registers an icon by URL in the default namespace.
  145. * @param iconName Name under which the icon should be registered.
  146. * @param url
  147. */
  148. /**
  149. * Registers an icon by URL in the default namespace.
  150. * @template THIS
  151. * @this {THIS}
  152. * @param {?} iconName Name under which the icon should be registered.
  153. * @param {?} url
  154. * @return {THIS}
  155. */
  156. MatIconRegistry.prototype.addSvgIcon = /**
  157. * Registers an icon by URL in the default namespace.
  158. * @template THIS
  159. * @this {THIS}
  160. * @param {?} iconName Name under which the icon should be registered.
  161. * @param {?} url
  162. * @return {THIS}
  163. */
  164. function (iconName, url) {
  165. return (/** @type {?} */ (this)).addSvgIconInNamespace('', iconName, url);
  166. };
  167. /**
  168. * Registers an icon using an HTML string in the default namespace.
  169. * @param iconName Name under which the icon should be registered.
  170. * @param literal SVG source of the icon.
  171. */
  172. /**
  173. * Registers an icon using an HTML string in the default namespace.
  174. * @template THIS
  175. * @this {THIS}
  176. * @param {?} iconName Name under which the icon should be registered.
  177. * @param {?} literal SVG source of the icon.
  178. * @return {THIS}
  179. */
  180. MatIconRegistry.prototype.addSvgIconLiteral = /**
  181. * Registers an icon using an HTML string in the default namespace.
  182. * @template THIS
  183. * @this {THIS}
  184. * @param {?} iconName Name under which the icon should be registered.
  185. * @param {?} literal SVG source of the icon.
  186. * @return {THIS}
  187. */
  188. function (iconName, literal) {
  189. return (/** @type {?} */ (this)).addSvgIconLiteralInNamespace('', iconName, literal);
  190. };
  191. /**
  192. * Registers an icon by URL in the specified namespace.
  193. * @param namespace Namespace in which the icon should be registered.
  194. * @param iconName Name under which the icon should be registered.
  195. * @param url
  196. */
  197. /**
  198. * Registers an icon by URL in the specified namespace.
  199. * @template THIS
  200. * @this {THIS}
  201. * @param {?} namespace Namespace in which the icon should be registered.
  202. * @param {?} iconName Name under which the icon should be registered.
  203. * @param {?} url
  204. * @return {THIS}
  205. */
  206. MatIconRegistry.prototype.addSvgIconInNamespace = /**
  207. * Registers an icon by URL in the specified namespace.
  208. * @template THIS
  209. * @this {THIS}
  210. * @param {?} namespace Namespace in which the icon should be registered.
  211. * @param {?} iconName Name under which the icon should be registered.
  212. * @param {?} url
  213. * @return {THIS}
  214. */
  215. function (namespace, iconName, url) {
  216. return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(url));
  217. };
  218. /**
  219. * Registers an icon using an HTML string in the specified namespace.
  220. * @param namespace Namespace in which the icon should be registered.
  221. * @param iconName Name under which the icon should be registered.
  222. * @param literal SVG source of the icon.
  223. */
  224. /**
  225. * Registers an icon using an HTML string in the specified namespace.
  226. * @template THIS
  227. * @this {THIS}
  228. * @param {?} namespace Namespace in which the icon should be registered.
  229. * @param {?} iconName Name under which the icon should be registered.
  230. * @param {?} literal SVG source of the icon.
  231. * @return {THIS}
  232. */
  233. MatIconRegistry.prototype.addSvgIconLiteralInNamespace = /**
  234. * Registers an icon using an HTML string in the specified namespace.
  235. * @template THIS
  236. * @this {THIS}
  237. * @param {?} namespace Namespace in which the icon should be registered.
  238. * @param {?} iconName Name under which the icon should be registered.
  239. * @param {?} literal SVG source of the icon.
  240. * @return {THIS}
  241. */
  242. function (namespace, iconName, literal) {
  243. /** @type {?} */
  244. var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(core.SecurityContext.HTML, literal);
  245. if (!sanitizedLiteral) {
  246. throw getMatIconFailedToSanitizeLiteralError(literal);
  247. }
  248. /** @type {?} */
  249. var svgElement = (/** @type {?} */ (this))._createSvgElementForSingleIcon(sanitizedLiteral);
  250. return (/** @type {?} */ (this))._addSvgIconConfig(namespace, iconName, new SvgIconConfig(svgElement));
  251. };
  252. /**
  253. * Registers an icon set by URL in the default namespace.
  254. * @param url
  255. */
  256. /**
  257. * Registers an icon set by URL in the default namespace.
  258. * @template THIS
  259. * @this {THIS}
  260. * @param {?} url
  261. * @return {THIS}
  262. */
  263. MatIconRegistry.prototype.addSvgIconSet = /**
  264. * Registers an icon set by URL in the default namespace.
  265. * @template THIS
  266. * @this {THIS}
  267. * @param {?} url
  268. * @return {THIS}
  269. */
  270. function (url) {
  271. return (/** @type {?} */ (this)).addSvgIconSetInNamespace('', url);
  272. };
  273. /**
  274. * Registers an icon set using an HTML string in the default namespace.
  275. * @param literal SVG source of the icon set.
  276. */
  277. /**
  278. * Registers an icon set using an HTML string in the default namespace.
  279. * @template THIS
  280. * @this {THIS}
  281. * @param {?} literal SVG source of the icon set.
  282. * @return {THIS}
  283. */
  284. MatIconRegistry.prototype.addSvgIconSetLiteral = /**
  285. * Registers an icon set using an HTML string in the default namespace.
  286. * @template THIS
  287. * @this {THIS}
  288. * @param {?} literal SVG source of the icon set.
  289. * @return {THIS}
  290. */
  291. function (literal) {
  292. return (/** @type {?} */ (this)).addSvgIconSetLiteralInNamespace('', literal);
  293. };
  294. /**
  295. * Registers an icon set by URL in the specified namespace.
  296. * @param namespace Namespace in which to register the icon set.
  297. * @param url
  298. */
  299. /**
  300. * Registers an icon set by URL in the specified namespace.
  301. * @template THIS
  302. * @this {THIS}
  303. * @param {?} namespace Namespace in which to register the icon set.
  304. * @param {?} url
  305. * @return {THIS}
  306. */
  307. MatIconRegistry.prototype.addSvgIconSetInNamespace = /**
  308. * Registers an icon set by URL in the specified namespace.
  309. * @template THIS
  310. * @this {THIS}
  311. * @param {?} namespace Namespace in which to register the icon set.
  312. * @param {?} url
  313. * @return {THIS}
  314. */
  315. function (namespace, url) {
  316. return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(url));
  317. };
  318. /**
  319. * Registers an icon set using an HTML string in the specified namespace.
  320. * @param namespace Namespace in which to register the icon set.
  321. * @param literal SVG source of the icon set.
  322. */
  323. /**
  324. * Registers an icon set using an HTML string in the specified namespace.
  325. * @template THIS
  326. * @this {THIS}
  327. * @param {?} namespace Namespace in which to register the icon set.
  328. * @param {?} literal SVG source of the icon set.
  329. * @return {THIS}
  330. */
  331. MatIconRegistry.prototype.addSvgIconSetLiteralInNamespace = /**
  332. * Registers an icon set using an HTML string in the specified namespace.
  333. * @template THIS
  334. * @this {THIS}
  335. * @param {?} namespace Namespace in which to register the icon set.
  336. * @param {?} literal SVG source of the icon set.
  337. * @return {THIS}
  338. */
  339. function (namespace, literal) {
  340. /** @type {?} */
  341. var sanitizedLiteral = (/** @type {?} */ (this))._sanitizer.sanitize(core.SecurityContext.HTML, literal);
  342. if (!sanitizedLiteral) {
  343. throw getMatIconFailedToSanitizeLiteralError(literal);
  344. }
  345. /** @type {?} */
  346. var svgElement = (/** @type {?} */ (this))._svgElementFromString(sanitizedLiteral);
  347. return (/** @type {?} */ (this))._addSvgIconSetConfig(namespace, new SvgIconConfig(svgElement));
  348. };
  349. /**
  350. * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
  351. * component with the alias as the fontSet input will cause the class name to be applied
  352. * to the `<mat-icon>` element.
  353. *
  354. * @param alias Alias for the font.
  355. * @param className Class name override to be used instead of the alias.
  356. */
  357. /**
  358. * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
  359. * component with the alias as the fontSet input will cause the class name to be applied
  360. * to the `<mat-icon>` element.
  361. *
  362. * @template THIS
  363. * @this {THIS}
  364. * @param {?} alias Alias for the font.
  365. * @param {?=} className Class name override to be used instead of the alias.
  366. * @return {THIS}
  367. */
  368. MatIconRegistry.prototype.registerFontClassAlias = /**
  369. * Defines an alias for a CSS class name to be used for icon fonts. Creating an matIcon
  370. * component with the alias as the fontSet input will cause the class name to be applied
  371. * to the `<mat-icon>` element.
  372. *
  373. * @template THIS
  374. * @this {THIS}
  375. * @param {?} alias Alias for the font.
  376. * @param {?=} className Class name override to be used instead of the alias.
  377. * @return {THIS}
  378. */
  379. function (alias, className) {
  380. if (className === void 0) { className = alias; }
  381. (/** @type {?} */ (this))._fontCssClassesByAlias.set(alias, className);
  382. return (/** @type {?} */ (this));
  383. };
  384. /**
  385. * Returns the CSS class name associated with the alias by a previous call to
  386. * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
  387. */
  388. /**
  389. * Returns the CSS class name associated with the alias by a previous call to
  390. * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
  391. * @param {?} alias
  392. * @return {?}
  393. */
  394. MatIconRegistry.prototype.classNameForFontAlias = /**
  395. * Returns the CSS class name associated with the alias by a previous call to
  396. * registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
  397. * @param {?} alias
  398. * @return {?}
  399. */
  400. function (alias) {
  401. return this._fontCssClassesByAlias.get(alias) || alias;
  402. };
  403. /**
  404. * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  405. * have a fontSet input value, and is not loading an icon by name or URL.
  406. *
  407. * @param className
  408. */
  409. /**
  410. * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  411. * have a fontSet input value, and is not loading an icon by name or URL.
  412. *
  413. * @template THIS
  414. * @this {THIS}
  415. * @param {?} className
  416. * @return {THIS}
  417. */
  418. MatIconRegistry.prototype.setDefaultFontSetClass = /**
  419. * Sets the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  420. * have a fontSet input value, and is not loading an icon by name or URL.
  421. *
  422. * @template THIS
  423. * @this {THIS}
  424. * @param {?} className
  425. * @return {THIS}
  426. */
  427. function (className) {
  428. (/** @type {?} */ (this))._defaultFontSetClass = className;
  429. return (/** @type {?} */ (this));
  430. };
  431. /**
  432. * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  433. * have a fontSet input value, and is not loading an icon by name or URL.
  434. */
  435. /**
  436. * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  437. * have a fontSet input value, and is not loading an icon by name or URL.
  438. * @return {?}
  439. */
  440. MatIconRegistry.prototype.getDefaultFontSetClass = /**
  441. * Returns the CSS class name to be used for icon fonts when an `<mat-icon>` component does not
  442. * have a fontSet input value, and is not loading an icon by name or URL.
  443. * @return {?}
  444. */
  445. function () {
  446. return this._defaultFontSetClass;
  447. };
  448. /**
  449. * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
  450. * The response from the URL may be cached so this will not always cause an HTTP request, but
  451. * the produced element will always be a new copy of the originally fetched icon. (That is,
  452. * it will not contain any modifications made to elements previously returned).
  453. *
  454. * @param safeUrl URL from which to fetch the SVG icon.
  455. */
  456. /**
  457. * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
  458. * The response from the URL may be cached so this will not always cause an HTTP request, but
  459. * the produced element will always be a new copy of the originally fetched icon. (That is,
  460. * it will not contain any modifications made to elements previously returned).
  461. *
  462. * @param {?} safeUrl URL from which to fetch the SVG icon.
  463. * @return {?}
  464. */
  465. MatIconRegistry.prototype.getSvgIconFromUrl = /**
  466. * Returns an Observable that produces the icon (as an `<svg>` DOM element) from the given URL.
  467. * The response from the URL may be cached so this will not always cause an HTTP request, but
  468. * the produced element will always be a new copy of the originally fetched icon. (That is,
  469. * it will not contain any modifications made to elements previously returned).
  470. *
  471. * @param {?} safeUrl URL from which to fetch the SVG icon.
  472. * @return {?}
  473. */
  474. function (safeUrl) {
  475. var _this = this;
  476. /** @type {?} */
  477. var url = this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, safeUrl);
  478. if (!url) {
  479. throw getMatIconFailedToSanitizeUrlError(safeUrl);
  480. }
  481. /** @type {?} */
  482. var cachedIcon = this._cachedIconsByUrl.get(url);
  483. if (cachedIcon) {
  484. return rxjs.of(cloneSvg(cachedIcon));
  485. }
  486. return this._loadSvgIconFromConfig(new SvgIconConfig(safeUrl)).pipe(operators.tap((/**
  487. * @param {?} svg
  488. * @return {?}
  489. */
  490. function (svg) { return _this._cachedIconsByUrl.set((/** @type {?} */ (url)), svg); })), operators.map((/**
  491. * @param {?} svg
  492. * @return {?}
  493. */
  494. function (svg) { return cloneSvg(svg); })));
  495. };
  496. /**
  497. * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
  498. * and namespace. The icon must have been previously registered with addIcon or addIconSet;
  499. * if not, the Observable will throw an error.
  500. *
  501. * @param name Name of the icon to be retrieved.
  502. * @param namespace Namespace in which to look for the icon.
  503. */
  504. /**
  505. * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
  506. * and namespace. The icon must have been previously registered with addIcon or addIconSet;
  507. * if not, the Observable will throw an error.
  508. *
  509. * @param {?} name Name of the icon to be retrieved.
  510. * @param {?=} namespace Namespace in which to look for the icon.
  511. * @return {?}
  512. */
  513. MatIconRegistry.prototype.getNamedSvgIcon = /**
  514. * Returns an Observable that produces the icon (as an `<svg>` DOM element) with the given name
  515. * and namespace. The icon must have been previously registered with addIcon or addIconSet;
  516. * if not, the Observable will throw an error.
  517. *
  518. * @param {?} name Name of the icon to be retrieved.
  519. * @param {?=} namespace Namespace in which to look for the icon.
  520. * @return {?}
  521. */
  522. function (name, namespace) {
  523. if (namespace === void 0) { namespace = ''; }
  524. // Return (copy of) cached icon if possible.
  525. /** @type {?} */
  526. var key = iconKey(namespace, name);
  527. /** @type {?} */
  528. var config = this._svgIconConfigs.get(key);
  529. if (config) {
  530. return this._getSvgFromConfig(config);
  531. }
  532. // See if we have any icon sets registered for the namespace.
  533. /** @type {?} */
  534. var iconSetConfigs = this._iconSetConfigs.get(namespace);
  535. if (iconSetConfigs) {
  536. return this._getSvgFromIconSetConfigs(name, iconSetConfigs);
  537. }
  538. return rxjs.throwError(getMatIconNameNotFoundError(key));
  539. };
  540. /**
  541. * @return {?}
  542. */
  543. MatIconRegistry.prototype.ngOnDestroy = /**
  544. * @return {?}
  545. */
  546. function () {
  547. this._svgIconConfigs.clear();
  548. this._iconSetConfigs.clear();
  549. this._cachedIconsByUrl.clear();
  550. };
  551. /**
  552. * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
  553. */
  554. /**
  555. * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
  556. * @private
  557. * @param {?} config
  558. * @return {?}
  559. */
  560. MatIconRegistry.prototype._getSvgFromConfig = /**
  561. * Returns the cached icon for a SvgIconConfig if available, or fetches it from its URL if not.
  562. * @private
  563. * @param {?} config
  564. * @return {?}
  565. */
  566. function (config) {
  567. if (config.svgElement) {
  568. // We already have the SVG element for this icon, return a copy.
  569. return rxjs.of(cloneSvg(config.svgElement));
  570. }
  571. else {
  572. // Fetch the icon from the config's URL, cache it, and return a copy.
  573. return this._loadSvgIconFromConfig(config).pipe(operators.tap((/**
  574. * @param {?} svg
  575. * @return {?}
  576. */
  577. function (svg) { return config.svgElement = svg; })), operators.map((/**
  578. * @param {?} svg
  579. * @return {?}
  580. */
  581. function (svg) { return cloneSvg(svg); })));
  582. }
  583. };
  584. /**
  585. * Attempts to find an icon with the specified name in any of the SVG icon sets.
  586. * First searches the available cached icons for a nested element with a matching name, and
  587. * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
  588. * that have not been cached, and searches again after all fetches are completed.
  589. * The returned Observable produces the SVG element if possible, and throws
  590. * an error if no icon with the specified name can be found.
  591. */
  592. /**
  593. * Attempts to find an icon with the specified name in any of the SVG icon sets.
  594. * First searches the available cached icons for a nested element with a matching name, and
  595. * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
  596. * that have not been cached, and searches again after all fetches are completed.
  597. * The returned Observable produces the SVG element if possible, and throws
  598. * an error if no icon with the specified name can be found.
  599. * @private
  600. * @param {?} name
  601. * @param {?} iconSetConfigs
  602. * @return {?}
  603. */
  604. MatIconRegistry.prototype._getSvgFromIconSetConfigs = /**
  605. * Attempts to find an icon with the specified name in any of the SVG icon sets.
  606. * First searches the available cached icons for a nested element with a matching name, and
  607. * if found copies the element to a new `<svg>` element. If not found, fetches all icon sets
  608. * that have not been cached, and searches again after all fetches are completed.
  609. * The returned Observable produces the SVG element if possible, and throws
  610. * an error if no icon with the specified name can be found.
  611. * @private
  612. * @param {?} name
  613. * @param {?} iconSetConfigs
  614. * @return {?}
  615. */
  616. function (name, iconSetConfigs) {
  617. var _this = this;
  618. // For all the icon set SVG elements we've fetched, see if any contain an icon with the
  619. // requested name.
  620. /** @type {?} */
  621. var namedIcon = this._extractIconWithNameFromAnySet(name, iconSetConfigs);
  622. if (namedIcon) {
  623. // We could cache namedIcon in _svgIconConfigs, but since we have to make a copy every
  624. // time anyway, there's probably not much advantage compared to just always extracting
  625. // it from the icon set.
  626. return rxjs.of(namedIcon);
  627. }
  628. // Not found in any cached icon sets. If there are icon sets with URLs that we haven't
  629. // fetched, fetch them now and look for iconName in the results.
  630. /** @type {?} */
  631. var iconSetFetchRequests = iconSetConfigs
  632. .filter((/**
  633. * @param {?} iconSetConfig
  634. * @return {?}
  635. */
  636. function (iconSetConfig) { return !iconSetConfig.svgElement; }))
  637. .map((/**
  638. * @param {?} iconSetConfig
  639. * @return {?}
  640. */
  641. function (iconSetConfig) {
  642. return _this._loadSvgIconSetFromConfig(iconSetConfig).pipe(operators.catchError((/**
  643. * @param {?} err
  644. * @return {?}
  645. */
  646. function (err) {
  647. /** @type {?} */
  648. var url = _this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, iconSetConfig.url);
  649. // Swallow errors fetching individual URLs so the
  650. // combined Observable won't necessarily fail.
  651. console.error("Loading icon set URL: " + url + " failed: " + err.message);
  652. return rxjs.of(null);
  653. })));
  654. }));
  655. // Fetch all the icon set URLs. When the requests complete, every IconSet should have a
  656. // cached SVG element (unless the request failed), and we can check again for the icon.
  657. return rxjs.forkJoin(iconSetFetchRequests).pipe(operators.map((/**
  658. * @return {?}
  659. */
  660. function () {
  661. /** @type {?} */
  662. var foundIcon = _this._extractIconWithNameFromAnySet(name, iconSetConfigs);
  663. if (!foundIcon) {
  664. throw getMatIconNameNotFoundError(name);
  665. }
  666. return foundIcon;
  667. })));
  668. };
  669. /**
  670. * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
  671. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  672. * returns it. Returns null if no matching element is found.
  673. */
  674. /**
  675. * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
  676. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  677. * returns it. Returns null if no matching element is found.
  678. * @private
  679. * @param {?} iconName
  680. * @param {?} iconSetConfigs
  681. * @return {?}
  682. */
  683. MatIconRegistry.prototype._extractIconWithNameFromAnySet = /**
  684. * Searches the cached SVG elements for the given icon sets for a nested icon element whose "id"
  685. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  686. * returns it. Returns null if no matching element is found.
  687. * @private
  688. * @param {?} iconName
  689. * @param {?} iconSetConfigs
  690. * @return {?}
  691. */
  692. function (iconName, iconSetConfigs) {
  693. // Iterate backwards, so icon sets added later have precedence.
  694. for (var i = iconSetConfigs.length - 1; i >= 0; i--) {
  695. /** @type {?} */
  696. var config = iconSetConfigs[i];
  697. if (config.svgElement) {
  698. /** @type {?} */
  699. var foundIcon = this._extractSvgIconFromSet(config.svgElement, iconName);
  700. if (foundIcon) {
  701. return foundIcon;
  702. }
  703. }
  704. }
  705. return null;
  706. };
  707. /**
  708. * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
  709. * from it.
  710. */
  711. /**
  712. * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
  713. * from it.
  714. * @private
  715. * @param {?} config
  716. * @return {?}
  717. */
  718. MatIconRegistry.prototype._loadSvgIconFromConfig = /**
  719. * Loads the content of the icon URL specified in the SvgIconConfig and creates an SVG element
  720. * from it.
  721. * @private
  722. * @param {?} config
  723. * @return {?}
  724. */
  725. function (config) {
  726. var _this = this;
  727. return this._fetchUrl(config.url)
  728. .pipe(operators.map((/**
  729. * @param {?} svgText
  730. * @return {?}
  731. */
  732. function (svgText) { return _this._createSvgElementForSingleIcon(svgText); })));
  733. };
  734. /**
  735. * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
  736. * from it.
  737. */
  738. /**
  739. * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
  740. * from it.
  741. * @private
  742. * @param {?} config
  743. * @return {?}
  744. */
  745. MatIconRegistry.prototype._loadSvgIconSetFromConfig = /**
  746. * Loads the content of the icon set URL specified in the SvgIconConfig and creates an SVG element
  747. * from it.
  748. * @private
  749. * @param {?} config
  750. * @return {?}
  751. */
  752. function (config) {
  753. var _this = this;
  754. // If the SVG for this icon set has already been parsed, do nothing.
  755. if (config.svgElement) {
  756. return rxjs.of(config.svgElement);
  757. }
  758. return this._fetchUrl(config.url).pipe(operators.map((/**
  759. * @param {?} svgText
  760. * @return {?}
  761. */
  762. function (svgText) {
  763. // It is possible that the icon set was parsed and cached by an earlier request, so parsing
  764. // only needs to occur if the cache is yet unset.
  765. if (!config.svgElement) {
  766. config.svgElement = _this._svgElementFromString(svgText);
  767. }
  768. return config.svgElement;
  769. })));
  770. };
  771. /**
  772. * Creates a DOM element from the given SVG string, and adds default attributes.
  773. */
  774. /**
  775. * Creates a DOM element from the given SVG string, and adds default attributes.
  776. * @private
  777. * @param {?} responseText
  778. * @return {?}
  779. */
  780. MatIconRegistry.prototype._createSvgElementForSingleIcon = /**
  781. * Creates a DOM element from the given SVG string, and adds default attributes.
  782. * @private
  783. * @param {?} responseText
  784. * @return {?}
  785. */
  786. function (responseText) {
  787. /** @type {?} */
  788. var svg = this._svgElementFromString(responseText);
  789. this._setSvgAttributes(svg);
  790. return svg;
  791. };
  792. /**
  793. * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
  794. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  795. * returns it. Returns null if no matching element is found.
  796. */
  797. /**
  798. * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
  799. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  800. * returns it. Returns null if no matching element is found.
  801. * @private
  802. * @param {?} iconSet
  803. * @param {?} iconName
  804. * @return {?}
  805. */
  806. MatIconRegistry.prototype._extractSvgIconFromSet = /**
  807. * Searches the cached element of the given SvgIconConfig for a nested icon element whose "id"
  808. * tag matches the specified name. If found, copies the nested element to a new SVG element and
  809. * returns it. Returns null if no matching element is found.
  810. * @private
  811. * @param {?} iconSet
  812. * @param {?} iconName
  813. * @return {?}
  814. */
  815. function (iconSet, iconName) {
  816. // Use the `id="iconName"` syntax in order to escape special
  817. // characters in the ID (versus using the #iconName syntax).
  818. /** @type {?} */
  819. var iconSource = iconSet.querySelector("[id=\"" + iconName + "\"]");
  820. if (!iconSource) {
  821. return null;
  822. }
  823. // Clone the element and remove the ID to prevent multiple elements from being added
  824. // to the page with the same ID.
  825. /** @type {?} */
  826. var iconElement = (/** @type {?} */ (iconSource.cloneNode(true)));
  827. iconElement.removeAttribute('id');
  828. // If the icon node is itself an <svg> node, clone and return it directly. If not, set it as
  829. // the content of a new <svg> node.
  830. if (iconElement.nodeName.toLowerCase() === 'svg') {
  831. return this._setSvgAttributes((/** @type {?} */ (iconElement)));
  832. }
  833. // If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>. Note
  834. // that the same could be achieved by referring to it via <use href="#id">, however the <use>
  835. // tag is problematic on Firefox, because it needs to include the current page path.
  836. if (iconElement.nodeName.toLowerCase() === 'symbol') {
  837. return this._setSvgAttributes(this._toSvgElement(iconElement));
  838. }
  839. // createElement('SVG') doesn't work as expected; the DOM ends up with
  840. // the correct nodes, but the SVG content doesn't render. Instead we
  841. // have to create an empty SVG node using innerHTML and append its content.
  842. // Elements created using DOMParser.parseFromString have the same problem.
  843. // http://stackoverflow.com/questions/23003278/svg-innerhtml-in-firefox-can-not-display
  844. /** @type {?} */
  845. var svg = this._svgElementFromString('<svg></svg>');
  846. // Clone the node so we don't remove it from the parent icon set element.
  847. svg.appendChild(iconElement);
  848. return this._setSvgAttributes(svg);
  849. };
  850. /**
  851. * Creates a DOM element from the given SVG string.
  852. */
  853. /**
  854. * Creates a DOM element from the given SVG string.
  855. * @private
  856. * @param {?} str
  857. * @return {?}
  858. */
  859. MatIconRegistry.prototype._svgElementFromString = /**
  860. * Creates a DOM element from the given SVG string.
  861. * @private
  862. * @param {?} str
  863. * @return {?}
  864. */
  865. function (str) {
  866. /** @type {?} */
  867. var div = this._document.createElement('DIV');
  868. div.innerHTML = str;
  869. /** @type {?} */
  870. var svg = (/** @type {?} */ (div.querySelector('svg')));
  871. if (!svg) {
  872. throw Error('<svg> tag not found');
  873. }
  874. return svg;
  875. };
  876. /**
  877. * Converts an element into an SVG node by cloning all of its children.
  878. */
  879. /**
  880. * Converts an element into an SVG node by cloning all of its children.
  881. * @private
  882. * @param {?} element
  883. * @return {?}
  884. */
  885. MatIconRegistry.prototype._toSvgElement = /**
  886. * Converts an element into an SVG node by cloning all of its children.
  887. * @private
  888. * @param {?} element
  889. * @return {?}
  890. */
  891. function (element) {
  892. /** @type {?} */
  893. var svg = this._svgElementFromString('<svg></svg>');
  894. for (var i = 0; i < element.childNodes.length; i++) {
  895. if (element.childNodes[i].nodeType === this._document.ELEMENT_NODE) {
  896. svg.appendChild(element.childNodes[i].cloneNode(true));
  897. }
  898. }
  899. return svg;
  900. };
  901. /**
  902. * Sets the default attributes for an SVG element to be used as an icon.
  903. */
  904. /**
  905. * Sets the default attributes for an SVG element to be used as an icon.
  906. * @private
  907. * @param {?} svg
  908. * @return {?}
  909. */
  910. MatIconRegistry.prototype._setSvgAttributes = /**
  911. * Sets the default attributes for an SVG element to be used as an icon.
  912. * @private
  913. * @param {?} svg
  914. * @return {?}
  915. */
  916. function (svg) {
  917. svg.setAttribute('fit', '');
  918. svg.setAttribute('height', '100%');
  919. svg.setAttribute('width', '100%');
  920. svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
  921. svg.setAttribute('focusable', 'false'); // Disable IE11 default behavior to make SVGs focusable.
  922. return svg;
  923. };
  924. /**
  925. * Returns an Observable which produces the string contents of the given URL. Results may be
  926. * cached, so future calls with the same URL may not cause another HTTP request.
  927. */
  928. /**
  929. * Returns an Observable which produces the string contents of the given URL. Results may be
  930. * cached, so future calls with the same URL may not cause another HTTP request.
  931. * @private
  932. * @param {?} safeUrl
  933. * @return {?}
  934. */
  935. MatIconRegistry.prototype._fetchUrl = /**
  936. * Returns an Observable which produces the string contents of the given URL. Results may be
  937. * cached, so future calls with the same URL may not cause another HTTP request.
  938. * @private
  939. * @param {?} safeUrl
  940. * @return {?}
  941. */
  942. function (safeUrl) {
  943. var _this = this;
  944. if (!this._httpClient) {
  945. throw getMatIconNoHttpProviderError();
  946. }
  947. if (safeUrl == null) {
  948. throw Error("Cannot fetch icon from URL \"" + safeUrl + "\".");
  949. }
  950. /** @type {?} */
  951. var url = this._sanitizer.sanitize(core.SecurityContext.RESOURCE_URL, safeUrl);
  952. if (!url) {
  953. throw getMatIconFailedToSanitizeUrlError(safeUrl);
  954. }
  955. // Store in-progress fetches to avoid sending a duplicate request for a URL when there is
  956. // already a request in progress for that URL. It's necessary to call share() on the
  957. // Observable returned by http.get() so that multiple subscribers don't cause multiple XHRs.
  958. /** @type {?} */
  959. var inProgressFetch = this._inProgressUrlFetches.get(url);
  960. if (inProgressFetch) {
  961. return inProgressFetch;
  962. }
  963. // TODO(jelbourn): for some reason, the `finalize` operator "loses" the generic type on the
  964. // Observable. Figure out why and fix it.
  965. /** @type {?} */
  966. var req = this._httpClient.get(url, { responseType: 'text' }).pipe(operators.finalize((/**
  967. * @return {?}
  968. */
  969. function () { return _this._inProgressUrlFetches.delete(url); })), operators.share());
  970. this._inProgressUrlFetches.set(url, req);
  971. return req;
  972. };
  973. /**
  974. * Registers an icon config by name in the specified namespace.
  975. * @param namespace Namespace in which to register the icon config.
  976. * @param iconName Name under which to register the config.
  977. * @param config Config to be registered.
  978. */
  979. /**
  980. * Registers an icon config by name in the specified namespace.
  981. * @private
  982. * @template THIS
  983. * @this {THIS}
  984. * @param {?} namespace Namespace in which to register the icon config.
  985. * @param {?} iconName Name under which to register the config.
  986. * @param {?} config Config to be registered.
  987. * @return {THIS}
  988. */
  989. MatIconRegistry.prototype._addSvgIconConfig = /**
  990. * Registers an icon config by name in the specified namespace.
  991. * @private
  992. * @template THIS
  993. * @this {THIS}
  994. * @param {?} namespace Namespace in which to register the icon config.
  995. * @param {?} iconName Name under which to register the config.
  996. * @param {?} config Config to be registered.
  997. * @return {THIS}
  998. */
  999. function (namespace, iconName, config) {
  1000. (/** @type {?} */ (this))._svgIconConfigs.set(iconKey(namespace, iconName), config);
  1001. return (/** @type {?} */ (this));
  1002. };
  1003. /**
  1004. * Registers an icon set config in the specified namespace.
  1005. * @param namespace Namespace in which to register the icon config.
  1006. * @param config Config to be registered.
  1007. */
  1008. /**
  1009. * Registers an icon set config in the specified namespace.
  1010. * @private
  1011. * @template THIS
  1012. * @this {THIS}
  1013. * @param {?} namespace Namespace in which to register the icon config.
  1014. * @param {?} config Config to be registered.
  1015. * @return {THIS}
  1016. */
  1017. MatIconRegistry.prototype._addSvgIconSetConfig = /**
  1018. * Registers an icon set config in the specified namespace.
  1019. * @private
  1020. * @template THIS
  1021. * @this {THIS}
  1022. * @param {?} namespace Namespace in which to register the icon config.
  1023. * @param {?} config Config to be registered.
  1024. * @return {THIS}
  1025. */
  1026. function (namespace, config) {
  1027. /** @type {?} */
  1028. var configNamespace = (/** @type {?} */ (this))._iconSetConfigs.get(namespace);
  1029. if (configNamespace) {
  1030. configNamespace.push(config);
  1031. }
  1032. else {
  1033. (/** @type {?} */ (this))._iconSetConfigs.set(namespace, [config]);
  1034. }
  1035. return (/** @type {?} */ (this));
  1036. };
  1037. MatIconRegistry.decorators = [
  1038. { type: core.Injectable, args: [{ providedIn: 'root' },] },
  1039. ];
  1040. /** @nocollapse */
  1041. MatIconRegistry.ctorParameters = function () { return [
  1042. { type: http.HttpClient, decorators: [{ type: core.Optional }] },
  1043. { type: platformBrowser.DomSanitizer },
  1044. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
  1045. ]; };
  1046. /** @nocollapse */ MatIconRegistry.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MatIconRegistry_Factory() { return new MatIconRegistry(core.ɵɵinject(http.HttpClient, 8), core.ɵɵinject(platformBrowser.DomSanitizer), core.ɵɵinject(common.DOCUMENT, 8)); }, token: MatIconRegistry, providedIn: "root" });
  1047. return MatIconRegistry;
  1048. }());
  1049. /**
  1050. * \@docs-private
  1051. * @param {?} parentRegistry
  1052. * @param {?} httpClient
  1053. * @param {?} sanitizer
  1054. * @param {?=} document
  1055. * @return {?}
  1056. */
  1057. function ICON_REGISTRY_PROVIDER_FACTORY(parentRegistry, httpClient, sanitizer, document) {
  1058. return parentRegistry || new MatIconRegistry(httpClient, sanitizer, document);
  1059. }
  1060. /**
  1061. * \@docs-private
  1062. * @type {?}
  1063. */
  1064. var ICON_REGISTRY_PROVIDER = {
  1065. // If there is already an MatIconRegistry available, use that. Otherwise, provide a new one.
  1066. provide: MatIconRegistry,
  1067. deps: [
  1068. [new core.Optional(), new core.SkipSelf(), MatIconRegistry],
  1069. [new core.Optional(), http.HttpClient],
  1070. platformBrowser.DomSanitizer,
  1071. [new core.Optional(), (/** @type {?} */ (common.DOCUMENT))],
  1072. ],
  1073. useFactory: ICON_REGISTRY_PROVIDER_FACTORY,
  1074. };
  1075. /**
  1076. * Clones an SVGElement while preserving type information.
  1077. * @param {?} svg
  1078. * @return {?}
  1079. */
  1080. function cloneSvg(svg) {
  1081. return (/** @type {?} */ (svg.cloneNode(true)));
  1082. }
  1083. /**
  1084. * Returns the cache key to use for an icon namespace and name.
  1085. * @param {?} namespace
  1086. * @param {?} name
  1087. * @return {?}
  1088. */
  1089. function iconKey(namespace, name) {
  1090. return namespace + ':' + name;
  1091. }
  1092. /**
  1093. * @fileoverview added by tsickle
  1094. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1095. */
  1096. // Boilerplate for applying mixins to MatIcon.
  1097. /**
  1098. * \@docs-private
  1099. */
  1100. var
  1101. // Boilerplate for applying mixins to MatIcon.
  1102. /**
  1103. * \@docs-private
  1104. */
  1105. MatIconBase = /** @class */ (function () {
  1106. function MatIconBase(_elementRef) {
  1107. this._elementRef = _elementRef;
  1108. }
  1109. return MatIconBase;
  1110. }());
  1111. /** @type {?} */
  1112. var _MatIconMixinBase = core$1.mixinColor(MatIconBase);
  1113. /**
  1114. * Injection token used to provide the current location to `MatIcon`.
  1115. * Used to handle server-side rendering and to stub out during unit tests.
  1116. * \@docs-private
  1117. * @type {?}
  1118. */
  1119. var MAT_ICON_LOCATION = new core.InjectionToken('mat-icon-location', {
  1120. providedIn: 'root',
  1121. factory: MAT_ICON_LOCATION_FACTORY
  1122. });
  1123. /**
  1124. * \@docs-private
  1125. * @return {?}
  1126. */
  1127. function MAT_ICON_LOCATION_FACTORY() {
  1128. /** @type {?} */
  1129. var _document = core.inject(common.DOCUMENT);
  1130. /** @type {?} */
  1131. var _location = _document ? _document.location : null;
  1132. return {
  1133. // Note that this needs to be a function, rather than a property, because Angular
  1134. // will only resolve it once, but we want the current path on each call.
  1135. getPathname: (/**
  1136. * @return {?}
  1137. */
  1138. function () { return _location ? (_location.pathname + _location.search) : ''; })
  1139. };
  1140. }
  1141. /**
  1142. * SVG attributes that accept a FuncIRI (e.g. `url(<something>)`).
  1143. * @type {?}
  1144. */
  1145. var funcIriAttributes = [
  1146. 'clip-path',
  1147. 'color-profile',
  1148. 'src',
  1149. 'cursor',
  1150. 'fill',
  1151. 'filter',
  1152. 'marker',
  1153. 'marker-start',
  1154. 'marker-mid',
  1155. 'marker-end',
  1156. 'mask',
  1157. 'stroke'
  1158. ];
  1159. var ɵ0 = /**
  1160. * @param {?} attr
  1161. * @return {?}
  1162. */
  1163. function (attr) { return "[" + attr + "]"; };
  1164. /**
  1165. * Selector that can be used to find all elements that are using a `FuncIRI`.
  1166. * @type {?}
  1167. */
  1168. var funcIriAttributeSelector = funcIriAttributes.map((ɵ0)).join(', ');
  1169. /**
  1170. * Regex that can be used to extract the id out of a FuncIRI.
  1171. * @type {?}
  1172. */
  1173. var funcIriPattern = /^url\(['"]?#(.*?)['"]?\)$/;
  1174. /**
  1175. * Component to display an icon. It can be used in the following ways:
  1176. *
  1177. * - Specify the svgIcon input to load an SVG icon from a URL previously registered with the
  1178. * addSvgIcon, addSvgIconInNamespace, addSvgIconSet, or addSvgIconSetInNamespace methods of
  1179. * MatIconRegistry. If the svgIcon value contains a colon it is assumed to be in the format
  1180. * "[namespace]:[name]", if not the value will be the name of an icon in the default namespace.
  1181. * Examples:
  1182. * `<mat-icon svgIcon="left-arrow"></mat-icon>
  1183. * <mat-icon svgIcon="animals:cat"></mat-icon>`
  1184. *
  1185. * - Use a font ligature as an icon by putting the ligature text in the content of the `<mat-icon>`
  1186. * component. By default the Material icons font is used as described at
  1187. * http://google.github.io/material-design-icons/#icon-font-for-the-web. You can specify an
  1188. * alternate font by setting the fontSet input to either the CSS class to apply to use the
  1189. * desired font, or to an alias previously registered with MatIconRegistry.registerFontClassAlias.
  1190. * Examples:
  1191. * `<mat-icon>home</mat-icon>
  1192. * <mat-icon fontSet="myfont">sun</mat-icon>`
  1193. *
  1194. * - Specify a font glyph to be included via CSS rules by setting the fontSet input to specify the
  1195. * font, and the fontIcon input to specify the icon. Typically the fontIcon will specify a
  1196. * CSS class which causes the glyph to be displayed via a :before selector, as in
  1197. * https://fortawesome.github.io/Font-Awesome/examples/
  1198. * Example:
  1199. * `<mat-icon fontSet="fa" fontIcon="alarm"></mat-icon>`
  1200. */
  1201. var MatIcon = /** @class */ (function (_super) {
  1202. __extends(MatIcon, _super);
  1203. function MatIcon(elementRef, _iconRegistry, ariaHidden, _location) {
  1204. var _this = _super.call(this, elementRef) || this;
  1205. _this._iconRegistry = _iconRegistry;
  1206. _this._location = _location;
  1207. _this._inline = false;
  1208. // If the user has not explicitly set aria-hidden, mark the icon as hidden, as this is
  1209. // the right thing to do for the majority of icon use-cases.
  1210. if (!ariaHidden) {
  1211. elementRef.nativeElement.setAttribute('aria-hidden', 'true');
  1212. }
  1213. return _this;
  1214. }
  1215. Object.defineProperty(MatIcon.prototype, "inline", {
  1216. /**
  1217. * Whether the icon should be inlined, automatically sizing the icon to match the font size of
  1218. * the element the icon is contained in.
  1219. */
  1220. get: /**
  1221. * Whether the icon should be inlined, automatically sizing the icon to match the font size of
  1222. * the element the icon is contained in.
  1223. * @return {?}
  1224. */
  1225. function () {
  1226. return this._inline;
  1227. },
  1228. set: /**
  1229. * @param {?} inline
  1230. * @return {?}
  1231. */
  1232. function (inline) {
  1233. this._inline = coercion.coerceBooleanProperty(inline);
  1234. },
  1235. enumerable: true,
  1236. configurable: true
  1237. });
  1238. Object.defineProperty(MatIcon.prototype, "fontSet", {
  1239. /** Font set that the icon is a part of. */
  1240. get: /**
  1241. * Font set that the icon is a part of.
  1242. * @return {?}
  1243. */
  1244. function () { return this._fontSet; },
  1245. set: /**
  1246. * @param {?} value
  1247. * @return {?}
  1248. */
  1249. function (value) {
  1250. this._fontSet = this._cleanupFontValue(value);
  1251. },
  1252. enumerable: true,
  1253. configurable: true
  1254. });
  1255. Object.defineProperty(MatIcon.prototype, "fontIcon", {
  1256. /** Name of an icon within a font set. */
  1257. get: /**
  1258. * Name of an icon within a font set.
  1259. * @return {?}
  1260. */
  1261. function () { return this._fontIcon; },
  1262. set: /**
  1263. * @param {?} value
  1264. * @return {?}
  1265. */
  1266. function (value) {
  1267. this._fontIcon = this._cleanupFontValue(value);
  1268. },
  1269. enumerable: true,
  1270. configurable: true
  1271. });
  1272. /**
  1273. * Splits an svgIcon binding value into its icon set and icon name components.
  1274. * Returns a 2-element array of [(icon set), (icon name)].
  1275. * The separator for the two fields is ':'. If there is no separator, an empty
  1276. * string is returned for the icon set and the entire value is returned for
  1277. * the icon name. If the argument is falsy, returns an array of two empty strings.
  1278. * Throws an error if the name contains two or more ':' separators.
  1279. * Examples:
  1280. * `'social:cake' -> ['social', 'cake']
  1281. * 'penguin' -> ['', 'penguin']
  1282. * null -> ['', '']
  1283. * 'a:b:c' -> (throws Error)`
  1284. */
  1285. /**
  1286. * Splits an svgIcon binding value into its icon set and icon name components.
  1287. * Returns a 2-element array of [(icon set), (icon name)].
  1288. * The separator for the two fields is ':'. If there is no separator, an empty
  1289. * string is returned for the icon set and the entire value is returned for
  1290. * the icon name. If the argument is falsy, returns an array of two empty strings.
  1291. * Throws an error if the name contains two or more ':' separators.
  1292. * Examples:
  1293. * `'social:cake' -> ['social', 'cake']
  1294. * 'penguin' -> ['', 'penguin']
  1295. * null -> ['', '']
  1296. * 'a:b:c' -> (throws Error)`
  1297. * @private
  1298. * @param {?} iconName
  1299. * @return {?}
  1300. */
  1301. MatIcon.prototype._splitIconName = /**
  1302. * Splits an svgIcon binding value into its icon set and icon name components.
  1303. * Returns a 2-element array of [(icon set), (icon name)].
  1304. * The separator for the two fields is ':'. If there is no separator, an empty
  1305. * string is returned for the icon set and the entire value is returned for
  1306. * the icon name. If the argument is falsy, returns an array of two empty strings.
  1307. * Throws an error if the name contains two or more ':' separators.
  1308. * Examples:
  1309. * `'social:cake' -> ['social', 'cake']
  1310. * 'penguin' -> ['', 'penguin']
  1311. * null -> ['', '']
  1312. * 'a:b:c' -> (throws Error)`
  1313. * @private
  1314. * @param {?} iconName
  1315. * @return {?}
  1316. */
  1317. function (iconName) {
  1318. if (!iconName) {
  1319. return ['', ''];
  1320. }
  1321. /** @type {?} */
  1322. var parts = iconName.split(':');
  1323. switch (parts.length) {
  1324. case 1: return ['', parts[0]]; // Use default namespace.
  1325. case 2: return (/** @type {?} */ (parts));
  1326. default: throw Error("Invalid icon name: \"" + iconName + "\"");
  1327. }
  1328. };
  1329. /**
  1330. * @param {?} changes
  1331. * @return {?}
  1332. */
  1333. MatIcon.prototype.ngOnChanges = /**
  1334. * @param {?} changes
  1335. * @return {?}
  1336. */
  1337. function (changes) {
  1338. var _this = this;
  1339. // Only update the inline SVG icon if the inputs changed, to avoid unnecessary DOM operations.
  1340. /** @type {?} */
  1341. var svgIconChanges = changes['svgIcon'];
  1342. if (svgIconChanges) {
  1343. if (this.svgIcon) {
  1344. var _a = this._splitIconName(this.svgIcon), namespace = _a[0], iconName = _a[1];
  1345. this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(operators.take(1)).subscribe((/**
  1346. * @param {?} svg
  1347. * @return {?}
  1348. */
  1349. function (svg) { return _this._setSvgElement(svg); }), (/**
  1350. * @param {?} err
  1351. * @return {?}
  1352. */
  1353. function (err) { return console.log("Error retrieving icon: " + err.message); }));
  1354. }
  1355. else if (svgIconChanges.previousValue) {
  1356. this._clearSvgElement();
  1357. }
  1358. }
  1359. if (this._usingFontIcon()) {
  1360. this._updateFontIconClasses();
  1361. }
  1362. };
  1363. /**
  1364. * @return {?}
  1365. */
  1366. MatIcon.prototype.ngOnInit = /**
  1367. * @return {?}
  1368. */
  1369. function () {
  1370. // Update font classes because ngOnChanges won't be called if none of the inputs are present,
  1371. // e.g. <mat-icon>arrow</mat-icon> In this case we need to add a CSS class for the default font.
  1372. if (this._usingFontIcon()) {
  1373. this._updateFontIconClasses();
  1374. }
  1375. };
  1376. /**
  1377. * @return {?}
  1378. */
  1379. MatIcon.prototype.ngAfterViewChecked = /**
  1380. * @return {?}
  1381. */
  1382. function () {
  1383. /** @type {?} */
  1384. var cachedElements = this._elementsWithExternalReferences;
  1385. if (cachedElements && this._location && cachedElements.size) {
  1386. /** @type {?} */
  1387. var newPath = this._location.getPathname();
  1388. // We need to check whether the URL has changed on each change detection since
  1389. // the browser doesn't have an API that will let us react on link clicks and
  1390. // we can't depend on the Angular router. The references need to be updated,
  1391. // because while most browsers don't care whether the URL is correct after
  1392. // the first render, Safari will break if the user navigates to a different
  1393. // page and the SVG isn't re-rendered.
  1394. if (newPath !== this._previousPath) {
  1395. this._previousPath = newPath;
  1396. this._prependPathToReferences(newPath);
  1397. }
  1398. }
  1399. };
  1400. /**
  1401. * @return {?}
  1402. */
  1403. MatIcon.prototype.ngOnDestroy = /**
  1404. * @return {?}
  1405. */
  1406. function () {
  1407. if (this._elementsWithExternalReferences) {
  1408. this._elementsWithExternalReferences.clear();
  1409. }
  1410. };
  1411. /**
  1412. * @private
  1413. * @return {?}
  1414. */
  1415. MatIcon.prototype._usingFontIcon = /**
  1416. * @private
  1417. * @return {?}
  1418. */
  1419. function () {
  1420. return !this.svgIcon;
  1421. };
  1422. /**
  1423. * @private
  1424. * @param {?} svg
  1425. * @return {?}
  1426. */
  1427. MatIcon.prototype._setSvgElement = /**
  1428. * @private
  1429. * @param {?} svg
  1430. * @return {?}
  1431. */
  1432. function (svg) {
  1433. this._clearSvgElement();
  1434. // Workaround for IE11 and Edge ignoring `style` tags inside dynamically-created SVGs.
  1435. // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10898469/
  1436. // Do this before inserting the element into the DOM, in order to avoid a style recalculation.
  1437. /** @type {?} */
  1438. var styleTags = (/** @type {?} */ (svg.querySelectorAll('style')));
  1439. for (var i = 0; i < styleTags.length; i++) {
  1440. styleTags[i].textContent += ' ';
  1441. }
  1442. // Note: we do this fix here, rather than the icon registry, because the
  1443. // references have to point to the URL at the time that the icon was created.
  1444. if (this._location) {
  1445. /** @type {?} */
  1446. var path = this._location.getPathname();
  1447. this._previousPath = path;
  1448. this._cacheChildrenWithExternalReferences(svg);
  1449. this._prependPathToReferences(path);
  1450. }
  1451. this._elementRef.nativeElement.appendChild(svg);
  1452. };
  1453. /**
  1454. * @private
  1455. * @return {?}
  1456. */
  1457. MatIcon.prototype._clearSvgElement = /**
  1458. * @private
  1459. * @return {?}
  1460. */
  1461. function () {
  1462. /** @type {?} */
  1463. var layoutElement = this._elementRef.nativeElement;
  1464. /** @type {?} */
  1465. var childCount = layoutElement.childNodes.length;
  1466. if (this._elementsWithExternalReferences) {
  1467. this._elementsWithExternalReferences.clear();
  1468. }
  1469. // Remove existing non-element child nodes and SVGs, and add the new SVG element. Note that
  1470. // we can't use innerHTML, because IE will throw if the element has a data binding.
  1471. while (childCount--) {
  1472. /** @type {?} */
  1473. var child = layoutElement.childNodes[childCount];
  1474. // 1 corresponds to Node.ELEMENT_NODE. We remove all non-element nodes in order to get rid
  1475. // of any loose text nodes, as well as any SVG elements in order to remove any old icons.
  1476. if (child.nodeType !== 1 || child.nodeName.toLowerCase() === 'svg') {
  1477. layoutElement.removeChild(child);
  1478. }
  1479. }
  1480. };
  1481. /**
  1482. * @private
  1483. * @return {?}
  1484. */
  1485. MatIcon.prototype._updateFontIconClasses = /**
  1486. * @private
  1487. * @return {?}
  1488. */
  1489. function () {
  1490. if (!this._usingFontIcon()) {
  1491. return;
  1492. }
  1493. /** @type {?} */
  1494. var elem = this._elementRef.nativeElement;
  1495. /** @type {?} */
  1496. var fontSetClass = this.fontSet ?
  1497. this._iconRegistry.classNameForFontAlias(this.fontSet) :
  1498. this._iconRegistry.getDefaultFontSetClass();
  1499. if (fontSetClass != this._previousFontSetClass) {
  1500. if (this._previousFontSetClass) {
  1501. elem.classList.remove(this._previousFontSetClass);
  1502. }
  1503. if (fontSetClass) {
  1504. elem.classList.add(fontSetClass);
  1505. }
  1506. this._previousFontSetClass = fontSetClass;
  1507. }
  1508. if (this.fontIcon != this._previousFontIconClass) {
  1509. if (this._previousFontIconClass) {
  1510. elem.classList.remove(this._previousFontIconClass);
  1511. }
  1512. if (this.fontIcon) {
  1513. elem.classList.add(this.fontIcon);
  1514. }
  1515. this._previousFontIconClass = this.fontIcon;
  1516. }
  1517. };
  1518. /**
  1519. * Cleans up a value to be used as a fontIcon or fontSet.
  1520. * Since the value ends up being assigned as a CSS class, we
  1521. * have to trim the value and omit space-separated values.
  1522. */
  1523. /**
  1524. * Cleans up a value to be used as a fontIcon or fontSet.
  1525. * Since the value ends up being assigned as a CSS class, we
  1526. * have to trim the value and omit space-separated values.
  1527. * @private
  1528. * @param {?} value
  1529. * @return {?}
  1530. */
  1531. MatIcon.prototype._cleanupFontValue = /**
  1532. * Cleans up a value to be used as a fontIcon or fontSet.
  1533. * Since the value ends up being assigned as a CSS class, we
  1534. * have to trim the value and omit space-separated values.
  1535. * @private
  1536. * @param {?} value
  1537. * @return {?}
  1538. */
  1539. function (value) {
  1540. return typeof value === 'string' ? value.trim().split(' ')[0] : value;
  1541. };
  1542. /**
  1543. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  1544. * reference. This is required because WebKit browsers require references to be prefixed with
  1545. * the current path, if the page has a `base` tag.
  1546. */
  1547. /**
  1548. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  1549. * reference. This is required because WebKit browsers require references to be prefixed with
  1550. * the current path, if the page has a `base` tag.
  1551. * @private
  1552. * @param {?} path
  1553. * @return {?}
  1554. */
  1555. MatIcon.prototype._prependPathToReferences = /**
  1556. * Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
  1557. * reference. This is required because WebKit browsers require references to be prefixed with
  1558. * the current path, if the page has a `base` tag.
  1559. * @private
  1560. * @param {?} path
  1561. * @return {?}
  1562. */
  1563. function (path) {
  1564. /** @type {?} */
  1565. var elements = this._elementsWithExternalReferences;
  1566. if (elements) {
  1567. elements.forEach((/**
  1568. * @param {?} attrs
  1569. * @param {?} element
  1570. * @return {?}
  1571. */
  1572. function (attrs, element) {
  1573. attrs.forEach((/**
  1574. * @param {?} attr
  1575. * @return {?}
  1576. */
  1577. function (attr) {
  1578. element.setAttribute(attr.name, "url('" + path + "#" + attr.value + "')");
  1579. }));
  1580. }));
  1581. }
  1582. };
  1583. /**
  1584. * Caches the children of an SVG element that have `url()`
  1585. * references that we need to prefix with the current path.
  1586. */
  1587. /**
  1588. * Caches the children of an SVG element that have `url()`
  1589. * references that we need to prefix with the current path.
  1590. * @private
  1591. * @param {?} element
  1592. * @return {?}
  1593. */
  1594. MatIcon.prototype._cacheChildrenWithExternalReferences = /**
  1595. * Caches the children of an SVG element that have `url()`
  1596. * references that we need to prefix with the current path.
  1597. * @private
  1598. * @param {?} element
  1599. * @return {?}
  1600. */
  1601. function (element) {
  1602. /** @type {?} */
  1603. var elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector);
  1604. /** @type {?} */
  1605. var elements = this._elementsWithExternalReferences =
  1606. this._elementsWithExternalReferences || new Map();
  1607. var _loop_1 = function (i) {
  1608. funcIriAttributes.forEach((/**
  1609. * @param {?} attr
  1610. * @return {?}
  1611. */
  1612. function (attr) {
  1613. /** @type {?} */
  1614. var elementWithReference = elementsWithFuncIri[i];
  1615. /** @type {?} */
  1616. var value = elementWithReference.getAttribute(attr);
  1617. /** @type {?} */
  1618. var match = value ? value.match(funcIriPattern) : null;
  1619. if (match) {
  1620. /** @type {?} */
  1621. var attributes = elements.get(elementWithReference);
  1622. if (!attributes) {
  1623. attributes = [];
  1624. elements.set(elementWithReference, attributes);
  1625. }
  1626. (/** @type {?} */ (attributes)).push({ name: attr, value: match[1] });
  1627. }
  1628. }));
  1629. };
  1630. for (var i = 0; i < elementsWithFuncIri.length; i++) {
  1631. _loop_1(i);
  1632. }
  1633. };
  1634. MatIcon.decorators = [
  1635. { type: core.Component, args: [{template: '<ng-content></ng-content>',
  1636. selector: 'mat-icon',
  1637. exportAs: 'matIcon',
  1638. styles: [".mat-icon{background-repeat:no-repeat;display:inline-block;fill:currentColor;height:24px;width:24px}.mat-icon.mat-icon-inline{font-size:inherit;height:inherit;line-height:inherit;width:inherit}[dir=rtl] .mat-icon-rtl-mirror{transform:scale(-1,1)}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon{display:block}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-icon{margin:auto}"],
  1639. inputs: ['color'],
  1640. host: {
  1641. 'role': 'img',
  1642. 'class': 'mat-icon notranslate',
  1643. '[class.mat-icon-inline]': 'inline',
  1644. '[class.mat-icon-no-color]': 'color !== "primary" && color !== "accent" && color !== "warn"',
  1645. },
  1646. encapsulation: core.ViewEncapsulation.None,
  1647. changeDetection: core.ChangeDetectionStrategy.OnPush,
  1648. },] },
  1649. ];
  1650. /** @nocollapse */
  1651. MatIcon.ctorParameters = function () { return [
  1652. { type: core.ElementRef },
  1653. { type: MatIconRegistry },
  1654. { type: String, decorators: [{ type: core.Attribute, args: ['aria-hidden',] }] },
  1655. { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_ICON_LOCATION,] }] }
  1656. ]; };
  1657. MatIcon.propDecorators = {
  1658. inline: [{ type: core.Input }],
  1659. svgIcon: [{ type: core.Input }],
  1660. fontSet: [{ type: core.Input }],
  1661. fontIcon: [{ type: core.Input }]
  1662. };
  1663. return MatIcon;
  1664. }(_MatIconMixinBase));
  1665. /**
  1666. * @fileoverview added by tsickle
  1667. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1668. */
  1669. var MatIconModule = /** @class */ (function () {
  1670. function MatIconModule() {
  1671. }
  1672. MatIconModule.decorators = [
  1673. { type: core.NgModule, args: [{
  1674. imports: [core$1.MatCommonModule],
  1675. exports: [MatIcon, core$1.MatCommonModule],
  1676. declarations: [MatIcon],
  1677. },] },
  1678. ];
  1679. return MatIconModule;
  1680. }());
  1681. exports.MatIconModule = MatIconModule;
  1682. exports.MAT_ICON_LOCATION_FACTORY = MAT_ICON_LOCATION_FACTORY;
  1683. exports.MAT_ICON_LOCATION = MAT_ICON_LOCATION;
  1684. exports.MatIcon = MatIcon;
  1685. exports.getMatIconNameNotFoundError = getMatIconNameNotFoundError;
  1686. exports.getMatIconNoHttpProviderError = getMatIconNoHttpProviderError;
  1687. exports.getMatIconFailedToSanitizeUrlError = getMatIconFailedToSanitizeUrlError;
  1688. exports.getMatIconFailedToSanitizeLiteralError = getMatIconFailedToSanitizeLiteralError;
  1689. exports.ICON_REGISTRY_PROVIDER_FACTORY = ICON_REGISTRY_PROVIDER_FACTORY;
  1690. exports.MatIconRegistry = MatIconRegistry;
  1691. exports.ICON_REGISTRY_PROVIDER = ICON_REGISTRY_PROVIDER;
  1692. Object.defineProperty(exports, '__esModule', { value: true });
  1693. })));
  1694. //# sourceMappingURL=material-icon.umd.js.map