@ngxi/cbi 0.12.18 → 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 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 cbi02tv = {
5
6
  "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
7
  "width": 24,
@@ -9051,44 +9052,47 @@ const cbiTwinlyCurtian = {
9051
9052
  };
9052
9053
  class Ngxi {
9053
9054
  constructor() {
9054
- this.platform = inject(PLATFORM_ID);
9055
+ this.platformId = inject(PLATFORM_ID);
9055
9056
  this.el = inject(ElementRef);
9056
9057
  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);
9058
+ this.sanitizer = inject(DomSanitizer);
9059
+ this.icon = input(null, ...[]);
9060
+ this.width = input(...[]);
9061
+ this.height = input(...[]);
9062
+ this.viewBox = input(...[]);
9063
+ this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
9064
+ this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
9065
+ this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
9064
9066
  this.setBody = effect(() => {
9065
9067
  const icon = this.icon();
9066
9068
  if (!icon) {
9067
9069
  this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
9068
9070
  return;
9069
9071
  }
9070
- if (isPlatformServer(this.platform)) {
9071
- this.el.nativeElement.innerHTML = icon.body;
9072
- this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
9072
+ const sanitizedBody = this.sanitizer.sanitize(SecurityContext.HTML, icon.body);
9073
+ if (isPlatformServer(this.platformId)) {
9074
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
9075
+ this.renderer.setAttribute(this.el.nativeElement, "data-ngxi-ssr", "");
9073
9076
  return;
9074
9077
  }
9075
9078
  if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
9076
- this.el.nativeElement.removeAttribute("data-ngxi-ssr");
9077
- if (this.el.nativeElement.innerHTML === icon.body) {
9079
+ if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
9080
+ this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
9078
9081
  return;
9079
9082
  }
9083
+ this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
9080
9084
  }
9081
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
9082
- });
9085
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
9086
+ }, ...[]);
9083
9087
  }
9084
9088
  static {
9085
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9089
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9086
9090
  }
9087
9091
  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 });
9092
+ 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 });
9089
9093
  }
9090
9094
  }
9091
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
9095
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
9092
9096
  type: Directive,
9093
9097
  args: [{
9094
9098
  standalone: true,
@@ -9103,16 +9107,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9103
9107
  }] });
9104
9108
  class NgxiCbi {
9105
9109
  constructor() {
9106
- this.ngxiCbi = input.required();
9110
+ this.ngxiCbi = input.required(...[]);
9107
9111
  }
9108
9112
  static {
9109
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9113
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9110
9114
  }
9111
9115
  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 });
9116
+ 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
9117
  }
9114
9118
  }
9115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiCbi, decorators: [{
9119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiCbi, decorators: [{
9116
9120
  type: Directive,
9117
9121
  args: [{
9118
9122
  standalone: true,