@eric-emg/symphiq-components 1.2.510 → 1.2.512

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.
@@ -1906,13 +1906,13 @@ class MetricFormatterService {
1906
1906
 
1907
1907
  class HeaderScrollService {
1908
1908
  constructor() {
1909
- this.DEFAULT_COLLAPSE_THRESHOLD = 180;
1909
+ this.DEFAULT_COLLAPSE_THRESHOLD = 50;
1910
1910
  this.DEFAULT_EXPAND_THRESHOLD = 5;
1911
1911
  this.DEFAULT_STATE_CHANGE_COOLDOWN = 500;
1912
1912
  this.DEFAULT_DEBOUNCE_DELAY = 250;
1913
1913
  this.HEADER_HEIGHT_DIFF = 48;
1914
1914
  this.STABILITY_THRESHOLD = 8;
1915
- this.DEBUG = true;
1915
+ this.DEBUG = false;
1916
1916
  this.isScrolled = signal(false, ...(ngDevMode ? [{ debugName: "isScrolled" }] : []));
1917
1917
  this.scrollProgress = signal(0, ...(ngDevMode ? [{ debugName: "scrollProgress" }] : []));
1918
1918
  this.scrollTimeout = null;
@@ -1929,7 +1929,6 @@ class HeaderScrollService {
1929
1929
  stateChangeCooldown: this.DEFAULT_STATE_CHANGE_COOLDOWN,
1930
1930
  debounceDelay: this.DEFAULT_DEBOUNCE_DELAY
1931
1931
  };
1932
- console.warn('[HeaderScrollService] INITIALIZED - v2 with bounce prevention');
1933
1932
  }
1934
1933
  log(message, data) {
1935
1934
  if (this.DEBUG) {
@@ -2039,7 +2038,7 @@ class HeaderScrollService {
2039
2038
  return;
2040
2039
  }
2041
2040
  this.stateChangeCount++;
2042
- console.warn('[HeaderScroll] STATE CHANGE #' + this.stateChangeCount, {
2041
+ this.log('STATE CHANGE #' + this.stateChangeCount, {
2043
2042
  from: finalCurrentState ? 'collapsed' : 'expanded',
2044
2043
  to: finalDesiredState ? 'collapsed' : 'expanded',
2045
2044
  finalPosition,
@@ -2087,6 +2086,100 @@ class HeaderScrollService {
2087
2086
  this.scrollTimeout = null;
2088
2087
  }
2089
2088
  }
2089
+ handleEmbeddedScroll(scrollTop, collapseThreshold, expandThreshold) {
2090
+ const now = Date.now();
2091
+ if (this.isProgrammaticScroll) {
2092
+ this.log('Embedded ignored: programmatic scroll', { scrollTop });
2093
+ return;
2094
+ }
2095
+ const timeSinceLastChange = now - this.lastStateChangeTime;
2096
+ if (timeSinceLastChange < this.config.stateChangeCooldown) {
2097
+ return;
2098
+ }
2099
+ const scrollDelta = scrollTop - this.lastScrollPosition;
2100
+ const absScrollDelta = Math.abs(scrollDelta);
2101
+ const newDirection = scrollDelta > 2 ? 'down' : scrollDelta < -2 ? 'up' : 'none';
2102
+ if (newDirection !== 'none') {
2103
+ if (newDirection === this.scrollDirection) {
2104
+ this.consecutiveDirectionCount++;
2105
+ }
2106
+ else {
2107
+ this.consecutiveDirectionCount = 1;
2108
+ this.scrollDirection = newDirection;
2109
+ }
2110
+ }
2111
+ if (absScrollDelta < 3) {
2112
+ this.scrollStabilityCount++;
2113
+ }
2114
+ else {
2115
+ this.scrollStabilityCount = 0;
2116
+ }
2117
+ this.lastScrollPosition = scrollTop;
2118
+ const currentState = this.isScrolled();
2119
+ let desiredState = currentState;
2120
+ if (!currentState && scrollTop > collapseThreshold) {
2121
+ desiredState = true;
2122
+ }
2123
+ else if (currentState && scrollTop < expandThreshold) {
2124
+ desiredState = false;
2125
+ }
2126
+ if (currentState === desiredState) {
2127
+ return;
2128
+ }
2129
+ const isStable = this.scrollStabilityCount >= this.STABILITY_THRESHOLD;
2130
+ const hasConsistentDirection = this.consecutiveDirectionCount >= 3;
2131
+ const directionMatchesIntent = (desiredState && this.scrollDirection === 'down') ||
2132
+ (!desiredState && this.scrollDirection === 'up');
2133
+ this.log('Embedded state change candidate', {
2134
+ scrollTop,
2135
+ currentState: currentState ? 'collapsed' : 'expanded',
2136
+ desiredState: desiredState ? 'collapsed' : 'expanded',
2137
+ stability: this.scrollStabilityCount,
2138
+ direction: this.scrollDirection,
2139
+ isStable,
2140
+ hasConsistentDirection,
2141
+ directionMatchesIntent
2142
+ });
2143
+ if (!isStable && !hasConsistentDirection) {
2144
+ this.log('Embedded blocked: insufficient stability');
2145
+ return;
2146
+ }
2147
+ if (!directionMatchesIntent && !isStable) {
2148
+ this.log('Embedded blocked: direction mismatch');
2149
+ return;
2150
+ }
2151
+ if (this.scrollTimeout) {
2152
+ clearTimeout(this.scrollTimeout);
2153
+ }
2154
+ this.scrollTimeout = setTimeout(() => {
2155
+ const finalCurrentState = this.isScrolled();
2156
+ let finalDesiredState = finalCurrentState;
2157
+ if (!finalCurrentState && scrollTop > collapseThreshold) {
2158
+ finalDesiredState = true;
2159
+ }
2160
+ else if (finalCurrentState && scrollTop < expandThreshold) {
2161
+ finalDesiredState = false;
2162
+ }
2163
+ if (finalCurrentState === finalDesiredState) {
2164
+ return;
2165
+ }
2166
+ this.stateChangeCount++;
2167
+ this.log('EMBEDDED STATE CHANGE #' + this.stateChangeCount, {
2168
+ from: finalCurrentState ? 'collapsed' : 'expanded',
2169
+ to: finalDesiredState ? 'collapsed' : 'expanded',
2170
+ scrollTop
2171
+ });
2172
+ this.isProgrammaticScroll = true;
2173
+ this.isScrolled.set(finalDesiredState);
2174
+ this.lastStateChangeTime = Date.now();
2175
+ this.scrollStabilityCount = 0;
2176
+ this.consecutiveDirectionCount = 0;
2177
+ setTimeout(() => {
2178
+ this.isProgrammaticScroll = false;
2179
+ this.lastScrollPosition = scrollTop;
2180
+ }, 400);
2181
+ }, this.config.debounceDelay);
2182
+ }
2090
2183
  static { this.ɵfac = function HeaderScrollService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || HeaderScrollService)(); }; }
2091
2184
  static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: HeaderScrollService, factory: HeaderScrollService.ɵfac, providedIn: 'root' }); }
2092
2185
  }
@@ -2095,7 +2188,7 @@ class HeaderScrollService {
2095
2188
  args: [{
2096
2189
  providedIn: 'root'
2097
2190
  }]
2098
- }], () => [], null); })();
2191
+ }], null, null); })();
2099
2192
 
2100
2193
  class IconService {
2101
2194
  constructor(http, sanitizer) {
@@ -95716,7 +95809,7 @@ class SymphiqProfileFocusAreasAnalysesDashboardComponent {
95716
95809
  this.AiDynamicContentStatusEnum = AiDynamicContentStatusEnum;
95717
95810
  this.ProfileAnalysisReviewStatusEnum = ProfileAnalysisReviewStatusEnum;
95718
95811
  this.COLLAPSE_THRESHOLD = 50;
95719
- this.EXPAND_THRESHOLD = 30;
95812
+ this.EXPAND_THRESHOLD = 10;
95720
95813
  this.embeddedScrollEffect = effect(() => {
95721
95814
  const scrollEvent = this.scrollEvent();
95722
95815
  const isEmbedded = this.embedded();
@@ -95731,13 +95824,7 @@ class SymphiqProfileFocusAreasAnalysesDashboardComponent {
95731
95824
  return;
95732
95825
  }
95733
95826
  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
- }
95827
+ this.headerScrollService.handleEmbeddedScroll(scrollTop, this.COLLAPSE_THRESHOLD, this.EXPAND_THRESHOLD);
95741
95828
  const scrollElement = this.scrollElement();
95742
95829
  if (scrollElement) {
95743
95830
  const scrollHeight = scrollElement.scrollHeight || 0;