@ngxi/cbi 0.12.23 → 0.12.24

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,
@@ -9049,53 +9049,66 @@ const cbiTwinlyCurtian = {
9049
9049
  "height": 24,
9050
9050
  "viewBox": "0 0 24 24"
9051
9051
  };
9052
+ function __decorate(decorators, target, key, desc) {
9053
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9054
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9055
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9056
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9057
+ }
9058
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
9059
+ var e = new Error(message);
9060
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
9061
+ };
9052
9062
  class Ngxi {
9053
9063
  constructor() {
9054
- this.sanitizer = inject(DomSanitizer);
9055
- this.icon = input(...[]);
9056
- this.width = input(...[]);
9057
- this.height = input(...[]);
9064
+ this.el = inject(ElementRef);
9065
+ this.platformId = inject(PLATFORM_ID);
9066
+ this.ngxi = input.required(...[]);
9067
+ this.width = input(void 0, ...[{
9068
+ transform: numberAttribute
9069
+ }]);
9070
+ this.height = input(void 0, ...[{
9071
+ transform: numberAttribute
9072
+ }]);
9058
9073
  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 ?? ""), ...[]);
9074
+ effect(() => {
9075
+ this.updateSvg();
9076
+ });
9077
+ }
9078
+ updateSvg() {
9079
+ if (isPlatformBrowser(this.platformId)) {
9080
+ const svg = this.el.nativeElement;
9081
+ svg.innerHTML = "";
9082
+ if (!this.ngxi) {
9083
+ return;
9084
+ }
9085
+ svg.innerHTML = this.ngxi().body;
9086
+ svg.setAttribute("width", (this.width() ?? this.ngxi()?.width ?? "").toString());
9087
+ svg.setAttribute("height", (this.height() ?? this.ngxi()?.height ?? "").toString());
9088
+ svg.setAttribute("viewBox", this.viewBox() ?? this.ngxi()?.viewBox ?? "");
9089
+ }
9063
9090
  }
9064
9091
  static {
9065
9092
  this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9066
9093
  }
9067
9094
  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 });
9095
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.2", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { ngxi: { classPropertyName: "ngxi", publicName: "ngxi", 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
9096
  }
9070
9097
  }
9071
9098
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: Ngxi, decorators: [{
9072
9099
  type: Directive,
9073
9100
  args: [{
9074
- standalone: true,
9075
9101
  selector: "svg[ngxi]",
9076
- host: {
9077
- "role": "img",
9078
- "[attr.width]": "resolvedWidth()",
9079
- "[attr.height]": "resolvedHeight()",
9080
- "[attr.viewBox]": "resolvedViewBox()",
9081
- "[innerHTML]": "safeSVG()"
9082
- }
9102
+ standalone: true
9083
9103
  }]
9084
- }] });
9085
- class NgxiCbi {
9104
+ }], ctorParameters: () => [] });
9105
+ let NgxiCbi = class NgxiCbi2 {
9086
9106
  constructor() {
9087
9107
  this.ngxiCbi = input.required(...[]);
9088
9108
  }
9089
- static {
9090
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
9091
- }
9092
- static {
9093
- 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 });
9094
- }
9095
- }
9096
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImport: i0, type: NgxiCbi, decorators: [{
9097
- type: Directive,
9098
- args: [{
9109
+ };
9110
+ NgxiCbi = __decorate([
9111
+ Directive({
9099
9112
  standalone: true,
9100
9113
  selector: "svg[ngxiCbi]",
9101
9114
  hostDirectives: [
@@ -9104,8 +9117,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.2", ngImpor
9104
9117
  inputs: ["icon:ngxiCbi", "width", "height", "viewBox"]
9105
9118
  }
9106
9119
  ]
9107
- }]
9108
- }] });
9120
+ })
9121
+ ], NgxiCbi);
9109
9122
  export {
9110
9123
  NgxiCbi,
9111
9124
  cbi02tv,