@ngxi/streamline-cyber 0.12.20 → 0.12.22

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,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, SecurityContext, Directive } from "@angular/core";
3
- import { isPlatformServer } from "@angular/common";
2
+ import { inject, input, computed, Directive } from "@angular/core";
4
3
  import { DomSanitizer } from "@angular/platform-browser";
5
4
  const streamlineCyber3dGlasses = {
6
5
  "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>',
@@ -3004,44 +3003,21 @@ const streamlineCyberWrenchScrewdriver = {
3004
3003
  };
3005
3004
  class Ngxi {
3006
3005
  constructor() {
3007
- this.platformId = inject(PLATFORM_ID);
3008
- this.el = inject(ElementRef);
3009
- this.renderer = inject(Renderer2);
3010
3006
  this.sanitizer = inject(DomSanitizer);
3011
- this.icon = input(null, ...[]);
3007
+ this.icon = input(...[]);
3012
3008
  this.width = input(...[]);
3013
3009
  this.height = input(...[]);
3014
3010
  this.viewBox = input(...[]);
3015
3011
  this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
3016
3012
  this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
3017
3013
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
3018
- this.setBody = effect(() => {
3019
- const icon = this.icon();
3020
- if (!icon) {
3021
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
3022
- return;
3023
- }
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", "");
3028
- return;
3029
- }
3030
- if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
3031
- if (this.el.nativeElement.innerHTML.trim() === sanitizedBody?.trim()) {
3032
- this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
3033
- return;
3034
- }
3035
- this.renderer.removeAttribute(this.el.nativeElement, "data-ngxi-ssr");
3036
- }
3037
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", sanitizedBody);
3038
- }, ...[]);
3014
+ this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
3039
3015
  }
3040
3016
  static {
3041
3017
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3042
3018
  }
3043
3019
  static {
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 });
3020
+ 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 });
3045
3021
  }
3046
3022
  }
3047
3023
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
@@ -3053,7 +3029,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
3053
3029
  "role": "img",
3054
3030
  "[attr.width]": "resolvedWidth()",
3055
3031
  "[attr.height]": "resolvedHeight()",
3056
- "[attr.viewBox]": "resolvedViewBox()"
3032
+ "[attr.viewBox]": "resolvedViewBox()",
3033
+ "[innerHTML]": "safeSVG()"
3057
3034
  }
3058
3035
  }]
3059
3036
  }] });