@ngxi/streamline-cyber 0.12.23 → 0.12.25

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 streamlineCyber3dGlasses = {
5
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>',
6
6
  "width": 24,
@@ -3003,37 +3003,47 @@ const streamlineCyberWrenchScrewdriver = {
3003
3003
  };
3004
3004
  class Ngxi {
3005
3005
  constructor() {
3006
- this.sanitizer = inject(DomSanitizer);
3007
- this.icon = input(...[]);
3008
- this.width = input(...[]);
3009
- this.height = input(...[]);
3006
+ this.el = inject(ElementRef);
3007
+ this.platformId = inject(PLATFORM_ID);
3008
+ this.icon = input.required(...[]);
3009
+ this.width = input(void 0, ...[{
3010
+ transform: numberAttribute
3011
+ }]);
3012
+ this.height = input(void 0, ...[{
3013
+ transform: numberAttribute
3014
+ }]);
3010
3015
  this.viewBox = input(...[]);
3011
- this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width, ...[]);
3012
- this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height, ...[]);
3013
- this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox, ...[]);
3014
- this.safeSVG = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? ""), ...[]);
3016
+ effect(() => {
3017
+ this.updateSvg();
3018
+ });
3019
+ }
3020
+ updateSvg() {
3021
+ if (isPlatformBrowser(this.platformId)) {
3022
+ const svg = this.el.nativeElement;
3023
+ svg.innerHTML = "";
3024
+ if (!this.icon) {
3025
+ return;
3026
+ }
3027
+ svg.innerHTML = this.icon().body;
3028
+ svg.setAttribute("width", (this.width() ?? this.icon()?.width ?? "").toString());
3029
+ svg.setAttribute("height", (this.height() ?? this.icon()?.height ?? "").toString());
3030
+ svg.setAttribute("viewBox", this.viewBox() ?? this.icon()?.viewBox ?? "");
3031
+ }
3015
3032
  }
3016
3033
  static {
3017
3034
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3018
3035
  }
3019
3036
  static {
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 });
3037
+ 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: 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 });
3021
3038
  }
3022
3039
  }
3023
3040
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
3024
3041
  type: Directive,
3025
3042
  args: [{
3026
- standalone: true,
3027
3043
  selector: "svg[ngxi]",
3028
- host: {
3029
- "role": "img",
3030
- "[attr.width]": "resolvedWidth()",
3031
- "[attr.height]": "resolvedHeight()",
3032
- "[attr.viewBox]": "resolvedViewBox()",
3033
- "[innerHTML]": "safeSVG()"
3034
- }
3044
+ standalone: true
3035
3045
  }]
3036
- }] });
3046
+ }], ctorParameters: () => [] });
3037
3047
  class NgxiStreamlineCyber {
3038
3048
  constructor() {
3039
3049
  this.ngxiStreamlineCyber = input.required(...[]);