@ngxi/eva 0.12.0-beta.9 → 0.12.1

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,5 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
2
+ import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
3
+ import { isPlatformServer } from "@angular/common";
3
4
  const evaActivityFill = {
4
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"/>',
5
6
  "width": 24,
@@ -2942,6 +2943,7 @@ const evaWifiOutline = {
2942
2943
  };
2943
2944
  class Ngxi {
2944
2945
  constructor() {
2946
+ this.platform = inject(PLATFORM_ID);
2945
2947
  this.el = inject(ElementRef);
2946
2948
  this.renderer = inject(Renderer2);
2947
2949
  this.icon = input(null);
@@ -2953,17 +2955,32 @@ class Ngxi {
2953
2955
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
2954
2956
  this.setBody = effect(() => {
2955
2957
  const icon = this.icon();
2956
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon?.body ?? "");
2958
+ if (!icon) {
2959
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
2960
+ return;
2961
+ }
2962
+ if (isPlatformServer(this.platform)) {
2963
+ this.el.nativeElement.innerHTML = icon.body;
2964
+ this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
2965
+ return;
2966
+ }
2967
+ if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
2968
+ this.el.nativeElement.removeAttribute("data-ngxi-ssr");
2969
+ if (this.el.nativeElement.innerHTML === icon.body) {
2970
+ return;
2971
+ }
2972
+ }
2973
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
2957
2974
  });
2958
2975
  }
2959
2976
  static {
2960
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2977
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2961
2978
  }
2962
2979
  static {
2963
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", 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 });
2980
+ 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 });
2964
2981
  }
2965
2982
  }
2966
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, decorators: [{
2983
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
2967
2984
  type: Directive,
2968
2985
  args: [{
2969
2986
  standalone: true,
@@ -2981,13 +2998,13 @@ class NgxiEva {
2981
2998
  this.ngxiEva = input.required();
2982
2999
  }
2983
3000
  static {
2984
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgxiEva, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3001
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiEva, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2985
3002
  }
2986
3003
  static {
2987
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: NgxiEva, isStandalone: true, selector: "svg[ngxiEva]", inputs: { ngxiEva: { classPropertyName: "ngxiEva", publicName: "ngxiEva", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiEva", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
3004
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: NgxiEva, isStandalone: true, selector: "svg[ngxiEva]", inputs: { ngxiEva: { classPropertyName: "ngxiEva", publicName: "ngxiEva", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiEva", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
2988
3005
  }
2989
3006
  }
2990
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgxiEva, decorators: [{
3007
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiEva, decorators: [{
2991
3008
  type: Directive,
2992
3009
  args: [{
2993
3010
  standalone: true,