@ng-zen/cli 20.0.0-next.2 β 20.0.0
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/CHANGELOG.md +24 -0
- package/package.json +1 -1
- package/schematics/components/files/icon/icon.spec.ts +23 -0
- package/schematics/components/files/icon/icon.stories.ts +12 -2
- package/schematics/components/files/icon/icon.ts +54 -10
- package/schematics/dependency-manager/dependencies.constant.js +0 -1
- package/schematics/dependency-manager/dependencies.constant.js.map +1 -1
- package/schematics/dependency-manager/dependencies.constant.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## [20.0.0](https://github.com/kstepien3/ng-zen/compare/v19.4.0...v20.0.0) (2025-07-22)
|
|
2
|
+
|
|
3
|
+
### β BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* **angular:** upgrade to v20 (#241)
|
|
6
|
+
|
|
7
|
+
### π New Features
|
|
8
|
+
|
|
9
|
+
* **icon:** remove @hugeicons/angular package & improvements ([#248](https://github.com/kstepien3/ng-zen/issues/248)) ([cceabb0](https://github.com/kstepien3/ng-zen/commit/cceabb036f092170da66724d29ffca8ccd702983))
|
|
10
|
+
|
|
11
|
+
### π οΈ Code Refactor
|
|
12
|
+
|
|
13
|
+
* remove suffix from files for Angular v20 compatibility ([#243](https://github.com/kstepien3/ng-zen/issues/243)) ([d26e2f2](https://github.com/kstepien3/ng-zen/commit/d26e2f2faeb052b8f984f82a59e7d95248b2964b))
|
|
14
|
+
|
|
15
|
+
### ποΈ Build Changes
|
|
16
|
+
|
|
17
|
+
* **angular:** upgrade to v20 ([#241](https://github.com/kstepien3/ng-zen/issues/241)) ([a97126c](https://github.com/kstepien3/ng-zen/commit/a97126cbe780cb6fca9fe6c7944aa70cb86b5273))
|
|
18
|
+
|
|
19
|
+
## [20.0.0-next.3](https://github.com/kstepien3/ng-zen/compare/v20.0.0-next.2...v20.0.0-next.3) (2025-07-21)
|
|
20
|
+
|
|
21
|
+
### π New Features
|
|
22
|
+
|
|
23
|
+
* **icon:** remove @hugeicons/angular package & improvements ([#248](https://github.com/kstepien3/ng-zen/issues/248)) ([cceabb0](https://github.com/kstepien3/ng-zen/commit/cceabb036f092170da66724d29ffca8ccd702983))
|
|
24
|
+
|
|
1
25
|
## [20.0.0-next.2](https://github.com/kstepien3/ng-zen/compare/v20.0.0-next.1...v20.0.0-next.2) (2025-07-16)
|
|
2
26
|
|
|
3
27
|
### π οΈ Code Refactor
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ZenIcon } from './icon';
|
|
4
|
+
|
|
5
|
+
describe('ZenIcon', () => {
|
|
6
|
+
let component: ZenIcon;
|
|
7
|
+
let fixture: ComponentFixture<ZenIcon>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ZenIcon],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ZenIcon);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.componentRef.setInput('icon', 'Tree02Icon');
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -8,14 +8,24 @@ export default {
|
|
|
8
8
|
title: 'Components/Icon',
|
|
9
9
|
component: ZenIcon,
|
|
10
10
|
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { control: { type: 'range', min: 12, max: 100, step: 1 }, description: 'Size' },
|
|
13
|
+
strokeWidth: { control: { type: 'range', min: 1, max: 5, step: 0.25 }, description: 'strokeWidth' },
|
|
14
|
+
absoluteStrokeWidth: { control: 'boolean' },
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
size: 64,
|
|
18
|
+
strokeWidth: 1.5,
|
|
19
|
+
absoluteStrokeWidth: false,
|
|
20
|
+
},
|
|
11
21
|
} satisfies Meta<Options>;
|
|
12
22
|
|
|
13
23
|
type Story = StoryObj<Options>;
|
|
14
24
|
|
|
15
25
|
export const Default: Story = {
|
|
16
|
-
render:
|
|
26
|
+
render: args => ({
|
|
17
27
|
template: `
|
|
18
|
-
<zen-icon icon="Tree02Icon" [size]="
|
|
28
|
+
<zen-icon icon="Tree02Icon" [size]="${args.size}" [strokeWidth]="${args.strokeWidth}" ${args.absoluteStrokeWidth ? 'absoluteStrokeWidth' : ''}>
|
|
19
29
|
`,
|
|
20
30
|
}),
|
|
21
31
|
};
|
|
@@ -1,35 +1,79 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
-
import { HugeiconsIconComponent } from '@hugeicons/angular';
|
|
1
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
3
2
|
import * as icons from '@hugeicons/core-free-icons';
|
|
4
3
|
|
|
5
4
|
type Icon = keyof typeof icons;
|
|
5
|
+
interface Path {
|
|
6
|
+
d: string | number;
|
|
7
|
+
fill: string | number;
|
|
8
|
+
opacity: string | number;
|
|
9
|
+
fillRule: string | number;
|
|
10
|
+
strokeWidth?: number;
|
|
11
|
+
}
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* A reusable Angular component for rendering icons from the Hugeicons library.
|
|
9
15
|
*
|
|
10
|
-
* This component
|
|
11
|
-
*
|
|
12
|
-
*
|
|
16
|
+
* This component renders an SVG icon from the `@hugeicons/core-free-icons` collection by name.
|
|
17
|
+
* The size, stroke width, and color are configurable through inputs. It dynamically generates the SVG
|
|
18
|
+
* and its paths, providing a flexible and efficient way to use Hugeicons in an Angular application.
|
|
13
19
|
*
|
|
14
20
|
* @example
|
|
15
21
|
* <zen-icon icon="Tree02Icon" />
|
|
16
22
|
*
|
|
17
|
-
* @
|
|
18
|
-
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
19
|
-
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
23
|
+
* @license {@link https://github.com/hugeicons/angular/blob/main/README.md#license|MIT}
|
|
20
24
|
* @see [Hugeicons](https://hugeicons.com)
|
|
21
25
|
*/
|
|
22
26
|
@Component({
|
|
23
27
|
selector: 'zen-icon',
|
|
24
28
|
template: `
|
|
25
|
-
<
|
|
29
|
+
<svg
|
|
30
|
+
[attr.color]="color()"
|
|
31
|
+
[attr.height]="size()"
|
|
32
|
+
[attr.width]="size()"
|
|
33
|
+
fill="none"
|
|
34
|
+
viewBox="0 0 24 24"
|
|
35
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
36
|
+
>
|
|
37
|
+
@for (path of paths(); track path) {
|
|
38
|
+
<path
|
|
39
|
+
[attr.d]="path.d"
|
|
40
|
+
[attr.fill-rule]="path.fillRule"
|
|
41
|
+
[attr.fill]="path.fill"
|
|
42
|
+
[attr.opacity]="path.opacity"
|
|
43
|
+
[attr.stroke-width]="path.strokeWidth"
|
|
44
|
+
[attr.stroke]="'currentColor'"
|
|
45
|
+
/>
|
|
46
|
+
}
|
|
47
|
+
</svg>
|
|
26
48
|
`,
|
|
27
|
-
imports: [HugeiconsIconComponent],
|
|
28
49
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
50
|
})
|
|
30
51
|
export class ZenIcon {
|
|
31
52
|
/** Icon file names from HugeIcons */
|
|
32
53
|
readonly icon = input.required({ transform: (icon: Icon) => icons[icon] });
|
|
33
54
|
readonly size = input<number>(24);
|
|
55
|
+
readonly absoluteStrokeWidth = input<boolean, unknown>(false, { transform: booleanAttribute });
|
|
34
56
|
readonly strokeWidth = input<number>(1.5);
|
|
57
|
+
readonly color = input<string>('currentColor');
|
|
58
|
+
|
|
59
|
+
readonly paths = computed<Path[]>(() => this.updatePaths());
|
|
60
|
+
|
|
61
|
+
private readonly calculatedStrokeWidth = computed(() => this.calculateStrokeWidth());
|
|
62
|
+
|
|
63
|
+
private calculateStrokeWidth(): number {
|
|
64
|
+
if (!this.absoluteStrokeWidth()) return this.strokeWidth();
|
|
65
|
+
|
|
66
|
+
const BASE_SIZE = 24;
|
|
67
|
+
return (this.strokeWidth() * BASE_SIZE) / this.size();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private updatePaths(): Path[] {
|
|
71
|
+
return this.icon().map(([, attrs]) => ({
|
|
72
|
+
d: attrs['d'],
|
|
73
|
+
fill: attrs['fill'] ?? 'none',
|
|
74
|
+
opacity: attrs['opacity'],
|
|
75
|
+
fillRule: attrs['fillRule'],
|
|
76
|
+
strokeWidth: this.calculatedStrokeWidth(),
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
35
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.constant.js","sourceRoot":"","sources":["../../../../../src/schematics/dependency-manager/dependencies.constant.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAyB;IACvD,IAAI,EAAE;QACJ,YAAY,EAAE;YACZ,
|
|
1
|
+
{"version":3,"file":"dependencies.constant.js","sourceRoot":"","sources":["../../../../../src/schematics/dependency-manager/dependencies.constant.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAyB;IACvD,IAAI,EAAE;QACJ,YAAY,EAAE;YACZ,4BAA4B,EAAE,QAAQ;SACvC;KACF;CACF,CAAC","sourcesContent":["import { FilesConfig } from '../../types';\n\nexport const DEPENDENCIES_CONFIG: Partial<FilesConfig> = {\n icon: {\n dependencies: {\n '@hugeicons/core-free-icons': 'latest',\n },\n },\n};\n"]}
|