@updevs/icons 1.0.0 → 1.0.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +15 -18
  3. package/ng-package.json +7 -0
  4. package/package.json +18 -31
  5. package/{fesm2015/updevs-icons.mjs → src/assets/icons/icons.ts} +3 -100
  6. package/src/assets/icons/v2.0.13.txt +1 -0
  7. package/src/index.ts +1 -0
  8. package/src/lib/icon/icon.component.html +1 -0
  9. package/src/lib/icon/icon.component.scss +13 -0
  10. package/src/lib/icon/icon.component.spec.ts +23 -0
  11. package/src/lib/icon/icon.component.ts +49 -0
  12. package/src/lib/icon/icon.model.ts +11 -0
  13. package/src/lib/icon/size.enum.ts +4 -0
  14. package/src/lib/icon/type.enum.ts +4 -0
  15. package/src/lib/upd-icons.module.ts +17 -0
  16. package/{public-api.d.ts → src/public-api.ts} +3 -0
  17. package/tsconfig.lib.json +14 -0
  18. package/tsconfig.lib.prod.json +10 -0
  19. package/tsconfig.spec.json +14 -0
  20. package/assets/icons/icons.d.ts +0 -4
  21. package/esm2020/assets/icons/icons.mjs +0 -4241
  22. package/esm2020/lib/icon/icon.component.mjs +0 -51
  23. package/esm2020/lib/icon/icon.model.mjs +0 -6
  24. package/esm2020/lib/icon/size.enum.mjs +0 -6
  25. package/esm2020/lib/icon/type.enum.mjs +0 -6
  26. package/esm2020/lib/upd-icons.module.mjs +0 -24
  27. package/esm2020/public-api.mjs +0 -8
  28. package/esm2020/updevs-icons.mjs +0 -5
  29. package/fesm2015/updevs-icons.mjs.map +0 -1
  30. package/fesm2020/updevs-icons.mjs +0 -4338
  31. package/fesm2020/updevs-icons.mjs.map +0 -1
  32. package/index.d.ts +0 -5
  33. package/lib/icon/icon.component.d.ts +0 -16
  34. package/lib/icon/icon.model.d.ts +0 -6
  35. package/lib/icon/size.enum.d.ts +0 -4
  36. package/lib/icon/type.enum.d.ts +0 -4
  37. package/lib/upd-icons.module.d.ts +0 -8
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.0.1 (2023-01-16)
7
+
8
+ **Note:** Version bump only for package @updevs/icons
package/README.md CHANGED
@@ -1,27 +1,24 @@
1
- # @updevs/icons
1
+ # Icons
2
2
 
3
- This is a helper library to make [heroicons](https://github.com/tailwindlabs/heroicons) available on angular.
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.0.
4
4
 
5
- ## Usage:
5
+ ## Code scaffolding
6
6
 
7
- ### Import module
7
+ Run `ng generate component component-name --project icons` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project icons`.
8
+ > Note: Don't forget to add `--project icons` or else it will be added to the default project in your `angular.json` file.
8
9
 
9
- ```ts
10
- import { UpdIconsModule } from '@updevs/icons';
10
+ ## Build
11
11
 
12
- /// ...
12
+ Run `ng build icons` to build the project. The build artifacts will be stored in the `dist/` directory.
13
13
 
14
- imports: [
15
- /// ...
16
- UpdIconsModule
17
- ]
18
- ```
14
+ ## Publishing
19
15
 
20
- ### Icon usage
16
+ After building your library with `ng build icons`, go to the dist folder `cd dist/icons` and run `npm publish`.
21
17
 
22
- ```html
18
+ ## Running unit tests
23
19
 
24
- <upd-icon name="academic-cap" color="#ddd89a" type="outline"></upd-icon>
25
- <upd-icon name="adjustments-vertical"></upd-icon>
26
- <upd-icon name="adjustments-horizontal" size="small"></upd-icon>
27
- ```
20
+ Run `ng test icons` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../dist/updevs/icons",
4
+ "lib": {
5
+ "entryFile": "src/index.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,33 +1,20 @@
1
1
  {
2
- "name": "@updevs/icons",
3
- "version": "1.0.0",
4
- "peerDependencies": {
5
- "@angular/common": "^15.0.4",
6
- "@angular/core": "^15.0.4",
7
- "@angular/localize": "^15.0.4",
8
- "@angular/platform-browser": "^15.0.4"
9
- },
10
- "dependencies": {
11
- "tslib": "^2.3.0"
12
- },
13
- "module": "fesm2015/updevs-icons.mjs",
14
- "es2020": "fesm2020/updevs-icons.mjs",
15
- "esm2020": "esm2020/updevs-icons.mjs",
16
- "fesm2020": "fesm2020/updevs-icons.mjs",
17
- "fesm2015": "fesm2015/updevs-icons.mjs",
18
- "typings": "index.d.ts",
19
- "exports": {
20
- "./package.json": {
21
- "default": "./package.json"
2
+ "name": "@updevs/icons",
3
+ "version": "1.0.1",
4
+ "scripts": {
5
+ "build": "ng-packagr"
22
6
  },
23
- ".": {
24
- "types": "./index.d.ts",
25
- "esm2020": "./esm2020/updevs-icons.mjs",
26
- "es2020": "./fesm2020/updevs-icons.mjs",
27
- "es2015": "./fesm2015/updevs-icons.mjs",
28
- "node": "./fesm2015/updevs-icons.mjs",
29
- "default": "./fesm2020/updevs-icons.mjs"
30
- }
31
- },
32
- "sideEffects": false
33
- }
7
+ "peerDependencies": {
8
+ "@angular/common": "^15.1.0",
9
+ "@angular/core": "^15.1.0",
10
+ "@angular/platform-browser": "^15.1.0"
11
+ },
12
+ "dependencies": {
13
+ "tslib": "^2.3.0"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "sideEffects": false,
19
+ "gitHead": "667e1860a13227cae79371443c3acd9594c75f39"
20
+ }
@@ -1,29 +1,7 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, Input, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/platform-browser';
4
- import * as i2 from '@angular/common';
5
- import { CommonModule } from '@angular/common';
6
-
7
- var SizeEnum;
8
- (function (SizeEnum) {
9
- SizeEnum["Small"] = "small";
10
- SizeEnum["Regular"] = "regular";
11
- })(SizeEnum || (SizeEnum = {}));
12
-
13
- var TypeEnum;
14
- (function (TypeEnum) {
15
- TypeEnum["Solid"] = "solid";
16
- TypeEnum["Outline"] = "outline";
17
- })(TypeEnum || (TypeEnum = {}));
18
-
19
- class IconModel {
20
- constructor(init) {
21
- Object.assign(this, init);
22
- }
23
- }
24
-
25
1
  /* eslint-disable max-len */
26
- const icons = {
2
+ import { IconModel } from '../../lib/icon/icon.model';
3
+
4
+ export const icons: { [key: string]: IconModel } = {
27
5
  'academic-cap': new IconModel({
28
6
  smallSolid: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
29
7
  <path fill-rule="evenodd" d="M9.664 1.319a.75.75 0 01.672 0 41.059 41.059 0 018.198 5.424.75.75 0 01-.254 1.285 31.372 31.372 0 00-7.86 3.83.75.75 0 01-.84 0 31.508 31.508 0 00-2.08-1.287V9.394c0-.244.116-.463.302-.592a35.504 35.504 0 013.305-2.033.75.75 0 00-.714-1.319 37 37 0 00-3.446 2.12A2.216 2.216 0 006 9.393v.38a31.293 31.293 0 00-4.28-1.746.75.75 0 01-.254-1.285 41.059 41.059 0 018.198-5.424zM6 11.459a29.848 29.848 0 00-2.455-1.158 41.029 41.029 0 00-.39 3.114.75.75 0 00.419.74c.528.256 1.046.53 1.554.82-.21.324-.455.63-.739.914a.75.75 0 101.06 1.06c.37-.369.69-.77.96-1.193a26.61 26.61 0 013.095 2.348.75.75 0 00.992 0 26.547 26.547 0 015.93-3.95.75.75 0 00.42-.739 41.053 41.053 0 00-.39-3.114 29.925 29.925 0 00-5.199 2.801 2.25 2.25 0 01-2.514 0c-.41-.275-.826-.541-1.25-.797a6.985 6.985 0 01-1.084 3.45 26.503 26.503 0 00-1.281-.78A5.487 5.487 0 006 12v-.54z" clip-rule="evenodd"/>
@@ -4261,78 +4239,3 @@ const icons = {
4261
4239
  `
4262
4240
  })
4263
4241
  };
4264
-
4265
- class IconComponent {
4266
- constructor(sanitizer) {
4267
- this.sanitizer = sanitizer;
4268
- this.size = SizeEnum.Regular;
4269
- this.type = TypeEnum.Solid;
4270
- this.color = 'black';
4271
- }
4272
- ngOnChanges(changes) {
4273
- if (!!changes) {
4274
- this.generateIcon();
4275
- }
4276
- }
4277
- generateIcon() {
4278
- if (!this.name || !this.size || !this.type) {
4279
- return;
4280
- }
4281
- const iconModel = icons[this.name];
4282
- let iconContent = '';
4283
- switch (this.size) {
4284
- case SizeEnum.Small:
4285
- iconContent = iconModel.smallSolid || '';
4286
- break;
4287
- case SizeEnum.Regular:
4288
- iconContent = (this.type === TypeEnum.Solid ? iconModel.regularSolid : iconModel.regularOutline) || '';
4289
- break;
4290
- }
4291
- this.icon = this.sanitizer.bypassSecurityTrustHtml(iconContent);
4292
- }
4293
- }
4294
- IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IconComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
4295
- IconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: IconComponent, selector: "upd-icon", inputs: { name: "name", size: "size", type: "type", color: "color" }, usesOnChanges: true, ngImport: i0, template: "<span *ngIf=\"!!icon\" [innerHTML]=\"icon\" [class]=\"size\" [style.color]=\"color\"></span>\n", styles: [":host ::ng-deep .small svg{width:20px;height:20px}:host ::ng-deep .regular svg{width:24px;height:24px}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4296
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: IconComponent, decorators: [{
4297
- type: Component,
4298
- args: [{ selector: 'upd-icon', template: "<span *ngIf=\"!!icon\" [innerHTML]=\"icon\" [class]=\"size\" [style.color]=\"color\"></span>\n", styles: [":host ::ng-deep .small svg{width:20px;height:20px}:host ::ng-deep .regular svg{width:24px;height:24px}\n"] }]
4299
- }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; }, propDecorators: { name: [{
4300
- type: Input
4301
- }], size: [{
4302
- type: Input
4303
- }], type: [{
4304
- type: Input
4305
- }], color: [{
4306
- type: Input
4307
- }] } });
4308
-
4309
- class UpdIconsModule {
4310
- }
4311
- UpdIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UpdIconsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4312
- UpdIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: UpdIconsModule, declarations: [IconComponent], imports: [CommonModule], exports: [IconComponent] });
4313
- UpdIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UpdIconsModule, imports: [CommonModule] });
4314
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UpdIconsModule, decorators: [{
4315
- type: NgModule,
4316
- args: [{
4317
- imports: [
4318
- CommonModule
4319
- ],
4320
- declarations: [
4321
- IconComponent
4322
- ],
4323
- exports: [
4324
- IconComponent
4325
- ]
4326
- }]
4327
- }] });
4328
-
4329
- /*
4330
- * Public API Surface of icons
4331
- */
4332
-
4333
- /**
4334
- * Generated bundle index. Do not edit.
4335
- */
4336
-
4337
- export { IconComponent, SizeEnum, TypeEnum, UpdIconsModule };
4338
- //# sourceMappingURL=updevs-icons.mjs.map
@@ -0,0 +1 @@
1
+ heroicons version '2.0.13'
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './public-api';
@@ -0,0 +1 @@
1
+ <span *ngIf="!!icon" [innerHTML]="icon" [class]="size" [style.color]="color"></span>
@@ -0,0 +1,13 @@
1
+ :host ::ng-deep .small {
2
+ svg {
3
+ width: 20px;
4
+ height: 20px;
5
+ }
6
+ }
7
+
8
+ :host ::ng-deep .regular {
9
+ svg {
10
+ width: 24px;
11
+ height: 24px;
12
+ }
13
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { IconComponent } from './icon.component';
4
+
5
+ describe('IconComponent', () => {
6
+ let component: IconComponent;
7
+ let fixture: ComponentFixture<IconComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [IconComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(IconComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,49 @@
1
+ import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
+
4
+ import { SizeEnum } from './size.enum';
5
+ import { TypeEnum } from './type.enum';
6
+ import { icons } from '../../assets/icons/icons';
7
+
8
+ @Component({
9
+ selector: 'upd-icon',
10
+ templateUrl: './icon.component.html',
11
+ styleUrls: ['./icon.component.scss']
12
+ })
13
+ export class IconComponent implements OnChanges {
14
+ @Input() name!: string;
15
+ @Input() size: 'small' | 'regular' = SizeEnum.Regular;
16
+ @Input() type: 'solid' | 'outline' = TypeEnum.Solid;
17
+ @Input() color = 'black';
18
+
19
+ icon?: SafeHtml;
20
+
21
+ constructor(private sanitizer: DomSanitizer) {
22
+ }
23
+
24
+ ngOnChanges(changes: SimpleChanges): void {
25
+ if (!!changes) {
26
+ this.generateIcon();
27
+ }
28
+ }
29
+
30
+ private generateIcon(): void {
31
+ if (!this.name || !this.size || !this.type) {
32
+ return;
33
+ }
34
+
35
+ const iconModel = icons[this.name];
36
+ let iconContent = '';
37
+
38
+ switch (this.size) {
39
+ case SizeEnum.Small:
40
+ iconContent = iconModel.smallSolid || '';
41
+ break;
42
+ case SizeEnum.Regular:
43
+ iconContent = (this.type === TypeEnum.Solid ? iconModel.regularSolid : iconModel.regularOutline) || '';
44
+ break;
45
+ }
46
+
47
+ this.icon = this.sanitizer.bypassSecurityTrustHtml(iconContent);
48
+ }
49
+ }
@@ -0,0 +1,11 @@
1
+ export class IconModel {
2
+ smallSolid?: string;
3
+ regularOutline?: string;
4
+ regularSolid?: string;
5
+
6
+ constructor(init: IconModel) {
7
+ Object.assign(this, init);
8
+ }
9
+ }
10
+
11
+
@@ -0,0 +1,4 @@
1
+ export enum SizeEnum {
2
+ Small = 'small',
3
+ Regular = 'regular'
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum TypeEnum {
2
+ Solid = 'solid',
3
+ Outline = 'outline'
4
+ }
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+
4
+ import { IconComponent } from './icon/icon.component';
5
+
6
+ @NgModule({
7
+ imports: [
8
+ CommonModule
9
+ ],
10
+ declarations: [
11
+ IconComponent
12
+ ],
13
+ exports: [
14
+ IconComponent
15
+ ]
16
+ })
17
+ export class UpdIconsModule {}
@@ -1,3 +1,6 @@
1
+ /*
2
+ * Public API Surface of icons
3
+ */
1
4
  export * from './lib/icon/icon.component';
2
5
  export * from './lib/icon/size.enum';
3
6
  export * from './lib/icon/type.enum';
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../../out-tsc/lib",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "types": []
10
+ },
11
+ "exclude": [
12
+ "**/*.spec.ts"
13
+ ]
14
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "include": [
11
+ "**/*.spec.ts",
12
+ "**/*.d.ts"
13
+ ]
14
+ }
@@ -1,4 +0,0 @@
1
- import { IconModel } from '../../lib/icon/icon.model';
2
- export declare const icons: {
3
- [key: string]: IconModel;
4
- };