@ngxi/cbi 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 cbi02tv = {
|
|
6
5
|
"body": '<path fill="currentColor" d="m16.5 8.261l2.121 6.123h1.467L22 8.261h-1.074l-1.571 4.768l-1.546-4.768zm-5.475 0h4.898v.897h-1.781l-.052 5.226h-1.231V9.158h-1.834zm-1.242 7.478v-.42H8.7c.435-.427 1-.946 1-1.511a.733.733 0 0 0-.835-.779a1.8 1.8 0 0 0-.791.191l.043.443a1.15 1.15 0 0 1 .614-.214c.217 0 .436.114.436.359c0 .488-.905 1.244-1.153 1.485v.446zM2 11.411a3.063 3.063 0 1 0 6.124 0a2.97 2.97 0 0 0-3.057-3.15A2.97 2.97 0 0 0 2 11.411m1.18 0a2.055 2.055 0 0 1 1.887-2.253a2.054 2.054 0 0 1 1.876 2.253a2.016 2.016 0 0 1-1.876 2.253a2.02 2.02 0 0 1-1.887-2.253"/>',
|
|
@@ -9052,44 +9051,21 @@ const cbiTwinlyCurtian = {
|
|
|
9052
9051
|
};
|
|
9053
9052
|
class Ngxi {
|
|
9054
9053
|
constructor() {
|
|
9055
|
-
this.platformId = inject(PLATFORM_ID);
|
|
9056
|
-
this.el = inject(ElementRef);
|
|
9057
|
-
this.renderer = inject(Renderer2);
|
|
9058
9054
|
this.sanitizer = inject(DomSanitizer);
|
|
9059
|
-
this.icon = input(
|
|
9055
|
+
this.icon = input(...[]);
|
|
9060
9056
|
this.width = input(...[]);
|
|
9061
9057
|
this.height = input(...[]);
|
|
9062
9058
|
this.viewBox = input(...[]);
|
|
9063
9059
|
this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
|
|
9064
9060
|
this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
|
|
9065
9061
|
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
|
|
9066
|
-
this.
|
|
9067
|
-
const icon = this.icon();
|
|
9068
|
-
if (!icon) {
|
|
9069
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
9070
|
-
return;
|
|
9071
|
-
}
|
|
9072
|
-
const sanitizedBody = this.sanitizer.sanitize(SecurityContext.HTML, icon.body);
|
|
9073
|
-
if (isPlatformServer(this.platformId)) {
|
|
9074
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
9075
|
-
this.renderer.setAttribute(this.el.nativeElement, "data-ngxi-ssr", "");
|
|
9076
|
-
return;
|
|
9077
|
-
}
|
|
9078
|
-
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
9079
|
-
if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
|
|
9080
|
-
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
9081
|
-
return;
|
|
9082
|
-
}
|
|
9083
|
-
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
9084
|
-
}
|
|
9085
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
9086
|
-
}, ...[]);
|
|
9062
|
+
this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
|
|
9087
9063
|
}
|
|
9088
9064
|
static {
|
|
9089
9065
|
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
9090
9066
|
}
|
|
9091
9067
|
static {
|
|
9092
|
-
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 });
|
|
9068
|
+
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 });
|
|
9093
9069
|
}
|
|
9094
9070
|
}
|
|
9095
9071
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
|
|
@@ -9101,7 +9077,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
|
|
|
9101
9077
|
"role": "img",
|
|
9102
9078
|
"[attr.width]": "resolvedWidth()",
|
|
9103
9079
|
"[attr.height]": "resolvedHeight()",
|
|
9104
|
-
"[attr.viewBox]": "resolvedViewBox()"
|
|
9080
|
+
"[attr.viewBox]": "resolvedViewBox()",
|
|
9081
|
+
"[innerHTML]": "safeSVG()"
|
|
9105
9082
|
}
|
|
9106
9083
|
}]
|
|
9107
9084
|
}] });
|