@ngxi/simple-icons 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/simple-icons.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 simpleIcons42 = {
|
|
5
6
|
"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"/>',
|
|
6
7
|
"width": 24,
|
|
@@ -21573,44 +21574,47 @@ const simpleIconsWindows11 = {
|
|
|
21573
21574
|
};
|
|
21574
21575
|
class Ngxi {
|
|
21575
21576
|
constructor() {
|
|
21576
|
-
this.
|
|
21577
|
+
this.platformId = inject(PLATFORM_ID);
|
|
21577
21578
|
this.el = inject(ElementRef);
|
|
21578
21579
|
this.renderer = inject(Renderer2);
|
|
21579
|
-
this.
|
|
21580
|
-
this.
|
|
21581
|
-
this.
|
|
21582
|
-
this.
|
|
21583
|
-
this.
|
|
21584
|
-
this.
|
|
21585
|
-
this.
|
|
21580
|
+
this.sanitizer = inject(DomSanitizer);
|
|
21581
|
+
this.icon = input(null, ...[]);
|
|
21582
|
+
this.width = input(...[]);
|
|
21583
|
+
this.height = input(...[]);
|
|
21584
|
+
this.viewBox = input(...[]);
|
|
21585
|
+
this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
|
|
21586
|
+
this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
|
|
21587
|
+
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
|
|
21586
21588
|
this.setBody = effect(() => {
|
|
21587
21589
|
const icon = this.icon();
|
|
21588
21590
|
if (!icon) {
|
|
21589
21591
|
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
21590
21592
|
return;
|
|
21591
21593
|
}
|
|
21592
|
-
|
|
21593
|
-
|
|
21594
|
-
this.el.nativeElement
|
|
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", "");
|
|
21595
21598
|
return;
|
|
21596
21599
|
}
|
|
21597
21600
|
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
21598
|
-
this.el.nativeElement.
|
|
21599
|
-
|
|
21601
|
+
if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
|
|
21602
|
+
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
21600
21603
|
return;
|
|
21601
21604
|
}
|
|
21605
|
+
this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
|
|
21602
21606
|
}
|
|
21603
|
-
this.renderer.setProperty(this.el.nativeElement, "innerHTML",
|
|
21604
|
-
});
|
|
21607
|
+
this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
|
|
21608
|
+
}, ...[]);
|
|
21605
21609
|
}
|
|
21606
21610
|
static {
|
|
21607
|
-
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
21611
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21608
21612
|
}
|
|
21609
21613
|
static {
|
|
21610
|
-
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
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 });
|
|
21611
21615
|
}
|
|
21612
21616
|
}
|
|
21613
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
|
|
21614
21618
|
type: Directive,
|
|
21615
21619
|
args: [{
|
|
21616
21620
|
standalone: true,
|
|
@@ -21625,16 +21629,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
21625
21629
|
}] });
|
|
21626
21630
|
class NgxiSimpleIcons {
|
|
21627
21631
|
constructor() {
|
|
21628
|
-
this.ngxiSimpleIcons = input.required();
|
|
21632
|
+
this.ngxiSimpleIcons = input.required(...[]);
|
|
21629
21633
|
}
|
|
21630
21634
|
static {
|
|
21631
|
-
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
21635
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiSimpleIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21632
21636
|
}
|
|
21633
21637
|
static {
|
|
21634
|
-
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
21638
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiSimpleIcons, isStandalone: true, selector: "svg[ngxiSimpleIcons]", inputs: { ngxiSimpleIcons: { classPropertyName: "ngxiSimpleIcons", publicName: "ngxiSimpleIcons", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiSimpleIcons", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
|
|
21635
21639
|
}
|
|
21636
21640
|
}
|
|
21637
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21641
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiSimpleIcons, decorators: [{
|
|
21638
21642
|
type: Directive,
|
|
21639
21643
|
args: [{
|
|
21640
21644
|
standalone: true,
|