@ngxi/cbi 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 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,37 +9051,47 @@ const cbiTwinlyCurtian = {
9051
9051
  };
9052
9052
  class Ngxi {
9053
9053
  constructor() {
9054
- this.sanitizer = inject(DomSanitizer);
9055
- this.icon = input(...[]);
9056
- this.width = input(...[]);
9057
- this.height = input(...[]);
9054
+ this.el = inject(ElementRef);
9055
+ this.platformId = inject(PLATFORM_ID);
9056
+ this.icon = input.required(...[]);
9057
+ this.width = input(void 0, ...[{
9058
+ transform: numberAttribute
9059
+ }]);
9060
+ this.height = input(void 0, ...[{
9061
+ transform: numberAttribute
9062
+ }]);
9058
9063
  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 ?? ""), ...[]);
9064
+ effect(() => {
9065
+ this.updateSvg();
9066
+ });
9067
+ }
9068
+ updateSvg() {
9069
+ if (isPlatformBrowser(this.platformId)) {
9070
+ const svg = this.el.nativeElement;
9071
+ svg.innerHTML = "";
9072
+ if (!this.icon) {
9073
+ return;
9074
+ }
9075
+ svg.innerHTML = this.icon().body;
9076
+ svg.setAttribute("width", (this.width() ?? this.icon()?.width ?? "").toString());
9077
+ svg.setAttribute("height", (this.height() ?? this.icon()?.height ?? "").toString());
9078
+ svg.setAttribute("viewBox", this.viewBox() ?? this.icon()?.viewBox ?? "");
9079
+ }
9063
9080
  }
9064
9081
  static {
9065
9082
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9066
9083
  }
9067
9084
  static {
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 });
9085
+ 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 });
9069
9086
  }
9070
9087
  }
9071
9088
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
9072
9089
  type: Directive,
9073
9090
  args: [{
9074
- standalone: true,
9075
9091
  selector: "svg[ngxi]",
9076
- host: {
9077
- "role": "img",
9078
- "[attr.width]": "resolvedWidth()",
9079
- "[attr.height]": "resolvedHeight()",
9080
- "[attr.viewBox]": "resolvedViewBox()",
9081
- "[innerHTML]": "safeSVG()"
9082
- }
9092
+ standalone: true
9083
9093
  }]
9084
- }] });
9094
+ }], ctorParameters: () => [] });
9085
9095
  class NgxiCbi {
9086
9096
  constructor() {
9087
9097
  this.ngxiCbi = input.required(...[]);