@eric-emg/symphiq-components 1.2.52 → 1.2.53

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.
@@ -21639,6 +21639,15 @@ class SymphiqFunnelAnalysisDashboardComponent {
21639
21639
  console.log('[SCROLL v7] Skipping - programmatic scroll in progress');
21640
21640
  return;
21641
21641
  }
21642
+ // Get the scrollable element once for all features
21643
+ const scrollContainerId = this.scrollContainerId();
21644
+ let scrollElement = null;
21645
+ if (scrollContainerId) {
21646
+ const ionContent = document.getElementById(scrollContainerId);
21647
+ if (ionContent?.shadowRoot) {
21648
+ scrollElement = ionContent.shadowRoot.querySelector('.inner-scroll');
21649
+ }
21650
+ }
21642
21651
  // ========================================
21643
21652
  // FEATURE 1: Header Collapse/Expand
21644
21653
  // ========================================
@@ -21664,11 +21673,9 @@ class SymphiqFunnelAnalysisDashboardComponent {
21664
21673
  // ========================================
21665
21674
  // FEATURE 2: Progress Bar Calculation
21666
21675
  // ========================================
21667
- // Calculate scroll progress using the scroll event target element
21668
- if (scrollEvent.target) {
21669
- const target = scrollEvent.target;
21670
- const scrollHeight = target.scrollHeight || 0;
21671
- const clientHeight = target.clientHeight || 0;
21676
+ if (scrollElement) {
21677
+ const scrollHeight = scrollElement.scrollHeight || 0;
21678
+ const clientHeight = scrollElement.clientHeight || 0;
21672
21679
  const maxScroll = scrollHeight - clientHeight;
21673
21680
  if (maxScroll > 0) {
21674
21681
  const progress = (scrollTop / maxScroll) * 100;
@@ -21686,58 +21693,50 @@ class SymphiqFunnelAnalysisDashboardComponent {
21686
21693
  }
21687
21694
  }
21688
21695
  else {
21689
- console.log('[SCROLL v7] Cannot calculate progress - no target element');
21696
+ console.log('[SCROLL v7] Cannot calculate progress - no scroll element found');
21690
21697
  }
21691
21698
  // ========================================
21692
21699
  // FEATURE 3: Navigation Dots Active Section
21693
21700
  // ========================================
21694
- // Determine which section is currently visible based on scroll position
21695
- const scrollContainerId = this.scrollContainerId();
21696
- if (scrollContainerId) {
21697
- const ionContent = document.getElementById(scrollContainerId);
21698
- if (ionContent) {
21699
- const scrollElement = ionContent.shadowRoot?.querySelector('.inner-scroll');
21700
- if (scrollElement) {
21701
- // Get all section elements
21702
- const sectionMap = [
21703
- { id: 'overview', elementId: 'overall-section' },
21704
- { id: 'insights', elementId: 'insights-section' },
21705
- { id: 'metrics', elementId: 'metrics-section' },
21706
- { id: 'breakdowns', elementId: 'breakdowns-section' },
21707
- { id: 'competitive', elementId: 'competitive-section' }
21708
- ];
21709
- // Find the section that's most visible in the viewport
21710
- let activeSection = 'overview'; // default
21711
- const viewportHeight = scrollElement.clientHeight;
21712
- const viewportTop = scrollTop;
21713
- const viewportBottom = viewportTop + viewportHeight;
21714
- const viewportCenter = viewportTop + (viewportHeight / 2);
21715
- for (const section of sectionMap) {
21716
- const element = scrollElement.querySelector(`#${section.elementId}`);
21717
- if (element) {
21718
- const elementTop = element.offsetTop;
21719
- const elementBottom = elementTop + element.offsetHeight;
21720
- // Check if the section's center is in the upper half of the viewport
21721
- // This provides better UX for navigation dot highlighting
21722
- const elementCenter = elementTop + (element.offsetHeight / 2);
21723
- if (elementTop <= viewportCenter && elementBottom >= viewportTop) {
21724
- activeSection = section.id;
21725
- // Don't break - continue to find the best match
21726
- }
21727
- }
21728
- }
21729
- const previousActiveSection = this.activeNavSection();
21730
- if (previousActiveSection !== activeSection) {
21731
- this.activeNavSection.set(activeSection);
21732
- console.log('[SCROLL v7] ✓ Active nav section updated', {
21733
- from: previousActiveSection,
21734
- to: activeSection,
21735
- scrollTop,
21736
- viewportCenter
21737
- });
21701
+ if (scrollElement) {
21702
+ // Get all section elements
21703
+ const sectionMap = [
21704
+ { id: 'overview', elementId: 'overall-section' },
21705
+ { id: 'insights', elementId: 'insights-section' },
21706
+ { id: 'metrics', elementId: 'metrics-section' },
21707
+ { id: 'breakdowns', elementId: 'breakdowns-section' },
21708
+ { id: 'competitive', elementId: 'competitive-section' }
21709
+ ];
21710
+ // Find the section that's most visible in the viewport
21711
+ let activeSection = 'overview'; // default
21712
+ const viewportHeight = scrollElement.clientHeight;
21713
+ const viewportTop = scrollTop;
21714
+ const viewportBottom = viewportTop + viewportHeight;
21715
+ const viewportCenter = viewportTop + (viewportHeight / 2);
21716
+ for (const section of sectionMap) {
21717
+ const element = scrollElement.querySelector(`#${section.elementId}`);
21718
+ if (element) {
21719
+ const elementTop = element.offsetTop;
21720
+ const elementBottom = elementTop + element.offsetHeight;
21721
+ // Check if the section's center is in the upper half of the viewport
21722
+ // This provides better UX for navigation dot highlighting
21723
+ const elementCenter = elementTop + (element.offsetHeight / 2);
21724
+ if (elementTop <= viewportCenter && elementBottom >= viewportTop) {
21725
+ activeSection = section.id;
21726
+ // Don't break - continue to find the best match
21738
21727
  }
21739
21728
  }
21740
21729
  }
21730
+ const previousActiveSection = this.activeNavSection();
21731
+ if (previousActiveSection !== activeSection) {
21732
+ this.activeNavSection.set(activeSection);
21733
+ console.log('[SCROLL v7] ✓ Active nav section updated', {
21734
+ from: previousActiveSection,
21735
+ to: activeSection,
21736
+ scrollTop,
21737
+ viewportCenter
21738
+ });
21739
+ }
21741
21740
  }
21742
21741
  });
21743
21742
  // Manage loading state with minimum display time