@ngxi/cbi 0.12.0-beta.9 → 0.12.1

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,5 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { inject, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
2
+ import { inject, PLATFORM_ID, ElementRef, Renderer2, input, computed, effect, Directive } from "@angular/core";
3
+ import { isPlatformServer } from "@angular/common";
3
4
  const cbi02tv = {
4
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"/>',
5
6
  "width": 24,
@@ -8882,6 +8883,7 @@ const cbiTwinlyCurtian = {
8882
8883
  };
8883
8884
  class Ngxi {
8884
8885
  constructor() {
8886
+ this.platform = inject(PLATFORM_ID);
8885
8887
  this.el = inject(ElementRef);
8886
8888
  this.renderer = inject(Renderer2);
8887
8889
  this.icon = input(null);
@@ -8893,17 +8895,32 @@ class Ngxi {
8893
8895
  this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox);
8894
8896
  this.setBody = effect(() => {
8895
8897
  const icon = this.icon();
8896
- this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon?.body ?? "");
8898
+ if (!icon) {
8899
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", "");
8900
+ return;
8901
+ }
8902
+ if (isPlatformServer(this.platform)) {
8903
+ this.el.nativeElement.innerHTML = icon.body;
8904
+ this.el.nativeElement.setAttribute("data-ngxi-ssr", "");
8905
+ return;
8906
+ }
8907
+ if (this.el.nativeElement.hasAttribute("data-ngxi-ssr")) {
8908
+ this.el.nativeElement.removeAttribute("data-ngxi-ssr");
8909
+ if (this.el.nativeElement.innerHTML === icon.body) {
8910
+ return;
8911
+ }
8912
+ }
8913
+ this.renderer.setProperty(this.el.nativeElement, "innerHTML", icon.body);
8897
8914
  });
8898
8915
  }
8899
8916
  static {
8900
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8917
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8901
8918
  }
8902
8919
  static {
8903
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", 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 });
8920
+ 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 });
8904
8921
  }
8905
8922
  }
8906
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, decorators: [{
8923
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: Ngxi, decorators: [{
8907
8924
  type: Directive,
8908
8925
  args: [{
8909
8926
  standalone: true,
@@ -8921,13 +8938,13 @@ class NgxiCbi {
8921
8938
  this.ngxiCbi = input.required();
8922
8939
  }
8923
8940
  static {
8924
- this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8941
+ this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiCbi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
8925
8942
  }
8926
8943
  static {
8927
- this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", 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 });
8944
+ this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", 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 });
8928
8945
  }
8929
8946
  }
8930
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: NgxiCbi, decorators: [{
8947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxiCbi, decorators: [{
8931
8948
  type: Directive,
8932
8949
  args: [{
8933
8950
  standalone: true,