@coreui/icons-angular 5.2.22 → 5.2.23
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/esm2022/lib/icon/icon.component.mjs +63 -84
- package/esm2022/lib/icon/icon.directive.mjs +56 -105
- package/esm2022/lib/icon/icon.interface.mjs +1 -1
- package/esm2022/lib/icon-set/icon-set.service.mjs +7 -9
- package/esm2022/lib/shared/html-attr.directive.mjs +28 -27
- package/fesm2022/coreui-icons-angular.mjs +148 -219
- package/fesm2022/coreui-icons-angular.mjs.map +1 -1
- package/lib/icon/icon.component.d.ts +19 -27
- package/lib/icon/icon.directive.d.ts +16 -29
- package/lib/icon/icon.interface.d.ts +15 -12
- package/lib/icon-set/icon-set.service.d.ts +2 -5
- package/lib/shared/html-attr.directive.d.ts +5 -10
- package/package.json +1 -1
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import { Directive,
|
|
1
|
+
import { Directive, effect, ElementRef, inject, input, Renderer2 } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export class HtmlAttributesDirective {
|
|
4
|
-
constructor(
|
|
5
|
-
this.
|
|
6
|
-
this
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
this.cHtmlAttr = input();
|
|
6
|
+
this.#renderer = inject(Renderer2);
|
|
7
|
+
this.#elementRef = inject(ElementRef);
|
|
8
|
+
this.attrEffect = effect(() => {
|
|
9
|
+
const attribs = this.cHtmlAttr();
|
|
10
|
+
for (const attr in attribs) {
|
|
11
|
+
if (attr === 'style' && typeof attribs[attr] === 'object') {
|
|
12
|
+
this.setStyle(attribs[attr]);
|
|
13
|
+
}
|
|
14
|
+
else if (attr === 'class') {
|
|
15
|
+
this.addClass(attribs[attr]);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.setAttrib(attr, attribs[attr]);
|
|
19
|
+
}
|
|
19
20
|
}
|
|
20
|
-
}
|
|
21
|
+
});
|
|
21
22
|
}
|
|
23
|
+
#renderer;
|
|
24
|
+
#elementRef;
|
|
22
25
|
setStyle(styles) {
|
|
23
26
|
for (const style in styles) {
|
|
24
27
|
if (style) {
|
|
25
|
-
this
|
|
28
|
+
this.#renderer.setStyle(this.#elementRef.nativeElement, style, styles[style]);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -31,16 +34,16 @@ export class HtmlAttributesDirective {
|
|
|
31
34
|
classArray
|
|
32
35
|
.filter((element) => element.length > 0)
|
|
33
36
|
.forEach((element) => {
|
|
34
|
-
this
|
|
37
|
+
this.#renderer.addClass(this.#elementRef.nativeElement, element);
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
setAttrib(key, value) {
|
|
38
41
|
value !== null
|
|
39
|
-
? this
|
|
40
|
-
: this
|
|
42
|
+
? this.#renderer.setAttribute(this.#elementRef.nativeElement, key, value)
|
|
43
|
+
: this.#renderer.removeAttribute(this.#elementRef.nativeElement, key);
|
|
41
44
|
}
|
|
42
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, deps: [
|
|
43
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
46
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.9", type: HtmlAttributesDirective, isStandalone: true, selector: "[cHtmlAttr]", inputs: { cHtmlAttr: { classPropertyName: "cHtmlAttr", publicName: "cHtmlAttr", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cHtmlAttr"], ngImport: i0 }); }
|
|
44
47
|
}
|
|
45
48
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, decorators: [{
|
|
46
49
|
type: Directive,
|
|
@@ -49,7 +52,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
49
52
|
exportAs: 'cHtmlAttr',
|
|
50
53
|
standalone: true
|
|
51
54
|
}]
|
|
52
|
-
}]
|
|
53
|
-
|
|
54
|
-
}] } });
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHRtbC1hdHRyLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NvcmV1aS1pY29ucy1hbmd1bGFyL3NyYy9saWIvc2hhcmVkL2h0bWwtYXR0ci5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBYyxLQUFLLEVBQXFCLE1BQU0sZUFBZSxDQUFDOztBQU9oRixNQUFNLE9BQU8sdUJBQXVCO0lBR2xDLFlBQ1UsUUFBbUIsRUFDbkIsRUFBYztRQURkLGFBQVEsR0FBUixRQUFRLENBQVc7UUFDbkIsT0FBRSxHQUFGLEVBQUUsQ0FBWTtJQUNyQixDQUFDO0lBRUosUUFBUTtRQUNOLE1BQU0sT0FBTyxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUM7UUFDL0IsS0FBSyxNQUFNLElBQUksSUFBSSxPQUFPLEVBQUUsQ0FBQztZQUMzQixJQUFJLElBQUksS0FBSyxPQUFPLElBQUksT0FBTyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssUUFBUSxFQUFFLENBQUM7Z0JBQzFELElBQUksQ0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ional, SkipSelf, inject,
|
|
2
|
+
import { Injectable, NgModule, Optional, SkipSelf, inject, input, computed, Directive, Renderer2, ElementRef, effect, signal, viewChild, afterNextRender, Component } from '@angular/core';
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
4
|
import { NgClass } from '@angular/common';
|
|
5
5
|
|
|
6
6
|
class IconSetService {
|
|
7
|
-
constructor() {
|
|
8
|
-
this._iconNames = {};
|
|
9
|
-
this._icons = {};
|
|
10
|
-
}
|
|
11
7
|
get iconNames() {
|
|
12
|
-
return this
|
|
8
|
+
return this.#iconNames;
|
|
13
9
|
}
|
|
10
|
+
#iconNames = {};
|
|
14
11
|
get icons() {
|
|
15
|
-
return this
|
|
12
|
+
return this.#icons;
|
|
16
13
|
}
|
|
17
14
|
set icons(iconSet) {
|
|
18
15
|
for (const iconsKey in iconSet) {
|
|
19
|
-
this
|
|
16
|
+
this.#iconNames[iconsKey] = iconsKey;
|
|
20
17
|
}
|
|
21
|
-
this
|
|
18
|
+
this.#icons = iconSet;
|
|
22
19
|
}
|
|
20
|
+
#icons = {};
|
|
23
21
|
getIcon(name) {
|
|
24
22
|
const icon = this.icons[name];
|
|
25
23
|
if (!icon) {
|
|
@@ -76,83 +74,68 @@ function transformName(value) {
|
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
class IconDirective {
|
|
79
|
-
#elementRef;
|
|
80
|
-
#sanitizer;
|
|
81
|
-
#iconSet;
|
|
82
77
|
constructor() {
|
|
83
|
-
this.#elementRef = inject(ElementRef);
|
|
84
78
|
this.#sanitizer = inject(DomSanitizer);
|
|
85
79
|
this.#iconSet = inject(IconSetService);
|
|
86
|
-
this
|
|
87
|
-
this.
|
|
88
|
-
this
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
80
|
+
this.content = input(undefined, { alias: 'cIcon' });
|
|
81
|
+
this.customClasses = input();
|
|
82
|
+
this.size = input('');
|
|
83
|
+
this.title = input();
|
|
84
|
+
this.height = input();
|
|
85
|
+
this.width = input();
|
|
86
|
+
this.name = input('', { transform: transformName });
|
|
87
|
+
this.viewBoxInput = input(undefined, { alias: 'viewBox' });
|
|
88
|
+
this.xmlns = input('http://www.w3.org/2000/svg');
|
|
89
|
+
this.pointerEvents = input('none', { alias: 'pointer-events' });
|
|
90
|
+
this.role = input('img');
|
|
91
|
+
this.hostClasses = computed(() => {
|
|
92
|
+
const computedSize = this.computedSize();
|
|
93
|
+
const classes = {
|
|
94
|
+
icon: true,
|
|
95
|
+
[`icon-${computedSize}`]: !!computedSize
|
|
96
|
+
};
|
|
97
|
+
return this.customClasses() ?? classes;
|
|
98
|
+
});
|
|
99
|
+
this.viewBox = computed(() => {
|
|
100
|
+
return this.viewBoxInput() ?? this.scale();
|
|
101
|
+
});
|
|
93
102
|
this.innerHtml = computed(() => {
|
|
94
|
-
const
|
|
103
|
+
const codeVal = this.code();
|
|
104
|
+
const code = Array.isArray(codeVal) ? (codeVal?.[1] ?? codeVal?.[0] ?? '') : codeVal || '';
|
|
95
105
|
// todo proper sanitize
|
|
96
106
|
// const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
|
|
97
|
-
return this.#sanitizer.bypassSecurityTrustHtml(this
|
|
107
|
+
return this.#sanitizer.bypassSecurityTrustHtml(this.#titleCode() + code || '');
|
|
108
|
+
});
|
|
109
|
+
this.#titleCode = computed(() => {
|
|
110
|
+
return this.title() ? `<title>${this.title()}</title>` : '';
|
|
98
111
|
});
|
|
99
112
|
this.code = computed(() => {
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
const content = this.content();
|
|
114
|
+
if (content) {
|
|
115
|
+
return content;
|
|
102
116
|
}
|
|
103
|
-
|
|
104
|
-
|
|
117
|
+
const name = this.name();
|
|
118
|
+
if (this.#iconSet && name) {
|
|
119
|
+
return this.#iconSet.getIcon(name);
|
|
105
120
|
}
|
|
106
|
-
if (
|
|
107
|
-
console.warn(`cIcon directive: The '${
|
|
121
|
+
if (name && !this.#iconSet?.icons[name]) {
|
|
122
|
+
console.warn(`cIcon directive: The '${name}' icon not found. Add it to the IconSet service for use with the 'name' property. \n`, name);
|
|
108
123
|
}
|
|
109
124
|
return '';
|
|
110
125
|
});
|
|
111
126
|
this.scale = computed(() => {
|
|
112
127
|
return Array.isArray(this.code()) && (this.code()?.length ?? 0) > 1 ? `0 0 ${this.code()?.[0]}` : '0 0 64 64';
|
|
113
128
|
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
129
|
+
this.computedSize = computed(() => {
|
|
130
|
+
const addCustom = !this.size() && (this.width() || this.height());
|
|
131
|
+
return this.size() === 'custom' || addCustom ? 'custom-size' : this.size();
|
|
118
132
|
});
|
|
119
133
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
#content;
|
|
124
|
-
set name(value) {
|
|
125
|
-
this.#name.set(value);
|
|
126
|
-
}
|
|
127
|
-
get name() {
|
|
128
|
-
return this.#name();
|
|
129
|
-
}
|
|
130
|
-
#name;
|
|
131
|
-
set viewBox(viewBox) {
|
|
132
|
-
this._viewBox = viewBox;
|
|
133
|
-
}
|
|
134
|
-
get viewBox() {
|
|
135
|
-
return this._viewBox ?? this.scale();
|
|
136
|
-
}
|
|
137
|
-
get hostClasses() {
|
|
138
|
-
return this.computedClasses;
|
|
139
|
-
}
|
|
140
|
-
get titleCode() {
|
|
141
|
-
return this.title ? `<title>${this.title}</title>` : '';
|
|
142
|
-
}
|
|
143
|
-
get computedSize() {
|
|
144
|
-
const addCustom = !this.size && (this.width || this.height);
|
|
145
|
-
return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
|
|
146
|
-
}
|
|
147
|
-
get computedClasses() {
|
|
148
|
-
const classes = {
|
|
149
|
-
icon: true,
|
|
150
|
-
[`icon-${this.computedSize}`]: !!this.computedSize
|
|
151
|
-
};
|
|
152
|
-
return this.customClasses ?? classes;
|
|
153
|
-
}
|
|
134
|
+
#sanitizer;
|
|
135
|
+
#iconSet;
|
|
136
|
+
#titleCode;
|
|
154
137
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
155
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
138
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.9", type: IconDirective, isStandalone: true, selector: "svg[cIcon]", inputs: { content: { classPropertyName: "content", publicName: "cIcon", isSignal: true, isRequired: false, transformFunction: null }, customClasses: { classPropertyName: "customClasses", publicName: "customClasses", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, viewBoxInput: { classPropertyName: "viewBoxInput", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null }, xmlns: { classPropertyName: "xmlns", publicName: "xmlns", isSignal: true, isRequired: false, transformFunction: null }, pointerEvents: { classPropertyName: "pointerEvents", publicName: "pointer-events", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "ngSkipHydration": "true" }, properties: { "innerHtml": "innerHtml()", "class": "hostClasses()", "attr.viewBox": "viewBox()", "attr.xmlns": "xmlns()", "attr.pointer-events": "pointerEvents()", "attr.role": "role()", "attr.aria-hidden": "true" } }, exportAs: ["cIcon"], ngImport: i0 }); }
|
|
156
139
|
}
|
|
157
140
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconDirective, decorators: [{
|
|
158
141
|
type: Directive,
|
|
@@ -160,76 +143,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
160
143
|
exportAs: 'cIcon',
|
|
161
144
|
selector: 'svg[cIcon]',
|
|
162
145
|
standalone: true,
|
|
163
|
-
host: {
|
|
146
|
+
host: {
|
|
147
|
+
ngSkipHydration: 'true',
|
|
148
|
+
'[innerHtml]': 'innerHtml()',
|
|
149
|
+
'[class]': 'hostClasses()',
|
|
150
|
+
'[attr.viewBox]': 'viewBox()',
|
|
151
|
+
'[attr.xmlns]': 'xmlns()',
|
|
152
|
+
'[attr.pointer-events]': 'pointerEvents()',
|
|
153
|
+
'[attr.role]': 'role()',
|
|
154
|
+
'[attr.aria-hidden]': 'true'
|
|
155
|
+
}
|
|
164
156
|
}]
|
|
165
|
-
}]
|
|
166
|
-
type: Input,
|
|
167
|
-
args: ['cIcon']
|
|
168
|
-
}], customClasses: [{
|
|
169
|
-
type: Input
|
|
170
|
-
}], size: [{
|
|
171
|
-
type: Input
|
|
172
|
-
}], title: [{
|
|
173
|
-
type: Input
|
|
174
|
-
}], height: [{
|
|
175
|
-
type: Input
|
|
176
|
-
}], width: [{
|
|
177
|
-
type: Input
|
|
178
|
-
}], name: [{
|
|
179
|
-
type: Input,
|
|
180
|
-
args: [{ transform: transformName }]
|
|
181
|
-
}], viewBox: [{
|
|
182
|
-
type: HostBinding,
|
|
183
|
-
args: ['attr.viewBox']
|
|
184
|
-
}, {
|
|
185
|
-
type: Input
|
|
186
|
-
}], ariaHidden: [{
|
|
187
|
-
type: HostBinding,
|
|
188
|
-
args: ['attr.aria-hidden']
|
|
189
|
-
}], xmlns: [{
|
|
190
|
-
type: HostBinding,
|
|
191
|
-
args: ['attr.xmlns']
|
|
192
|
-
}, {
|
|
193
|
-
type: Input
|
|
194
|
-
}], pointerEvents: [{
|
|
195
|
-
type: HostBinding,
|
|
196
|
-
args: ['attr.pointer-events']
|
|
197
|
-
}, {
|
|
198
|
-
type: Input,
|
|
199
|
-
args: ['pointer-events']
|
|
200
|
-
}], role: [{
|
|
201
|
-
type: HostBinding,
|
|
202
|
-
args: ['attr.role']
|
|
203
|
-
}, {
|
|
204
|
-
type: Input
|
|
205
|
-
}], hostClasses: [{
|
|
206
|
-
type: HostBinding,
|
|
207
|
-
args: ['class']
|
|
208
|
-
}] } });
|
|
157
|
+
}] });
|
|
209
158
|
|
|
210
159
|
class HtmlAttributesDirective {
|
|
211
|
-
constructor(
|
|
212
|
-
this.
|
|
213
|
-
this
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
160
|
+
constructor() {
|
|
161
|
+
this.cHtmlAttr = input();
|
|
162
|
+
this.#renderer = inject(Renderer2);
|
|
163
|
+
this.#elementRef = inject(ElementRef);
|
|
164
|
+
this.attrEffect = effect(() => {
|
|
165
|
+
const attribs = this.cHtmlAttr();
|
|
166
|
+
for (const attr in attribs) {
|
|
167
|
+
if (attr === 'style' && typeof attribs[attr] === 'object') {
|
|
168
|
+
this.setStyle(attribs[attr]);
|
|
169
|
+
}
|
|
170
|
+
else if (attr === 'class') {
|
|
171
|
+
this.addClass(attribs[attr]);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.setAttrib(attr, attribs[attr]);
|
|
175
|
+
}
|
|
226
176
|
}
|
|
227
|
-
}
|
|
177
|
+
});
|
|
228
178
|
}
|
|
179
|
+
#renderer;
|
|
180
|
+
#elementRef;
|
|
229
181
|
setStyle(styles) {
|
|
230
182
|
for (const style in styles) {
|
|
231
183
|
if (style) {
|
|
232
|
-
this
|
|
184
|
+
this.#renderer.setStyle(this.#elementRef.nativeElement, style, styles[style]);
|
|
233
185
|
}
|
|
234
186
|
}
|
|
235
187
|
}
|
|
@@ -238,16 +190,16 @@ class HtmlAttributesDirective {
|
|
|
238
190
|
classArray
|
|
239
191
|
.filter((element) => element.length > 0)
|
|
240
192
|
.forEach((element) => {
|
|
241
|
-
this
|
|
193
|
+
this.#renderer.addClass(this.#elementRef.nativeElement, element);
|
|
242
194
|
});
|
|
243
195
|
}
|
|
244
196
|
setAttrib(key, value) {
|
|
245
197
|
value !== null
|
|
246
|
-
? this
|
|
247
|
-
: this
|
|
198
|
+
? this.#renderer.setAttribute(this.#elementRef.nativeElement, key, value)
|
|
199
|
+
: this.#renderer.removeAttribute(this.#elementRef.nativeElement, key);
|
|
248
200
|
}
|
|
249
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, deps: [
|
|
250
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
201
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
202
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.9", type: HtmlAttributesDirective, isStandalone: true, selector: "[cHtmlAttr]", inputs: { cHtmlAttr: { classPropertyName: "cHtmlAttr", publicName: "cHtmlAttr", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cHtmlAttr"], ngImport: i0 }); }
|
|
251
203
|
}
|
|
252
204
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, decorators: [{
|
|
253
205
|
type: Directive,
|
|
@@ -256,120 +208,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
|
|
|
256
208
|
exportAs: 'cHtmlAttr',
|
|
257
209
|
standalone: true
|
|
258
210
|
}]
|
|
259
|
-
}]
|
|
260
|
-
type: Input
|
|
261
|
-
}] } });
|
|
211
|
+
}] });
|
|
262
212
|
|
|
263
213
|
class IconComponent {
|
|
264
214
|
#renderer;
|
|
265
215
|
#elementRef;
|
|
266
216
|
#sanitizer;
|
|
267
217
|
#iconSet;
|
|
218
|
+
#hostElement;
|
|
268
219
|
constructor() {
|
|
269
220
|
this.#renderer = inject(Renderer2);
|
|
270
221
|
this.#elementRef = inject(ElementRef);
|
|
271
222
|
this.#sanitizer = inject(DomSanitizer);
|
|
272
223
|
this.#iconSet = inject(IconSetService);
|
|
273
|
-
this.#
|
|
274
|
-
this.
|
|
275
|
-
this.
|
|
276
|
-
this.
|
|
277
|
-
this
|
|
224
|
+
this.#hostElement = signal(undefined);
|
|
225
|
+
this.content = input();
|
|
226
|
+
this.attributes = input({ role: 'img' });
|
|
227
|
+
this.customClasses = input();
|
|
228
|
+
this.size = input('');
|
|
229
|
+
this.title = input();
|
|
230
|
+
this.use = input('');
|
|
231
|
+
this.height = input();
|
|
232
|
+
this.width = input();
|
|
233
|
+
this.name = input('', { transform: transformName });
|
|
234
|
+
this.viewBoxInput = input(undefined, { alias: 'viewBox' });
|
|
235
|
+
this.svgElementRef = viewChild('svgElement');
|
|
236
|
+
this.svgElementEffect = effect(() => {
|
|
237
|
+
const svgElementRef = this.svgElementRef();
|
|
238
|
+
const hostElement = this.#hostElement()?.nativeElement;
|
|
239
|
+
if (svgElementRef && hostElement) {
|
|
240
|
+
const svgElement = svgElementRef.nativeElement;
|
|
241
|
+
hostElement.classList?.values()?.forEach((item) => {
|
|
242
|
+
this.#renderer.addClass(svgElement, item);
|
|
243
|
+
});
|
|
244
|
+
const parentElement = this.#renderer.parentNode(hostElement);
|
|
245
|
+
this.#renderer.insertBefore(parentElement, svgElement, hostElement);
|
|
246
|
+
this.#renderer.removeChild(parentElement, hostElement);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
this.viewBox = computed(() => {
|
|
250
|
+
return this.viewBoxInput() ?? this.scale();
|
|
251
|
+
});
|
|
278
252
|
this.innerHtml = computed(() => {
|
|
279
|
-
const
|
|
253
|
+
const codeVal = this.code();
|
|
254
|
+
const code = Array.isArray(codeVal) ? (codeVal?.[1] ?? codeVal?.[0] ?? '') : codeVal || '';
|
|
280
255
|
// todo proper sanitize
|
|
281
256
|
// const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
|
|
282
|
-
return this.#sanitizer.bypassSecurityTrustHtml(this
|
|
257
|
+
return this.#sanitizer.bypassSecurityTrustHtml(this.#titleCode() + code || '');
|
|
258
|
+
});
|
|
259
|
+
this.#titleCode = computed(() => {
|
|
260
|
+
return this.title() ? `<title>${this.title()}</title>` : '';
|
|
283
261
|
});
|
|
284
262
|
this.code = computed(() => {
|
|
285
|
-
|
|
286
|
-
|
|
263
|
+
const content = this.content();
|
|
264
|
+
if (content) {
|
|
265
|
+
return content;
|
|
287
266
|
}
|
|
288
|
-
|
|
289
|
-
|
|
267
|
+
const name = this.name();
|
|
268
|
+
if (this.#iconSet && name) {
|
|
269
|
+
return this.#iconSet.getIcon(name);
|
|
290
270
|
}
|
|
291
|
-
if (
|
|
292
|
-
console.warn(`c-icon component:
|
|
293
|
-
`To use icon by 'name' prop you need to add it to IconSet service. \n`, this.#name());
|
|
271
|
+
if (name && !this.#iconSet?.icons[name]) {
|
|
272
|
+
console.warn(`c-icon component: The '${name}' icon not found. Add it to the IconSet service for use with the 'name' property. \n`, name);
|
|
294
273
|
}
|
|
295
274
|
return '';
|
|
296
275
|
});
|
|
297
276
|
this.scale = computed(() => {
|
|
298
|
-
return Array.isArray(this.code()) && this.code()
|
|
277
|
+
return Array.isArray(this.code()) && (this.code()?.length ?? 0) > 1 ? `0 0 ${this.code()?.[0]}` : '0 0 64 64';
|
|
299
278
|
});
|
|
300
|
-
this
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
set viewBox(viewBox) {
|
|
314
|
-
this._viewBox = viewBox;
|
|
315
|
-
}
|
|
316
|
-
get viewBox() {
|
|
317
|
-
return this._viewBox ?? this.scale();
|
|
318
|
-
}
|
|
319
|
-
ngAfterViewInit() {
|
|
320
|
-
this.#elementRef.nativeElement.classList.forEach((item) => {
|
|
321
|
-
this.#renderer.addClass(this.svgElementRef.nativeElement, item);
|
|
279
|
+
this.computedSize = computed(() => {
|
|
280
|
+
const addCustom = !this.size() && (this.width() || this.height());
|
|
281
|
+
return this.size() === 'custom' || addCustom ? 'custom-size' : this.size();
|
|
282
|
+
});
|
|
283
|
+
this.computedClasses = computed(() => {
|
|
284
|
+
const classes = {
|
|
285
|
+
icon: true,
|
|
286
|
+
[`icon-${this.computedSize()}`]: !!this.computedSize()
|
|
287
|
+
};
|
|
288
|
+
return this.customClasses() ?? classes;
|
|
289
|
+
});
|
|
290
|
+
afterNextRender(() => {
|
|
291
|
+
this.#hostElement.set(this.#elementRef);
|
|
322
292
|
});
|
|
323
|
-
const parentElement = this.#renderer.parentNode(this.#elementRef.nativeElement);
|
|
324
|
-
const svgElement = this.svgElementRef.nativeElement;
|
|
325
|
-
this.#renderer.insertBefore(parentElement, svgElement, this.#elementRef.nativeElement);
|
|
326
|
-
this.#renderer.removeChild(parentElement, this.#elementRef.nativeElement);
|
|
327
|
-
}
|
|
328
|
-
get titleCode() {
|
|
329
|
-
return this.title ? `<title>${this.title}</title>` : '';
|
|
330
|
-
}
|
|
331
|
-
get computedSize() {
|
|
332
|
-
const addCustom = !this.size && (this.width || this.height);
|
|
333
|
-
return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
|
|
334
|
-
}
|
|
335
|
-
get computedClasses() {
|
|
336
|
-
const classes = {
|
|
337
|
-
icon: true,
|
|
338
|
-
[`icon-${this.computedSize}`]: !!this.computedSize
|
|
339
|
-
};
|
|
340
|
-
return this.customClasses ?? classes;
|
|
341
293
|
}
|
|
294
|
+
#titleCode;
|
|
342
295
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
343
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.9", type: IconComponent, isStandalone: true, selector: "c-icon", inputs: { content: "content", attributes: "attributes", customClasses: "customClasses", size: "size", title: "title", use: "use", height: "height", width: "width", name:
|
|
296
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.9", type: IconComponent, isStandalone: true, selector: "c-icon", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, attributes: { classPropertyName: "attributes", publicName: "attributes", isSignal: true, isRequired: false, transformFunction: null }, customClasses: { classPropertyName: "customClasses", publicName: "customClasses", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, use: { classPropertyName: "use", publicName: "use", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, viewBoxInput: { classPropertyName: "viewBoxInput", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "ngSkipHydration": "true" }, styleAttribute: "display: none" }, viewQueries: [{ propertyName: "svgElementRef", first: true, predicate: ["svgElement"], descendants: true, isSignal: true }], exportAs: ["cIconComponent"], ngImport: i0, template: "@if (!use() && !!code()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width()\"\n [attr.height]=\"height() || width()\"\n [attr.viewBox]=\"viewBox() ?? scale()\"\n [innerHtml]=\"innerHtml()\"\n [ngClass]=\"computedClasses()\"\n [cHtmlAttr]=\"attributes()\"\n aria-hidden=\"true\"\n pointer-events=\"none\"\n role=\"img\"\n #svgElement\n >\n </svg>\n} @else if (use()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width()\"\n [attr.height]=\"height() || width()\"\n [ngClass]=\"computedClasses()\"\n [cHtmlAttr]=\"attributes()\"\n aria-hidden=\"true\"\n pointer-events=\"none\"\n role=\"img\"\n #svgElement\n >\n <use [attr.href]=\"use()\"></use>\n </svg>\n}\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: HtmlAttributesDirective, selector: "[cHtmlAttr]", inputs: ["cHtmlAttr"], exportAs: ["cHtmlAttr"] }] }); }
|
|
344
297
|
}
|
|
345
298
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconComponent, decorators: [{
|
|
346
299
|
type: Component,
|
|
347
|
-
args: [{ exportAs: 'cIconComponent', imports: [NgClass, HtmlAttributesDirective], selector: 'c-icon', standalone: true, host: { ngSkipHydration: 'true' }, template: "@if (!use && !!code) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width\"\n [attr.height]=\"height || width\"\n [attr.viewBox]=\"viewBox\"\n [innerHtml]=\"innerHtml()\"\n [ngClass]=\"computedClasses\"\n [cHtmlAttr]=\"attributes\"\n aria-hidden=\"true\"\n pointer-events=\"none\"\n role=\"img\"\n #svgElement\n >\n </svg>\n} @else if (use) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width\"\n [attr.height]=\"height || width\"\n [ngClass]=\"computedClasses\"\n [cHtmlAttr]=\"attributes\"\n aria-hidden=\"true\"\n pointer-events=\"none\"\n role=\"img\"\n #svgElement\n >\n <use [attr.href]=\"use\"></use>\n </svg>\n}\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"] }]
|
|
348
|
-
}], ctorParameters: () => []
|
|
349
|
-
type: Input
|
|
350
|
-
}], attributes: [{
|
|
351
|
-
type: Input
|
|
352
|
-
}], customClasses: [{
|
|
353
|
-
type: Input
|
|
354
|
-
}], size: [{
|
|
355
|
-
type: Input
|
|
356
|
-
}], title: [{
|
|
357
|
-
type: Input
|
|
358
|
-
}], use: [{
|
|
359
|
-
type: Input
|
|
360
|
-
}], height: [{
|
|
361
|
-
type: Input
|
|
362
|
-
}], width: [{
|
|
363
|
-
type: Input
|
|
364
|
-
}], name: [{
|
|
365
|
-
type: Input,
|
|
366
|
-
args: [{ transform: transformName }]
|
|
367
|
-
}], viewBox: [{
|
|
368
|
-
type: Input
|
|
369
|
-
}], svgElementRef: [{
|
|
370
|
-
type: ViewChild,
|
|
371
|
-
args: ['svgElement', { read: ElementRef }]
|
|
372
|
-
}] } });
|
|
300
|
+
args: [{ exportAs: 'cIconComponent', imports: [NgClass, HtmlAttributesDirective], selector: 'c-icon', standalone: true, host: { ngSkipHydration: 'true', style: 'display: none' }, template: "@if (!use() && !!code()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width()\"\n [attr.height]=\"height() || width()\"\n [attr.viewBox]=\"viewBox() ?? scale()\"\n [innerHtml]=\"innerHtml()\"\n [ngClass]=\"computedClasses()\"\n [cHtmlAttr]=\"attributes()\"\n aria-hidden=\"true\"\n pointer-events=\"none\"\n role=\"img\"\n #svgElement\n >\n </svg>\n} @else if (use()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width()\"\n [attr.height]=\"height() || width()\"\n [ngClass]=\"computedClasses()\"\n [cHtmlAttr]=\"attributes()\"\n aria-hidden=\"true\"\n pointer-events=\"none\"\n role=\"img\"\n #svgElement\n >\n <use [attr.href]=\"use()\"></use>\n </svg>\n}\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"] }]
|
|
301
|
+
}], ctorParameters: () => [] });
|
|
373
302
|
|
|
374
303
|
class IconModule {
|
|
375
304
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|