@salesforcedevs/docs-components 1.3.300-scroll-alpha1 → 1.3.300-scroll-alpha3
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.
package/package.json
CHANGED
|
@@ -215,10 +215,16 @@ export default class ContentLayout extends LightningElement {
|
|
|
215
215
|
".sticky-doc-header"
|
|
216
216
|
) as HTMLElement;
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
let docPhaseEl = (
|
|
219
219
|
this.template.querySelector("[name=doc-phase]")! as any
|
|
220
220
|
).assignedElements()[0] as HTMLSlotElement;
|
|
221
221
|
|
|
222
|
+
if(!docPhaseEl) {
|
|
223
|
+
docPhaseEl = (
|
|
224
|
+
this.template.querySelector("[name=version-banner]")! as any
|
|
225
|
+
).assignedElements()[0] as HTMLSlotElement;
|
|
226
|
+
}
|
|
227
|
+
|
|
222
228
|
if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
|
|
223
229
|
console.warn("One or more required elements are missing.");
|
|
224
230
|
return;
|
|
@@ -231,6 +237,14 @@ export default class ContentLayout extends LightningElement {
|
|
|
231
237
|
(globalNavEl.getBoundingClientRect().height !== 72 ? 0 : 72) +
|
|
232
238
|
contextNavEl.getBoundingClientRect().height;
|
|
233
239
|
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
|
|
240
|
+
const totalHeaderHeight = globalNavHeight + docHeaderHeight + 40;
|
|
241
|
+
|
|
242
|
+
// Selecting the doc section heading and RNB here.
|
|
243
|
+
const docHeadingEls = Array.from(
|
|
244
|
+
document.querySelectorAll("doc-heading")
|
|
245
|
+
);
|
|
246
|
+
const rightNavBarEl = this.template.querySelector(".right-nav-bar");
|
|
247
|
+
|
|
234
248
|
sidebarEl.style.setProperty(
|
|
235
249
|
"--dx-c-content-sidebar-sticky-top",
|
|
236
250
|
`${globalNavHeight + docHeaderHeight}px`
|
|
@@ -241,6 +255,26 @@ export default class ContentLayout extends LightningElement {
|
|
|
241
255
|
`${globalNavHeight}px`
|
|
242
256
|
);
|
|
243
257
|
|
|
258
|
+
// Adjusting the doc section heading on scroll.
|
|
259
|
+
docHeadingEls.forEach((docHeadingEl) => {
|
|
260
|
+
(docHeadingEl as any).style.scrollMarginTop = docPhaseEl
|
|
261
|
+
? `${
|
|
262
|
+
totalHeaderHeight +
|
|
263
|
+
docPhaseEl.getBoundingClientRect().height
|
|
264
|
+
}px`
|
|
265
|
+
: `${totalHeaderHeight}px`;
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// Adjusting the right nav bar on scroll.
|
|
269
|
+
if (rightNavBarEl) {
|
|
270
|
+
rightNavBarEl.style.top = docPhaseEl
|
|
271
|
+
? `${
|
|
272
|
+
totalHeaderHeight +
|
|
273
|
+
docPhaseEl.getBoundingClientRect().height
|
|
274
|
+
}px`
|
|
275
|
+
: `${totalHeaderHeight}px`;
|
|
276
|
+
}
|
|
277
|
+
|
|
244
278
|
// If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
|
|
245
279
|
if (docPhaseEl) {
|
|
246
280
|
docPhaseEl.style.setProperty(
|
|
@@ -253,31 +287,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
253
287
|
: globalNavHeight + docHeaderHeight
|
|
254
288
|
}px`
|
|
255
289
|
);
|
|
256
|
-
|
|
257
|
-
// Adjust scroll margin for doc headings when doc phase is present
|
|
258
|
-
const docHeadingEls = Array.from(
|
|
259
|
-
document.querySelectorAll("doc-heading")
|
|
260
|
-
);
|
|
261
|
-
docHeadingEls.forEach((docHeadingEl) => {
|
|
262
|
-
(docHeadingEl as any).style.scrollMarginTop = `${
|
|
263
|
-
globalNavHeight +
|
|
264
|
-
docHeaderHeight +
|
|
265
|
-
docPhaseEl.getBoundingClientRect().height +
|
|
266
|
-
40
|
|
267
|
-
}px`;
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
// Adjust right nav bar position when doc phase is present
|
|
271
|
-
const rightNavBarEl =
|
|
272
|
-
this.template.querySelector(".right-nav-bar");
|
|
273
|
-
|
|
274
|
-
if (rightNavBarEl) {
|
|
275
|
-
rightNavBarEl.style.top = `${
|
|
276
|
-
globalNavHeight +
|
|
277
|
-
docHeaderHeight +
|
|
278
|
-
docPhaseEl.getBoundingClientRect().height
|
|
279
|
-
}px`;
|
|
280
|
-
}
|
|
281
290
|
}
|
|
282
291
|
});
|
|
283
292
|
};
|