@ibragim-dev-org/ui-forge-library 1.4.32 → 1.4.33

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.
@@ -786,6 +786,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
786
786
 
787
787
  class StableScrollDirective {
788
788
  host;
789
+ destroyRef;
789
790
  el;
790
791
  lastScrollHeight = 0;
791
792
  /** Emit when user reaches top threshold */
@@ -796,8 +797,9 @@ class StableScrollDirective {
796
797
  $topThreshold = input(0, ...(ngDevMode ? [{ debugName: "$topThreshold" }] : []));
797
798
  /** Bottom threshold in px or percentage (0–1). Default: 0 (exact bottom). */
798
799
  $bottomThreshold = input(0, ...(ngDevMode ? [{ debugName: "$bottomThreshold" }] : []));
799
- constructor(host) {
800
+ constructor(host, destroyRef) {
800
801
  this.host = host;
802
+ this.destroyRef = destroyRef;
801
803
  this.el = this.host.nativeElement;
802
804
  }
803
805
  scrolling$ = new Subject();
@@ -814,21 +816,29 @@ class StableScrollDirective {
814
816
  this.isScrolling = true;
815
817
  this.scrolling$.next();
816
818
  this.onScroll();
817
- }))
819
+ }), takeUntilDestroyed(this.destroyRef))
818
820
  .subscribe();
819
821
  this.scrolling$
820
822
  .pipe(debounceTime(120), tap(() => {
821
823
  this.isScrolling = false;
822
824
  this.scrollEnd$.next();
823
- }))
825
+ }), takeUntilDestroyed(this.destroyRef))
824
826
  .subscribe();
825
827
  this.resizeObserver = new ResizeObserver(() => {
826
828
  if (!this.isScrolling) {
827
829
  this.captureBeforeChange();
828
- requestAnimationFrame(() => this.restoreScrollPosition());
830
+ this.restoreScrollPosition();
829
831
  }
830
832
  });
831
833
  this.resizeObserver.observe(this.el);
834
+ fromEvent(window, 'resize')
835
+ .pipe(throttleTime(50), tap(() => {
836
+ if (!this.isScrolling) {
837
+ this.captureBeforeChange();
838
+ this.restoreScrollPosition();
839
+ }
840
+ }), takeUntilDestroyed(this.destroyRef))
841
+ .subscribe();
832
842
  }
833
843
  ngOnDestroy() {
834
844
  this.resizeObserver.disconnect();
@@ -857,11 +867,13 @@ class StableScrollDirective {
857
867
  }
858
868
  /** Call this AFTER Angular renders new items */
859
869
  restoreScrollPosition() {
860
- const newHeight = this.el.scrollHeight;
861
- const diff = newHeight - this.lastScrollHeight;
862
- this.el.scrollTop += diff;
870
+ requestAnimationFrame(() => {
871
+ const newHeight = this.el.scrollHeight;
872
+ const diff = newHeight - this.lastScrollHeight;
873
+ this.el.scrollTop += diff;
874
+ });
863
875
  }
864
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StableScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
876
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StableScrollDirective, deps: [{ token: i0.ElementRef }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
865
877
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: StableScrollDirective, isStandalone: true, selector: "[stableScroll]", inputs: { $topThreshold: { classPropertyName: "$topThreshold", publicName: "$topThreshold", isSignal: true, isRequired: false, transformFunction: null }, $bottomThreshold: { classPropertyName: "$bottomThreshold", publicName: "$bottomThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { reachedTop: "reachedTop", reachedBottom: "reachedBottom" }, ngImport: i0 });
866
878
  }
867
879
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StableScrollDirective, decorators: [{
@@ -869,7 +881,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
869
881
  args: [{
870
882
  selector: '[stableScroll]',
871
883
  }]
872
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { reachedTop: [{ type: i0.Output, args: ["reachedTop"] }], reachedBottom: [{ type: i0.Output, args: ["reachedBottom"] }], $topThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$topThreshold", required: false }] }], $bottomThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$bottomThreshold", required: false }] }] } });
884
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.DestroyRef }], propDecorators: { reachedTop: [{ type: i0.Output, args: ["reachedTop"] }], reachedBottom: [{ type: i0.Output, args: ["reachedBottom"] }], $topThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$topThreshold", required: false }] }], $bottomThreshold: [{ type: i0.Input, args: [{ isSignal: true, alias: "$bottomThreshold", required: false }] }] } });
873
885
 
874
886
  class CenterEllipsisPipe {
875
887
  transform(value, visibleStart = 4, visibleEnd = 4) {