@ng-icons/core 13.1.1 → 13.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,6 @@
1
+
2
+ <img width="847" alt="logo" src="https://user-images.githubusercontent.com/20795331/142078474-da890691-b524-4144-9640-2f7f9da3a3a3.png">
3
+
1
4
  # Ng Icons
2
5
 
3
6
  The all-in-one icon library for Angular. This allows you to use icons from multiple icon sets with a single icon component.
package/esm2020/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './lib/icon.component';
2
2
  export * from './lib/icon.module';
3
- export * from './lib/icon.token';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxrQkFBa0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL2ljb24uY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2ljb24ubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2ljb24udG9rZW4nO1xuIl19
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsbUJBQW1CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9pY29uLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9pY29uLm1vZHVsZSc7XG4iXX0=
@@ -1,14 +1,15 @@
1
- import { ChangeDetectionStrategy, Component, ElementRef, HostBinding, Inject, Input, } from '@angular/core';
2
- import { IconsToken } from './icon.token';
1
+ import { ChangeDetectionStrategy, Component, ElementRef, HostBinding, Input, } from '@angular/core';
3
2
  import { DomSanitizer } from '@angular/platform-browser';
4
3
  import { toUpperCamelCase } from './utils/format';
4
+ import { IconService } from './icon.service';
5
5
  import * as i0 from "@angular/core";
6
6
  import * as i1 from "@angular/platform-browser";
7
+ import * as i2 from "./icon.service";
7
8
  export class IconComponent {
8
- constructor(elementRef, sanitizer, icons) {
9
+ constructor(elementRef, sanitizer, iconService) {
9
10
  this.elementRef = elementRef;
10
11
  this.sanitizer = sanitizer;
11
- this.icons = icons;
12
+ this.iconService = iconService;
12
13
  /** Define the size of the icon */
13
14
  this.size = '1em';
14
15
  }
@@ -16,23 +17,20 @@ export class IconComponent {
16
17
  set name(name) {
17
18
  name = toUpperCamelCase(name);
18
19
  // if there is no icon with this name warn the user as they probably forgot to import it
19
- if (!this.icons.hasOwnProperty(name)) {
20
+ if (!this.iconService.icons.hasOwnProperty(name)) {
20
21
  console.warn(`No icon named ${name} was found. You may need to import it using the withIcons function.`);
21
22
  return;
22
23
  }
23
24
  // insert the SVG into the template
24
- this.template = this.sanitizer.bypassSecurityTrustHtml(this.icons[name]);
25
+ this.template = this.sanitizer.bypassSecurityTrustHtml(this.iconService.icons[name]);
25
26
  }
26
27
  }
27
- IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconsToken }], target: i0.ɵɵFactoryTarget.Component });
28
+ IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: i2.IconService }], target: i0.ɵɵFactoryTarget.Component });
28
29
  IconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: IconComponent, selector: "ng-icon", inputs: { name: "name", size: "size", strokeWidth: "strokeWidth", color: "color" }, host: { properties: { "innerHTML": "this.template", "style.--ng-icon__size": "this.size", "style.--ng-icon__stroke-width": "this.strokeWidth", "style.color": "this.color" } }, ngImport: i0, template: '', isInline: true, styles: [":host{display:inline-block;width:var(--ng-icon__size);height:var(--ng-icon__size)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
29
30
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, decorators: [{
30
31
  type: Component,
31
32
  args: [{ selector: 'ng-icon', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:inline-block;width:var(--ng-icon__size);height:var(--ng-icon__size)}\n"] }]
32
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: undefined, decorators: [{
33
- type: Inject,
34
- args: [IconsToken]
35
- }] }]; }, propDecorators: { name: [{
33
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: i2.IconService }]; }, propDecorators: { name: [{
36
34
  type: Input
37
35
  }], template: [{
38
36
  type: HostBinding,
@@ -53,4 +51,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
53
51
  }, {
54
52
  type: Input
55
53
  }] } });
56
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9saWIvaWNvbi5jb21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VxuICBjb2xvcj86IHN0cmluZztcblxuICBjb25zdHJ1Y3RvcihcbiAgICBwcml2YXRlIHJlYWRvbmx5IGVsZW1lbnRSZWY6IEVsZW1lbnRSZWY8SFRNTEVsZW1lbnQ+LFxuICAgIHByaXZhdGUgcmVhZG9ubHkgc2FuaXRpemVyOiBEb21TYW5pdGl6ZXIsXG4gICAgcHJpdmF0ZSByZWFkb25seSBpY29uU2VydmljZTogSWNvblNlcnZpY2UsXG4gICkge31cbn1cbiJdfQ==
@@ -1,11 +1,12 @@
1
- import { Inject, NgModule, Optional, SkipSelf, } from '@angular/core';
1
+ import { NgModule } from '@angular/core';
2
2
  import { IconComponent } from './icon.component';
3
- import { IconsToken } from './icon.token';
3
+ import { IconService } from './icon.service';
4
4
  import * as i0 from "@angular/core";
5
+ import * as i1 from "./icon.service";
5
6
  export class NgIconsModule {
6
- constructor(icons) {
7
- this.icons = icons;
8
- if (!this.icons) {
7
+ constructor(iconService) {
8
+ this.iconService = iconService;
9
+ if (Object.keys(this.iconService.icons).length === 0) {
9
10
  throw new Error('No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).');
10
11
  }
11
12
  }
@@ -15,22 +16,11 @@ export class NgIconsModule {
15
16
  * @param icons The object containing the required icons
16
17
  */
17
18
  static withIcons(icons) {
18
- return {
19
- ngModule: NgIconsModule,
20
- providers: [
21
- {
22
- provide: IconsToken,
23
- useFactory: (existingIcons = {}) => ({
24
- ...existingIcons,
25
- ...icons,
26
- }),
27
- deps: [[new Optional(), new SkipSelf(), new Inject(IconsToken)]],
28
- },
29
- ],
30
- };
19
+ IconService.addIcons(icons);
20
+ return { ngModule: NgIconsModule };
31
21
  }
32
22
  }
33
- NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconsToken, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
23
+ NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: i1.IconService }], target: i0.ɵɵFactoryTarget.NgModule });
34
24
  NgIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, declarations: [IconComponent], exports: [IconComponent] });
35
25
  NgIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule });
36
26
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, decorators: [{
@@ -39,10 +29,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
39
29
  declarations: [IconComponent],
40
30
  exports: [IconComponent],
41
31
  }]
42
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
43
- type: Optional
44
- }, {
45
- type: Inject,
46
- args: [IconsToken]
47
- }] }]; } });
48
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9saWIvaWNvbi5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLE1BQU0sRUFFTixRQUFRLEVBQ1IsUUFBUSxFQUNSLFFBQVEsR0FDVCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDakQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGNBQWMsQ0FBQzs7QUFNMUMsTUFBTSxPQUFPLGFBQWE7SUFDeEIsWUFHbUIsS0FBK0I7UUFBL0IsVUFBSyxHQUFMLEtBQUssQ0FBMEI7UUFFaEQs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ybiB7XG4gICAgICBuZ01vZHVsZTogTmdJY29uc01vZHVsZSxcbiAgICAgIHByb3ZpZGVyczogW1xuICAgICAgICB7XG4gICAgICAgICAgcHJvdmlkZTogSWNvbnNUb2tlbixcbiAgICAgICAgICB1c2VGYWN0b3J5OiAoZXhpc3RpbmdJY29uczogUmVjb3JkPHN0cmluZywgc3RyaW5nPiA9IHt9KSA9PiAoe1xuICAgICAgICAgICAgLi4uZXhpc3RpbmdJY29ucyxcbiAgICAgICAgICAgIC4uLmljb25zLFxuICAgICAgICAgIH0pLFxuICAgICAgICAgIGRlcHM6IFtbbmV3IE9wdGlvbmFsKCksIG5ldyBTa2lwU2VsZigpLCBuZXcgSW5qZWN0KEljb25zVG9rZW4pXV0sXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH07XG4gIH1cbn1cbiJdfQ==
32
+ }], ctorParameters: function () { return [{ type: i1.IconService }]; } });
33
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9saWIvaWNvbi5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QixRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDOUQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQ2pELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7O0FBTTdDLE1BQU0sT0FBTyxhQUFhO0lBQ3hCLFlBQTZCLFdBQXdCO1FBQXhCLGdCQUFXLEdBQVgsV0FBVyxDQUFhO1FBQ25ELElBQUksTUFBTSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLEtBQUssQ0FBQyxDQUFDLE1BQU0s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ObyBpY29ucyBoYXZlIGJlZW4gcHJvdmlkZWQuIEVuc3VyZSB0byBpbmNsdWRlIHNvbWUgaWNvbnMgYnkgaW1wb3J0aW5nIHRoZW0gdXNpbmcgTmdJY29uc01vZHVsZS53aXRoSWNvbnMoeyAuLi4gfSkuJyxcbiAgICAgICk7XG4gICAgfVxuICB9XG5cbiAgLyoqXG4gICAqIERlZmluZSB0aGUgaWNvbnMgdGhhdCB3aWxsIGJlIGluY2x1ZGVkIGluIHRoZSBhcHBsaWNhdGlvbi4gVGhpcyBhbGxvd3MgdW51c2VkIGljb25zIHRvXG4gICAqIGJlIHRyZWUtc2hha2VuIGF3YXkgdG8gcmVkdWNlIGJ1bmRsZSBzaXplXG4gICAqIEBwYXJhbSBpY29ucyBUaGUgb2JqZWN0IGNvbnRhaW5pbmcgdGhlIHJlcXVpcmVkIGljb25zXG4gICAqL1xuICBzdGF0aWMgd2l0aEljb25zKFxuICAgIGljb25zOiBSZWNvcmQ8c3RyaW5nLCBzdHJpbmc+LFxuICApOiBNb2R1bGVXaXRoUHJvdmlkZXJzPE5nSWNvbnNNb2R1bGU+IHtcbiAgICBJY29uU2VydmljZS5hZGRJY29ucyhpY29ucyk7XG5cbiAgICByZXR1cm4geyBuZ01vZHVsZTogTmdJY29uc01vZHVsZSB9O1xuICB9XG59XG4iXX0=
@@ -0,0 +1,25 @@
1
+ import { Injectable } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class IconService {
4
+ /** Access the icons in the class. */
5
+ get icons() {
6
+ return IconService.icons;
7
+ }
8
+ /**
9
+ * Insert icons into the iconset
10
+ */
11
+ static addIcons(icons) {
12
+ IconService.icons = { ...IconService.icons, ...icons };
13
+ }
14
+ }
15
+ /** Store the available icons. */
16
+ IconService.icons = {};
17
+ IconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
18
+ IconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, providedIn: 'root' });
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, decorators: [{
20
+ type: Injectable,
21
+ args: [{
22
+ providedIn: 'root',
23
+ }]
24
+ }] });
25
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29yZS9zcmMvbGliL2ljb24uc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQUszQyxNQUFNLE9BQU8sV0FBVztJQUl0QixxQ0FBcUM7SUFDckMsSUFBSSxLQUFLO1FBQ1AsT0FBTyxXQUFXLENBQUMsS0FBSyxDQUFDO0lBQzNCLENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBNkI7UUFDM0MsV0FBVyxDQUFDLEtBQUssR0FBRyxFQUFFLEdBQUcsV0FBVyxDQUFDLEtBQUssRUFBRSxHQUFHLEtBQUssRUFBRSxDQUFDO0lBQ3pELENBQUM7O0FBYkQsaUNBQWlDO0FBQ2xCLGlCQUFLLEdBQXFDLEVBQUcsQ0FBQTt3R0FGakQsV0FBVzs0R0FBWCxXQUFXLGNBRlYsTUFBTTsyRkFFUCxXQUFXO2tCQUh2QixVQUFVO21CQUFDO29CQUNWLFVBQVUsRUFBRSxNQUFNO2lCQUNuQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEluamVjdGFibGUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQEluamVjdGFibGUoe1xuICBwcm92aWRlZEluOiAncm9vdCcsXG59KVxuZXhwb3J0IGNsYXNzIEljb25TZXJ2aWNlIHtcbiAgLyoqIFN0b3JlIHRoZSBhdmFpbGFibGUgaWNvbnMuICovXG4gIHByaXZhdGUgc3RhdGljIGljb25zOiBSZWFkb25seTxSZWNvcmQ8c3RyaW5nLCBzdHJpbmc+PiA9IHt9O1xuXG4gIC8qKiBBY2Nlc3MgdGhlIGljb25zIGluIHRoZSBjbGFzcy4gKi9cbiAgZ2V0IGljb25zKCk6IFJlYWRvbmx5PFJlY29yZDxzdHJpbmcsIHN0cmluZz4+IHtcbiAgICByZXR1cm4gSWNvblNlcnZpY2UuaWNvbnM7XG4gIH1cblxuICAvKipcbiAgICogSW5zZXJ0IGljb25zIGludG8gdGhlIGljb25zZXRcbiAgICovXG4gIHN0YXRpYyBhZGRJY29ucyhpY29uczogUmVjb3JkPHN0cmluZywgc3RyaW5nPik6IHZvaWQge1xuICAgIEljb25TZXJ2aWNlLmljb25zID0geyAuLi5JY29uU2VydmljZS5pY29ucywgLi4uaWNvbnMgfTtcbiAgfVxufVxuIl19
@@ -1,9 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Input, HostBinding, Optional, SkipSelf, NgModule } from '@angular/core';
2
+ import { Injectable, Component, ChangeDetectionStrategy, Input, HostBinding, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/platform-browser';
4
4
 
5
- const IconsToken = new InjectionToken('Icons');
6
-
7
5
  /**
8
6
  * Hyphenated to UpperCamelCase
9
7
  */
@@ -26,11 +24,34 @@ function toCapitalCase(str) {
26
24
  return str.charAt(0).toUpperCase() + str.substr(1);
27
25
  }
28
26
 
27
+ class IconService {
28
+ /** Access the icons in the class. */
29
+ get icons() {
30
+ return IconService.icons;
31
+ }
32
+ /**
33
+ * Insert icons into the iconset
34
+ */
35
+ static addIcons(icons) {
36
+ IconService.icons = Object.assign(Object.assign({}, IconService.icons), icons);
37
+ }
38
+ }
39
+ /** Store the available icons. */
40
+ IconService.icons = {};
41
+ IconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
42
+ IconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, providedIn: 'root' });
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, decorators: [{
44
+ type: Injectable,
45
+ args: [{
46
+ providedIn: 'root',
47
+ }]
48
+ }] });
49
+
29
50
  class IconComponent {
30
- constructor(elementRef, sanitizer, icons) {
51
+ constructor(elementRef, sanitizer, iconService) {
31
52
  this.elementRef = elementRef;
32
53
  this.sanitizer = sanitizer;
33
- this.icons = icons;
54
+ this.iconService = iconService;
34
55
  /** Define the size of the icon */
35
56
  this.size = '1em';
36
57
  }
@@ -38,25 +59,20 @@ class IconComponent {
38
59
  set name(name) {
39
60
  name = toUpperCamelCase(name);
40
61
  // if there is no icon with this name warn the user as they probably forgot to import it
41
- if (!this.icons.hasOwnProperty(name)) {
62
+ if (!this.iconService.icons.hasOwnProperty(name)) {
42
63
  console.warn(`No icon named ${name} was found. You may need to import it using the withIcons function.`);
43
64
  return;
44
65
  }
45
66
  // insert the SVG into the template
46
- this.template = this.sanitizer.bypassSecurityTrustHtml(this.icons[name]);
67
+ this.template = this.sanitizer.bypassSecurityTrustHtml(this.iconService.icons[name]);
47
68
  }
48
69
  }
49
- IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconsToken }], target: i0.ɵɵFactoryTarget.Component });
70
+ IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconService }], target: i0.ɵɵFactoryTarget.Component });
50
71
  IconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: IconComponent, selector: "ng-icon", inputs: { name: "name", size: "size", strokeWidth: "strokeWidth", color: "color" }, host: { properties: { "innerHTML": "this.template", "style.--ng-icon__size": "this.size", "style.--ng-icon__stroke-width": "this.strokeWidth", "style.color": "this.color" } }, ngImport: i0, template: '', isInline: true, styles: [":host{display:inline-block;width:var(--ng-icon__size);height:var(--ng-icon__size)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
51
72
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, decorators: [{
52
73
  type: Component,
53
74
  args: [{ selector: 'ng-icon', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:inline-block;width:var(--ng-icon__size);height:var(--ng-icon__size)}\n"] }]
54
- }], ctorParameters: function () {
55
- return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: undefined, decorators: [{
56
- type: Inject,
57
- args: [IconsToken]
58
- }] }];
59
- }, propDecorators: { name: [{
75
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconService }]; }, propDecorators: { name: [{
60
76
  type: Input
61
77
  }], template: [{
62
78
  type: HostBinding,
@@ -79,9 +95,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
79
95
  }] } });
80
96
 
81
97
  class NgIconsModule {
82
- constructor(icons) {
83
- this.icons = icons;
84
- if (!this.icons) {
98
+ constructor(iconService) {
99
+ this.iconService = iconService;
100
+ if (Object.keys(this.iconService.icons).length === 0) {
85
101
  throw new Error('No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).');
86
102
  }
87
103
  }
@@ -91,19 +107,11 @@ class NgIconsModule {
91
107
  * @param icons The object containing the required icons
92
108
  */
93
109
  static withIcons(icons) {
94
- return {
95
- ngModule: NgIconsModule,
96
- providers: [
97
- {
98
- provide: IconsToken,
99
- useFactory: (existingIcons = {}) => (Object.assign(Object.assign({}, existingIcons), icons)),
100
- deps: [[new Optional(), new SkipSelf(), new Inject(IconsToken)]],
101
- },
102
- ],
103
- };
110
+ IconService.addIcons(icons);
111
+ return { ngModule: NgIconsModule };
104
112
  }
105
113
  }
106
- NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconsToken, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
114
+ NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconService }], target: i0.ɵɵFactoryTarget.NgModule });
107
115
  NgIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, declarations: [IconComponent], exports: [IconComponent] });
108
116
  NgIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule });
109
117
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, decorators: [{
@@ -112,17 +120,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
112
120
  declarations: [IconComponent],
113
121
  exports: [IconComponent],
114
122
  }]
115
- }], ctorParameters: function () {
116
- return [{ type: undefined, decorators: [{
117
- type: Optional
118
- }, {
119
- type: Inject,
120
- args: [IconsToken]
121
- }] }];
122
- } });
123
+ }], ctorParameters: function () { return [{ type: IconService }]; } });
123
124
 
124
125
  /**
125
126
  * Generated bundle index. Do not edit.
126
127
  */
127
128
 
128
- export { IconComponent, IconsToken, NgIconsModule };
129
+ export { IconComponent, NgIconsModule };
@@ -1 +1 @@
1
- {"version":3,"file":"ng-icons-core.mjs","sources":["../../../../packages/core/src/lib/icon.token.ts","../../../../packages/core/src/lib/utils/format.ts","../../../../packages/core/src/lib/icon.component.ts","../../../../packages/core/src/lib/icon.module.ts","../../../../packages/core/src/ng-icons-core.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const IconsToken = new InjectionToken('Icons');\n","/**\n * Hyphenated to UpperCamelCase\n */\nexport function toUpperCamelCase(str: string): string {\n return toCapitalCase(toPropertyName(str));\n}\n\n/**\n * Hyphenated to lowerCamelCase\n */\nexport function toPropertyName(str: string): string {\n return str\n .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) =>\n chr ? chr.toUpperCase() : '',\n )\n .replace(/[^a-zA-Z\\d]/g, '')\n .replace(/^([A-Z])/, m => m.toLowerCase());\n}\n\n/**\n * Capitalizes the first letter of a string\n */\nexport function toCapitalCase(str: string): string {\n return str.charAt(0).toUpperCase() + str.substr(1);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n} from '@angular/core';\nimport { IconsToken } from './icon.token';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { toUpperCamelCase } from './utils/format';\n\n@Component({\n selector: 'ng-icon',\n template: '',\n styleUrls: ['./icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IconComponent {\n /** Define the name of the icon to display */\n @Input() set name(name: string) {\n name = toUpperCamelCase(name);\n\n // if there is no icon with this name warn the user as they probably forgot to import it\n if (!this.icons.hasOwnProperty(name)) {\n console.warn(\n `No icon named ${name} was found. You may need to import it using the withIcons function.`,\n );\n return;\n }\n\n // insert the SVG into the template\n this.template = this.sanitizer.bypassSecurityTrustHtml(this.icons[name]);\n }\n\n /** Store the formatted icon name */\n @HostBinding('innerHTML') template?: SafeHtml;\n\n /** Define the size of the icon */\n @HostBinding('style.--ng-icon__size')\n @Input()\n size: string = '1em';\n\n /** Define the stroke-width of the icon */\n @HostBinding('style.--ng-icon__stroke-width')\n @Input()\n strokeWidth?: string | number;\n\n /** Define the color of the icon */\n @HostBinding('style.color')\n @Input()\n color?: string;\n\n constructor(\n private readonly elementRef: ElementRef<HTMLElement>,\n private readonly sanitizer: DomSanitizer,\n @Inject(IconsToken) private readonly icons: Record<string, string>,\n ) {}\n}\n","import {\n Inject,\n ModuleWithProviders,\n NgModule,\n Optional,\n SkipSelf,\n} from '@angular/core';\nimport { IconComponent } from './icon.component';\nimport { IconsToken } from './icon.token';\n\n@NgModule({\n declarations: [IconComponent],\n exports: [IconComponent],\n})\nexport class NgIconsModule {\n constructor(\n @Optional()\n @Inject(IconsToken)\n private readonly icons: Record<string, string>[],\n ) {\n if (!this.icons) {\n throw new Error(\n 'No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).',\n );\n }\n }\n\n /**\n * Define the icons that will be included in the application. This allows unused icons to\n * be tree-shaken away to reduce bundle size\n * @param icons The object containing the required icons\n */\n static withIcons(\n icons: Record<string, string>,\n ): ModuleWithProviders<NgIconsModule> {\n return {\n ngModule: NgIconsModule,\n providers: [\n {\n provide: IconsToken,\n useFactory: (existingIcons: Record<string, string> = {}) => ({\n ...existingIcons,\n ...icons,\n }),\n deps: [[new Optional(), new SkipSelf(), new Inject(IconsToken)]],\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAEa,UAAU,GAAG,IAAI,cAAc,CAAC,OAAO;;ACFpD;;;SAGgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;SAGgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,KAC1C,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,CAC7B;SACA,OAAO,CAAC,cAAc,EAAE,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K,aAAa;IACxB,YAGmB,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;QAEhD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,MAAM,IAAI,KAAK,CACb,qHAAqH,CACtH,CAAC;SACH;KACF;;;;;;IAOD,OAAO,SAAS,CACd,KAA6B;QAE7B,OAAO;YACL,QAAQ,EAAE,aAAa;YACvB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,UAAU;oBACnB,UAAU,EAAE,CAAC,gBAAwC,EAAE,sCAClD,aAAa,GACb,KAAK,EACR;oBACF,IAAI,EAAE,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,QAAQ,EAAE,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;iBACjE;aACF;SACF,CAAC;KACH;;0GAlCU,aAAa,kBAGd,UAAU;2GAHT,aAAa,iBAHT,aAAa,aAClB,aAAa;2GAEZ,aAAa;2FAAb,aAAa;kBAJzB,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,aAAa,CAAC;oBAC7B,OAAO,EAAE,CAAC,aAAa,CAAC;iBACzB;;;8BAGI,QAAQ;;8BACR,MAAM;+BAAC,UAAU;;;;ACjBtB;;;;;;"}
1
+ {"version":3,"file":"ng-icons-core.mjs","sources":["../../../../packages/core/src/lib/utils/format.ts","../../../../packages/core/src/lib/icon.service.ts","../../../../packages/core/src/lib/icon.component.ts","../../../../packages/core/src/lib/icon.module.ts","../../../../packages/core/src/ng-icons-core.ts"],"sourcesContent":["/**\n * Hyphenated to UpperCamelCase\n */\nexport function toUpperCamelCase(str: string): string {\n return toCapitalCase(toPropertyName(str));\n}\n\n/**\n * Hyphenated to lowerCamelCase\n */\nexport function toPropertyName(str: string): string {\n return str\n .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) =>\n chr ? chr.toUpperCase() : '',\n )\n .replace(/[^a-zA-Z\\d]/g, '')\n .replace(/^([A-Z])/, m => m.toLowerCase());\n}\n\n/**\n * Capitalizes the first letter of a string\n */\nexport function toCapitalCase(str: string): string {\n return str.charAt(0).toUpperCase() + str.substr(1);\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class IconService {\n /** Store the available icons. */\n private static icons: Readonly<Record<string, string>> = {};\n\n /** Access the icons in the class. */\n get icons(): Readonly<Record<string, string>> {\n return IconService.icons;\n }\n\n /**\n * Insert icons into the iconset\n */\n static addIcons(icons: Record<string, string>): void {\n IconService.icons = { ...IconService.icons, ...icons };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Input,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { toUpperCamelCase } from './utils/format';\nimport { IconService } from './icon.service';\n\n@Component({\n selector: 'ng-icon',\n template: '',\n styleUrls: ['./icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IconComponent {\n /** Define the name of the icon to display */\n @Input() set name(name: string) {\n name = toUpperCamelCase(name);\n\n // if there is no icon with this name warn the user as they probably forgot to import it\n if (!this.iconService.icons.hasOwnProperty(name)) {\n console.warn(\n `No icon named ${name} was found. You may need to import it using the withIcons function.`,\n );\n return;\n }\n\n // insert the SVG into the template\n this.template = this.sanitizer.bypassSecurityTrustHtml(\n this.iconService.icons[name],\n );\n }\n\n /** Store the formatted icon name */\n @HostBinding('innerHTML') template?: SafeHtml;\n\n /** Define the size of the icon */\n @HostBinding('style.--ng-icon__size')\n @Input()\n size: string = '1em';\n\n /** Define the stroke-width of the icon */\n @HostBinding('style.--ng-icon__stroke-width')\n @Input()\n strokeWidth?: string | number;\n\n /** Define the color of the icon */\n @HostBinding('style.color')\n @Input()\n color?: string;\n\n constructor(\n private readonly elementRef: ElementRef<HTMLElement>,\n private readonly sanitizer: DomSanitizer,\n private readonly iconService: IconService,\n ) {}\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { IconComponent } from './icon.component';\nimport { IconService } from './icon.service';\n\n@NgModule({\n declarations: [IconComponent],\n exports: [IconComponent],\n})\nexport class NgIconsModule {\n constructor(private readonly iconService: IconService) {\n if (Object.keys(this.iconService.icons).length === 0) {\n throw new Error(\n 'No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).',\n );\n }\n }\n\n /**\n * Define the icons that will be included in the application. This allows unused icons to\n * be tree-shaken away to reduce bundle size\n * @param icons The object containing the required icons\n */\n static withIcons(\n icons: Record<string, string>,\n ): ModuleWithProviders<NgIconsModule> {\n IconService.addIcons(icons);\n\n return { ngModule: NgIconsModule };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;SAGgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;SAGgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,KAC1C,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,CAC7B;SACA,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;SAGgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrD;;MCnBa,WAAW;;IAKtB,IAAI,KAAK;QACP,OAAO,WAAW,CAAC,KAAK,CAAC;KAC1B;;;;IAKD,OAAO,QAAQ,CAAC,KAA6B;QAC3C,WAAW,CAAC,KAAK,mCAAQ,WAAW,CAAC,KAAK,GAAK,KAAK,CAAE,CAAC;KACxD;;AAbD;AACe,iB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KAAK,CAAC,EAAE;YACpD,MAAM,IAAI,KAAK,CACb,qHAAqH,CACtH,CAAC;SACH;KACF;;;;;;IAOD,OAAO,SAAS,CACd,KAA6B;QAE7B,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE5B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;KACpC;;0GApBU,aAAa;2GAAb,aAAa,iBAHT,aAAa,aAClB,aAAa;2GAEZ,aAAa;2FAAb,aAAa;kBAJzB,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,aAAa,CAAC;oBAC7B,OAAO,EAAE,CAAC,aAAa,CAAC;iBACzB;;;ACPD;;;;;;"}
@@ -1,9 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Input, HostBinding, Optional, SkipSelf, NgModule } from '@angular/core';
2
+ import { Injectable, Component, ChangeDetectionStrategy, Input, HostBinding, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/platform-browser';
4
4
 
5
- const IconsToken = new InjectionToken('Icons');
6
-
7
5
  /**
8
6
  * Hyphenated to UpperCamelCase
9
7
  */
@@ -26,11 +24,34 @@ function toCapitalCase(str) {
26
24
  return str.charAt(0).toUpperCase() + str.substr(1);
27
25
  }
28
26
 
27
+ class IconService {
28
+ /** Access the icons in the class. */
29
+ get icons() {
30
+ return IconService.icons;
31
+ }
32
+ /**
33
+ * Insert icons into the iconset
34
+ */
35
+ static addIcons(icons) {
36
+ IconService.icons = { ...IconService.icons, ...icons };
37
+ }
38
+ }
39
+ /** Store the available icons. */
40
+ IconService.icons = {};
41
+ IconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
42
+ IconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, providedIn: 'root' });
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconService, decorators: [{
44
+ type: Injectable,
45
+ args: [{
46
+ providedIn: 'root',
47
+ }]
48
+ }] });
49
+
29
50
  class IconComponent {
30
- constructor(elementRef, sanitizer, icons) {
51
+ constructor(elementRef, sanitizer, iconService) {
31
52
  this.elementRef = elementRef;
32
53
  this.sanitizer = sanitizer;
33
- this.icons = icons;
54
+ this.iconService = iconService;
34
55
  /** Define the size of the icon */
35
56
  this.size = '1em';
36
57
  }
@@ -38,23 +59,20 @@ class IconComponent {
38
59
  set name(name) {
39
60
  name = toUpperCamelCase(name);
40
61
  // if there is no icon with this name warn the user as they probably forgot to import it
41
- if (!this.icons.hasOwnProperty(name)) {
62
+ if (!this.iconService.icons.hasOwnProperty(name)) {
42
63
  console.warn(`No icon named ${name} was found. You may need to import it using the withIcons function.`);
43
64
  return;
44
65
  }
45
66
  // insert the SVG into the template
46
- this.template = this.sanitizer.bypassSecurityTrustHtml(this.icons[name]);
67
+ this.template = this.sanitizer.bypassSecurityTrustHtml(this.iconService.icons[name]);
47
68
  }
48
69
  }
49
- IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconsToken }], target: i0.ɵɵFactoryTarget.Component });
70
+ IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconService }], target: i0.ɵɵFactoryTarget.Component });
50
71
  IconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: IconComponent, selector: "ng-icon", inputs: { name: "name", size: "size", strokeWidth: "strokeWidth", color: "color" }, host: { properties: { "innerHTML": "this.template", "style.--ng-icon__size": "this.size", "style.--ng-icon__stroke-width": "this.strokeWidth", "style.color": "this.color" } }, ngImport: i0, template: '', isInline: true, styles: [":host{display:inline-block;width:var(--ng-icon__size);height:var(--ng-icon__size)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
51
72
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, decorators: [{
52
73
  type: Component,
53
74
  args: [{ selector: 'ng-icon', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:inline-block;width:var(--ng-icon__size);height:var(--ng-icon__size)}\n"] }]
54
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: undefined, decorators: [{
55
- type: Inject,
56
- args: [IconsToken]
57
- }] }]; }, propDecorators: { name: [{
75
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconService }]; }, propDecorators: { name: [{
58
76
  type: Input
59
77
  }], template: [{
60
78
  type: HostBinding,
@@ -77,9 +95,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
77
95
  }] } });
78
96
 
79
97
  class NgIconsModule {
80
- constructor(icons) {
81
- this.icons = icons;
82
- if (!this.icons) {
98
+ constructor(iconService) {
99
+ this.iconService = iconService;
100
+ if (Object.keys(this.iconService.icons).length === 0) {
83
101
  throw new Error('No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).');
84
102
  }
85
103
  }
@@ -89,22 +107,11 @@ class NgIconsModule {
89
107
  * @param icons The object containing the required icons
90
108
  */
91
109
  static withIcons(icons) {
92
- return {
93
- ngModule: NgIconsModule,
94
- providers: [
95
- {
96
- provide: IconsToken,
97
- useFactory: (existingIcons = {}) => ({
98
- ...existingIcons,
99
- ...icons,
100
- }),
101
- deps: [[new Optional(), new SkipSelf(), new Inject(IconsToken)]],
102
- },
103
- ],
104
- };
110
+ IconService.addIcons(icons);
111
+ return { ngModule: NgIconsModule };
105
112
  }
106
113
  }
107
- NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconsToken, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
114
+ NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconService }], target: i0.ɵɵFactoryTarget.NgModule });
108
115
  NgIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, declarations: [IconComponent], exports: [IconComponent] });
109
116
  NgIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule });
110
117
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, decorators: [{
@@ -113,15 +120,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
113
120
  declarations: [IconComponent],
114
121
  exports: [IconComponent],
115
122
  }]
116
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
117
- type: Optional
118
- }, {
119
- type: Inject,
120
- args: [IconsToken]
121
- }] }]; } });
123
+ }], ctorParameters: function () { return [{ type: IconService }]; } });
122
124
 
123
125
  /**
124
126
  * Generated bundle index. Do not edit.
125
127
  */
126
128
 
127
- export { IconComponent, IconsToken, NgIconsModule };
129
+ export { IconComponent, NgIconsModule };
@@ -1 +1 @@
1
- {"version":3,"file":"ng-icons-core.mjs","sources":["../../../../packages/core/src/lib/icon.token.ts","../../../../packages/core/src/lib/utils/format.ts","../../../../packages/core/src/lib/icon.component.ts","../../../../packages/core/src/lib/icon.module.ts","../../../../packages/core/src/ng-icons-core.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const IconsToken = new InjectionToken('Icons');\n","/**\n * Hyphenated to UpperCamelCase\n */\nexport function toUpperCamelCase(str: string): string {\n return toCapitalCase(toPropertyName(str));\n}\n\n/**\n * Hyphenated to lowerCamelCase\n */\nexport function toPropertyName(str: string): string {\n return str\n .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) =>\n chr ? chr.toUpperCase() : '',\n )\n .replace(/[^a-zA-Z\\d]/g, '')\n .replace(/^([A-Z])/, m => m.toLowerCase());\n}\n\n/**\n * Capitalizes the first letter of a string\n */\nexport function toCapitalCase(str: string): string {\n return str.charAt(0).toUpperCase() + str.substr(1);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n} from '@angular/core';\nimport { IconsToken } from './icon.token';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { toUpperCamelCase } from './utils/format';\n\n@Component({\n selector: 'ng-icon',\n template: '',\n styleUrls: ['./icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IconComponent {\n /** Define the name of the icon to display */\n @Input() set name(name: string) {\n name = toUpperCamelCase(name);\n\n // if there is no icon with this name warn the user as they probably forgot to import it\n if (!this.icons.hasOwnProperty(name)) {\n console.warn(\n `No icon named ${name} was found. You may need to import it using the withIcons function.`,\n );\n return;\n }\n\n // insert the SVG into the template\n this.template = this.sanitizer.bypassSecurityTrustHtml(this.icons[name]);\n }\n\n /** Store the formatted icon name */\n @HostBinding('innerHTML') template?: SafeHtml;\n\n /** Define the size of the icon */\n @HostBinding('style.--ng-icon__size')\n @Input()\n size: string = '1em';\n\n /** Define the stroke-width of the icon */\n @HostBinding('style.--ng-icon__stroke-width')\n @Input()\n strokeWidth?: string | number;\n\n /** Define the color of the icon */\n @HostBinding('style.color')\n @Input()\n color?: string;\n\n constructor(\n private readonly elementRef: ElementRef<HTMLElement>,\n private readonly sanitizer: DomSanitizer,\n @Inject(IconsToken) private readonly icons: Record<string, string>,\n ) {}\n}\n","import {\n Inject,\n ModuleWithProviders,\n NgModule,\n Optional,\n SkipSelf,\n} from '@angular/core';\nimport { IconComponent } from './icon.component';\nimport { IconsToken } from './icon.token';\n\n@NgModule({\n declarations: [IconComponent],\n exports: [IconComponent],\n})\nexport class NgIconsModule {\n constructor(\n @Optional()\n @Inject(IconsToken)\n private readonly icons: Record<string, string>[],\n ) {\n if (!this.icons) {\n throw new Error(\n 'No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).',\n );\n }\n }\n\n /**\n * Define the icons that will be included in the application. This allows unused icons to\n * be tree-shaken away to reduce bundle size\n * @param icons The object containing the required icons\n */\n static withIcons(\n icons: Record<string, string>,\n ): ModuleWithProviders<NgIconsModule> {\n return {\n ngModule: NgIconsModule,\n providers: [\n {\n provide: IconsToken,\n useFactory: (existingIcons: Record<string, string> = {}) => ({\n ...existingIcons,\n ...icons,\n }),\n deps: [[new Optional(), new SkipSelf(), new Inject(IconsToken)]],\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAEa,UAAU,GAAG,IAAI,cAAc,CAAC,OAAO;;ACFpD;;;SAGgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;SAGgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,KAC1C,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,CAC7B;SACA,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;SAGgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,C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AAS,EAAE;gBACT;oBACE,OAAO,EAAE,UAAU;oBACnB,UAAU,EAAE,CAAC,gBAAwC,EAAE,MAAM;wBAC3D,GAAG,aAAa;wBAChB,GAAG,KAAK;qBACT,CAAC;oBACF,IAAI,EAAE,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,QAAQ,EAAE,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;iBACjE;aACF;SACF,CAAC;KACH;;0GAlCU,aAAa,kBAGd,UAAU;2GAHT,aAAa,iBAHT,aAAa,aAClB,aAAa;2GAEZ,aAAa;2FAAb,aAAa;kBAJzB,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,aAAa,CAAC;oBAC7B,OAAO,EAAE,CAAC,aAAa,CAAC;iBACzB;;0BAGI,QAAQ;;0BACR,MAAM;2BAAC,UAAU;;;ACjBtB;;;;;;"}
1
+ {"version":3,"file":"ng-icons-core.mjs","sources":["../../../../packages/core/src/lib/utils/format.ts","../../../../packages/core/src/lib/icon.service.ts","../../../../packages/core/src/lib/icon.component.ts","../../../../packages/core/src/lib/icon.module.ts","../../../../packages/core/src/ng-icons-core.ts"],"sourcesContent":["/**\n * Hyphenated to UpperCamelCase\n */\nexport function toUpperCamelCase(str: string): string {\n return toCapitalCase(toPropertyName(str));\n}\n\n/**\n * Hyphenated to lowerCamelCase\n */\nexport function toPropertyName(str: string): string {\n return str\n .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) =>\n chr ? chr.toUpperCase() : '',\n )\n .replace(/[^a-zA-Z\\d]/g, '')\n .replace(/^([A-Z])/, m => m.toLowerCase());\n}\n\n/**\n * Capitalizes the first letter of a string\n */\nexport function toCapitalCase(str: string): string {\n return str.charAt(0).toUpperCase() + str.substr(1);\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class IconService {\n /** Store the available icons. */\n private static icons: Readonly<Record<string, string>> = {};\n\n /** Access the icons in the class. */\n get icons(): Readonly<Record<string, string>> {\n return IconService.icons;\n }\n\n /**\n * Insert icons into the iconset\n */\n static addIcons(icons: Record<string, string>): void {\n IconService.icons = { ...IconService.icons, ...icons };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostBinding,\n Input,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { toUpperCamelCase } from './utils/format';\nimport { IconService } from './icon.service';\n\n@Component({\n selector: 'ng-icon',\n template: '',\n styleUrls: ['./icon.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IconComponent {\n /** Define the name of the icon to display */\n @Input() set name(name: string) {\n name = toUpperCamelCase(name);\n\n // if there is no icon with this name warn the user as they probably forgot to import it\n if (!this.iconService.icons.hasOwnProperty(name)) {\n console.warn(\n `No icon named ${name} was found. You may need to import it using the withIcons function.`,\n );\n return;\n }\n\n // insert the SVG into the template\n this.template = this.sanitizer.bypassSecurityTrustHtml(\n this.iconService.icons[name],\n );\n }\n\n /** Store the formatted icon name */\n @HostBinding('innerHTML') template?: SafeHtml;\n\n /** Define the size of the icon */\n @HostBinding('style.--ng-icon__size')\n @Input()\n size: string = '1em';\n\n /** Define the stroke-width of the icon */\n @HostBinding('style.--ng-icon__stroke-width')\n @Input()\n strokeWidth?: string | number;\n\n /** Define the color of the icon */\n @HostBinding('style.color')\n @Input()\n color?: string;\n\n constructor(\n private readonly elementRef: ElementRef<HTMLElement>,\n private readonly sanitizer: DomSanitizer,\n private readonly iconService: IconService,\n ) {}\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { IconComponent } from './icon.component';\nimport { IconService } from './icon.service';\n\n@NgModule({\n declarations: [IconComponent],\n exports: [IconComponent],\n})\nexport class NgIconsModule {\n constructor(private readonly iconService: IconService) {\n if (Object.keys(this.iconService.icons).length === 0) {\n throw new Error(\n 'No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).',\n );\n }\n }\n\n /**\n * Define the icons that will be included in the application. This allows unused icons to\n * be tree-shaken away to reduce bundle size\n * @param icons The object containing the required icons\n */\n static withIcons(\n icons: Record<string, string>,\n ): ModuleWithProviders<NgIconsModule> {\n IconService.addIcons(icons);\n\n return { ngModule: NgIconsModule };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;SAGgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;SAGgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,KAC1C,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,CAC7B;SACA,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;SAGgB,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACrD;;MCnBa,WAAW;;IAKtB,IAAI,KAAK;QACP,OAAO,WAAW,CAAC,KAAK,CAAC;KAC1B;;;;IAKD,OAAO,QAAQ,CAAC,KAA6B;QAC3C,WAAW,CAAC,KAAK,GAAG,EAAE,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;KACxD;;AAbD;AACe,iBAAK,GAAqC,EAAG,CAAA;wGAFjD,WAAW;4GAAX,WAAW,cAFV,MAAM;2FAEP,WAAW;kBAHvB,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;MCaY,aAAa;IAqCxB,YACmB,UAAmC,EACnC,SAAuB,EACvB,WAAwB;QAFxB,e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,EAAE,CAAC;KACpC;;0GApBU,aAAa;2GAAb,aAAa,iBAHT,aAAa,aAClB,aAAa;2GAEZ,aAAa;2FAAb,aAAa;kBAJzB,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,aAAa,CAAC;oBAC7B,OAAO,EAAE,CAAC,aAAa,CAAC;iBACzB;;;ACPD;;;;;;"}
package/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './lib/icon.component';
2
2
  export * from './lib/icon.module';
3
- export * from './lib/icon.token';
@@ -1,10 +1,11 @@
1
1
  import { ElementRef } from '@angular/core';
2
2
  import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
+ import { IconService } from './icon.service';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class IconComponent {
5
6
  private readonly elementRef;
6
7
  private readonly sanitizer;
7
- private readonly icons;
8
+ private readonly iconService;
8
9
  /** Define the name of the icon to display */
9
10
  set name(name: string);
10
11
  /** Store the formatted icon name */
@@ -15,7 +16,7 @@ export declare class IconComponent {
15
16
  strokeWidth?: string | number;
16
17
  /** Define the color of the icon */
17
18
  color?: string;
18
- constructor(elementRef: ElementRef<HTMLElement>, sanitizer: DomSanitizer, icons: Record<string, string>);
19
+ constructor(elementRef: ElementRef<HTMLElement>, sanitizer: DomSanitizer, iconService: IconService);
19
20
  static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
20
21
  static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "ng-icon", never, { "name": "name"; "size": "size"; "strokeWidth": "strokeWidth"; "color": "color"; }, {}, never, never>;
21
22
  }
@@ -1,16 +1,17 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
+ import { IconService } from './icon.service';
2
3
  import * as i0 from "@angular/core";
3
4
  import * as i1 from "./icon.component";
4
5
  export declare class NgIconsModule {
5
- private readonly icons;
6
- constructor(icons: Record<string, string>[]);
6
+ private readonly iconService;
7
+ constructor(iconService: IconService);
7
8
  /**
8
9
  * Define the icons that will be included in the application. This allows unused icons to
9
10
  * be tree-shaken away to reduce bundle size
10
11
  * @param icons The object containing the required icons
11
12
  */
12
13
  static withIcons(icons: Record<string, string>): ModuleWithProviders<NgIconsModule>;
13
- static ɵfac: i0.ɵɵFactoryDeclaration<NgIconsModule, [{ optional: true; }]>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgIconsModule, never>;
14
15
  static ɵmod: i0.ɵɵNgModuleDeclaration<NgIconsModule, [typeof i1.IconComponent], never, [typeof i1.IconComponent]>;
15
16
  static ɵinj: i0.ɵɵInjectorDeclaration<NgIconsModule>;
16
17
  }
@@ -0,0 +1,13 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class IconService {
3
+ /** Store the available icons. */
4
+ private static icons;
5
+ /** Access the icons in the class. */
6
+ get icons(): Readonly<Record<string, string>>;
7
+ /**
8
+ * Insert icons into the iconset
9
+ */
10
+ static addIcons(icons: Record<string, string>): void;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<IconService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<IconService>;
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-icons/core",
3
- "version": "13.1.1",
3
+ "version": "13.1.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "url": "https://github.com/ng-icons/ng-icons"
@@ -1,3 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- export const IconsToken = new InjectionToken('Icons');
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi50b2tlbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvcmUvc3JjL2xpYi9pY29uLnRva2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFL0MsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHLElBQUksY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuZXhwb3J0IGNvbnN0IEljb25zVG9rZW4gPSBuZXcgSW5qZWN0aW9uVG9rZW4oJ0ljb25zJyk7XG4iXX0=
@@ -1,2 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- export declare const IconsToken: InjectionToken<unknown>;