@ibragim-dev-org/ui-forge-library 1.4.64 → 1.4.68

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.
@@ -858,6 +858,8 @@ class StableScrollDirective {
858
858
  mutationObserver;
859
859
  restoreFrameId = null;
860
860
  restoreMicrotaskPending = false;
861
+ // Restoration only runs after captureBeforeChange(); otherwise the element scrolls natively.
862
+ restoreArmed = false;
861
863
  // ---- thresholds ----
862
864
  $topThreshold = input(0, ...(ngDevMode ? [{ debugName: "$topThreshold" }] : []));
863
865
  $bottomThreshold = input(0, ...(ngDevMode ? [{ debugName: "$bottomThreshold" }] : []));
@@ -909,6 +911,7 @@ class StableScrollDirective {
909
911
  }
910
912
  /** Call BEFORE data changes */
911
913
  captureBeforeChange() {
914
+ this.restoreArmed = true;
912
915
  this.refreshAnchorSnapshot();
913
916
  }
914
917
  /** Call AFTER render */
@@ -939,7 +942,7 @@ class StableScrollDirective {
939
942
  if (!mutations.some((mutation) => mutation.addedNodes.length || mutation.removedNodes.length)) {
940
943
  return;
941
944
  }
942
- if (!this.anchorSnapshot) {
945
+ if (!this.restoreArmed) {
943
946
  this.refreshAnchorSnapshot();
944
947
  return;
945
948
  }
@@ -988,6 +991,7 @@ class StableScrollDirective {
988
991
  this.restoreFrameId = requestAnimationFrame(() => {
989
992
  this.restoreFrameId = null;
990
993
  this.restoreFromSnapshot();
994
+ this.restoreArmed = false;
991
995
  });
992
996
  }
993
997
  refreshAnchorSnapshot() {
@@ -1733,23 +1737,26 @@ class UiAvatarDirective {
1733
1737
  this.elementRef = elementRef;
1734
1738
  this.renderer = renderer;
1735
1739
  effect(() => {
1736
- const src = this.$src()?.trim();
1737
- const canShow = this.$canShowAvatar();
1738
- const acronym = this.$acronym()
1739
- .trim()
1740
- .split(/\s+/)
1741
- .slice(0, 2)
1742
- .map((w) => w[0]?.toUpperCase() || '')
1743
- .join('');
1744
- this.$text.set(acronym);
1745
- if (src && canShow) {
1746
- this.renderer.removeStyle(this.elementRef.nativeElement, 'background');
1747
- return;
1748
- }
1749
- const colorValue = this.$acronym();
1750
- this.renderer.setStyle(this.elementRef.nativeElement, 'background', stringToColorGradient(colorValue));
1740
+ this.setStyleBackground();
1751
1741
  });
1752
1742
  }
1743
+ setStyleBackground() {
1744
+ const src = this.$src()?.trim();
1745
+ const canShow = this.$canShowAvatar();
1746
+ const acronym = this.$acronym()
1747
+ .trim()
1748
+ .split(/\s+/)
1749
+ .slice(0, 2)
1750
+ .map((w) => w[0]?.toUpperCase() || '')
1751
+ .join('');
1752
+ this.$text.set(acronym);
1753
+ if (src && canShow) {
1754
+ this.renderer.removeStyle(this.elementRef.nativeElement, 'background');
1755
+ return;
1756
+ }
1757
+ const colorValue = this.$acronym();
1758
+ this.renderer.setStyle(this.elementRef.nativeElement, 'background', stringToColorGradient(colorValue));
1759
+ }
1753
1760
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: UiAvatarDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1754
1761
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: UiAvatarDirective, isStandalone: true, selector: "app-ui-avatar", inputs: { $size: { classPropertyName: "$size", publicName: "$size", isSignal: true, isRequired: false, transformFunction: null }, $isRounded: { classPropertyName: "$isRounded", publicName: "$isRounded", isSignal: true, isRequired: false, transformFunction: null }, $src: { classPropertyName: "$src", publicName: "$src", isSignal: true, isRequired: true, transformFunction: null }, $acronym: { classPropertyName: "$acronym", publicName: "$acronym", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.nano": "$size() === 'nano'", "class.micro": "$size() === 'micro'", "class.extra-small": "$size() === 'extra-small'", "class.small": "$size() === 'small'", "class.medium": "$size() === 'medium'", "class.large": "$size() === 'large'", "class.extra-large": "$size() === 'extra-large'", "class.xx-large": "$size() === 'xx-large'", "class.xxx-large": "$size() === 'xxx-large'", "class.rounded": "$isRounded()" } }, ngImport: i0 });
1755
1762
  }