@ngxi/eva 0.12.19 → 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/dist/lib/eva.d.ts +1 -0
- 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 evaActivityFill = {
|
|
5
6
|
"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"/>',
|
|
6
7
|
"width": 24,
|
|
@@ -2943,44 +2944,47 @@ const evaWifiOutline = {
|
|
|
2943
2944
|
};
|
|
2944
2945
|
class Ngxi {
|
|
2945
2946
|
constructor() {
|
|
2946
|
-
this.
|
|
2947
|
+
this.platformId = inject(PLATFORM_ID);
|
|
2947
2948
|
this.el = inject(ElementRef);
|
|
2948
2949
|
this.renderer = inject(Renderer2);
|
|
2949
|
-
this.
|
|
2950
|
-
this.
|
|
2951
|
-
this.
|
|
2952
|
-
this.
|
|
2953
|
-
this.
|
|
2954
|
-
this.
|
|
2955
|
-
this.
|
|
2950
|
+
this.sanitizer = inject(DomSanitizer);
|
|
2951
|
+
this.icon = input(null, ...[]);
|
|
2952
|
+
this.width = input(...[]);
|
|
2953
|
+
this.height = input(...[]);
|
|
2954
|
+
this.viewBox = input(...[]);
|
|
2955
|
+
this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
|
|
2956
|
+
this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
|
|
2957
|
+
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
|
|
2956
2958
|
this.setBody = effect(() => {
|
|
2957
2959
|
const icon = this.icon();
|
|
2958
2960
|
if (!icon) {
|
|
2959
2961
|
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
2960
2962
|
return;
|
|
2961
2963
|
}
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
this.el.nativeElement
|
|
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", "");
|
|
2965
2968
|
return;
|
|
2966
2969
|
}
|
|
2967
2970
|
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
2968
|
-
this.el.nativeElement.
|
|
2969
|
-
|
|
2971
|
+
if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
|
|
2972
|
+
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
2970
2973
|
return;
|
|
2971
2974
|
}
|
|
2975
|
+
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
2972
2976
|
}
|
|
2973
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML",
|
|
2974
|
-
});
|
|
2977
|
+
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
2978
|
+
}, ...[]);
|
|
2975
2979
|
}
|
|
2976
2980
|
static {
|
|
2977
|
-
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2981
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2978
2982
|
}
|
|
2979
2983
|
static {
|
|
2980
|
-
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
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 });
|
|
2981
2985
|
}
|
|
2982
2986
|
}
|
|
2983
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
|
|
2984
2988
|
type: Directive,
|
|
2985
2989
|
args: [{
|
|
2986
2990
|
standalone: true,
|
|
@@ -2995,16 +2999,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2995
2999
|
}] });
|
|
2996
3000
|
class NgxiEva {
|
|
2997
3001
|
constructor() {
|
|
2998
|
-
this.ngxiEva = input.required();
|
|
3002
|
+
this.ngxiEva = input.required(...[]);
|
|
2999
3003
|
}
|
|
3000
3004
|
static {
|
|
3001
|
-
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3005
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiEva, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3002
3006
|
}
|
|
3003
3007
|
static {
|
|
3004
|
-
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
3008
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiEva, isStandalone: true, selector: "svg[ngxiEva]", inputs: { ngxiEva: { classPropertyName: "ngxiEva", publicName: "ngxiEva", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiEva", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
|
|
3005
3009
|
}
|
|
3006
3010
|
}
|
|
3007
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3011
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiEva, decorators: [{
|
|
3008
3012
|
type: Directive,
|
|
3009
3013
|
args: [{
|
|
3010
3014
|
standalone: true,
|