@ngxi/simple-icons 0.12.22 → 0.12.24

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, input, computed, Directive } from "@angular/core";
3
- import { DomSanitizer } from "@angular/platform-browser";
2
+ import { inject, ElementRef, PLATFORM_ID, input, numberAttribute, effect, Directive } from "@angular/core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
4
  const simpleIcons42 = {
5
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"/>',
6
6
  "width": 24,
@@ -21577,53 +21577,66 @@ const simpleIconsWindows11 = {
21577
21577
  "height": 24,
21578
21578
  "viewBox": "0 0 24 24"
21579
21579
  };
21580
+ function __decorate(decorators, target, key, desc) {
21581
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21582
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21583
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21584
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
21585
+ }
21586
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
21587
+ var e = new Error(message);
21588
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
21589
+ };
21580
21590
  class Ngxi {
21581
21591
  constructor() {
21582
- this.sanitizer = inject(DomSanitizer);
21583
- this.icon = input(...[]);
21584
- this.width = input(...[]);
21585
- this.height = input(...[]);
21592
+ this.el = inject(ElementRef);
21593
+ this.platformId = inject(PLATFORM_ID);
21594
+ this.ngxi = input.required(...[]);
21595
+ this.width = input(void 0, ...[{
21596
+ transform: numberAttribute
21597
+ }]);
21598
+ this.height = input(void 0, ...[{
21599
+ transform: numberAttribute
21600
+ }]);
21586
21601
  this.viewBox = input(...[]);
21587
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
21588
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
21589
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
21590
- this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
21602
+ effect(() => {
21603
+ this.updateSvg();
21604
+ });
21605
+ }
21606
+ updateSvg() {
21607
+ if (isPlatformBrowser(this.platformId)) {
21608
+ const svg = this.el.nativeElement;
21609
+ svg.innerHTML = "";
21610
+ if (!this.ngxi) {
21611
+ return;
21612
+ }
21613
+ svg.innerHTML = this.ngxi().body;
21614
+ svg.setAttribute("width", (this.width() ?? this.ngxi()?.width ?? "").toString());
21615
+ svg.setAttribute("height", (this.height() ?? this.ngxi()?.height ?? "").toString());
21616
+ svg.setAttribute("viewBox", this.viewBox() ?? this.ngxi()?.viewBox ?? "");
21617
+ }
21591
21618
  }
21592
21619
  static {
21593
21620
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21594
21621
  }
21595
21622
  static {
21596
- 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 });
21623
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { ngxi: { classPropertyName: "ngxi", publicName: "ngxi", isSignal: true, isRequired: true, 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 } }, ngImport: i0 });
21597
21624
  }
21598
21625
  }
21599
21626
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
21600
21627
  type: Directive,
21601
21628
  args: [{
21602
- standalone: true,
21603
21629
  selector: "svg[ngxi]",
21604
- host: {
21605
- "role": "img",
21606
- "[attr.width]": "resolvedWidth()",
21607
- "[attr.height]": "resolvedHeight()",
21608
- "[attr.viewBox]": "resolvedViewBox()",
21609
- "[innerHTML]": "safeSVG()"
21610
- }
21630
+ standalone: true
21611
21631
  }]
21612
- }] });
21613
- class NgxiSimpleIcons {
21632
+ }], ctorParameters: () => [] });
21633
+ let NgxiSimpleIcons = class NgxiSimpleIcons2 {
21614
21634
  constructor() {
21615
21635
  this.ngxiSimpleIcons = input.required(...[]);
21616
21636
  }
21617
- static {
21618
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiSimpleIcons, deps: [], target: i0.ɵɵFactoryTarget.Directive });
21619
- }
21620
- static {
21621
- 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 });
21622
- }
21623
- }
21624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiSimpleIcons, decorators: [{
21625
- type: Directive,
21626
- args: [{
21637
+ };
21638
+ NgxiSimpleIcons = __decorate([
21639
+ Directive({
21627
21640
  standalone: true,
21628
21641
  selector: "svg[ngxiSimpleIcons]",
21629
21642
  hostDirectives: [
@@ -21632,8 +21645,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
21632
21645
  inputs: ["icon:ngxiSimpleIcons", "width", "height", "viewBox"]
21633
21646
  }
21634
21647
  ]
21635
- }]
21636
- }] });
21648
+ })
21649
+ ], NgxiSimpleIcons);
21637
21650
  export {
21638
21651
  NgxiSimpleIcons,
21639
21652
  simpleIcons1001tracklists,