Socket
Socket
Sign inDemoInstall

angular-svg-icon

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-svg-icon - npm Package Compare versions

Comparing version 7.2.1 to 8.0.0

esm2015/lib/angular-svg-icon.module.js

2

angular-svg-icon.d.ts
/**
* Generated bundle index. Do not edit.
*/
export * from './index';
export * from './public-api';

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"AngularSvgIconConfig":{"__symbolic":"interface"},"AngularSvgIconModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":13,"character":2}],"declarations":[{"__symbolic":"reference","name":"SvgIconComponent"}],"providers":[{"__symbolic":"reference","name":"SVG_ICON_REGISTRY_PROVIDER"},{"provide":{"__symbolic":"reference","name":"SvgLoader"},"useClass":{"__symbolic":"reference","name":"SvgHttpLoader"}}],"exports":[{"__symbolic":"reference","name":"SvgIconComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"defaults":[{}],"value":{"ngModule":{"__symbolic":"reference","name":"AngularSvgIconModule"},"providers":[{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"loader"},"right":{"provide":{"__symbolic":"reference","name":"SvgLoader"},"useClass":{"__symbolic":"reference","name":"SvgHttpLoader"}}},{"__symbolic":"reference","name":"SVG_ICON_REGISTRY_PROVIDER"}]}}}},"SERVER_URL":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":7,"character":30},"arguments":["SERVER_URL"]},"SvgIconRegistryService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":17,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":17,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":18,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":18,"character":17},"arguments":[{"__symbolic":"reference","name":"SERVER_URL"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":19,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":17},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":19,"character":24}]}]],"parameters":[{"__symbolic":"reference","name":"SvgLoader"},{"__symbolic":"reference","name":"Object"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"any"}]}],"addSvg":[{"__symbolic":"method"}],"loadSvg":[{"__symbolic":"method"}],"getSvgByName":[{"__symbolic":"method"}],"unloadSvg":[{"__symbolic":"method"}]}},"SVG_ICON_REGISTRY_PROVIDER_FACTORY":{"__symbolic":"function","parameters":["parentRegistry","loader","platformId","serverUrl","document"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"parentRegistry"},"right":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"SvgIconRegistryService"},"arguments":[{"__symbolic":"reference","name":"loader"},{"__symbolic":"reference","name":"platformId"},{"__symbolic":"reference","name":"serverUrl"},{"__symbolic":"reference","name":"document"}]}}},"SVG_ICON_REGISTRY_PROVIDER":{"provide":{"__symbolic":"reference","name":"SvgIconRegistryService"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":93,"character":14}},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":93,"character":30}},{"__symbolic":"reference","name":"SvgIconRegistryService"}],{"__symbolic":"reference","name":"SvgLoader"},[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":93,"character":79}],[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":94,"character":8}},{"__symbolic":"reference","name":"SERVER_URL"}],[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":94,"character":64}},{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":94,"character":76}]],"useFactory":{"__symbolic":"reference","name":"SVG_ICON_REGISTRY_PROVIDER_FACTORY"}},"SvgIconComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":8,"character":1},"arguments":[{"selector":"svg-icon","template":"<ng-content></ng-content>"}]}],"members":{"src":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":2}}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":2}}]}],"stretch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":2}}]}],"applyCss":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":2}}]}],"svgStyle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":2}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":32,"character":30},{"__symbolic":"reference","module":"@angular/core","name":"KeyValueDiffers","line":33,"character":19},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":34,"character":20},{"__symbolic":"reference","name":"SvgIconRegistryService"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":36,"character":15}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"initSvg":[{"__symbolic":"method"}],"destroy":[{"__symbolic":"method"}],"resetDiffer":[{"__symbolic":"method"}],"setSvg":[{"__symbolic":"method"}],"copyNgContentAttribute":[{"__symbolic":"method"}],"setNgContentAttribute":[{"__symbolic":"method"}],"stylize":[{"__symbolic":"method"}],"applyChanges":[{"__symbolic":"method"}],"setStyle":[{"__symbolic":"method"}]}},"SvgLoader":{"__symbolic":"class","members":{"getSvg":[{"__symbolic":"method"}]}},"SvgHttpLoader":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"SvgLoader"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":11,"character":27}]}],"getSvg":[{"__symbolic":"method"}]}}},"origins":{"AngularSvgIconConfig":"./src/angular-svg-icon.module","AngularSvgIconModule":"./src/angular-svg-icon.module","SERVER_URL":"./src/svg-icon-registry.service","SvgIconRegistryService":"./src/svg-icon-registry.service","SVG_ICON_REGISTRY_PROVIDER_FACTORY":"./src/svg-icon-registry.service","SVG_ICON_REGISTRY_PROVIDER":"./src/svg-icon-registry.service","SvgIconComponent":"./src/svg-icon.component","SvgLoader":"./src/svg-loader","SvgHttpLoader":"./src/svg-loader"},"importAs":"angular-svg-icon"}
{"__symbolic":"module","version":4,"metadata":{"AngularSvgIconConfig":{"__symbolic":"interface"},"AngularSvgIconModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":13,"character":2}],"declarations":[{"__symbolic":"reference","name":"SvgIconComponent"}],"providers":[{"__symbolic":"reference","name":"SVG_ICON_REGISTRY_PROVIDER"},{"provide":{"__symbolic":"reference","name":"SvgLoader"},"useClass":{"__symbolic":"reference","name":"SvgHttpLoader"}}],"exports":[{"__symbolic":"reference","name":"SvgIconComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"defaults":[{}],"value":{"ngModule":{"__symbolic":"reference","name":"AngularSvgIconModule"},"providers":[{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"loader"},"right":{"provide":{"__symbolic":"reference","name":"SvgLoader"},"useClass":{"__symbolic":"reference","name":"SvgHttpLoader"}}},{"__symbolic":"reference","name":"SVG_ICON_REGISTRY_PROVIDER"}]}}}},"SERVER_URL":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":7,"character":30},"arguments":["SERVER_URL"]},"SvgIconRegistryService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":18,"character":3},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":18,"character":10}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":19,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":15},"arguments":[{"__symbolic":"reference","name":"SERVER_URL"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":20,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":15},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":20,"character":22}]}]],"parameters":[{"__symbolic":"reference","name":"SvgLoader"},{"__symbolic":"reference","name":"Object"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"any"}]}],"addSvg":[{"__symbolic":"method"}],"loadSvg":[{"__symbolic":"method"}],"getSvgByName":[{"__symbolic":"method"}],"unloadSvg":[{"__symbolic":"method"}]}},"SVG_ICON_REGISTRY_PROVIDER_FACTORY":{"__symbolic":"function","parameters":["parentRegistry","loader","platformId","serverUrl","document"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"reference","name":"parentRegistry"},"right":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"SvgIconRegistryService"},"arguments":[{"__symbolic":"reference","name":"loader"},{"__symbolic":"reference","name":"platformId"},{"__symbolic":"reference","name":"serverUrl"},{"__symbolic":"reference","name":"document"}]}}},"SVG_ICON_REGISTRY_PROVIDER":{"provide":{"__symbolic":"reference","name":"SvgIconRegistryService"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":98,"character":14}},{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":98,"character":30}},{"__symbolic":"reference","name":"SvgIconRegistryService"}],{"__symbolic":"reference","name":"SvgLoader"},[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":98,"character":79}],[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":99,"character":8}},{"__symbolic":"reference","name":"SERVER_URL"}],[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":99,"character":64}},{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":99,"character":76}]],"useFactory":{"__symbolic":"reference","name":"SVG_ICON_REGISTRY_PROVIDER_FACTORY"}},"SvgIconComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":8,"character":1},"arguments":[{"selector":"svg-icon","template":"<ng-content></ng-content>"}]}],"members":{"src":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":2}}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":2}}]}],"stretch":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":2}}]}],"applyCss":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":2}}]}],"svgStyle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":19,"character":2}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":33,"character":19},{"__symbolic":"reference","module":"@angular/core","name":"KeyValueDiffers","line":34,"character":19},{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":35,"character":20},{"__symbolic":"reference","name":"SvgIconRegistryService"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":37,"character":15}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"initSvg":[{"__symbolic":"method"}],"destroy":[{"__symbolic":"method"}],"resetDiffer":[{"__symbolic":"method"}],"setSvg":[{"__symbolic":"method"}],"copyNgContentAttribute":[{"__symbolic":"method"}],"setNgContentAttribute":[{"__symbolic":"method"}],"stylize":[{"__symbolic":"method"}],"applyChanges":[{"__symbolic":"method"}],"setStyle":[{"__symbolic":"method"}]}},"SvgLoader":{"__symbolic":"class","members":{"getSvg":[{"__symbolic":"method"}]}},"SvgHttpLoader":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"SvgLoader"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":11,"character":27}]}],"getSvg":[{"__symbolic":"method"}]}}},"origins":{"AngularSvgIconConfig":"./lib/angular-svg-icon.module","AngularSvgIconModule":"./lib/angular-svg-icon.module","SERVER_URL":"./lib/svg-icon-registry.service","SvgIconRegistryService":"./lib/svg-icon-registry.service","SVG_ICON_REGISTRY_PROVIDER_FACTORY":"./lib/svg-icon-registry.service","SVG_ICON_REGISTRY_PROVIDER":"./lib/svg-icon-registry.service","SvgIconComponent":"./lib/svg-icon.component","SvgLoader":"./lib/svg-loader","SvgHttpLoader":"./lib/svg-loader"},"importAs":"angular-svg-icon"}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@angular/common/http'), require('@angular/core')) :
typeof define === 'function' && define.amd ? define('angular-svg-icon', ['exports', 'rxjs', 'rxjs/operators', '@angular/common', '@angular/common/http', '@angular/core'], factory) :
(factory((global['angular-svg-icon'] = {}),global.rxjs,global.rxjs.operators,global.ng.common,global.ng.common.http,global.ng.core));
}(this, (function (exports,rxjs,operators,common,http,core) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs'), require('rxjs/operators'), require('@angular/common/http')) :
typeof define === 'function' && define.amd ? define('angular-svg-icon', ['exports', '@angular/core', '@angular/common', 'rxjs', 'rxjs/operators', '@angular/common/http'], factory) :
(global = global || self, factory(global['angular-svg-icon'] = {}, global.ng.core, global.ng.common, global.rxjs, global.rxjs.operators, global.ng.common.http));
}(this, function (exports, core, common, rxjs, operators, http) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
ar.push(r.value);
}
catch (error) {
e = { error: error };
}
finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
}
finally {
if (e)
throw e.error;
}
}
return ar;
}
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @abstract
*/
/**
var /**
* @abstract
*/
var /**
* @abstract
*/ SvgLoader = /** @class */ (function () {
SvgLoader = /** @class */ (function () {
function SvgLoader() {

@@ -76,5 +33,5 @@ }

__extends(SvgHttpLoader, _super);
function SvgHttpLoader(http$$1) {
function SvgHttpLoader(http) {
var _this = _super.call(this) || this;
_this.http = http$$1;
_this.http = http;
return _this;

@@ -90,5 +47,5 @@ }

*/
function (url) {
return this.http.get(url, { responseType: 'text' });
};
function (url) {
return this.http.get(url, { responseType: 'text' });
};
SvgHttpLoader.decorators = [

@@ -98,7 +55,5 @@ { type: core.Injectable }

/** @nocollapse */
SvgHttpLoader.ctorParameters = function () {
return [
{ type: http.HttpClient }
];
};
SvgHttpLoader.ctorParameters = function () { return [
{ type: http.HttpClient }
]; };
return SvgHttpLoader;

@@ -136,12 +91,12 @@ }(SvgLoader));

*/
function (name, data) {
if (!this.iconsByUrl.has(name)) {
/** @type {?} */
var div = this.document.createElement('DIV');
div.innerHTML = data;
/** @type {?} */
var svg = ( /** @type {?} */(div.querySelector('svg')));
this.iconsByUrl.set(name, svg);
}
};
function (name, data) {
if (!this.iconsByUrl.has(name)) {
/** @type {?} */
var div = this.document.createElement('DIV');
div.innerHTML = data;
/** @type {?} */
var svg = (/** @type {?} */ (div.querySelector('svg')));
this.iconsByUrl.set(name, svg);
}
};
/** Load a SVG to the registry from a URL. */

@@ -160,44 +115,46 @@ /**

*/
function (url, name) {
var _this = this;
if (name === void 0) {
name = url;
}
// not sure if there should be a possibility to use name for server usage
// so overriding it for now if provided
// maybe should separate functionality for url and name use-cases
if (this.serverUrl && url.match(/^(http(s)?):/) === null) {
url = this.serverUrl + url;
name = url;
}
if (this.iconsByUrl.has(name)) {
return rxjs.of(this.iconsByUrl.get(name));
}
else if (this.iconsLoadingByUrl.has(name)) {
return this.iconsLoadingByUrl.get(name);
}
function (url, name) {
var _this = this;
if (name === void 0) { name = url; }
// not sure if there should be a possibility to use name for server usage
// so overriding it for now if provided
// maybe should separate functionality for url and name use-cases
if (this.serverUrl && url.match(/^(http(s)?):/) === null) {
url = this.serverUrl + url;
name = url;
}
if (this.iconsByUrl.has(name)) {
return rxjs.of(this.iconsByUrl.get(name));
}
else if (this.iconsLoadingByUrl.has(name)) {
return this.iconsLoadingByUrl.get(name);
}
/** @type {?} */
var o = (/** @type {?} */ (this.loader.getSvg(url).pipe(operators.map((/**
* @param {?} svg
* @return {?}
*/
function (svg) {
/** @type {?} */
var o = ( /** @type {?} */(this.loader.getSvg(url).pipe(operators.map(( /**
* @param {?} svg
* @return {?}
*/function (svg) {
/** @type {?} */
var div = _this.document.createElement('DIV');
div.innerHTML = svg;
return ( /** @type {?} */(div.querySelector('svg')));
})), operators.tap(( /**
* @param {?} svg
* @return {?}
*/function (svg) { return _this.iconsByUrl.set(name, svg); })), operators.catchError(( /**
* @param {?} err
* @return {?}
*/function (err) {
console.error(err);
return rxjs.throwError(err);
})), operators.finalize(( /**
* @return {?}
*/function () { return _this.iconsLoadingByUrl.delete(name); })), operators.share())));
this.iconsLoadingByUrl.set(name, o);
return o;
};
var div = _this.document.createElement('DIV');
div.innerHTML = svg;
return (/** @type {?} */ (div.querySelector('svg')));
})), operators.tap((/**
* @param {?} svg
* @return {?}
*/
function (svg) { return _this.iconsByUrl.set(name, svg); })), operators.catchError((/**
* @param {?} err
* @return {?}
*/
function (err) {
console.error(err);
return rxjs.throwError(err);
})), operators.finalize((/**
* @return {?}
*/
function () { return _this.iconsLoadingByUrl.delete(name); })), operators.share())));
this.iconsLoadingByUrl.set(name, o);
return o;
};
/** Get loaded SVG from registry by name. (also works by url because of blended map) */

@@ -214,11 +171,11 @@ /**

*/
function (name) {
if (this.iconsByUrl.has(name)) {
return rxjs.of(this.iconsByUrl.get(name));
}
else if (this.iconsLoadingByUrl.has(name)) {
return this.iconsLoadingByUrl.get(name);
}
return rxjs.throwError("No svg with name '" + name + "' has been loaded");
};
function (name) {
if (this.iconsByUrl.has(name)) {
return rxjs.of(this.iconsByUrl.get(name));
}
else if (this.iconsLoadingByUrl.has(name)) {
return this.iconsLoadingByUrl.get(name);
}
return rxjs.throwError("No svg with name '" + name + "' has been loaded");
};
/** Remove a SVG from the registry by URL (or name). */

@@ -235,7 +192,7 @@ /**

*/
function (url) {
if (this.iconsByUrl.has(url)) {
this.iconsByUrl.delete(url);
}
};
function (url) {
if (this.iconsByUrl.has(url)) {
this.iconsByUrl.delete(url);
}
};
SvgIconRegistryService.decorators = [

@@ -245,10 +202,8 @@ { type: core.Injectable }

/** @nocollapse */
SvgIconRegistryService.ctorParameters = function () {
return [
{ type: SvgLoader },
{ type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [SERVER_URL,] }] },
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
];
};
SvgIconRegistryService.ctorParameters = function () { return [
{ type: SvgLoader },
{ type: Object, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [SERVER_URL,] }] },
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [common.DOCUMENT,] }] }
]; };
return SvgIconRegistryService;

@@ -270,4 +225,4 @@ }());

provide: SvgIconRegistryService,
deps: [[new core.Optional(), new core.SkipSelf(), SvgIconRegistryService], SvgLoader, [( /** @type {?} */(core.PLATFORM_ID))],
[new core.Optional(), ( /** @type {?} */(SERVER_URL))], [new core.Optional(), ( /** @type {?} */(common.DOCUMENT))]
deps: [[new core.Optional(), new core.SkipSelf(), SvgIconRegistryService], SvgLoader, [(/** @type {?} */ (core.PLATFORM_ID))],
[new core.Optional(), (/** @type {?} */ (SERVER_URL))], [new core.Optional(), (/** @type {?} */ (common.DOCUMENT))]
],

@@ -277,6 +232,18 @@ useFactory: SVG_ICON_REGISTRY_PROVIDER_FACTORY

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var SvgIconComponent = /** @class */ (function () {

@@ -315,5 +282,5 @@ function SvgIconComponent(element, differs, renderer, iconReg, cdr) {

*/
function () {
this.init();
};
function () {
this.init();
};
/**

@@ -325,5 +292,5 @@ * @return {?}

*/
function () {
this.destroy();
};
function () {
this.destroy();
};
/**

@@ -337,13 +304,13 @@ * @param {?} changeRecord

*/
function (changeRecord) {
if (changeRecord['src'] || changeRecord['name']) {
if (this.svg) {
this.destroy();
}
this.init();
function (changeRecord) {
if (changeRecord.src || changeRecord.name) {
if (this.svg) {
this.destroy();
}
if (changeRecord['stretch']) {
this.stylize();
}
};
this.init();
}
if (changeRecord.stretch) {
this.stylize();
}
};
/**

@@ -355,11 +322,11 @@ * @return {?}

*/
function () {
if (this.svg && this.differ) {
/** @type {?} */
var changes = this.differ.diff(this._svgStyle);
if (changes) {
this.applyChanges(changes);
}
function () {
if (this.svg && this.differ) {
/** @type {?} */
var changes = this.differ.diff(this._svgStyle);
if (changes) {
this.applyChanges(changes);
}
};
}
};
/**

@@ -373,9 +340,10 @@ * @private

*/
function () {
if (this.name) {
this.icnSub = this.iconReg.getSvgByName(this.name).subscribe(this.initSvg.bind(this));
return;
}
function () {
if (this.name) {
this.icnSub = this.iconReg.getSvgByName(this.name).subscribe(this.initSvg.bind(this));
}
else if (this.src) {
this.icnSub = this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this));
};
}
};
/**

@@ -391,6 +359,6 @@ * @private

*/
function (svg) {
this.setSvg(svg);
this.resetDiffer();
};
function (svg) {
this.setSvg(svg);
this.resetDiffer();
};
/**

@@ -404,9 +372,9 @@ * @private

*/
function () {
this.svg = undefined;
this.differ = undefined;
if (this.icnSub) {
this.icnSub.unsubscribe();
}
};
function () {
this.svg = undefined;
this.differ = undefined;
if (this.icnSub) {
this.icnSub.unsubscribe();
}
};
/**

@@ -420,7 +388,7 @@ * @private

*/
function () {
if (this._svgStyle && !this.differ) {
this.differ = this.differs.find(this._svgStyle).create();
}
};
function () {
if (this._svgStyle && !this.differ) {
this.differ = this.differs.find(this._svgStyle).create();
}
};
/**

@@ -436,18 +404,18 @@ * @private

*/
function (svg) {
if (svg) {
this.svg = svg;
/** @type {?} */
var icon = ( /** @type {?} */(svg.cloneNode(true)));
/** @type {?} */
var elem = this.element.nativeElement;
if (this.applyCss) {
this.copyNgContentAttribute(elem, icon);
}
elem.innerHTML = '';
this.renderer.appendChild(elem, icon);
this.stylize();
this.cdr.markForCheck();
function (svg) {
if (svg) {
this.svg = svg;
/** @type {?} */
var icon = (/** @type {?} */ (svg.cloneNode(true)));
/** @type {?} */
var elem = this.element.nativeElement;
if (this.applyCss) {
this.copyNgContentAttribute(elem, icon);
}
};
elem.innerHTML = '';
this.renderer.appendChild(elem, icon);
this.stylize();
this.cdr.markForCheck();
}
};
/**

@@ -465,16 +433,16 @@ * @private

*/
function (hostElem, icon) {
function (hostElem, icon) {
/** @type {?} */
var attributes = (/** @type {?} */ (hostElem.attributes));
/** @type {?} */
var len = attributes.length;
for (var i = 0; i < len; i += 1) {
/** @type {?} */
var attributes = ( /** @type {?} */(hostElem.attributes));
/** @type {?} */
var len = attributes.length;
for (var i = 0; i < len; i += 1) {
/** @type {?} */
var attribute = attributes.item(i);
if (attribute.name.startsWith('_ngcontent')) {
this.setNgContentAttribute(icon, attribute.name);
break;
}
var attribute = attributes.item(i);
if (attribute.name.startsWith('_ngcontent')) {
this.setNgContentAttribute(icon, attribute.name);
break;
}
};
}
};
/**

@@ -492,14 +460,14 @@ * @private

*/
function (parent, attributeName) {
this.renderer.setAttribute(parent, attributeName, '');
function (parent, attributeName) {
this.renderer.setAttribute(parent, attributeName, '');
/** @type {?} */
var len = parent.childNodes.length;
for (var i = 0; i < len; i += 1) {
/** @type {?} */
var len = parent.childNodes.length;
for (var i = 0; i < len; i += 1) {
/** @type {?} */
var child = parent.childNodes[i];
if (child instanceof Element) {
this.setNgContentAttribute(child, attributeName);
}
var child = parent.childNodes[i];
if (child instanceof Element) {
this.setNgContentAttribute(child, attributeName);
}
};
}
};
/**

@@ -513,14 +481,14 @@ * @private

*/
function () {
if (this.svg) {
/** @type {?} */
var svg = this.element.nativeElement.firstChild;
if (this.stretch === true) {
this.renderer.setAttribute(svg, 'preserveAspectRatio', 'none');
}
else if (this.stretch === false) {
this.renderer.removeAttribute(svg, 'preserveAspectRatio');
}
function () {
if (this.svg) {
/** @type {?} */
var svg = this.element.nativeElement.firstChild;
if (this.stretch === true) {
this.renderer.setAttribute(svg, 'preserveAspectRatio', 'none');
}
};
else if (this.stretch === false) {
this.renderer.removeAttribute(svg, 'preserveAspectRatio');
}
}
};
/**

@@ -536,17 +504,20 @@ * @private

*/
function (changes) {
var _this = this;
changes.forEachRemovedItem(( /**
* @param {?} record
* @return {?}
*/function (record) { return _this.setStyle(record.key, null); }));
changes.forEachAddedItem(( /**
* @param {?} record
* @return {?}
*/function (record) { return _this.setStyle(record.key, record.currentValue); }));
changes.forEachChangedItem(( /**
* @param {?} record
* @return {?}
*/function (record) { return _this.setStyle(record.key, record.currentValue); }));
};
function (changes) {
var _this = this;
changes.forEachRemovedItem((/**
* @param {?} record
* @return {?}
*/
function (record) { return _this.setStyle(record.key, null); }));
changes.forEachAddedItem((/**
* @param {?} record
* @return {?}
*/
function (record) { return _this.setStyle(record.key, record.currentValue); }));
changes.forEachChangedItem((/**
* @param {?} record
* @return {?}
*/
function (record) { return _this.setStyle(record.key, record.currentValue); }));
};
/**

@@ -564,14 +535,14 @@ * @private

*/
function (nameAndUnit, value) {
var _a = __read(nameAndUnit.split('.'), 2), name = _a[0], unit = _a[1];
value = value !== null && unit ? "" + value + unit : value;
/** @type {?} */
var svg = this.element.nativeElement.firstChild;
if (value !== null) {
this.renderer.setStyle(svg, name, ( /** @type {?} */(value)));
}
else {
this.renderer.removeStyle(svg, name);
}
};
function (nameAndUnit, value) {
var _a = __read(nameAndUnit.split('.'), 2), name = _a[0], unit = _a[1];
value = value !== null && unit ? "" + value + unit : value;
/** @type {?} */
var svg = this.element.nativeElement.firstChild;
if (value !== null) {
this.renderer.setStyle(svg, name, (/** @type {?} */ (value)));
}
else {
this.renderer.removeStyle(svg, name);
}
};
SvgIconComponent.decorators = [

@@ -584,11 +555,9 @@ { type: core.Component, args: [{

/** @nocollapse */
SvgIconComponent.ctorParameters = function () {
return [
{ type: core.ElementRef },
{ type: core.KeyValueDiffers },
{ type: core.Renderer2 },
{ type: SvgIconRegistryService },
{ type: core.ChangeDetectorRef }
];
};
SvgIconComponent.ctorParameters = function () { return [
{ type: core.ElementRef },
{ type: core.KeyValueDiffers },
{ type: core.Renderer2 },
{ type: SvgIconRegistryService },
{ type: core.ChangeDetectorRef }
]; };
SvgIconComponent.propDecorators = {

@@ -619,14 +588,12 @@ src: [{ type: core.Input }],

*/
function (config) {
if (config === void 0) {
config = {};
}
return {
ngModule: AngularSvgIconModule,
providers: [
config.loader || { provide: SvgLoader, useClass: SvgHttpLoader },
SVG_ICON_REGISTRY_PROVIDER
]
};
function (config) {
if (config === void 0) { config = {}; }
return {
ngModule: AngularSvgIconModule,
providers: [
config.loader || { provide: SvgLoader, useClass: SvgHttpLoader },
SVG_ICON_REGISTRY_PROVIDER
]
};
};
AngularSvgIconModule.decorators = [

@@ -645,25 +612,14 @@ { type: core.NgModule, args: [{

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
exports.AngularSvgIconModule = AngularSvgIconModule;
exports.SVG_ICON_REGISTRY_PROVIDER_FACTORY = SVG_ICON_REGISTRY_PROVIDER_FACTORY;
exports.SERVER_URL = SERVER_URL;
exports.SvgIconRegistryService = SvgIconRegistryService;
exports.SVG_ICON_REGISTRY_PROVIDER = SVG_ICON_REGISTRY_PROVIDER;
exports.SVG_ICON_REGISTRY_PROVIDER_FACTORY = SVG_ICON_REGISTRY_PROVIDER_FACTORY;
exports.SvgHttpLoader = SvgHttpLoader;
exports.SvgIconComponent = SvgIconComponent;
exports.SvgIconRegistryService = SvgIconRegistryService;
exports.SvgLoader = SvgLoader;
exports.SvgHttpLoader = SvgHttpLoader;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=angular-svg-icon.umd.js.map
}));
//# sourceMappingURL=angular-svg-icon.umd.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("@angular/common/http"),require("@angular/core")):"function"==typeof define&&define.amd?define("angular-svg-icon",["exports","rxjs","rxjs/operators","@angular/common","@angular/common/http","@angular/core"],e):e(t["angular-svg-icon"]={},t.rxjs,t.rxjs.operators,t.ng.common,t.ng.common.http,t.ng.core)}(this,function(t,i,o,r,e,s){"use strict";var c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var n=function d(){},a=function(r){function t(t){var e=r.call(this)||this;return e.http=t,e}return function n(t,e){function r(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(t,r),t.prototype.getSvg=function(t){return this.http.get(t,{responseType:"text"})},t.decorators=[{type:s.Injectable}],t.ctorParameters=function(){return[{type:e.HttpClient}]},t}(n),u=new s.InjectionToken("SERVER_URL"),p=function(){function t(t,e,r,n){this.loader=t,this.platformId=e,this.serverUrl=r,this._document=n,this.iconsByUrl=new Map,this.iconsLoadingByUrl=new Map,this.document=this._document}return t.prototype.addSvg=function(t,e){if(!this.iconsByUrl.has(t)){var r=this.document.createElement("DIV");r.innerHTML=e;var n=r.querySelector("svg");this.iconsByUrl.set(t,n)}},t.prototype.loadSvg=function(t,e){var r=this;if(void 0===e&&(e=t),this.serverUrl&&null===t.match(/^(http(s)?):/)&&(t=this.serverUrl+t,e=t),this.iconsByUrl.has(e))return i.of(this.iconsByUrl.get(e));if(this.iconsLoadingByUrl.has(e))return this.iconsLoadingByUrl.get(e);var n=this.loader.getSvg(t).pipe(o.map(function(t){var e=r.document.createElement("DIV");return e.innerHTML=t,e.querySelector("svg")}),o.tap(function(t){return r.iconsByUrl.set(e,t)}),o.catchError(function(t){return console.error(t),i.throwError(t)}),o.finalize(function(){return r.iconsLoadingByUrl["delete"](e)}),o.share());return this.iconsLoadingByUrl.set(e,n),n},t.prototype.getSvgByName=function(t){return this.iconsByUrl.has(t)?i.of(this.iconsByUrl.get(t)):this.iconsLoadingByUrl.has(t)?this.iconsLoadingByUrl.get(t):i.throwError("No svg with name '"+t+"' has been loaded")},t.prototype.unloadSvg=function(t){this.iconsByUrl.has(t)&&this.iconsByUrl["delete"](t)},t.decorators=[{type:s.Injectable}],t.ctorParameters=function(){return[{type:n},{type:Object,decorators:[{type:s.Inject,args:[s.PLATFORM_ID]}]},{type:String,decorators:[{type:s.Optional},{type:s.Inject,args:[u]}]},{type:undefined,decorators:[{type:s.Optional},{type:s.Inject,args:[r.DOCUMENT]}]}]},t}();function h(t,e,r,n,i){return t||new p(e,r,n,i)}var l={provide:p,deps:[[new s.Optional,new s.SkipSelf,p],n,[s.PLATFORM_ID],[new s.Optional,u],[new s.Optional,r.DOCUMENT]],useFactory:h},f=function(){function t(t,e,r,n,i){this.element=t,this.differs=e,this.renderer=r,this.iconReg=n,this.cdr=i,this.stretch=!1,this.applyCss=!1}return Object.defineProperty(t.prototype,"svgStyle",{set:function(t){this._svgStyle=t,!this.differ&&t&&(this.differ=this.differs.find(t).create())},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){this.init()},t.prototype.ngOnDestroy=function(){this.destroy()},t.prototype.ngOnChanges=function(t){(t.src||t.name)&&(this.svg&&this.destroy(),this.init()),t.stretch&&this.stylize()},t.prototype.ngDoCheck=function(){if(this.svg&&this.differ){var t=this.differ.diff(this._svgStyle);t&&this.applyChanges(t)}},t.prototype.init=function(){this.name?this.icnSub=this.iconReg.getSvgByName(this.name).subscribe(this.initSvg.bind(this)):this.icnSub=this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this))},t.prototype.initSvg=function(t){this.setSvg(t),this.resetDiffer()},t.prototype.destroy=function(){this.svg=undefined,this.differ=undefined,this.icnSub&&this.icnSub.unsubscribe()},t.prototype.resetDiffer=function(){this._svgStyle&&!this.differ&&(this.differ=this.differs.find(this._svgStyle).create())},t.prototype.setSvg=function(t){if(t){var e=(this.svg=t).cloneNode(!0),r=this.element.nativeElement;this.applyCss&&this.copyNgContentAttribute(r,e),r.innerHTML="",this.renderer.appendChild(r,e),this.stylize(),this.cdr.markForCheck()}},t.prototype.copyNgContentAttribute=function(t,e){for(var r=t.attributes,n=r.length,i=0;i<n;i+=1){var o=r.item(i);if(o.name.startsWith("_ngcontent")){this.setNgContentAttribute(e,o.name);break}}},t.prototype.setNgContentAttribute=function(t,e){this.renderer.setAttribute(t,e,"");for(var r=t.childNodes.length,n=0;n<r;n+=1){var i=t.childNodes[n];i instanceof Element&&this.setNgContentAttribute(i,e)}},t.prototype.stylize=function(){if(this.svg){var t=this.element.nativeElement.firstChild;!0===this.stretch?this.renderer.setAttribute(t,"preserveAspectRatio","none"):!1===this.stretch&&this.renderer.removeAttribute(t,"preserveAspectRatio")}},t.prototype.applyChanges=function(t){var e=this;t.forEachRemovedItem(function(t){return e.setStyle(t.key,null)}),t.forEachAddedItem(function(t){return e.setStyle(t.key,t.currentValue)}),t.forEachChangedItem(function(t){return e.setStyle(t.key,t.currentValue)})},t.prototype.setStyle=function(t,e){var r=function a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)s.push(n.value)}catch(c){i={error:c}}finally{try{n&&!n.done&&(r=o["return"])&&r.call(o)}finally{if(i)throw i.error}}return s}(t.split("."),2),n=r[0],i=r[1];e=null!==e&&i?""+e+i:e;var o=this.element.nativeElement.firstChild;null!==e?this.renderer.setStyle(o,n,e):this.renderer.removeStyle(o,n)},t.decorators=[{type:s.Component,args:[{selector:"svg-icon",template:"<ng-content></ng-content>"}]}],t.ctorParameters=function(){return[{type:s.ElementRef},{type:s.KeyValueDiffers},{type:s.Renderer2},{type:p},{type:s.ChangeDetectorRef}]},t.propDecorators={src:[{type:s.Input}],name:[{type:s.Input}],stretch:[{type:s.Input}],applyCss:[{type:s.Input}],svgStyle:[{type:s.Input}]},t}(),y=function(){function e(){}return e.forRoot=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[t.loader||{provide:n,useClass:a},l]}},e.decorators=[{type:s.NgModule,args:[{imports:[r.CommonModule],declarations:[f],providers:[l,{provide:n,useClass:a}],exports:[f]}]}],e}();t.AngularSvgIconModule=y,t.SVG_ICON_REGISTRY_PROVIDER_FACTORY=h,t.SERVER_URL=u,t.SvgIconRegistryService=p,t.SVG_ICON_REGISTRY_PROVIDER=l,t.SvgIconComponent=f,t.SvgLoader=n,t.SvgHttpLoader=a,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("angular-svg-icon",["exports","@angular/core","@angular/common","rxjs","rxjs/operators","@angular/common/http"],e):e((t=t||self)["angular-svg-icon"]={},t.ng.core,t.ng.common,t.rxjs,t.rxjs.operators,t.ng.common.http)}(this,function(t,e,r,n,i,o){"use strict";var s,c=this&&this.__extends||(s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(){},u=function(t){function r(e){var r=t.call(this)||this;return r.http=e,r}return c(r,t),r.prototype.getSvg=function(t){return this.http.get(t,{responseType:"text"})},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:o.HttpClient}]},r}(a),p=new e.InjectionToken("SERVER_URL"),h=function(){function t(t,e,r,n){this.loader=t,this.platformId=e,this.serverUrl=r,this._document=n,this.iconsByUrl=new Map,this.iconsLoadingByUrl=new Map,this.document=this._document}return t.prototype.addSvg=function(t,e){if(!this.iconsByUrl.has(t)){var r=this.document.createElement("DIV");r.innerHTML=e;var n=r.querySelector("svg");this.iconsByUrl.set(t,n)}},t.prototype.loadSvg=function(t,e){var r=this;if(void 0===e&&(e=t),this.serverUrl&&null===t.match(/^(http(s)?):/)&&(t=this.serverUrl+t,e=t),this.iconsByUrl.has(e))return n.of(this.iconsByUrl.get(e));if(this.iconsLoadingByUrl.has(e))return this.iconsLoadingByUrl.get(e);var o=this.loader.getSvg(t).pipe(i.map(function(t){var e=r.document.createElement("DIV");return e.innerHTML=t,e.querySelector("svg")}),i.tap(function(t){return r.iconsByUrl.set(e,t)}),i.catchError(function(t){return console.error(t),n.throwError(t)}),i.finalize(function(){return r.iconsLoadingByUrl.delete(e)}),i.share());return this.iconsLoadingByUrl.set(e,o),o},t.prototype.getSvgByName=function(t){return this.iconsByUrl.has(t)?n.of(this.iconsByUrl.get(t)):this.iconsLoadingByUrl.has(t)?this.iconsLoadingByUrl.get(t):n.throwError("No svg with name '"+t+"' has been loaded")},t.prototype.unloadSvg=function(t){this.iconsByUrl.has(t)&&this.iconsByUrl.delete(t)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:a},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:String,decorators:[{type:e.Optional},{type:e.Inject,args:[p]}]},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[r.DOCUMENT]}]}]},t}();function l(t,e,r,n,i){return t||new h(e,r,n,i)}var f={provide:h,deps:[[new e.Optional,new e.SkipSelf,h],a,[e.PLATFORM_ID],[new e.Optional,p],[new e.Optional,r.DOCUMENT]],useFactory:l},y=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},d=function(){function t(t,e,r,n,i){this.element=t,this.differs=e,this.renderer=r,this.iconReg=n,this.cdr=i,this.stretch=!1,this.applyCss=!1}return Object.defineProperty(t.prototype,"svgStyle",{set:function(t){this._svgStyle=t,!this.differ&&t&&(this.differ=this.differs.find(t).create())},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){this.init()},t.prototype.ngOnDestroy=function(){this.destroy()},t.prototype.ngOnChanges=function(t){(t.src||t.name)&&(this.svg&&this.destroy(),this.init()),t.stretch&&this.stylize()},t.prototype.ngDoCheck=function(){if(this.svg&&this.differ){var t=this.differ.diff(this._svgStyle);t&&this.applyChanges(t)}},t.prototype.init=function(){this.name?this.icnSub=this.iconReg.getSvgByName(this.name).subscribe(this.initSvg.bind(this)):this.src&&(this.icnSub=this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this)))},t.prototype.initSvg=function(t){this.setSvg(t),this.resetDiffer()},t.prototype.destroy=function(){this.svg=void 0,this.differ=void 0,this.icnSub&&this.icnSub.unsubscribe()},t.prototype.resetDiffer=function(){this._svgStyle&&!this.differ&&(this.differ=this.differs.find(this._svgStyle).create())},t.prototype.setSvg=function(t){if(t){this.svg=t;var e=t.cloneNode(!0),r=this.element.nativeElement;this.applyCss&&this.copyNgContentAttribute(r,e),r.innerHTML="",this.renderer.appendChild(r,e),this.stylize(),this.cdr.markForCheck()}},t.prototype.copyNgContentAttribute=function(t,e){for(var r=t.attributes,n=r.length,i=0;i<n;i+=1){var o=r.item(i);if(o.name.startsWith("_ngcontent")){this.setNgContentAttribute(e,o.name);break}}},t.prototype.setNgContentAttribute=function(t,e){this.renderer.setAttribute(t,e,"");for(var r=t.childNodes.length,n=0;n<r;n+=1){var i=t.childNodes[n];i instanceof Element&&this.setNgContentAttribute(i,e)}},t.prototype.stylize=function(){if(this.svg){var t=this.element.nativeElement.firstChild;!0===this.stretch?this.renderer.setAttribute(t,"preserveAspectRatio","none"):!1===this.stretch&&this.renderer.removeAttribute(t,"preserveAspectRatio")}},t.prototype.applyChanges=function(t){var e=this;t.forEachRemovedItem(function(t){return e.setStyle(t.key,null)}),t.forEachAddedItem(function(t){return e.setStyle(t.key,t.currentValue)}),t.forEachChangedItem(function(t){return e.setStyle(t.key,t.currentValue)})},t.prototype.setStyle=function(t,e){var r=y(t.split("."),2),n=r[0],i=r[1];e=null!==e&&i?""+e+i:e;var o=this.element.nativeElement.firstChild;null!==e?this.renderer.setStyle(o,n,e):this.renderer.removeStyle(o,n)},t.decorators=[{type:e.Component,args:[{selector:"svg-icon",template:"<ng-content></ng-content>"}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.KeyValueDiffers},{type:e.Renderer2},{type:h},{type:e.ChangeDetectorRef}]},t.propDecorators={src:[{type:e.Input}],name:[{type:e.Input}],stretch:[{type:e.Input}],applyCss:[{type:e.Input}],svgStyle:[{type:e.Input}]},t}(),g=function(){function t(){}return t.forRoot=function(e){return void 0===e&&(e={}),{ngModule:t,providers:[e.loader||{provide:a,useClass:u},f]}},t.decorators=[{type:e.NgModule,args:[{imports:[r.CommonModule],declarations:[d],providers:[f,{provide:a,useClass:u}],exports:[d]}]}],t}();t.AngularSvgIconModule=g,t.SERVER_URL=p,t.SVG_ICON_REGISTRY_PROVIDER=f,t.SVG_ICON_REGISTRY_PROVIDER_FACTORY=l,t.SvgHttpLoader=u,t.SvgIconComponent=d,t.SvgIconRegistryService=h,t.SvgLoader=a,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=angular-svg-icon.umd.min.js.map

@@ -8,3 +8,3 @@ /**

*/
export { AngularSvgIconModule, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SERVER_URL, SvgIconRegistryService, SVG_ICON_REGISTRY_PROVIDER, SvgIconComponent, SvgLoader, SvgHttpLoader } from './index';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1zdmctaWNvbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2FuZ3VsYXItc3ZnLWljb24vIiwic291cmNlcyI6WyJhbmd1bGFyLXN2Zy1pY29uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxxTEFBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
export { AngularSvgIconModule, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SERVER_URL, SvgIconRegistryService, SVG_ICON_REGISTRY_PROVIDER, SvgIconComponent, SvgLoader, SvgHttpLoader } from './public-api';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1zdmctaWNvbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2FuZ3VsYXItc3ZnLWljb24vIiwic291cmNlcyI6WyJhbmd1bGFyLXN2Zy1pY29uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxxTEFBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=

@@ -8,3 +8,3 @@ /**

*/
export { AngularSvgIconModule, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SERVER_URL, SvgIconRegistryService, SVG_ICON_REGISTRY_PROVIDER, SvgIconComponent, SvgLoader, SvgHttpLoader } from './index';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1zdmctaWNvbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2FuZ3VsYXItc3ZnLWljb24vIiwic291cmNlcyI6WyJhbmd1bGFyLXN2Zy1pY29uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxxTEFBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
export { AngularSvgIconModule, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SERVER_URL, SvgIconRegistryService, SVG_ICON_REGISTRY_PROVIDER, SvgIconComponent, SvgLoader, SvgHttpLoader } from './public-api';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1zdmctaWNvbi5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2FuZ3VsYXItc3ZnLWljb24vIiwic291cmNlcyI6WyJhbmd1bGFyLXN2Zy1pY29uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxxTEFBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=

@@ -0,6 +1,6 @@

import { Injectable, InjectionToken, Inject, PLATFORM_ID, Optional, SkipSelf, Component, ElementRef, KeyValueDiffers, Renderer2, ChangeDetectorRef, Input, NgModule } from '@angular/core';
import { DOCUMENT, CommonModule } from '@angular/common';
import { of, throwError } from 'rxjs';
import { catchError, finalize, map, share, tap } from 'rxjs/operators';
import { DOCUMENT, CommonModule } from '@angular/common';
import { map, tap, catchError, finalize, share } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';
import { Injectable, Inject, InjectionToken, Optional, PLATFORM_ID, SkipSelf, ChangeDetectorRef, Component, ElementRef, Input, KeyValueDiffers, Renderer2, NgModule } from '@angular/core';

@@ -230,3 +230,3 @@ /**

ngOnChanges(changeRecord) {
if (changeRecord['src'] || changeRecord['name']) {
if (changeRecord.src || changeRecord.name) {
if (this.svg) {

@@ -237,3 +237,3 @@ this.destroy();

}
if (changeRecord['stretch']) {
if (changeRecord.stretch) {
this.stylize();

@@ -261,5 +261,6 @@ }

this.icnSub = this.iconReg.getSvgByName(this.name).subscribe(this.initSvg.bind(this));
return;
}
this.icnSub = this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this));
else if (this.src) {
this.icnSub = this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this));
}
}

@@ -463,14 +464,3 @@ /**

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { AngularSvgIconModule, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SERVER_URL, SvgIconRegistryService, SVG_ICON_REGISTRY_PROVIDER, SvgIconComponent, SvgLoader, SvgHttpLoader };
//# sourceMappingURL=angular-svg-icon.js.map
export { AngularSvgIconModule, SERVER_URL, SVG_ICON_REGISTRY_PROVIDER, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SvgHttpLoader, SvgIconComponent, SvgIconRegistryService, SvgLoader };
//# sourceMappingURL=angular-svg-icon.js.map

@@ -0,13 +1,21 @@

import { Injectable, InjectionToken, Inject, PLATFORM_ID, Optional, SkipSelf, Component, ElementRef, KeyValueDiffers, Renderer2, ChangeDetectorRef, Input, NgModule } from '@angular/core';
import { DOCUMENT, CommonModule } from '@angular/common';
import { of, throwError } from 'rxjs';
import { catchError, finalize, map, share, tap } from 'rxjs/operators';
import { DOCUMENT, CommonModule } from '@angular/common';
import { map, tap, catchError, finalize, share } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';
import { __extends, __read } from 'tslib';
import { Injectable, Inject, InjectionToken, Optional, PLATFORM_ID, SkipSelf, ChangeDetectorRef, Component, ElementRef, Input, KeyValueDiffers, Renderer2, NgModule } from '@angular/core';
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @abstract

@@ -215,6 +223,18 @@ */

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var SvgIconComponent = /** @class */ (function () {

@@ -274,3 +294,3 @@ function SvgIconComponent(element, differs, renderer, iconReg, cdr) {

function (changeRecord) {
if (changeRecord['src'] || changeRecord['name']) {
if (changeRecord.src || changeRecord.name) {
if (this.svg) {

@@ -281,3 +301,3 @@ this.destroy();

}
if (changeRecord['stretch']) {
if (changeRecord.stretch) {
this.stylize();

@@ -312,5 +332,6 @@ }

this.icnSub = this.iconReg.getSvgByName(this.name).subscribe(this.initSvg.bind(this));
return;
}
this.icnSub = this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this));
else if (this.src) {
this.icnSub = this.iconReg.loadSvg(this.src).subscribe(this.initSvg.bind(this));
}
};

@@ -569,14 +590,3 @@ /**

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { AngularSvgIconModule, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SERVER_URL, SvgIconRegistryService, SVG_ICON_REGISTRY_PROVIDER, SvgIconComponent, SvgLoader, SvgHttpLoader };
//# sourceMappingURL=angular-svg-icon.js.map
export { AngularSvgIconModule, SERVER_URL, SVG_ICON_REGISTRY_PROVIDER, SVG_ICON_REGISTRY_PROVIDER_FACTORY, SvgHttpLoader, SvgIconComponent, SvgIconRegistryService, SvgLoader };
//# sourceMappingURL=angular-svg-icon.js.map
{
"$schema": "../../node_modules/ng-packagr/package.schema.json",
"name": "angular-svg-icon",
"description": "Angular 7 component for inlining SVGs allowing them to be easily styled with CSS.",
"version": "7.2.1",
"description": "Angular 8 component for inlining SVGs allowing them to be easily styled with CSS.",
"version": "8.0.0",
"repository": {

@@ -7,0 +6,0 @@ "type": "git",

@@ -6,3 +6,3 @@ [![npm version](https://badge.fury.io/js/angular-svg-icon.svg)](https://badge.fury.io/js/angular-svg-icon)

The **angular-svg-icon** is an Angular 7 service and component that provides a
The **angular-svg-icon** is an Angular 8 service and component that provides a
means to inline SVG files to allow for them to be easily styled by CSS and code.

@@ -22,3 +22,4 @@

**Note on earlier versions of Angular:**
- For Angular 6, use angular-svg-icons@6.0.0
- For Angular 7, use angular-svg-icon@7.2.1
- For Angular 6, use angular-svg-icon@6.0.0
- For Angular 4.3 through Angular 5.x, use angular-svg-icon@5.1.1

@@ -25,0 +26,0 @@ - For Angular 2.4 through Angular 4.2, use angular-svg-icon@4.2.6

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc