@salesforcedevs/docs-components
Advanced tools
Comparing version 1.3.324 to 1.3.325
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.324", | ||
"version": "1.3.325", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -27,3 +27,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "f005d7f0cbb1ce8f67f11d7267cfeb893d2c031a" | ||
"gitHead": "142d2d19228378de3cf5a98e3f0586a34626fed3" | ||
} |
@@ -218,6 +218,12 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
const docPhaseEl = ( | ||
let docPhaseEl = ( | ||
this.template.querySelector("[name=doc-phase]")! as any | ||
).assignedElements()[0] as HTMLSlotElement; | ||
if (!docPhaseEl) { | ||
docPhaseEl = ( | ||
this.template.querySelector("[name=version-banner]")! as any | ||
).assignedElements()[0] as HTMLSlotElement; | ||
} | ||
if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) { | ||
@@ -235,2 +241,10 @@ console.warn("One or more required elements are missing."); | ||
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height; | ||
const totalHeaderHeight = globalNavHeight + docHeaderHeight; | ||
// Selecting the doc section heading and RNB here. | ||
const docHeadingEls = Array.from( | ||
document.querySelectorAll("doc-heading") | ||
); | ||
const rightNavBarEl = this.template.querySelector(".right-nav-bar"); | ||
sidebarEl.style.setProperty( | ||
@@ -246,2 +260,23 @@ "--dx-c-content-sidebar-sticky-top", | ||
// Adjusting the doc section heading on scroll. | ||
docHeadingEls.forEach((docHeadingEl) => { | ||
(docHeadingEl as any).style.scrollMarginTop = docPhaseEl | ||
? `${ | ||
totalHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height + | ||
40 | ||
}px` | ||
: `${totalHeaderHeight + 40}px`; | ||
}); | ||
// Adjusting the right nav bar on scroll. | ||
if (rightNavBarEl) { | ||
rightNavBarEl.style.top = docPhaseEl | ||
? `${ | ||
totalHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height | ||
}px` | ||
: `${totalHeaderHeight}px`; | ||
} | ||
// If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell). | ||
@@ -259,26 +294,2 @@ if (docPhaseEl) { | ||
); | ||
// Adjust scroll margin for doc headings when doc phase is present | ||
const docHeadingEls = Array.from( | ||
document.querySelectorAll("doc-heading") | ||
); | ||
docHeadingEls.forEach((docHeadingEl) => { | ||
(docHeadingEl as any).style.scrollMarginTop = `${ | ||
globalNavHeight + | ||
docHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height | ||
}px`; | ||
}); | ||
// Adjust right nav bar position when doc phase is present | ||
const rightNavBarEl = | ||
this.template.querySelector(".right-nav-bar"); | ||
if (rightNavBarEl) { | ||
rightNavBarEl.style.top = `${ | ||
globalNavHeight + | ||
docHeaderHeight + | ||
docPhaseEl.getBoundingClientRect().height | ||
}px`; | ||
} | ||
} | ||
@@ -285,0 +296,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256553
6543