@ngxi/vscode-icons 0.12.18 → 0.12.20
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 +27 -23
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
|
|
2
|
+
import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, SecurityContext, Directive } from "@angular/core";
|
|
3
3
|
import { isPlatformServer } from "@angular/common";
|
|
4
|
+
import { DomSanitizer } from "@angular/platform-browser";
|
|
4
5
|
const vscodeIconsDefaultFile = {
|
|
5
6
|
"body": '<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>',
|
|
6
7
|
"width": 32,
|
|
@@ -8409,44 +8410,47 @@ const vscodeIconsFileTypeMakefile = {
|
|
|
8409
8410
|
};
|
|
8410
8411
|
class Ngxi {
|
|
8411
8412
|
constructor() {
|
|
8412
|
-
this.
|
|
8413
|
+
this.platformId = inject(PLATFORM_ID);
|
|
8413
8414
|
this.el = inject(ElementRef);
|
|
8414
8415
|
this.renderer = inject(Renderer2);
|
|
8415
|
-
this.
|
|
8416
|
-
this.
|
|
8417
|
-
this.
|
|
8418
|
-
this.
|
|
8419
|
-
this.
|
|
8420
|
-
this.
|
|
8421
|
-
this.
|
|
8416
|
+
this.sanitizer = inject(DomSanitizer);
|
|
8417
|
+
this.icon = input(null, ...[]);
|
|
8418
|
+
this.width = input(...[]);
|
|
8419
|
+
this.height = input(...[]);
|
|
8420
|
+
this.viewBox = input(...[]);
|
|
8421
|
+
this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
|
|
8422
|
+
this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
|
|
8423
|
+
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
|
|
8422
8424
|
this.setBody = effect(() => {
|
|
8423
8425
|
const icon = this.icon();
|
|
8424
8426
|
if (!icon) {
|
|
8425
8427
|
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
8426
8428
|
return;
|
|
8427
8429
|
}
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
this.el.nativeElement
|
|
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", "");
|
|
8431
8434
|
return;
|
|
8432
8435
|
}
|
|
8433
8436
|
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
8434
|
-
this.el.nativeElement.
|
|
8435
|
-
|
|
8437
|
+
if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
|
|
8438
|
+
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
8436
8439
|
return;
|
|
8437
8440
|
}
|
|
8441
|
+
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
8438
8442
|
}
|
|
8439
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML",
|
|
8440
|
-
});
|
|
8443
|
+
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
8444
|
+
}, ...[]);
|
|
8441
8445
|
}
|
|
8442
8446
|
static {
|
|
8443
|
-
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
8447
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8444
8448
|
}
|
|
8445
8449
|
static {
|
|
8446
|
-
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
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 });
|
|
8447
8451
|
}
|
|
8448
8452
|
}
|
|
8449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
8453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
|
|
8450
8454
|
type: Directive,
|
|
8451
8455
|
args: [{
|
|
8452
8456
|
standalone: true,
|
|
@@ -8461,16 +8465,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
8461
8465
|
}] });
|
|
8462
8466
|
class NgxiVscodeIcons {
|
|
8463
8467
|
constructor() {
|
|
8464
|
-
this.ngxiVscodeIcons = input.required();
|
|
8468
|
+
this.ngxiVscodeIcons = input.required(...[]);
|
|
8465
8469
|
}
|
|
8466
8470
|
static {
|
|
8467
|
-
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
8471
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiVscodeIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8468
8472
|
}
|
|
8469
8473
|
static {
|
|
8470
|
-
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
8474
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", 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 });
|
|
8471
8475
|
}
|
|
8472
8476
|
}
|
|
8473
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
8477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiVscodeIcons, decorators: [{
|
|
8474
8478
|
type: Directive,
|
|
8475
8479
|
args: [{
|
|
8476
8480
|
standalone: true,
|