@ng-icons/core 12.7.0 → 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,13 +1,17 @@
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.
4
- Containing over 7000+ icons for you to use in your projects.
7
+ Containing over 17000+ icons for you to use in your projects.
5
8
 
6
9
  Currently, we support the following libraries:
7
10
 
8
11
  - [Bootstrap Icons](https://icons.getbootstrap.com/)
9
12
  - [Heroicons](https://heroicons.com/)
10
13
  - [Ionicons](https://ionic.io/ionicons)
14
+ - [Material Icons](https://fonts.google.com/icons?selected=Material+Icons)
11
15
  - [CSS.gg](https://css.gg/)
12
16
  - [Feather Icons](https://feathericons.com/)
13
17
  - [Jam Icons](https://jam-icons.com/)
@@ -18,21 +22,17 @@ Currently, we support the following libraries:
18
22
 
19
23
  Got suggestions for additional iconsets? Create an issue and we can consider adding them!
20
24
 
21
- ## Installation
25
+ ## Supported Versions
22
26
 
23
- Ng Icons consists of multiple packages:
27
+ | Angular Version | Ng Icon Version |
28
+ | --------------- | ------------------ |
29
+ | 11.x.x | 12.x.x |
30
+ | 12.x.x | 13.x.x (or 12.x.x) |
31
+ | 13.x.x | 13.x.x |
24
32
 
25
- - `@ng-icons/core` - This contains the icon component and the `NgIconsModule` that is used to register the icons you want to include in your application.
26
- - `@ng-icons/bootstrap-icons` - The Bootstrap iconset including both outline and solid variants.
27
- - `@ng-icons/heroicons` - The Heroicons iconset including both outline and solid variants.
28
- - `@ng-icons/ionicons` - The Ionicons iconset including both outline and solid variants.
29
- - `@ng-icons/css.gg` - The CSS.gg iconset.
30
- - `@ng-icons/feather-icons` - The Feather Icons iconset.
31
- - `@ng-icons/jam-icons` - The Jam Icons iconset.
32
- - `@ng-icons/octicons` - The Octicons iconset.
33
- - `@ng-icons/radix-icons` - The Radix UI iconset.
34
- - `@ng-icons/tabler-icons` - The Tabler iconset.
35
- - `@ng-icons/akar-icons` - The Akar iconset.
33
+ > Note: Ng Icons relies on modern browser features and is designed to work on evergreen browsers. We do not support older browsers such as IE11.
34
+
35
+ ## Installation
36
36
 
37
37
  You must install the `@ng-icons/core` package, however you only need to install the iconset libraries you intend to use.
38
38
 
@@ -48,6 +48,25 @@ or
48
48
  yarn add @ng-icons/core @ng-icons/heroicons ...
49
49
  ```
50
50
 
51
+ ## Packages
52
+
53
+ The following packages are available:
54
+
55
+ | Package | License |
56
+ | --------------------------- | ---------- |
57
+ | `@ng-icons/core` | MIT |
58
+ | `@ng-icons/bootstrap-icons` | MIT |
59
+ | `@ng-icons/heroicons` | MIT |
60
+ | `@ng-icons/ionicons` | MIT |
61
+ | `@ng-icons/material-icons` | Apache 2.0 |
62
+ | `@ng-icons/css.gg` | MIT |
63
+ | `@ng-icons/feather-icons` | MIT |
64
+ | `@ng-icons/jam-icons` | MIT |
65
+ | `@ng-icons/octicons` | MIT |
66
+ | `@ng-icons/radix-icons` | MIT |
67
+ | `@ng-icons/tabler-icons` | MIT |
68
+ | `@ng-icons/akar-icons` | MIT |
69
+
51
70
  ## Usage
52
71
 
53
72
  Import the `NgIconsModule` and register the icons you wish to use:
@@ -74,7 +93,8 @@ You can then use the icon in your templates:
74
93
  <ng-icon name="feather-airplay"></ng-icon>
75
94
  ```
76
95
 
77
- | Name | Type | Description |
78
- | ----------- | ---------------- | ------------------------------------ |
79
- | size | string | Define the size of the icon. |
80
- | strokeWidth | string \| number | Define the stroke-width of the icon. |
96
+ | Name | Type | Description |
97
+ | ----------- | -------------------- | ---------------------------------------------------------------------------------- |
98
+ | size | `string` | Define the size of the icon. This defaults to the current font size. |
99
+ | color | `string` | Define the color of the icon. This defaults to the current text color. |
100
+ | strokeWidth | `string` \| `number` | Define the stroke-width of the icon. This only works on iconsets that use strokes. |
@@ -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=
@@ -0,0 +1,54 @@
1
+ import { ChangeDetectionStrategy, Component, ElementRef, HostBinding, Input, } from '@angular/core';
2
+ import { DomSanitizer } from '@angular/platform-browser';
3
+ import { toUpperCamelCase } from './utils/format';
4
+ import { IconService } from './icon.service';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "@angular/platform-browser";
7
+ import * as i2 from "./icon.service";
8
+ export class IconComponent {
9
+ constructor(elementRef, sanitizer, iconService) {
10
+ this.elementRef = elementRef;
11
+ this.sanitizer = sanitizer;
12
+ this.iconService = iconService;
13
+ /** Define the size of the icon */
14
+ this.size = '1em';
15
+ }
16
+ /** Define the name of the icon to display */
17
+ set name(name) {
18
+ name = toUpperCamelCase(name);
19
+ // if there is no icon with this name warn the user as they probably forgot to import it
20
+ if (!this.iconService.icons.hasOwnProperty(name)) {
21
+ console.warn(`No icon named ${name} was found. You may need to import it using the withIcons function.`);
22
+ return;
23
+ }
24
+ // insert the SVG into the template
25
+ this.template = this.sanitizer.bypassSecurityTrustHtml(this.iconService.icons[name]);
26
+ }
27
+ }
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 });
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 });
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, decorators: [{
31
+ type: Component,
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"] }]
33
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: i2.IconService }]; }, propDecorators: { name: [{
34
+ type: Input
35
+ }], template: [{
36
+ type: HostBinding,
37
+ args: ['innerHTML']
38
+ }], size: [{
39
+ type: HostBinding,
40
+ args: ['style.--ng-icon__size']
41
+ }, {
42
+ type: Input
43
+ }], strokeWidth: [{
44
+ type: HostBinding,
45
+ args: ['style.--ng-icon__stroke-width']
46
+ }, {
47
+ type: Input
48
+ }], color: [{
49
+ type: HostBinding,
50
+ args: ['style.color']
51
+ }, {
52
+ type: Input
53
+ }] } });
54
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9saWIvaWNvbi5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsVUFBVSxFQUNWLFdBQVcsRUFDWCxLQUFLLEdBQ04sTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLFlBQVksRUFBWSxNQUFNLDJCQUEyQixDQUFDO0FBQ25FLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2xELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7OztBQVE3QyxNQUFNLE9BQU8sYUFBYTtJQXFDeEIsWUFDbUIsVUFBbUMsRUFDbkMsU0FBdUIsRUFDdkIsV0FBd0I7UUFGeEIsZUFBVSxHQUFWLFVBQVUsQ0FBeUI7UUFDbkMsY0FBUyxHQUFULFNBQVMsQ0FBYztRQUN2QixnQkFBVyxHQUFYLFdBQVcsQ0FBYTtRQWxCM0Msa0NBQWtDO1FBR2xDLFNBQUksR0FBVyxLQUFLLENBQUM7SUFnQmxCLENBQUM7SUF4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TVkcgaW50byB0aGUgdGVtcGxhdGVcbiAgICB0aGlzLnRlbXBsYXRlID0gdGhpcy5zYW5pdGl6ZXIuYnlwYXNzU2VjdXJpdHlUcnVzdEh0bWwoXG4gICAgICB0aGlzLmljb25TZXJ2aWNlLmljb25zW25hbWVdLFxuICAgICk7XG4gIH1cblxuICAvKiogU3RvcmUgdGhlIGZvcm1hdHRlZCBpY29uIG5hbWUgKi9cbiAgQEhvc3RCaW5kaW5nKCdpbm5lckhUTUwnKSB0ZW1wbGF0ZT86IFNhZmVIdG1sO1xuXG4gIC8qKiBEZWZpbmUgdGhlIHNpemUgb2YgdGhlIGljb24gKi9cbiAgQEhvc3RCaW5kaW5nKCdzdHlsZS4tLW5nLWljb25fX3NpemUnKVxuICBASW5wdXQoKVxuICBzaXplOiBzdHJpbmcgPSAnMWVtJztcblxuICAvKiogRGVmaW5lIHRoZSBzdHJva2Utd2lkdGggb2YgdGhlIGljb24gKi9cbiAgQEhvc3RCaW5kaW5nKCdzdHlsZS4tLW5nLWljb25fX3N0cm9rZS13aWR0aCcpXG4gIEBJbnB1dCgpXG4gIHN0cm9rZVdpZHRoPzogc3RyaW5nIHwgbnVtYmVyO1xuXG4gIC8qKiBEZWZpbmUgdGhlIGNvbG9yIG9mIHRoZSBpY29uICovXG4gIEBIb3N0QmluZGluZygnc3R5bGUuY29sb3InKVxuICBASW5wdXQoKVxuICBjb2xvcj86IHN0cmluZztcblxuICBjb25zdHJ1Y3RvcihcbiAgICBwcml2YXRlIHJlYWRvbmx5IGVsZW1lbnRSZWY6IEVsZW1lbnRSZWY8SFRNTEVsZW1lbnQ+LFxuICAgIHByaXZhdGUgcmVhZG9ubHkgc2FuaXRpemVyOiBEb21TYW5pdGl6ZXIsXG4gICAgcHJpdmF0ZSByZWFkb25seSBpY29uU2VydmljZTogSWNvblNlcnZpY2UsXG4gICkge31cbn1cbiJdfQ==
@@ -0,0 +1,33 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { IconComponent } from './icon.component';
3
+ import { IconService } from './icon.service';
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "./icon.service";
6
+ export class NgIconsModule {
7
+ constructor(iconService) {
8
+ this.iconService = iconService;
9
+ if (Object.keys(this.iconService.icons).length === 0) {
10
+ throw new Error('No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).');
11
+ }
12
+ }
13
+ /**
14
+ * Define the icons that will be included in the application. This allows unused icons to
15
+ * be tree-shaken away to reduce bundle size
16
+ * @param icons The object containing the required icons
17
+ */
18
+ static withIcons(icons) {
19
+ IconService.addIcons(icons);
20
+ return { ngModule: NgIconsModule };
21
+ }
22
+ }
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 });
24
+ NgIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, declarations: [IconComponent], exports: [IconComponent] });
25
+ NgIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule });
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, decorators: [{
27
+ type: NgModule,
28
+ args: [{
29
+ declarations: [IconComponent],
30
+ exports: [IconComponent],
31
+ }]
32
+ }], ctorParameters: function () { return [{ type: i1.IconService }]; } });
33
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9saWIvaWNvbi5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QixRQUFRLE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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
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Hyphenated to UpperCamelCase
3
+ */
4
+ export function toUpperCamelCase(str) {
5
+ return toCapitalCase(toPropertyName(str));
6
+ }
7
+ /**
8
+ * Hyphenated to lowerCamelCase
9
+ */
10
+ export function toPropertyName(str) {
11
+ return str
12
+ .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) => chr ? chr.toUpperCase() : '')
13
+ .replace(/[^a-zA-Z\d]/g, '')
14
+ .replace(/^([A-Z])/, m => m.toLowerCase());
15
+ }
16
+ /**
17
+ * Capitalizes the first letter of a string
18
+ */
19
+ export function toCapitalCase(str) {
20
+ return str.charAt(0).toUpperCase() + str.substr(1);
21
+ }
22
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybWF0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29yZS9zcmMvbGliL3V0aWxzL2Zvcm1hdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE1BQU0sVUFBVSxnQkFBZ0IsQ0FBQyxHQUFXO0lBQzFDLE9BQU8sYUFBYSxDQUFDLGNBQWMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO0FBQzVDLENBQUM7QUFFRDs7R0FFRztBQUNILE1BQU0sVUFBVSxjQUFjLENBQUMsR0FBVztJQUN4QyxPQUFPLEdBQUc7U0FDUCxPQUFPLENBQUMsc0JBQXNCLEVBQUUsQ0FBQyxDQUFDLEVBQUUsRUFBRSxFQUFFLEdBQUcsRUFBRSxFQUFFLENBQzlDLEdBQUcsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLFdBQVcsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQzdCO1NBQ0EsT0FBTyxDQUFDLGNBQWMsRUFBRSxFQUFFLENBQUM7U0FDM0IsT0FBTyxDQUFDLFVBQVUsRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQyxDQUFDO0FBQy9DLENBQUM7QUFFRDs7R0FFRztBQUNILE1BQU0sVUFBVSxhQUFhLENBQUMsR0FBVztJQUN2QyxPQUFPLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsV0FBVyxFQUFFLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNyRCxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBIeXBoZW5hdGVkIHRvIFVwcGVyQ2FtZWxDYXNlXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB0b1VwcGVyQ2FtZWxDYXNlKHN0cjogc3RyaW5nKTogc3RyaW5nIHtcbiAgcmV0dXJuIHRvQ2FwaXRhbENhc2UodG9Qcm9wZXJ0eU5hbWUoc3RyKSk7XG59XG5cbi8qKlxuICogSHlwaGVuYXRlZCB0byBsb3dlckNhbWVsQ2FzZVxuICovXG5leHBvcnQgZnVuY3Rpb24gdG9Qcm9wZXJ0eU5hbWUoc3RyOiBzdHJpbmcpOiBzdHJpbmcge1xuICByZXR1cm4gc3RyXG4gICAgLnJlcGxhY2UoLyhbXmEtekEtWjAtOV0pKyguKT8vZywgKF8sIF9fLCBjaHIpID0+XG4gICAgICBjaHIgPyBjaHIudG9VcHBlckNhc2UoKSA6ICcnLFxuICAgIClcbiAgICAucmVwbGFjZSgvW15hLXpBLVpcXGRdL2csICcnKVxuICAgIC5yZXBsYWNlKC9eKFtBLVpdKS8sIG0gPT4gbS50b0xvd2VyQ2FzZSgpKTtcbn1cblxuLyoqXG4gKiBDYXBpdGFsaXplcyB0aGUgZmlyc3QgbGV0dGVyIG9mIGEgc3RyaW5nXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB0b0NhcGl0YWxDYXNlKHN0cjogc3RyaW5nKTogc3RyaW5nIHtcbiAgcmV0dXJuIHN0ci5jaGFyQXQoMCkudG9VcHBlckNhc2UoKSArIHN0ci5zdWJzdHIoMSk7XG59XG4iXX0=
@@ -0,0 +1,129 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, ChangeDetectionStrategy, Input, HostBinding, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
4
+
5
+ /**
6
+ * Hyphenated to UpperCamelCase
7
+ */
8
+ function toUpperCamelCase(str) {
9
+ return toCapitalCase(toPropertyName(str));
10
+ }
11
+ /**
12
+ * Hyphenated to lowerCamelCase
13
+ */
14
+ function toPropertyName(str) {
15
+ return str
16
+ .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) => chr ? chr.toUpperCase() : '')
17
+ .replace(/[^a-zA-Z\d]/g, '')
18
+ .replace(/^([A-Z])/, m => m.toLowerCase());
19
+ }
20
+ /**
21
+ * Capitalizes the first letter of a string
22
+ */
23
+ function toCapitalCase(str) {
24
+ return str.charAt(0).toUpperCase() + str.substr(1);
25
+ }
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
+
50
+ class IconComponent {
51
+ constructor(elementRef, sanitizer, iconService) {
52
+ this.elementRef = elementRef;
53
+ this.sanitizer = sanitizer;
54
+ this.iconService = iconService;
55
+ /** Define the size of the icon */
56
+ this.size = '1em';
57
+ }
58
+ /** Define the name of the icon to display */
59
+ set name(name) {
60
+ name = toUpperCamelCase(name);
61
+ // if there is no icon with this name warn the user as they probably forgot to import it
62
+ if (!this.iconService.icons.hasOwnProperty(name)) {
63
+ console.warn(`No icon named ${name} was found. You may need to import it using the withIcons function.`);
64
+ return;
65
+ }
66
+ // insert the SVG into the template
67
+ this.template = this.sanitizer.bypassSecurityTrustHtml(this.iconService.icons[name]);
68
+ }
69
+ }
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 });
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 });
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, decorators: [{
73
+ type: Component,
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"] }]
75
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconService }]; }, propDecorators: { name: [{
76
+ type: Input
77
+ }], template: [{
78
+ type: HostBinding,
79
+ args: ['innerHTML']
80
+ }], size: [{
81
+ type: HostBinding,
82
+ args: ['style.--ng-icon__size']
83
+ }, {
84
+ type: Input
85
+ }], strokeWidth: [{
86
+ type: HostBinding,
87
+ args: ['style.--ng-icon__stroke-width']
88
+ }, {
89
+ type: Input
90
+ }], color: [{
91
+ type: HostBinding,
92
+ args: ['style.color']
93
+ }, {
94
+ type: Input
95
+ }] } });
96
+
97
+ class NgIconsModule {
98
+ constructor(iconService) {
99
+ this.iconService = iconService;
100
+ if (Object.keys(this.iconService.icons).length === 0) {
101
+ throw new Error('No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).');
102
+ }
103
+ }
104
+ /**
105
+ * Define the icons that will be included in the application. This allows unused icons to
106
+ * be tree-shaken away to reduce bundle size
107
+ * @param icons The object containing the required icons
108
+ */
109
+ static withIcons(icons) {
110
+ IconService.addIcons(icons);
111
+ return { ngModule: NgIconsModule };
112
+ }
113
+ }
114
+ NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconService }], target: i0.ɵɵFactoryTarget.NgModule });
115
+ NgIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, declarations: [IconComponent], exports: [IconComponent] });
116
+ NgIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule });
117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, decorators: [{
118
+ type: NgModule,
119
+ args: [{
120
+ declarations: [IconComponent],
121
+ exports: [IconComponent],
122
+ }]
123
+ }], ctorParameters: function () { return [{ type: IconService }]; } });
124
+
125
+ /**
126
+ * Generated bundle index. Do not edit.
127
+ */
128
+
129
+ export { IconComponent, NgIconsModule };
@@ -0,0 +1 @@
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,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AK;gBAMN,WAAW;sBAFV,WAAW;uBAAC,+BAA+B;;sBAC3C,KAAK;gBAMN,KAAK;sBAFJ,WAAW;uBAAC,aAAa;;sBACzB,KAAK;;;MC3CK,aAAa;IACxB,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QACnD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,MAAM,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;;;;;;"}
@@ -0,0 +1,129 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, ChangeDetectionStrategy, Input, HostBinding, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
4
+
5
+ /**
6
+ * Hyphenated to UpperCamelCase
7
+ */
8
+ function toUpperCamelCase(str) {
9
+ return toCapitalCase(toPropertyName(str));
10
+ }
11
+ /**
12
+ * Hyphenated to lowerCamelCase
13
+ */
14
+ function toPropertyName(str) {
15
+ return str
16
+ .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, chr) => chr ? chr.toUpperCase() : '')
17
+ .replace(/[^a-zA-Z\d]/g, '')
18
+ .replace(/^([A-Z])/, m => m.toLowerCase());
19
+ }
20
+ /**
21
+ * Capitalizes the first letter of a string
22
+ */
23
+ function toCapitalCase(str) {
24
+ return str.charAt(0).toUpperCase() + str.substr(1);
25
+ }
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
+
50
+ class IconComponent {
51
+ constructor(elementRef, sanitizer, iconService) {
52
+ this.elementRef = elementRef;
53
+ this.sanitizer = sanitizer;
54
+ this.iconService = iconService;
55
+ /** Define the size of the icon */
56
+ this.size = '1em';
57
+ }
58
+ /** Define the name of the icon to display */
59
+ set name(name) {
60
+ name = toUpperCamelCase(name);
61
+ // if there is no icon with this name warn the user as they probably forgot to import it
62
+ if (!this.iconService.icons.hasOwnProperty(name)) {
63
+ console.warn(`No icon named ${name} was found. You may need to import it using the withIcons function.`);
64
+ return;
65
+ }
66
+ // insert the SVG into the template
67
+ this.template = this.sanitizer.bypassSecurityTrustHtml(this.iconService.icons[name]);
68
+ }
69
+ }
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 });
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 });
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: IconComponent, decorators: [{
73
+ type: Component,
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"] }]
75
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconService }]; }, propDecorators: { name: [{
76
+ type: Input
77
+ }], template: [{
78
+ type: HostBinding,
79
+ args: ['innerHTML']
80
+ }], size: [{
81
+ type: HostBinding,
82
+ args: ['style.--ng-icon__size']
83
+ }, {
84
+ type: Input
85
+ }], strokeWidth: [{
86
+ type: HostBinding,
87
+ args: ['style.--ng-icon__stroke-width']
88
+ }, {
89
+ type: Input
90
+ }], color: [{
91
+ type: HostBinding,
92
+ args: ['style.color']
93
+ }, {
94
+ type: Input
95
+ }] } });
96
+
97
+ class NgIconsModule {
98
+ constructor(iconService) {
99
+ this.iconService = iconService;
100
+ if (Object.keys(this.iconService.icons).length === 0) {
101
+ throw new Error('No icons have been provided. Ensure to include some icons by importing them using NgIconsModule.withIcons({ ... }).');
102
+ }
103
+ }
104
+ /**
105
+ * Define the icons that will be included in the application. This allows unused icons to
106
+ * be tree-shaken away to reduce bundle size
107
+ * @param icons The object containing the required icons
108
+ */
109
+ static withIcons(icons) {
110
+ IconService.addIcons(icons);
111
+ return { ngModule: NgIconsModule };
112
+ }
113
+ }
114
+ NgIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, deps: [{ token: IconService }], target: i0.ɵɵFactoryTarget.NgModule });
115
+ NgIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, declarations: [IconComponent], exports: [IconComponent] });
116
+ NgIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule });
117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: NgIconsModule, decorators: [{
118
+ type: NgModule,
119
+ args: [{
120
+ declarations: [IconComponent],
121
+ exports: [IconComponent],
122
+ }]
123
+ }], ctorParameters: function () { return [{ type: IconService }]; } });
124
+
125
+ /**
126
+ * Generated bundle index. Do not edit.
127
+ */
128
+
129
+ export { IconComponent, NgIconsModule };
@@ -0,0 +1 @@
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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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;;;;;;"}
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,9 +1,11 @@
1
1
  import { ElementRef } from '@angular/core';
2
2
  import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
+ import { IconService } from './icon.service';
4
+ import * as i0 from "@angular/core";
3
5
  export declare class IconComponent {
4
6
  private readonly elementRef;
5
7
  private readonly sanitizer;
6
- private readonly icons;
8
+ private readonly iconService;
7
9
  /** Define the name of the icon to display */
8
10
  set name(name: string);
9
11
  /** Store the formatted icon name */
@@ -12,19 +14,9 @@ export declare class IconComponent {
12
14
  size: string;
13
15
  /** Define the stroke-width of the icon */
14
16
  strokeWidth?: string | number;
15
- /** Flatten the iconsets */
16
- get iconset(): Record<string, string>;
17
- constructor(elementRef: ElementRef<HTMLElement>, sanitizer: DomSanitizer, icons: Record<string, string>[]);
18
- /**
19
- * Hyphenated to UpperCamelCase
20
- */
21
- private toUpperCamelCase;
22
- /**
23
- * Hyphenated to lowerCamelCase
24
- */
25
- private toPropertyName;
26
- /**
27
- * Capitalizes the first letter of a string
28
- */
29
- private toCapitalCase;
17
+ /** Define the color of the icon */
18
+ color?: string;
19
+ constructor(elementRef: ElementRef<HTMLElement>, sanitizer: DomSanitizer, iconService: IconService);
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "ng-icon", never, { "name": "name"; "size": "size"; "strokeWidth": "strokeWidth"; "color": "color"; }, {}, never, never>;
30
22
  }
@@ -1,11 +1,17 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
+ import { IconService } from './icon.service';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "./icon.component";
2
5
  export declare class NgIconsModule {
3
- private readonly icons;
4
- constructor(icons: Record<string, string>[]);
6
+ private readonly iconService;
7
+ constructor(iconService: IconService);
5
8
  /**
6
9
  * Define the icons that will be included in the application. This allows unused icons to
7
10
  * be tree-shaken away to reduce bundle size
8
11
  * @param icons The object containing the required icons
9
12
  */
10
13
  static withIcons(icons: Record<string, string>): ModuleWithProviders<NgIconsModule>;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgIconsModule, never>;
15
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgIconsModule, [typeof i1.IconComponent], never, [typeof i1.IconComponent]>;
16
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgIconsModule>;
11
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
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hyphenated to UpperCamelCase
3
+ */
4
+ export declare function toUpperCamelCase(str: string): string;
5
+ /**
6
+ * Hyphenated to lowerCamelCase
7
+ */
8
+ export declare function toPropertyName(str: string): string;
9
+ /**
10
+ * Capitalizes the first letter of a string
11
+ */
12
+ export declare function toCapitalCase(str: string): string;