@ngxi/simple-icons 0.12.0 → 0.12.1
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 +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { inject, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
|
|
2
|
+
import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
|
|
3
|
+
import { isPlatformServer } from "@angular/common";
|
|
3
4
|
const simpleIcons42 = {
|
|
4
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"/>',
|
|
5
6
|
"width": 24,
|
|
@@ -21416,6 +21417,7 @@ const simpleIconsWindows11 = {
|
|
|
21416
21417
|
};
|
|
21417
21418
|
class Ngxi {
|
|
21418
21419
|
constructor() {
|
|
21420
|
+
this.platform = inject(PLATFORM_ID);
|
|
21419
21421
|
this.el = inject(ElementRef);
|
|
21420
21422
|
this.renderer = inject(Renderer2);
|
|
21421
21423
|
this.icon = input(null);
|
|
@@ -21427,7 +21429,22 @@ class Ngxi {
|
|
|
21427
21429
|
this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
|
|
21428
21430
|
this.setBody = effect(() => {
|
|
21429
21431
|
const icon = this.icon();
|
|
21430
|
-
|
|
21432
|
+
if (!icon) {
|
|
21433
|
+
this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
|
|
21434
|
+
return;
|
|
21435
|
+
}
|
|
21436
|
+
if (isPlatformServer(this.platform)) {
|
|
21437
|
+
this.el.nativeElement.innerHTML = icon.body;
|
|
21438
|
+
this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
|
|
21439
|
+
return;
|
|
21440
|
+
}
|
|
21441
|
+
if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
|
|
21442
|
+
this.el.nativeElement.removeAttribute("data-ngxi-ssr");
|
|
21443
|
+
if (this.el.nativeElement.innerHTML === icon.body) {
|
|
21444
|
+
return;
|
|
21445
|
+
}
|
|
21446
|
+
}
|
|
21447
|
+
this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
|
|
21431
21448
|
});
|
|
21432
21449
|
}
|
|
21433
21450
|
static {
|