@ibragim-dev-org/ui-forge-library 1.4.56 → 1.4.57

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.
@@ -671,10 +671,8 @@ class SkeletonDirective {
671
671
  effect(() => {
672
672
  if (this.$isLoading()) {
673
673
  this.applyHostSkeletonStyles();
674
- this.applySkeletonRecursive(this.el.nativeElement, 0);
675
674
  }
676
675
  else {
677
- this.removeSkeletonRecursive(this.el.nativeElement);
678
676
  this.removeHostSkeletonStyles();
679
677
  }
680
678
  });
@@ -683,12 +681,20 @@ class SkeletonDirective {
683
681
  this.injectKeyframes();
684
682
  }
685
683
  applyHostSkeletonStyles() {
686
- this.renderer.setStyle(this.el.nativeElement, 'position', 'relative');
687
- this.renderer.setStyle(this.el.nativeElement, 'overflow', 'hidden');
684
+ const element = this.el.nativeElement;
685
+ this.renderer.setStyle(element, 'position', 'relative');
686
+ this.renderer.setStyle(element, 'overflow', 'hidden');
687
+ this.renderer.setStyle(element, 'color', 'transparent');
688
+ this.renderer.setStyle(element, 'animation', `skeletonPulseParent 1.5s infinite`);
689
+ this.renderer.setStyle(element, 'border-radius', getComputedStyle(element).borderRadius);
688
690
  }
689
691
  removeHostSkeletonStyles() {
690
- this.renderer.removeStyle(this.el.nativeElement, 'position');
691
- this.renderer.removeStyle(this.el.nativeElement, 'overflow');
692
+ const element = this.el.nativeElement;
693
+ this.renderer.removeStyle(element, 'position');
694
+ this.renderer.removeStyle(element, 'overflow');
695
+ this.renderer.removeStyle(element, 'color');
696
+ this.renderer.removeStyle(element, 'animation');
697
+ this.renderer.removeStyle(element, 'background-color');
692
698
  }
693
699
  injectKeyframes() {
694
700
  if (!isBrowser())
@@ -702,37 +708,10 @@ class SkeletonDirective {
702
708
  50% { background-color: ${this.$darkColor()}; }
703
709
  100% { background-color: ${this.$lightColor()}; }
704
710
  }
705
- `;
706
- const childPulse = `
707
- @keyframes skeletonPulseChild {
708
- 0% { background-color: ${this.$darkColor()}; }
709
- 50% { background-color: ${this.$lightColor()}; }
710
- 100% { background-color: ${this.$darkColor()}; }
711
- }
712
711
  `;
713
712
  if (![...styleSheet.cssRules].some((r) => r.cssText.includes('skeletonPulseParent'))) {
714
713
  styleSheet.insertRule(parentPulse, styleSheet.cssRules.length);
715
714
  }
716
- if (![...styleSheet.cssRules].some((r) => r.cssText.includes('skeletonPulseChild'))) {
717
- styleSheet.insertRule(childPulse, styleSheet.cssRules.length);
718
- }
719
- }
720
- applySkeletonRecursive(element, depth) {
721
- const animationName = depth % 2 === 0 ? 'skeletonPulseParent' : 'skeletonPulseChild';
722
- this.renderer.setStyle(element, 'color', 'transparent'); // hide text
723
- this.renderer.setStyle(element, 'animation', `${animationName} 1.5s infinite`);
724
- this.renderer.setStyle(element, 'border-radius', getComputedStyle(element).borderRadius);
725
- Array.from(element.children).forEach((child) => {
726
- this.applySkeletonRecursive(child, depth + 1);
727
- });
728
- }
729
- removeSkeletonRecursive(element) {
730
- this.renderer.removeStyle(element, 'color');
731
- this.renderer.removeStyle(element, 'animation');
732
- this.renderer.removeStyle(element, 'background-color');
733
- Array.from(element.children).forEach((child) => {
734
- this.removeSkeletonRecursive(child);
735
- });
736
715
  }
737
716
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SkeletonDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
738
717
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: SkeletonDirective, isStandalone: true, selector: "[appSkeleton]", inputs: { $isLoading: { classPropertyName: "$isLoading", publicName: "appSkeleton", isSignal: true, isRequired: true, transformFunction: null }, $lightColor: { classPropertyName: "$lightColor", publicName: "$lightColor", isSignal: true, isRequired: true, transformFunction: null }, $darkColor: { classPropertyName: "$darkColor", publicName: "$darkColor", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });