@eric-emg/symphiq-components 1.2.510 → 1.2.511

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.
@@ -2087,6 +2087,100 @@ class HeaderScrollService {
2087
2087
  this.scrollTimeout = null;
2088
2088
  }
2089
2089
  }
2090
+ handleEmbeddedScroll(scrollTop, collapseThreshold, expandThreshold) {
2091
+ const now = Date.now();
2092
+ if (this.isProgrammaticScroll) {
2093
+ this.log('Embedded ignored: programmatic scroll', { scrollTop });
2094
+ return;
2095
+ }
2096
+ const timeSinceLastChange = now - this.lastStateChangeTime;
2097
+ if (timeSinceLastChange < this.config.stateChangeCooldown) {
2098
+ return;
2099
+ }
2100
+ const scrollDelta = scrollTop - this.lastScrollPosition;
2101
+ const absScrollDelta = Math.abs(scrollDelta);
2102
+ const newDirection = scrollDelta > 2 ? 'down' : scrollDelta < -2 ? 'up' : 'none';
2103
+ if (newDirection !== 'none') {
2104
+ if (newDirection === this.scrollDirection) {
2105
+ this.consecutiveDirectionCount++;
2106
+ }
2107
+ else {
2108
+ this.consecutiveDirectionCount = 1;
2109
+ this.scrollDirection = newDirection;
2110
+ }
2111
+ }
2112
+ if (absScrollDelta < 3) {
2113
+ this.scrollStabilityCount++;
2114
+ }
2115
+ else {
2116
+ this.scrollStabilityCount = 0;
2117
+ }
2118
+ this.lastScrollPosition = scrollTop;
2119
+ const currentState = this.isScrolled();
2120
+ let desiredState = currentState;
2121
+ if (!currentState && scrollTop > collapseThreshold) {
2122
+ desiredState = true;
2123
+ }
2124
+ else if (currentState && scrollTop < expandThreshold) {
2125
+ desiredState = false;
2126
+ }
2127
+ if (currentState === desiredState) {
2128
+ return;
2129
+ }
2130
+ const isStable = this.scrollStabilityCount >= this.STABILITY_THRESHOLD;
2131
+ const hasConsistentDirection = this.consecutiveDirectionCount >= 3;
2132
+ const directionMatchesIntent = (desiredState && this.scrollDirection === 'down') ||
2133
+ (!desiredState && this.scrollDirection === 'up');
2134
+ this.log('Embedded state change candidate', {
2135
+ scrollTop,
2136
+ currentState: currentState ? 'collapsed' : 'expanded',
2137
+ desiredState: desiredState ? 'collapsed' : 'expanded',
2138
+ stability: this.scrollStabilityCount,
2139
+ direction: this.scrollDirection,
2140
+ isStable,
2141
+ hasConsistentDirection,
2142
+ directionMatchesIntent
2143
+ });
2144
+ if (!isStable && !hasConsistentDirection) {
2145
+ this.log('Embedded blocked: insufficient stability');
2146
+ return;
2147
+ }
2148
+ if (!directionMatchesIntent && !isStable) {
2149
+ this.log('Embedded blocked: direction mismatch');
2150
+ return;
2151
+ }
2152
+ if (this.scrollTimeout) {
2153
+ clearTimeout(this.scrollTimeout);
2154
+ }
2155
+ this.scrollTimeout = setTimeout(() => {
2156
+ const finalCurrentState = this.isScrolled();
2157
+ let finalDesiredState = finalCurrentState;
2158
+ if (!finalCurrentState && scrollTop > collapseThreshold) {
2159
+ finalDesiredState = true;
2160
+ }
2161
+ else if (finalCurrentState && scrollTop < expandThreshold) {
2162
+ finalDesiredState = false;
2163
+ }
2164
+ if (finalCurrentState === finalDesiredState) {
2165
+ return;
2166
+ }
2167
+ this.stateChangeCount++;
2168
+ console.warn('[HeaderScroll] EMBEDDED STATE CHANGE #' + this.stateChangeCount, {
2169
+ from: finalCurrentState ? 'collapsed' : 'expanded',
2170
+ to: finalDesiredState ? 'collapsed' : 'expanded',
2171
+ scrollTop
2172
+ });
2173
+ this.isProgrammaticScroll = true;
2174
+ this.isScrolled.set(finalDesiredState);
2175
+ this.lastStateChangeTime = Date.now();
2176
+ this.scrollStabilityCount = 0;
2177
+ this.consecutiveDirectionCount = 0;
2178
+ setTimeout(() => {
2179
+ this.isProgrammaticScroll = false;
2180
+ this.lastScrollPosition = scrollTop;
2181
+ }, 400);
2182
+ }, this.config.debounceDelay);
2183
+ }
2090
2184
  static { this.ɵfac = function HeaderScrollService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || HeaderScrollService)(); }; }
2091
2185
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: HeaderScrollService, factory: HeaderScrollService.ɵfac, providedIn: 'root' }); }
2092
2186
  }
@@ -95715,8 +95809,8 @@ class SymphiqProfileFocusAreasAnalysesDashboardComponent {
95715
95809
  this.FocusAreaDetailStatusEnum = FocusAreaDetailStatusEnum;
95716
95810
  this.AiDynamicContentStatusEnum = AiDynamicContentStatusEnum;
95717
95811
  this.ProfileAnalysisReviewStatusEnum = ProfileAnalysisReviewStatusEnum;
95718
- this.COLLAPSE_THRESHOLD = 50;
95719
- this.EXPAND_THRESHOLD = 30;
95812
+ this.COLLAPSE_THRESHOLD = 150;
95813
+ this.EXPAND_THRESHOLD = 10;
95720
95814
  this.embeddedScrollEffect = effect(() => {
95721
95815
  const scrollEvent = this.scrollEvent();
95722
95816
  const isEmbedded = this.embedded();
@@ -95731,13 +95825,7 @@ class SymphiqProfileFocusAreasAnalysesDashboardComponent {
95731
95825
  return;
95732
95826
  }
95733
95827
  const scrollTop = detail.scrollTop || 0;
95734
- const currentState = this.headerScrollService.isScrolled();
95735
- if (!currentState && scrollTop > this.COLLAPSE_THRESHOLD) {
95736
- this.headerScrollService.isScrolled.set(true);
95737
- }
95738
- else if (currentState && scrollTop < this.EXPAND_THRESHOLD) {
95739
- this.headerScrollService.isScrolled.set(false);
95740
- }
95828
+ this.headerScrollService.handleEmbeddedScroll(scrollTop, this.COLLAPSE_THRESHOLD, this.EXPAND_THRESHOLD);
95741
95829
  const scrollElement = this.scrollElement();
95742
95830
  if (scrollElement) {
95743
95831
  const scrollHeight = scrollElement.scrollHeight || 0;