@ibragim-dev-org/ui-forge-library 1.4.67 → 1.4.69
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.
|
@@ -617,11 +617,16 @@ class StickyObserverDirective {
|
|
|
617
617
|
elementRef;
|
|
618
618
|
renderer;
|
|
619
619
|
$isStuck = signal(false, ...(ngDevMode ? [{ debugName: "$isStuck" }] : []));
|
|
620
|
+
isStuck = output();
|
|
620
621
|
observer;
|
|
621
622
|
sentinel;
|
|
622
623
|
constructor(elementRef, renderer) {
|
|
623
624
|
this.elementRef = elementRef;
|
|
624
625
|
this.renderer = renderer;
|
|
626
|
+
effect(() => {
|
|
627
|
+
const isStuck = this.$isStuck();
|
|
628
|
+
this.isStuck.emit(isStuck);
|
|
629
|
+
});
|
|
625
630
|
}
|
|
626
631
|
ngAfterViewInit() {
|
|
627
632
|
const stickyEl = this.elementRef.nativeElement;
|
|
@@ -642,7 +647,7 @@ class StickyObserverDirective {
|
|
|
642
647
|
this.sentinel?.remove();
|
|
643
648
|
}
|
|
644
649
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StickyObserverDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
645
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: StickyObserverDirective, isStandalone: true, selector: "[appStickyObserver]", host: { properties: { "class.sticked": "$isStuck()" } }, ngImport: i0 });
|
|
650
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: StickyObserverDirective, isStandalone: true, selector: "[appStickyObserver]", outputs: { isStuck: "isStuck" }, host: { properties: { "class.sticked": "$isStuck()" } }, ngImport: i0 });
|
|
646
651
|
}
|
|
647
652
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: StickyObserverDirective, decorators: [{
|
|
648
653
|
type: Directive,
|
|
@@ -652,7 +657,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
|
|
|
652
657
|
'[class.sticked]': '$isStuck()',
|
|
653
658
|
},
|
|
654
659
|
}]
|
|
655
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }] });
|
|
660
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { isStuck: [{ type: i0.Output, args: ["isStuck"] }] } });
|
|
656
661
|
|
|
657
662
|
const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
658
663
|
|
|
@@ -858,6 +863,8 @@ class StableScrollDirective {
|
|
|
858
863
|
mutationObserver;
|
|
859
864
|
restoreFrameId = null;
|
|
860
865
|
restoreMicrotaskPending = false;
|
|
866
|
+
// Restoration only runs after captureBeforeChange(); otherwise the element scrolls natively.
|
|
867
|
+
restoreArmed = false;
|
|
861
868
|
// ---- thresholds ----
|
|
862
869
|
$topThreshold = input(0, ...(ngDevMode ? [{ debugName: "$topThreshold" }] : []));
|
|
863
870
|
$bottomThreshold = input(0, ...(ngDevMode ? [{ debugName: "$bottomThreshold" }] : []));
|
|
@@ -909,6 +916,7 @@ class StableScrollDirective {
|
|
|
909
916
|
}
|
|
910
917
|
/** Call BEFORE data changes */
|
|
911
918
|
captureBeforeChange() {
|
|
919
|
+
this.restoreArmed = true;
|
|
912
920
|
this.refreshAnchorSnapshot();
|
|
913
921
|
}
|
|
914
922
|
/** Call AFTER render */
|
|
@@ -939,7 +947,7 @@ class StableScrollDirective {
|
|
|
939
947
|
if (!mutations.some((mutation) => mutation.addedNodes.length || mutation.removedNodes.length)) {
|
|
940
948
|
return;
|
|
941
949
|
}
|
|
942
|
-
if (!this.
|
|
950
|
+
if (!this.restoreArmed) {
|
|
943
951
|
this.refreshAnchorSnapshot();
|
|
944
952
|
return;
|
|
945
953
|
}
|
|
@@ -988,6 +996,7 @@ class StableScrollDirective {
|
|
|
988
996
|
this.restoreFrameId = requestAnimationFrame(() => {
|
|
989
997
|
this.restoreFrameId = null;
|
|
990
998
|
this.restoreFromSnapshot();
|
|
999
|
+
this.restoreArmed = false;
|
|
991
1000
|
});
|
|
992
1001
|
}
|
|
993
1002
|
refreshAnchorSnapshot() {
|