@sula-tech/webcomponents 0.17.4 → 0.17.5

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.
@@ -27786,17 +27786,29 @@ const SulaLoader = class {
27786
27786
  * Tamanho predefinido (small, medium, large)
27787
27787
  */
27788
27788
  this.size = SulaLoaderSize.Medium;
27789
+ this.animationInstance = null;
27790
+ }
27791
+ connectedCallback() {
27792
+ this.tryInitLottie();
27789
27793
  }
27790
27794
  componentDidLoad() {
27791
- this.initLottie();
27795
+ this.tryInitLottie();
27796
+ }
27797
+ componentDidRender() {
27798
+ this.tryInitLottie();
27792
27799
  }
27793
27800
  disconnectedCallback() {
27794
- if (this.animationInstance) {
27795
- this.animationInstance.destroy();
27801
+ this.destroyAnimation();
27802
+ }
27803
+ destroyAnimation() {
27804
+ if (!this.animationInstance) {
27805
+ return;
27796
27806
  }
27807
+ this.animationInstance.destroy();
27808
+ this.animationInstance = null;
27797
27809
  }
27798
- initLottie() {
27799
- if (!this.containerRef)
27810
+ tryInitLottie() {
27811
+ if (!this.containerRef || this.animationInstance)
27800
27812
  return;
27801
27813
  try {
27802
27814
  const animationData = loaderAnimation;
@@ -27813,6 +27825,9 @@ const SulaLoader = class {
27813
27825
  console.error('Erro ao carregar animação Lottie:', error);
27814
27826
  }
27815
27827
  }
27828
+ initLottie() {
27829
+ this.tryInitLottie();
27830
+ }
27816
27831
  getDimensions() {
27817
27832
  const sizes = {
27818
27833
  small: '24px',
@@ -27823,7 +27838,7 @@ const SulaLoader = class {
27823
27838
  }
27824
27839
  render() {
27825
27840
  const { width, height } = this.getDimensions();
27826
- return (index.h(index.Host, { key: 'abd6665256f4e7173603ccc791b20f884bf9e9b6' }, index.h("div", { key: '41f9fb073388d7fc2a1585231fb8c257e5996847', ref: el => (this.containerRef = el), style: {
27841
+ return (index.h(index.Host, { key: '4d73099f19f4e81ed2cd83ee1402e0f06f71f7ca' }, index.h("div", { key: '2593fe1c91bf4c7f167caa55fdc476d0a9d73841', ref: el => (this.containerRef = el), style: {
27827
27842
  width: width,
27828
27843
  height: height,
27829
27844
  } })));