@ngxi/vscode-icons 0.12.20 → 0.12.22

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,6 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, SecurityContext, Directive } from "@angular/core";
3
- import { isPlatformServer } from "@angular/common";
2
+ import { inject, input, computed, Directive } from "@angular/core";
4
3
  import { DomSanitizer } from "@angular/platform-browser";
5
4
  const vscodeIconsDefaultFile = {
6
5
  "body": '<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>',
@@ -8410,44 +8409,21 @@ const vscodeIconsFileTypeMakefile = {
8410
8409
  };
8411
8410
  class Ngxi {
8412
8411
  constructor() {
8413
- this.platformId = inject(PLATFORM_ID);
8414
- this.el = inject(ElementRef);
8415
- this.renderer = inject(Renderer2);
8416
8412
  this.sanitizer = inject(DomSanitizer);
8417
- this.icon = input(null, ...[]);
8413
+ this.icon = input(...[]);
8418
8414
  this.width = input(...[]);
8419
8415
  this.height = input(...[]);
8420
8416
  this.viewBox = input(...[]);
8421
8417
  this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
8422
8418
  this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
8423
8419
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
8424
- this.setBody = effect(() => {
8425
- const icon = this.icon();
8426
- if (!icon) {
8427
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
8428
- return;
8429
- }
8430
- const sanitizedBody = this.sanitizer.sanitize(SecurityContext.HTML, icon.body);
8431
- if (isPlatformServer(this.platformId)) {
8432
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
8433
- this.renderer.setAttribute(this.el.nativeElement, "data-ngxi-ssr", "");
8434
- return;
8435
- }
8436
- if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
8437
- if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
8438
- this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
8439
- return;
8440
- }
8441
- this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
8442
- }
8443
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
8444
- }, ...[]);
8420
+ this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
8445
8421
  }
8446
8422
  static {
8447
8423
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8448
8424
  }
8449
8425
  static {
8450
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", 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 });
8426
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", 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()", "innerHTML": "safeSVG()" } }, ngImport: i0 });
8451
8427
  }
8452
8428
  }
8453
8429
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
@@ -8459,7 +8435,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
8459
8435
  "role": "img",
8460
8436
  "[attr.width]": "resolvedWidth()",
8461
8437
  "[attr.height]": "resolvedHeight()",
8462
- "[attr.viewBox]": "resolvedViewBox()"
8438
+ "[attr.viewBox]": "resolvedViewBox()",
8439
+ "[innerHTML]": "safeSVG()"
8463
8440
  }
8464
8441
  }]
8465
8442
  }] });