@ngxi/cbi 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 cbi02tv = {
4
5
  "body": '<path fill="currentColor" d="m16.5 8.261l2.121 6.123h1.467L22 8.261h-1.074l-1.571 4.768l-1.546-4.768zm-5.475 0h4.898v.897h-1.781l-.052 5.226h-1.231V9.158h-1.834zm-1.242 7.478v-.42H8.7c.435-.427 1-.946 1-1.511a.733.733 0 0 0-.835-.779a1.8 1.8 0 0 0-.791.191l.043.443a1.15 1.15 0 0 1 .614-.214c.217 0 .436.114.436.359c0 .488-.905 1.244-1.153 1.485v.446zM2 11.411a3.063 3.063 0 1 0 6.124 0a2.97 2.97 0 0 0-3.057-3.15A2.97 2.97 0 0 0 2 11.411m1.18 0a2.055 2.055 0 0 1 1.887-2.253a2.054 2.054 0 0 1 1.876 2.253a2.016 2.016 0 0 1-1.876 2.253a2.02 2.02 0 0 1-1.887-2.253"/>',
5
6
  "width": 24,
@@ -8882,6 +8883,7 @@ const cbiTwinlyCurtian = {
8882
8883
  };
8883
8884
  class Ngxi {
8884
8885
  constructor() {
8886
+ this.platform = inject(PLATFORM_ID);
8885
8887
  this.el = inject(ElementRef);
8886
8888
  this.renderer = inject(Renderer2);
8887
8889
  this.icon = input(null);
@@ -8893,7 +8895,22 @@ class Ngxi {
8893
8895
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
8894
8896
  this.setBody = effect(() => {
8895
8897
  const icon = this.icon();
8896
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon?.body ?? "");
8898
+ if (!icon) {
8899
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
8900
+ return;
8901
+ }
8902
+ if (isPlatformServer(this.platform)) {
8903
+ this.el.nativeElement.innerHTML = icon.body;
8904
+ this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
8905
+ return;
8906
+ }
8907
+ if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
8908
+ this.el.nativeElement.removeAttribute("data-ngxi-ssr");
8909
+ if (this.el.nativeElement.innerHTML === icon.body) {
8910
+ return;
8911
+ }
8912
+ }
8913
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
8897
8914
  });
8898
8915
  }
8899
8916
  static {