@ngxi/eva 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 evaActivityFill = {
5
5
  "body": '<path fill="currentColor" d="M14.33 20h-.21a2 2 0 0 1-1.76-1.58L9.68 6l-2.76 6.4A1 1 0 0 1 6 13H3a1 1 0 0 1 0-2h2.34l2.51-5.79a2 2 0 0 1 3.79.38L14.32 18l2.76-6.38A1 1 0 0 1 18 11h3a1 1 0 0 1 0 2h-2.34l-2.51 5.79A2 2 0 0 1 14.33 20"/>',
6
6
  "width": 24,
@@ -2941,53 +2941,66 @@ const evaWifiOutline = {
2941
2941
  "height": 24,
2942
2942
  "viewBox": "0 0 24 24"
2943
2943
  };
2944
+ function __decorate(decorators, target, key, desc) {
2945
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2946
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2947
+ 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;
2948
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2949
+ }
2950
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
2951
+ var e = new Error(message);
2952
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2953
+ };
2944
2954
  class Ngxi {
2945
2955
  constructor() {
2946
- this.sanitizer = inject(DomSanitizer);
2947
- this.icon = input(...[]);
2948
- this.width = input(...[]);
2949
- this.height = input(...[]);
2956
+ this.el = inject(ElementRef);
2957
+ this.platformId = inject(PLATFORM_ID);
2958
+ this.ngxi = input.required(...[]);
2959
+ this.width = input(void 0, ...[{
2960
+ transform: numberAttribute
2961
+ }]);
2962
+ this.height = input(void 0, ...[{
2963
+ transform: numberAttribute
2964
+ }]);
2950
2965
  this.viewBox = input(...[]);
2951
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
2952
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
2953
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
2954
- this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
2966
+ effect(() => {
2967
+ this.updateSvg();
2968
+ });
2969
+ }
2970
+ updateSvg() {
2971
+ if (isPlatformBrowser(this.platformId)) {
2972
+ const svg = this.el.nativeElement;
2973
+ svg.innerHTML = "";
2974
+ if (!this.ngxi) {
2975
+ return;
2976
+ }
2977
+ svg.innerHTML = this.ngxi().body;
2978
+ svg.setAttribute("width", (this.width() ?? this.ngxi()?.width ?? "").toString());
2979
+ svg.setAttribute("height", (this.height() ?? this.ngxi()?.height ?? "").toString());
2980
+ svg.setAttribute("viewBox", this.viewBox() ?? this.ngxi()?.viewBox ?? "");
2981
+ }
2955
2982
  }
2956
2983
  static {
2957
2984
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2958
2985
  }
2959
2986
  static {
2960
- 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 });
2987
+ 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 });
2961
2988
  }
2962
2989
  }
2963
2990
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
2964
2991
  type: Directive,
2965
2992
  args: [{
2966
- standalone: true,
2967
2993
  selector: "svg[ngxi]",
2968
- host: {
2969
- "role": "img",
2970
- "[attr.width]": "resolvedWidth()",
2971
- "[attr.height]": "resolvedHeight()",
2972
- "[attr.viewBox]": "resolvedViewBox()",
2973
- "[innerHTML]": "safeSVG()"
2974
- }
2994
+ standalone: true
2975
2995
  }]
2976
- }] });
2977
- class NgxiEva {
2996
+ }], ctorParameters: () => [] });
2997
+ let NgxiEva = class NgxiEva2 {
2978
2998
  constructor() {
2979
2999
  this.ngxiEva = input.required(...[]);
2980
3000
  }
2981
- static {
2982
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiEva, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2983
- }
2984
- static {
2985
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiEva, isStandalone: true, selector: "svg[ngxiEva]", inputs: { ngxiEva: { classPropertyName: "ngxiEva", publicName: "ngxiEva", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiEva", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
2986
- }
2987
- }
2988
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiEva, decorators: [{
2989
- type: Directive,
2990
- args: [{
3001
+ };
3002
+ NgxiEva = __decorate([
3003
+ Directive({
2991
3004
  standalone: true,
2992
3005
  selector: "svg[ngxiEva]",
2993
3006
  hostDirectives: [
@@ -2996,8 +3009,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
2996
3009
  inputs: ["icon:ngxiEva", "width", "height", "viewBox"]
2997
3010
  }
2998
3011
  ]
2999
- }]
3000
- }] });
3012
+ })
3013
+ ], NgxiEva);
3001
3014
  export {
3002
3015
  NgxiEva,
3003
3016
  evaActivityFill,