@ngxi/eva 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 +6 -29
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { inject,
|
|
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 evaActivityFill = {
|
|
6
5
|
"body": '<path fill="currentColor" d="M14.33 20h-.21a2 2 0 0 1-1.76-1.58L9.68 6l-2.76 6.4A1 1 0 0 1 6 13H3a1 1 0 0 1 0-2h2.34l2.51-5.79a2 2 0 0 1 3.79.38L14.32 18l2.76-6.38A1 1 0 0 1 18 11h3a1 1 0 0 1 0 2h-2.34l-2.51 5.79A2 2 0 0 1 14.33 20"/>',
|
|
@@ -2944,44 +2943,21 @@ const evaWifiOutline = {
|
|
|
2944
2943
|
};
|
|
2945
2944
|
class Ngxi {
|
|
2946
2945
|
constructor() {
|
|
2947
|
-
this.platformId = inject(PLATFORM_ID);
|
|
2948
|
-
this.el = inject(ElementRef);
|
|
2949
|
-
this.renderer = inject(Renderer2);
|
|
2950
2946
|
this.sanitizer = inject(DomSanitizer);
|
|
2951
|
-
this.icon = input(
|
|
2947
|
+
this.icon = input(...[]);
|
|
2952
2948
|
this.width = input(...[]);
|
|
2953
2949
|
this.height = input(...[]);
|
|
2954
2950
|
this.viewBox = input(...[]);
|
|
2955
2951
|
this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
|
|
2956
2952
|
this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
|
|
2957
2953
|
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
|
|
2958
|
-
this.
|
|
2959
|
-
const icon = this.icon();
|
|
2960
|
-
if (!icon) {
|
|
2961
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
2962
|
-
return;
|
|
2963
|
-
}
|
|
2964
|
-
const sanitizedBody = this.sanitizer.sanitize(SecurityContext.HTML, icon.body);
|
|
2965
|
-
if (isPlatformServer(this.platformId)) {
|
|
2966
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
2967
|
-
this.renderer.setAttribute(this.el.nativeElement, "data-ngxi-ssr", "");
|
|
2968
|
-
return;
|
|
2969
|
-
}
|
|
2970
|
-
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
2971
|
-
if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
|
|
2972
|
-
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
2973
|
-
return;
|
|
2974
|
-
}
|
|
2975
|
-
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
2976
|
-
}
|
|
2977
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
2978
|
-
}, ...[]);
|
|
2954
|
+
this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
|
|
2979
2955
|
}
|
|
2980
2956
|
static {
|
|
2981
2957
|
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2982
2958
|
}
|
|
2983
2959
|
static {
|
|
2984
|
-
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 });
|
|
2960
|
+
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 });
|
|
2985
2961
|
}
|
|
2986
2962
|
}
|
|
2987
2963
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
|
|
@@ -2993,7 +2969,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
|
|
|
2993
2969
|
"role": "img",
|
|
2994
2970
|
"[attr.width]": "resolvedWidth()",
|
|
2995
2971
|
"[attr.height]": "resolvedHeight()",
|
|
2996
|
-
"[attr.viewBox]": "resolvedViewBox()"
|
|
2972
|
+
"[attr.viewBox]": "resolvedViewBox()",
|
|
2973
|
+
"[innerHTML]": "safeSVG()"
|
|
2997
2974
|
}
|
|
2998
2975
|
}]
|
|
2999
2976
|
}] });
|