@ngxi/vscode-icons 0.12.23 → 0.12.26

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,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, input, computed, Directive } from "@angular/core";
3
- import { DomSanitizer } from "@angular/platform-browser";
2
+ import { inject, ElementRef, PLATFORM_ID, input, numberAttribute, effect, Directive } from "@angular/core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
4
  const vscodeIconsDefaultFile = {
5
5
  "body": '<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>',
6
6
  "width": 32,
@@ -8409,37 +8409,47 @@ const vscodeIconsFileTypeMakefile = {
8409
8409
  };
8410
8410
  class Ngxi {
8411
8411
  constructor() {
8412
- this.sanitizer = inject(DomSanitizer);
8413
- this.icon = input(...[]);
8414
- this.width = input(...[]);
8415
- this.height = input(...[]);
8412
+ this.el = inject(ElementRef);
8413
+ this.platformId = inject(PLATFORM_ID);
8414
+ this.icon = input.required(...[]);
8415
+ this.width = input(void 0, ...[{
8416
+ transform: numberAttribute
8417
+ }]);
8418
+ this.height = input(void 0, ...[{
8419
+ transform: numberAttribute
8420
+ }]);
8416
8421
  this.viewBox = input(...[]);
8417
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
8418
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
8419
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
8420
- this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
8422
+ effect(() => {
8423
+ this.updateSvg();
8424
+ });
8425
+ }
8426
+ updateSvg() {
8427
+ if (isPlatformBrowser(this.platformId)) {
8428
+ const svg = this.el.nativeElement;
8429
+ svg.innerHTML = "";
8430
+ if (!this.icon) {
8431
+ return;
8432
+ }
8433
+ svg.innerHTML = this.icon().body;
8434
+ svg.setAttribute("width", (this.width() ?? this.icon()?.width ?? "").toString());
8435
+ svg.setAttribute("height", (this.height() ?? this.icon()?.height ?? "").toString());
8436
+ svg.setAttribute("viewBox", this.viewBox() ?? this.icon()?.viewBox ?? "");
8437
+ }
8421
8438
  }
8422
8439
  static {
8423
8440
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8424
8441
  }
8425
8442
  static {
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 });
8443
+ 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: true, 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 } }, ngImport: i0 });
8427
8444
  }
8428
8445
  }
8429
8446
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
8430
8447
  type: Directive,
8431
8448
  args: [{
8432
- standalone: true,
8433
8449
  selector: "svg[ngxi]",
8434
- host: {
8435
- "role": "img",
8436
- "[attr.width]": "resolvedWidth()",
8437
- "[attr.height]": "resolvedHeight()",
8438
- "[attr.viewBox]": "resolvedViewBox()",
8439
- "[innerHTML]": "safeSVG()"
8440
- }
8450
+ standalone: true
8441
8451
  }]
8442
- }] });
8452
+ }], ctorParameters: () => [] });
8443
8453
  class NgxiVscodeIcons {
8444
8454
  constructor() {
8445
8455
  this.ngxiVscodeIcons = input.required(...[]);