@ngxi/vscode-icons 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 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,17 +8373,32 @@ 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 {
8378
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8395
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8379
8396
  }
8380
8397
  static {
8381
- 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 });
8398
+ 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 });
8382
8399
  }
8383
8400
  }
8384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, decorators: [{
8401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
8385
8402
  type: Directive,
8386
8403
  args: [{
8387
8404
  standalone: true,
@@ -8399,13 +8416,13 @@ class NgxiVscodeIcons {
8399
8416
  this.ngxiVscodeIcons = input.required();
8400
8417
  }
8401
8418
  static {
8402
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgxiVscodeIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8419
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiVscodeIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8403
8420
  }
8404
8421
  static {
8405
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: NgxiVscodeIcons, isStandalone: true, selector: "svg[ngxiVscodeIcons]", inputs: { ngxiVscodeIcons: { classPropertyName: "ngxiVscodeIcons", publicName: "ngxiVscodeIcons", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiVscodeIcons", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
8422
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: NgxiVscodeIcons, isStandalone: true, selector: "svg[ngxiVscodeIcons]", inputs: { ngxiVscodeIcons: { classPropertyName: "ngxiVscodeIcons", publicName: "ngxiVscodeIcons", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiVscodeIcons", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
8406
8423
  }
8407
8424
  }
8408
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgxiVscodeIcons, decorators: [{
8425
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiVscodeIcons, decorators: [{
8409
8426
  type: Directive,
8410
8427
  args: [{
8411
8428
  standalone: true,