@ngxi/cbi 0.12.19 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
3
- import { isPlatformServer } from "@angular/common";
2
+ import { inject, input, computed, Directive } from "@angular/core";
3
+ import { DomSanitizer } from "@angular/platform-browser";
4
4
  const cbi02tv = {
5
5
  "body": '<path fill="currentColor" d="m16.5 8.261l2.121 6.123h1.467L22 8.261h-1.074l-1.571 4.768l-1.546-4.768zm-5.475 0h4.898v.897h-1.781l-.052 5.226h-1.231V9.158h-1.834zm-1.242 7.478v-.42H8.7c.435-.427 1-.946 1-1.511a.733.733 0 0 0-.835-.779a1.8 1.8 0 0 0-.791.191l.043.443a1.15 1.15 0 0 1 .614-.214c.217 0 .436.114.436.359c0 .488-.905 1.244-1.153 1.485v.446zM2 11.411a3.063 3.063 0 1 0 6.124 0a2.97 2.97 0 0 0-3.057-3.15A2.97 2.97 0 0 0 2 11.411m1.18 0a2.055 2.055 0 0 1 1.887-2.253a2.054 2.054 0 0 1 1.876 2.253a2.016 2.016 0 0 1-1.876 2.253a2.02 2.02 0 0 1-1.887-2.253"/>',
6
6
  "width": 24,
@@ -9051,44 +9051,24 @@ const cbiTwinlyCurtian = {
9051
9051
  };
9052
9052
  class Ngxi {
9053
9053
  constructor() {
9054
- this.platform = inject(PLATFORM_ID);
9055
- this.el = inject(ElementRef);
9056
- this.renderer = inject(Renderer2);
9057
- this.icon = input(null);
9058
- this.width = input();
9059
- this.height = input();
9060
- this.viewBox = input();
9061
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width);
9062
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height);
9063
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
9064
- this.setBody = effect(() => {
9065
- const icon = this.icon();
9066
- if (!icon) {
9067
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
9068
- return;
9069
- }
9070
- if (isPlatformServer(this.platform)) {
9071
- this.el.nativeElement.innerHTML = icon.body;
9072
- this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
9073
- return;
9074
- }
9075
- if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
9076
- this.el.nativeElement.removeAttribute("data-ngxi-ssr");
9077
- if (this.el.nativeElement.innerHTML === icon.body) {
9078
- return;
9079
- }
9080
- }
9081
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
9082
- });
9054
+ this.sanitizer = inject(DomSanitizer);
9055
+ this.icon = input(...[]);
9056
+ this.width = input(...[]);
9057
+ this.height = input(...[]);
9058
+ this.viewBox = input(...[]);
9059
+ this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
9060
+ this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
9061
+ this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
9062
+ this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
9083
9063
  }
9084
9064
  static {
9085
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9065
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9086
9066
  }
9087
9067
  static {
9088
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", 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 });
9068
+ 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 });
9089
9069
  }
9090
9070
  }
9091
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
9071
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
9092
9072
  type: Directive,
9093
9073
  args: [{
9094
9074
  standalone: true,
@@ -9097,22 +9077,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9097
9077
  "role": "img",
9098
9078
  "[attr.width]": "resolvedWidth()",
9099
9079
  "[attr.height]": "resolvedHeight()",
9100
- "[attr.viewBox]": "resolvedViewBox()"
9080
+ "[attr.viewBox]": "resolvedViewBox()",
9081
+ "[innerHTML]": "safeSVG()"
9101
9082
  }
9102
9083
  }]
9103
9084
  }] });
9104
9085
  class NgxiCbi {
9105
9086
  constructor() {
9106
- this.ngxiCbi = input.required();
9087
+ this.ngxiCbi = input.required(...[]);
9107
9088
  }
9108
9089
  static {
9109
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9090
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9110
9091
  }
9111
9092
  static {
9112
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: NgxiCbi, isStandalone: true, selector: "svg[ngxiCbi]", inputs: { ngxiCbi: { classPropertyName: "ngxiCbi", publicName: "ngxiCbi", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiCbi", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
9093
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiCbi, isStandalone: true, selector: "svg[ngxiCbi]", inputs: { ngxiCbi: { classPropertyName: "ngxiCbi", publicName: "ngxiCbi", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiCbi", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
9113
9094
  }
9114
9095
  }
9115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiCbi, decorators: [{
9096
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiCbi, decorators: [{
9116
9097
  type: Directive,
9117
9098
  args: [{
9118
9099
  standalone: true,