@ngxi/simple-icons 0.12.20 → 0.12.21
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 simpleIcons42 = {
|
|
6
5
|
"body": '<path fill="currentColor" d="M19.581 16.851H24v-4.439ZM24 3.574h-4.419v4.42l-4.419 4.418v4.44h4.419v-4.44L24 7.993Zm-4.419 0h-4.419v4.42zm-6.324 8.838H4.419l8.838-8.838H8.838L0 12.412v3.595h8.838v4.419h4.419z"/>',
|
|
@@ -21574,44 +21573,21 @@ const simpleIconsWindows11 = {
|
|
|
21574
21573
|
};
|
|
21575
21574
|
class Ngxi {
|
|
21576
21575
|
constructor() {
|
|
21577
|
-
this.platformId = inject(PLATFORM_ID);
|
|
21578
|
-
this.el = inject(ElementRef);
|
|
21579
|
-
this.renderer = inject(Renderer2);
|
|
21580
21576
|
this.sanitizer = inject(DomSanitizer);
|
|
21581
|
-
this.icon = input(
|
|
21577
|
+
this.icon = input(...[]);
|
|
21582
21578
|
this.width = input(...[]);
|
|
21583
21579
|
this.height = input(...[]);
|
|
21584
21580
|
this.viewBox = input(...[]);
|
|
21585
21581
|
this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
|
|
21586
21582
|
this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
|
|
21587
21583
|
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
|
|
21588
|
-
this.
|
|
21589
|
-
const icon = this.icon();
|
|
21590
|
-
if (!icon) {
|
|
21591
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
21592
|
-
return;
|
|
21593
|
-
}
|
|
21594
|
-
const sanitizedBody = this.sanitizer.sanitize(SecurityContext.HTML, icon.body);
|
|
21595
|
-
if (isPlatformServer(this.platformId)) {
|
|
21596
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
21597
|
-
this.renderer.setAttribute(this.el.nativeElement, "data-ngxi-ssr", "");
|
|
21598
|
-
return;
|
|
21599
|
-
}
|
|
21600
|
-
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
21601
|
-
if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
|
|
21602
|
-
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
21603
|
-
return;
|
|
21604
|
-
}
|
|
21605
|
-
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
21606
|
-
}
|
|
21607
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
21608
|
-
}, ...[]);
|
|
21584
|
+
this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
|
|
21609
21585
|
}
|
|
21610
21586
|
static {
|
|
21611
21587
|
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21612
21588
|
}
|
|
21613
21589
|
static {
|
|
21614
|
-
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 });
|
|
21590
|
+
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 });
|
|
21615
21591
|
}
|
|
21616
21592
|
}
|
|
21617
21593
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
|
|
@@ -21623,7 +21599,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
|
|
|
21623
21599
|
"role": "img",
|
|
21624
21600
|
"[attr.width]": "resolvedWidth()",
|
|
21625
21601
|
"[attr.height]": "resolvedHeight()",
|
|
21626
|
-
"[attr.viewBox]": "resolvedViewBox()"
|
|
21602
|
+
"[attr.viewBox]": "resolvedViewBox()",
|
|
21603
|
+
"[innerHTML]": "safeSVG()"
|
|
21627
21604
|
}
|
|
21628
21605
|
}]
|
|
21629
21606
|
}] });
|