@ngxi/streamline-cyber 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 streamlineCyber3dGlasses = {
5
6
  "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10"><path d="m22.5 10.5l-5.75-5H14.5m-14 5l5.75-5H8.5m-8 5l2 9H8l3.5-3.5l3.5 3.5h5.5l2-9m-22 0h22"/><path d="M3.25 12.5h7.25V14L7 17.5H4.5zm16.5 0H12.5V14l3.5 3.5h2.5z"/></g>',
6
7
  "width": 24,
@@ -3003,44 +3004,47 @@ const streamlineCyberWrenchScrewdriver = {
3003
3004
  };
3004
3005
  class Ngxi {
3005
3006
  constructor() {
3006
- this.platform = inject(PLATFORM_ID);
3007
+ this.platformId = inject(PLATFORM_ID);
3007
3008
  this.el = inject(ElementRef);
3008
3009
  this.renderer = inject(Renderer2);
3009
- this.icon = input(null);
3010
- this.width = input();
3011
- this.height = input();
3012
- this.viewBox = input();
3013
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width);
3014
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height);
3015
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
3010
+ this.sanitizer = inject(DomSanitizer);
3011
+ this.icon = input(null, ...[]);
3012
+ this.width = input(...[]);
3013
+ this.height = input(...[]);
3014
+ this.viewBox = input(...[]);
3015
+ this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
3016
+ this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
3017
+ this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
3016
3018
  this.setBody = effect(() => {
3017
3019
  const icon = this.icon();
3018
3020
  if (!icon) {
3019
3021
  this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
3020
3022
  return;
3021
3023
  }
3022
- if (isPlatformServer(this.platform)) {
3023
- this.el.nativeElement.innerHTML = icon.body;
3024
- this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
3024
+ const sanitizedBody = this.sanitizer.sanitize(SecurityContext.HTML, icon.body);
3025
+ if (isPlatformServer(this.platformId)) {
3026
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
3027
+ this.renderer.setAttribute(this.el.nativeElement, "data-ngxi-ssr", "");
3025
3028
  return;
3026
3029
  }
3027
3030
  if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
3028
- this.el.nativeElement.removeAttribute("data-ngxi-ssr");
3029
- if (this.el.nativeElement.innerHTML === icon.body) {
3031
+ if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
3032
+ this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
3030
3033
  return;
3031
3034
  }
3035
+ this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
3032
3036
  }
3033
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
3034
- });
3037
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
3038
+ }, ...[]);
3035
3039
  }
3036
3040
  static {
3037
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3041
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3038
3042
  }
3039
3043
  static {
3040
- 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 });
3044
+ 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 });
3041
3045
  }
3042
3046
  }
3043
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
3047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
3044
3048
  type: Directive,
3045
3049
  args: [{
3046
3050
  standalone: true,
@@ -3055,16 +3059,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
3055
3059
  }] });
3056
3060
  class NgxiStreamlineCyber {
3057
3061
  constructor() {
3058
- this.ngxiStreamlineCyber = input.required();
3062
+ this.ngxiStreamlineCyber = input.required(...[]);
3059
3063
  }
3060
3064
  static {
3061
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiStreamlineCyber, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3065
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiStreamlineCyber, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3062
3066
  }
3063
3067
  static {
3064
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: NgxiStreamlineCyber, isStandalone: true, selector: "svg[ngxiStreamlineCyber]", inputs: { ngxiStreamlineCyber: { classPropertyName: "ngxiStreamlineCyber", publicName: "ngxiStreamlineCyber", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiStreamlineCyber", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
3068
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: NgxiStreamlineCyber, isStandalone: true, selector: "svg[ngxiStreamlineCyber]", inputs: { ngxiStreamlineCyber: { classPropertyName: "ngxiStreamlineCyber", publicName: "ngxiStreamlineCyber", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: Ngxi, inputs: ["icon", "ngxiStreamlineCyber", "width", "width", "height", "height", "viewBox", "viewBox"] }], ngImport: i0 });
3065
3069
  }
3066
3070
  }
3067
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiStreamlineCyber, decorators: [{
3071
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiStreamlineCyber, decorators: [{
3068
3072
  type: Directive,
3069
3073
  args: [{
3070
3074
  standalone: true,