@eric-emg/symphiq-components 1.2.110 → 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,27 +24146,47 @@ class FloatingTocComponent {
24146
24146
  isSectionExpanded(sectionId) {
24147
24147
  return this.expandedSections().has(sectionId);
24148
24148
  }
24149
- scrollToSection(sectionId) {
24150
- console.log('[FloatingTOC] scrollToSection called', {
24151
- sectionId,
24149
+ getScrollOffset() {
24150
+ return this.HEADER_OFFSET + this.parentHeaderOffset;
24151
+ }
24152
+ scrollToElement(element) {
24153
+ const offset = this.getScrollOffset();
24154
+ console.log('[FloatingTOC] scrollToElement', {
24152
24155
  embedded: this.embedded,
24153
24156
  hasScrollElement: !!this.scrollElement,
24154
- scrollElementTag: this.scrollElement?.tagName,
24155
- hasContainerElement: !!this.containerElement,
24156
- containerElementTag: this.containerElement?.tagName,
24157
+ offset,
24158
+ headerOffset: this.HEADER_OFFSET,
24157
24159
  parentHeaderOffset: this.parentHeaderOffset
24158
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
+ }
24185
+ scrollToSection(sectionId) {
24186
+ console.log('[FloatingTOC] scrollToSection called', { sectionId });
24159
24187
  const element = document.getElementById(`section-${sectionId}`);
24160
- console.log('[FloatingTOC] Target element', {
24161
- elementId: `section-${sectionId}`,
24162
- found: !!element,
24163
- elementRect: element?.getBoundingClientRect(),
24164
- elementOffsetTop: element?.offsetTop,
24165
- elementOffsetParent: element?.offsetParent?.tagName
24166
- });
24167
24188
  if (element) {
24168
- console.log('[FloatingTOC] Calling scrollIntoView on element');
24169
- element.scrollIntoView({ behavior: 'smooth', block: 'start' });
24189
+ this.scrollToElement(element);
24170
24190
  }
24171
24191
  else {
24172
24192
  console.warn('[FloatingTOC] Element not found for section:', sectionId);
@@ -24176,26 +24196,10 @@ class FloatingTocComponent {
24176
24196
  }
24177
24197
  }
24178
24198
  scrollToSubsection(subsectionId) {
24179
- console.log('[FloatingTOC] scrollToSubsection called', {
24180
- subsectionId,
24181
- embedded: this.embedded,
24182
- hasScrollElement: !!this.scrollElement,
24183
- scrollElementTag: this.scrollElement?.tagName,
24184
- hasContainerElement: !!this.containerElement,
24185
- containerElementTag: this.containerElement?.tagName,
24186
- parentHeaderOffset: this.parentHeaderOffset
24187
- });
24199
+ console.log('[FloatingTOC] scrollToSubsection called', { subsectionId });
24188
24200
  const element = document.getElementById(`subsection-${subsectionId}`);
24189
- console.log('[FloatingTOC] Target element', {
24190
- elementId: `subsection-${subsectionId}`,
24191
- found: !!element,
24192
- elementRect: element?.getBoundingClientRect(),
24193
- elementOffsetTop: element?.offsetTop,
24194
- elementOffsetParent: element?.offsetParent?.tagName
24195
- });
24196
24201
  if (element) {
24197
- console.log('[FloatingTOC] Calling scrollIntoView on element');
24198
- element.scrollIntoView({ behavior: 'smooth', block: 'start' });
24202
+ this.scrollToElement(element);
24199
24203
  }
24200
24204
  else {
24201
24205
  console.warn('[FloatingTOC] Element not found for subsection:', subsectionId);
@@ -24205,18 +24209,11 @@ class FloatingTocComponent {
24205
24209
  }
24206
24210
  }
24207
24211
  scrollToTop() {
24208
- console.log('[FloatingTOC] scrollToTop called', {
24209
- embedded: this.embedded,
24210
- hasScrollElement: !!this.scrollElement,
24211
- scrollElementTag: this.scrollElement?.tagName,
24212
- scrollElementScrollTop: this.scrollElement?.scrollTop
24213
- });
24212
+ console.log('[FloatingTOC] scrollToTop called', { embedded: this.embedded });
24214
24213
  if (this.embedded && this.scrollElement) {
24215
- console.log('[FloatingTOC] Scrolling scrollElement to top');
24216
24214
  this.scrollElement.scrollTo({ top: 0, behavior: 'smooth' });
24217
24215
  }
24218
24216
  else {
24219
- console.log('[FloatingTOC] Scrolling window to top');
24220
24217
  window.scrollTo({ top: 0, behavior: 'smooth' });
24221
24218
  }
24222
24219
  if (!this.isPinned()) {