@ngxi/eva 0.12.23 → 0.12.25

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, input, computed, Directive } from "@angular/core";
3
- import { DomSanitizer } from "@angular/platform-browser";
2
+ import { inject, ElementRef, PLATFORM_ID, input, numberAttribute, effect, Directive } from "@angular/core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
4
  const evaActivityFill = {
5
5
  "body": '<path fill="currentColor" d="M14.33 20h-.21a2 2 0 0 1-1.76-1.58L9.68 6l-2.76 6.4A1 1 0 0 1 6 13H3a1 1 0 0 1 0-2h2.34l2.51-5.79a2 2 0 0 1 3.79.38L14.32 18l2.76-6.38A1 1 0 0 1 18 11h3a1 1 0 0 1 0 2h-2.34l-2.51 5.79A2 2 0 0 1 14.33 20"/>',
6
6
  "width": 24,
@@ -2943,37 +2943,47 @@ const evaWifiOutline = {
2943
2943
  };
2944
2944
  class Ngxi {
2945
2945
  constructor() {
2946
- this.sanitizer = inject(DomSanitizer);
2947
- this.icon = input(...[]);
2948
- this.width = input(...[]);
2949
- this.height = input(...[]);
2946
+ this.el = inject(ElementRef);
2947
+ this.platformId = inject(PLATFORM_ID);
2948
+ this.icon = input.required(...[]);
2949
+ this.width = input(void 0, ...[{
2950
+ transform: numberAttribute
2951
+ }]);
2952
+ this.height = input(void 0, ...[{
2953
+ transform: numberAttribute
2954
+ }]);
2950
2955
  this.viewBox = input(...[]);
2951
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
2952
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
2953
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
2954
- this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
2956
+ effect(() => {
2957
+ this.updateSvg();
2958
+ });
2959
+ }
2960
+ updateSvg() {
2961
+ if (isPlatformBrowser(this.platformId)) {
2962
+ const svg = this.el.nativeElement;
2963
+ svg.innerHTML = "";
2964
+ if (!this.icon) {
2965
+ return;
2966
+ }
2967
+ svg.innerHTML = this.icon().body;
2968
+ svg.setAttribute("width", (this.width() ?? this.icon()?.width ?? "").toString());
2969
+ svg.setAttribute("height", (this.height() ?? this.icon()?.height ?? "").toString());
2970
+ svg.setAttribute("viewBox", this.viewBox() ?? this.icon()?.viewBox ?? "");
2971
+ }
2955
2972
  }
2956
2973
  static {
2957
2974
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2958
2975
  }
2959
2976
  static {
2960
- 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 });
2977
+ 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: true, 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 } }, ngImport: i0 });
2961
2978
  }
2962
2979
  }
2963
2980
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
2964
2981
  type: Directive,
2965
2982
  args: [{
2966
- standalone: true,
2967
2983
  selector: "svg[ngxi]",
2968
- host: {
2969
- "role": "img",
2970
- "[attr.width]": "resolvedWidth()",
2971
- "[attr.height]": "resolvedHeight()",
2972
- "[attr.viewBox]": "resolvedViewBox()",
2973
- "[innerHTML]": "safeSVG()"
2974
- }
2984
+ standalone: true
2975
2985
  }]
2976
- }] });
2986
+ }], ctorParameters: () => [] });
2977
2987
  class NgxiEva {
2978
2988
  constructor() {
2979
2989
  this.ngxiEva = input.required(...[]);