@eric-emg/symphiq-components 1.2.109 → 1.2.111

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.
@@ -24146,25 +24146,70 @@ class FloatingTocComponent {
24146
24146
  isSectionExpanded(sectionId) {
24147
24147
  return this.expandedSections().has(sectionId);
24148
24148
  }
24149
+ getScrollOffset() {
24150
+ return this.HEADER_OFFSET + this.parentHeaderOffset;
24151
+ }
24152
+ scrollToElement(element) {
24153
+ const offset = this.getScrollOffset();
24154
+ console.log('[FloatingTOC] scrollToElement', {
24155
+ embedded: this.embedded,
24156
+ hasScrollElement: !!this.scrollElement,
24157
+ offset,
24158
+ headerOffset: this.HEADER_OFFSET,
24159
+ parentHeaderOffset: this.parentHeaderOffset
24160
+ });
24161
+ if (this.embedded && this.scrollElement) {
24162
+ const scrollContainer = this.scrollElement;
24163
+ const containerRect = scrollContainer.getBoundingClientRect();
24164
+ const elementRect = element.getBoundingClientRect();
24165
+ const relativeTop = elementRect.top - containerRect.top;
24166
+ const targetScrollTop = scrollContainer.scrollTop + relativeTop - offset;
24167
+ console.log('[FloatingTOC] Scrolling container', {
24168
+ containerScrollTop: scrollContainer.scrollTop,
24169
+ relativeTop,
24170
+ targetScrollTop
24171
+ });
24172
+ scrollContainer.scrollTo({ top: targetScrollTop, behavior: 'smooth' });
24173
+ }
24174
+ else {
24175
+ const elementRect = element.getBoundingClientRect();
24176
+ const targetScrollTop = window.scrollY + elementRect.top - offset;
24177
+ console.log('[FloatingTOC] Scrolling window', {
24178
+ windowScrollY: window.scrollY,
24179
+ elementTop: elementRect.top,
24180
+ targetScrollTop
24181
+ });
24182
+ window.scrollTo({ top: targetScrollTop, behavior: 'smooth' });
24183
+ }
24184
+ }
24149
24185
  scrollToSection(sectionId) {
24186
+ console.log('[FloatingTOC] scrollToSection called', { sectionId });
24150
24187
  const element = document.getElementById(`section-${sectionId}`);
24151
24188
  if (element) {
24152
- element.scrollIntoView({ behavior: 'smooth', block: 'start' });
24189
+ this.scrollToElement(element);
24190
+ }
24191
+ else {
24192
+ console.warn('[FloatingTOC] Element not found for section:', sectionId);
24153
24193
  }
24154
24194
  if (!this.isPinned()) {
24155
24195
  this.isHovered.set(false);
24156
24196
  }
24157
24197
  }
24158
24198
  scrollToSubsection(subsectionId) {
24199
+ console.log('[FloatingTOC] scrollToSubsection called', { subsectionId });
24159
24200
  const element = document.getElementById(`subsection-${subsectionId}`);
24160
24201
  if (element) {
24161
- element.scrollIntoView({ behavior: 'smooth', block: 'start' });
24202
+ this.scrollToElement(element);
24203
+ }
24204
+ else {
24205
+ console.warn('[FloatingTOC] Element not found for subsection:', subsectionId);
24162
24206
  }
24163
24207
  if (!this.isPinned()) {
24164
24208
  this.isHovered.set(false);
24165
24209
  }
24166
24210
  }
24167
24211
  scrollToTop() {
24212
+ console.log('[FloatingTOC] scrollToTop called', { embedded: this.embedded });
24168
24213
  if (this.embedded && this.scrollElement) {
24169
24214
  this.scrollElement.scrollTo({ top: 0, behavior: 'smooth' });
24170
24215
  }