@coreui/icons-angular 5.2.21 → 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.
@@ -1,25 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, NgModule, Optional, SkipSelf, inject, ElementRef, signal, computed, afterNextRender, Directive, Input, HostBinding, Renderer2, Component, ViewChild } from '@angular/core';
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._iconNames;
8
+ return this.#iconNames;
13
9
  }
10
+ #iconNames = {};
14
11
  get icons() {
15
- return this._icons;
12
+ return this.#icons;
16
13
  }
17
14
  set icons(iconSet) {
18
15
  for (const iconsKey in iconSet) {
19
- this._iconNames[iconsKey] = iconsKey;
16
+ this.#iconNames[iconsKey] = iconsKey;
20
17
  }
21
- this._icons = iconSet;
18
+ this.#icons = iconSet;
22
19
  }
20
+ #icons = {};
23
21
  getIcon(name) {
24
22
  const icon = this.icons[name];
25
23
  if (!icon) {
@@ -27,10 +25,10 @@ class IconSetService {
27
25
  }
28
26
  return this.icons[name];
29
27
  }
30
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconSetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
31
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconSetService, providedIn: 'root' }); }
28
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconSetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
29
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconSetService, providedIn: 'root' }); }
32
30
  }
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconSetService, decorators: [{
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconSetService, decorators: [{
34
32
  type: Injectable,
35
33
  args: [{
36
34
  providedIn: 'root'
@@ -51,11 +49,11 @@ class IconSetModule {
51
49
  ]
52
50
  };
53
51
  }
54
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconSetModule, deps: [{ token: IconSetModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
55
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: IconSetModule }); }
56
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconSetModule, providers: [IconSetService] }); }
52
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconSetModule, deps: [{ token: IconSetModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
53
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: IconSetModule }); }
54
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconSetModule, providers: [IconSetService] }); }
57
55
  }
58
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconSetModule, decorators: [{
56
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconSetModule, decorators: [{
59
57
  type: NgModule,
60
58
  args: [{
61
59
  providers: [IconSetService]
@@ -76,166 +74,114 @@ 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.#content = signal('');
87
- this.size = '';
88
- this.#name = signal('');
89
- this.ariaHidden = true;
90
- this.xmlns = 'http://www.w3.org/2000/svg';
91
- this.pointerEvents = 'none';
92
- this.role = 'img';
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 code = Array.isArray(this.code()) ? this.code()[1] ?? this.code()[0] ?? '' : this.code() || '';
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.titleCode + code || '');
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
- if (this.#content()) {
101
- return this.#content();
113
+ const content = this.content();
114
+ if (content) {
115
+ return content;
102
116
  }
103
- if (this.#iconSet && this.#name()) {
104
- return this.#iconSet.getIcon(this.#name());
117
+ const name = this.name();
118
+ if (this.#iconSet && name) {
119
+ return this.#iconSet.getIcon(name);
105
120
  }
106
- if (this.#name() && !this.#iconSet?.icons[this.#name()]) {
107
- console.warn(`c-icon component: icon name '${this.#name()}' does not exist for IconSet service. ` +
108
- `To use icon by 'name' prop you need to add it to IconSet service. \n`, this.#name());
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);
109
123
  }
110
124
  return '';
111
125
  });
112
126
  this.scale = computed(() => {
113
- return Array.isArray(this.code()) && this.code().length > 1 ? `0 0 ${this.code()[0]}` : '0 0 64 64';
127
+ return Array.isArray(this.code()) && (this.code()?.length ?? 0) > 1 ? `0 0 ${this.code()?.[0]}` : '0 0 64 64';
114
128
  });
115
- afterNextRender({
116
- write: () => {
117
- this.#elementRef.nativeElement.innerHTML = this.innerHtml();
118
- }
129
+ this.computedSize = computed(() => {
130
+ const addCustom = !this.size() && (this.width() || this.height());
131
+ return this.size() === 'custom' || addCustom ? 'custom-size' : this.size();
119
132
  });
120
133
  }
121
- set content(value) {
122
- this.#content.set(value);
123
- }
124
- #content;
125
- set name(value) {
126
- this.#name.set(value);
127
- }
128
- get name() {
129
- return this.#name();
130
- }
131
- #name;
132
- set viewBox(viewBox) {
133
- this._viewBox = viewBox;
134
- }
135
- get viewBox() {
136
- return this._viewBox ?? this.scale();
137
- }
138
- get hostClasses() {
139
- return this.computedClasses;
140
- }
141
- get bindInnerHtml() {
142
- return this.innerHtml();
143
- }
144
- get titleCode() {
145
- return this.title ? `<title>${this.title}</title>` : '';
146
- }
147
- get computedSize() {
148
- const addCustom = !this.size && (this.width || this.height);
149
- return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
150
- }
151
- get computedClasses() {
152
- const classes = {
153
- icon: true,
154
- [`icon-${this.computedSize}`]: !!this.computedSize
155
- };
156
- return this.customClasses ?? classes;
157
- }
158
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
159
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.8", type: IconDirective, isStandalone: true, selector: "svg[cIcon]", inputs: { content: ["cIcon", "content"], customClasses: "customClasses", size: "size", title: "title", height: "height", width: "width", name: ["name", "name", transformName], viewBox: "viewBox", xmlns: "xmlns", pointerEvents: ["pointer-events", "pointerEvents"], role: "role" }, host: { properties: { "attr.viewBox": "this.viewBox", "attr.aria-hidden": "this.ariaHidden", "attr.xmlns": "this.xmlns", "attr.pointer-events": "this.pointerEvents", "attr.role": "this.role", "class": "this.hostClasses", "innerHtml": "this.bindInnerHtml" } }, exportAs: ["cIcon"], ngImport: i0 }); }
134
+ #sanitizer;
135
+ #iconSet;
136
+ #titleCode;
137
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
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 }); }
160
139
  }
161
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconDirective, decorators: [{
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconDirective, decorators: [{
162
141
  type: Directive,
163
142
  args: [{
164
143
  exportAs: 'cIcon',
165
144
  selector: 'svg[cIcon]',
166
- standalone: true
145
+ standalone: true,
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
+ }
167
156
  }]
168
- }], ctorParameters: () => [], propDecorators: { content: [{
169
- type: Input,
170
- args: ['cIcon']
171
- }], customClasses: [{
172
- type: Input
173
- }], size: [{
174
- type: Input
175
- }], title: [{
176
- type: Input
177
- }], height: [{
178
- type: Input
179
- }], width: [{
180
- type: Input
181
- }], name: [{
182
- type: Input,
183
- args: [{ transform: transformName }]
184
- }], viewBox: [{
185
- type: HostBinding,
186
- args: ['attr.viewBox']
187
- }, {
188
- type: Input
189
- }], ariaHidden: [{
190
- type: HostBinding,
191
- args: ['attr.aria-hidden']
192
- }], xmlns: [{
193
- type: HostBinding,
194
- args: ['attr.xmlns']
195
- }, {
196
- type: Input
197
- }], pointerEvents: [{
198
- type: HostBinding,
199
- args: ['attr.pointer-events']
200
- }, {
201
- type: Input,
202
- args: ['pointer-events']
203
- }], role: [{
204
- type: HostBinding,
205
- args: ['attr.role']
206
- }, {
207
- type: Input
208
- }], hostClasses: [{
209
- type: HostBinding,
210
- args: ['class']
211
- }], bindInnerHtml: [{
212
- type: HostBinding,
213
- args: ['innerHtml']
214
- }] } });
157
+ }] });
215
158
 
216
159
  class HtmlAttributesDirective {
217
- constructor(renderer, el) {
218
- this.renderer = renderer;
219
- this.el = el;
220
- }
221
- ngOnInit() {
222
- const attribs = this.cHtmlAttr;
223
- for (const attr in attribs) {
224
- if (attr === 'style' && typeof attribs[attr] === 'object') {
225
- this.setStyle(attribs[attr]);
226
- }
227
- else if (attr === 'class') {
228
- this.addClass(attribs[attr]);
229
- }
230
- else {
231
- this.setAttrib(attr, attribs[attr]);
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
+ }
232
176
  }
233
- }
177
+ });
234
178
  }
179
+ #renderer;
180
+ #elementRef;
235
181
  setStyle(styles) {
236
182
  for (const style in styles) {
237
183
  if (style) {
238
- this.renderer.setStyle(this.el.nativeElement, style, styles[style]);
184
+ this.#renderer.setStyle(this.#elementRef.nativeElement, style, styles[style]);
239
185
  }
240
186
  }
241
187
  }
@@ -244,147 +190,124 @@ class HtmlAttributesDirective {
244
190
  classArray
245
191
  .filter((element) => element.length > 0)
246
192
  .forEach((element) => {
247
- this.renderer.addClass(this.el.nativeElement, element);
193
+ this.#renderer.addClass(this.#elementRef.nativeElement, element);
248
194
  });
249
195
  }
250
196
  setAttrib(key, value) {
251
197
  value !== null
252
- ? this.renderer.setAttribute(this.el.nativeElement, key, value)
253
- : this.renderer.removeAttribute(this.el.nativeElement, key);
198
+ ? this.#renderer.setAttribute(this.#elementRef.nativeElement, key, value)
199
+ : this.#renderer.removeAttribute(this.#elementRef.nativeElement, key);
254
200
  }
255
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: HtmlAttributesDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
256
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.8", type: HtmlAttributesDirective, isStandalone: true, selector: "[cHtmlAttr]", inputs: { cHtmlAttr: "cHtmlAttr" }, exportAs: ["cHtmlAttr"], ngImport: i0 }); }
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 }); }
257
203
  }
258
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: HtmlAttributesDirective, decorators: [{
204
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: HtmlAttributesDirective, decorators: [{
259
205
  type: Directive,
260
206
  args: [{
261
207
  selector: '[cHtmlAttr]',
262
208
  exportAs: 'cHtmlAttr',
263
209
  standalone: true
264
210
  }]
265
- }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { cHtmlAttr: [{
266
- type: Input
267
- }] } });
211
+ }] });
268
212
 
269
213
  class IconComponent {
270
214
  #renderer;
271
215
  #elementRef;
272
216
  #sanitizer;
273
217
  #iconSet;
218
+ #hostElement;
274
219
  constructor() {
275
220
  this.#renderer = inject(Renderer2);
276
221
  this.#elementRef = inject(ElementRef);
277
222
  this.#sanitizer = inject(DomSanitizer);
278
223
  this.#iconSet = inject(IconSetService);
279
- this.#content = signal('');
280
- this.attributes = { role: 'img' };
281
- this.size = '';
282
- this.use = '';
283
- this.#name = signal('');
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
+ });
284
252
  this.innerHtml = computed(() => {
285
- const code = Array.isArray(this.code()) ? (this.code()[1] ?? this.code()[0] ?? '') : this.code() || '';
253
+ const codeVal = this.code();
254
+ const code = Array.isArray(codeVal) ? (codeVal?.[1] ?? codeVal?.[0] ?? '') : codeVal || '';
286
255
  // todo proper sanitize
287
256
  // const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
288
- return this.#sanitizer.bypassSecurityTrustHtml(this.titleCode + code || '');
257
+ return this.#sanitizer.bypassSecurityTrustHtml(this.#titleCode() + code || '');
258
+ });
259
+ this.#titleCode = computed(() => {
260
+ return this.title() ? `<title>${this.title()}</title>` : '';
289
261
  });
290
262
  this.code = computed(() => {
291
- if (this.#content()) {
292
- return this.#content();
263
+ const content = this.content();
264
+ if (content) {
265
+ return content;
293
266
  }
294
- if (this.#iconSet && this.#name()) {
295
- return this.#iconSet.getIcon(this.#name());
267
+ const name = this.name();
268
+ if (this.#iconSet && name) {
269
+ return this.#iconSet.getIcon(name);
296
270
  }
297
- if (this.#name() && !this.#iconSet?.icons[this.#name()]) {
298
- console.warn(`c-icon component: icon name '${this.#name()}' does not exist for IconSet service. ` +
299
- `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);
300
273
  }
301
274
  return '';
302
275
  });
303
276
  this.scale = computed(() => {
304
- return Array.isArray(this.code()) && this.code().length > 1 ? `0 0 ${this.code()[0]}` : '0 0 64 64';
277
+ return Array.isArray(this.code()) && (this.code()?.length ?? 0) > 1 ? `0 0 ${this.code()?.[0]}` : '0 0 64 64';
305
278
  });
306
- this.#renderer.setStyle(this.#elementRef.nativeElement, 'display', 'none');
307
- }
308
- set content(value) {
309
- this.#content.set(value);
310
- }
311
- #content;
312
- set name(value) {
313
- this.#name.set(value);
314
- }
315
- get name() {
316
- return this.#name();
317
- }
318
- #name;
319
- set viewBox(viewBox) {
320
- this._viewBox = viewBox;
321
- }
322
- get viewBox() {
323
- return this._viewBox ?? this.scale();
324
- }
325
- ngAfterViewInit() {
326
- this.#elementRef.nativeElement.classList.forEach((item) => {
327
- 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);
328
292
  });
329
- const parentElement = this.#renderer.parentNode(this.#elementRef.nativeElement);
330
- const svgElement = this.svgElementRef.nativeElement;
331
- this.#renderer.insertBefore(parentElement, svgElement, this.#elementRef.nativeElement);
332
- this.#renderer.removeChild(parentElement, this.#elementRef.nativeElement);
333
- }
334
- get titleCode() {
335
- return this.title ? `<title>${this.title}</title>` : '';
336
- }
337
- get computedSize() {
338
- const addCustom = !this.size && (this.width || this.height);
339
- return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
340
- }
341
- get computedClasses() {
342
- const classes = {
343
- icon: true,
344
- [`icon-${this.computedSize}`]: !!this.computedSize
345
- };
346
- return this.customClasses ?? classes;
347
293
  }
348
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
349
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.8", 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: ["name", "name", transformName], viewBox: "viewBox" }, host: { attributes: { "ngSkipHydration": "true" } }, viewQueries: [{ propertyName: "svgElementRef", first: true, predicate: ["svgElement"], descendants: true, read: ElementRef }], 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\"\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"] }] }); }
294
+ #titleCode;
295
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
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"] }] }); }
350
297
  }
351
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconComponent, decorators: [{
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconComponent, decorators: [{
352
299
  type: Component,
353
- 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"] }]
354
- }], ctorParameters: () => [], propDecorators: { content: [{
355
- type: Input
356
- }], attributes: [{
357
- type: Input
358
- }], customClasses: [{
359
- type: Input
360
- }], size: [{
361
- type: Input
362
- }], title: [{
363
- type: Input
364
- }], use: [{
365
- type: Input
366
- }], height: [{
367
- type: Input
368
- }], width: [{
369
- type: Input
370
- }], name: [{
371
- type: Input,
372
- args: [{ transform: transformName }]
373
- }], viewBox: [{
374
- type: Input
375
- }], svgElementRef: [{
376
- type: ViewChild,
377
- args: ['svgElement', { read: ElementRef }]
378
- }] } });
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: () => [] });
379
302
 
380
303
  class IconModule {
381
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
382
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: IconModule, imports: [IconComponent,
304
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
305
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: IconModule, imports: [IconComponent,
383
306
  IconDirective], exports: [IconComponent,
384
307
  IconDirective] }); }
385
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconModule }); }
308
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconModule }); }
386
309
  }
387
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: IconModule, decorators: [{
310
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: IconModule, decorators: [{
388
311
  type: NgModule,
389
312
  args: [{
390
313
  imports: [