@ngxi/vscode-icons 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 vscodeIconsDefaultFile = {
4
5
  "body": '<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>',
5
6
  "width": 32,
@@ -8360,6 +8361,7 @@ const vscodeIconsFileTypeMakefile = {
8360
8361
  };
8361
8362
  class Ngxi {
8362
8363
  constructor() {
8364
+ this.platform = inject(PLATFORM_ID);
8363
8365
  this.el = inject(ElementRef);
8364
8366
  this.renderer = inject(Renderer2);
8365
8367
  this.icon = input(null);
@@ -8371,7 +8373,22 @@ class Ngxi {
8371
8373
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
8372
8374
  this.setBody = effect(() => {
8373
8375
  const icon = this.icon();
8374
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon?.body ?? "");
8376
+ if (!icon) {
8377
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
8378
+ return;
8379
+ }
8380
+ if (isPlatformServer(this.platform)) {
8381
+ this.el.nativeElement.innerHTML = icon.body;
8382
+ this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
8383
+ return;
8384
+ }
8385
+ if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
8386
+ this.el.nativeElement.removeAttribute("data-ngxi-ssr");
8387
+ if (this.el.nativeElement.innerHTML === icon.body) {
8388
+ return;
8389
+ }
8390
+ }
8391
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
8375
8392
  });
8376
8393
  }
8377
8394
  static {