@ngxi/simple-icons 0.12.19 → 0.12.21

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
3
- import { isPlatformServer } from "@angular/common";
2
+ import { inject, input, computed, Directive } from "@angular/core";
3
+ import { DomSanitizer } from "@angular/platform-browser";
4
4
  const simpleIcons42 = {
5
5
  "body": '<path fill="currentColor" d="M19.581 16.851H24v-4.439ZM24 3.574h-4.419v4.42l-4.419 4.418v4.44h4.419v-4.44L24 7.993Zm-4.419 0h-4.419v4.42zm-6.324 8.838H4.419l8.838-8.838H8.838L0 12.412v3.595h8.838v4.419h4.419z"/>',
6
6
  "width": 24,
@@ -21573,44 +21573,24 @@ const simpleIconsWindows11 = {
21573
21573
  };
21574
21574
  class Ngxi {
21575
21575
  constructor() {
21576
- this.platform = inject(PLATFORM_ID);
21577
- this.el = inject(ElementRef);
21578
- this.renderer = inject(Renderer2);
21579
- this.icon = input(null);
21580
- this.width = input();
21581
- this.height = input();
21582
- this.viewBox = input();
21583
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width);
21584
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height);
21585
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
21586
- this.setBody = effect(() => {
21587
- const icon = this.icon();
21588
- if (!icon) {
21589
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
21590
- return;
21591
- }
21592
- if (isPlatformServer(this.platform)) {
21593
- this.el.nativeElement.innerHTML = icon.body;
21594
- this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
21595
- return;
21596
- }
21597
- if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
21598
- this.el.nativeElement.removeAttribute("data-ngxi-ssr");
21599
- if (this.el.nativeElement.innerHTML === icon.body) {
21600
- return;
21601
- }
21602
- }
21603
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
21604
- });
21576
+ this.sanitizer = inject(DomSanitizer);
21577
+ this.icon = input(...[]);
21578
+ this.width = input(...[]);
21579
+ this.height = input(...[]);
21580
+ this.viewBox = input(...[]);
21581
+ this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
21582
+ this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
21583
+ this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
21584
+ this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
21605
21585
  }
21606
21586
  static {
21607
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21587
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21608
21588
  }
21609
21589
  static {
21610
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, viewBox: { classPropertyName: "viewBox", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.width": "resolvedWidth()", "attr.height": "resolvedHeight()", "attr.viewBox": "resolvedViewBox()" } }, ngImport: i0 });
21590
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, viewBox: { classPropertyName: "viewBox", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.width": "resolvedWidth()", "attr.height": "resolvedHeight()", "attr.viewBox": "resolvedViewBox()", "innerHTML": "safeSVG()" } }, ngImport: i0 });
21611
21591
  }
21612
21592
  }
21613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
21593
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
21614
21594
  type: Directive,
21615
21595
  args: [{
21616
21596
  standalone: true,
@@ -21619,22 +21599,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
21619
21599
  "role": "img",
21620
21600
  "[attr.width]": "resolvedWidth()",
21621
21601
  "[attr.height]": "resolvedHeight()",
21622
- "[attr.viewBox]": "resolvedViewBox()"
21602
+ "[attr.viewBox]": "resolvedViewBox()",
21603
+ "[innerHTML]": "safeSVG()"
21623
21604
  }
21624
21605
  }]
21625
21606
  }] });
21626
21607
  class NgxiSimpleIcons {
21627
21608
  constructor() {
21628
- this.ngxiSimpleIcons = input.required();
21609
+ this.ngxiSimpleIcons = input.required(...[]);
21629
21610
  }
21630
21611
  static {
21631
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiSimpleIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21612
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiSimpleIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21632
21613
  }
21633
21614
  static {
21634
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: NgxiSimpleIcons, isStandalone: true, selector: "svg[ngxiSimpleIcons]", inputs: { ngxiSimpleIcons: { classPropertyName: "ngxiSimpleIcons", publicName: "ngxiSimpleIcons", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiSimpleIcons", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
21615
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiSimpleIcons, isStandalone: true, selector: "svg[ngxiSimpleIcons]", inputs: { ngxiSimpleIcons: { classPropertyName: "ngxiSimpleIcons", publicName: "ngxiSimpleIcons", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiSimpleIcons", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
21635
21616
  }
21636
21617
  }
21637
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiSimpleIcons, decorators: [{
21618
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiSimpleIcons, decorators: [{
21638
21619
  type: Directive,
21639
21620
  args: [{
21640
21621
  standalone: true,