@ngxi/eva 0.12.0 → 0.12.2

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,7 +2955,22 @@ 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 {