@ngxi/streamline-cyber 0.12.0 → 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 streamlineCyber3dGlasses = {
4
5
  "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10"><path d="m22.5 10.5l-5.75-5H14.5m-14 5l5.75-5H8.5m-8 5l2 9H8l3.5-3.5l3.5 3.5h5.5l2-9m-22 0h22"/><path d="M3.25 12.5h7.25V14L7 17.5H4.5zm16.5 0H12.5V14l3.5 3.5h2.5z"/></g>',
5
6
  "width": 24,
@@ -3002,6 +3003,7 @@ const streamlineCyberWrenchScrewdriver = {
3002
3003
  };
3003
3004
  class Ngxi {
3004
3005
  constructor() {
3006
+ this.platform = inject(PLATFORM_ID);
3005
3007
  this.el = inject(ElementRef);
3006
3008
  this.renderer = inject(Renderer2);
3007
3009
  this.icon = input(null);
@@ -3013,7 +3015,22 @@ class Ngxi {
3013
3015
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
3014
3016
  this.setBody = effect(() => {
3015
3017
  const icon = this.icon();
3016
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon?.body ?? "");
3018
+ if (!icon) {
3019
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
3020
+ return;
3021
+ }
3022
+ if (isPlatformServer(this.platform)) {
3023
+ this.el.nativeElement.innerHTML = icon.body;
3024
+ this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
3025
+ return;
3026
+ }
3027
+ if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
3028
+ this.el.nativeElement.removeAttribute("data-ngxi-ssr");
3029
+ if (this.el.nativeElement.innerHTML === icon.body) {
3030
+ return;
3031
+ }
3032
+ }
3033
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
3017
3034
  });
3018
3035
  }
3019
3036
  static {