@salesforcedevs/docs-components 1.3.300-scroll-fix-alpha2 → 1.3.300-scroll-alpha

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.300-scroll-fix-alpha2",
3
+ "version": "1.3.300-scroll-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -385,6 +385,6 @@ mark {
385
385
  /* offset page jump link due to fixed header */
386
386
  [id] {
387
387
  scroll-margin-top: calc(
388
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
388
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) + 50px
389
389
  );
390
390
  }
@@ -43,7 +43,7 @@ dx-toc {
43
43
  /* offset page jump link due to fixed header */
44
44
  ::slotted(doc-heading) {
45
45
  scroll-margin-top: calc(
46
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
46
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) + 50px
47
47
  );
48
48
  }
49
49
 
@@ -231,38 +231,15 @@ export default class ContentLayout extends LightningElement {
231
231
  (globalNavEl.getBoundingClientRect().height !== 72 ? 0 : 72) +
232
232
  contextNavEl.getBoundingClientRect().height;
233
233
  const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
234
- const totalHeaderHeight = globalNavHeight + docHeaderHeight;
235
-
236
- const docHeadingEls = Array.from(
237
- document.querySelectorAll("doc-heading")
238
- );
239
- const rightNavBarEl = this.template.querySelector(".right-nav-bar");
240
-
241
234
  sidebarEl.style.setProperty(
242
235
  "--dx-c-content-sidebar-sticky-top",
243
236
  `${globalNavHeight + docHeaderHeight}px`
244
237
  );
245
238
 
246
- docHeadingEls.forEach((docHeadingEl) => {
247
- (docHeadingEl as any).style.scrollMarginTop = docPhaseEl
248
- ? `${
249
- totalHeaderHeight +
250
- docPhaseEl.getBoundingClientRect().height
251
- }px`
252
- : `${totalHeaderHeight + 30}px`;
253
- });
254
-
255
- if (rightNavBarEl) {
256
- rightNavBarEl.style.setProperty(
257
- "--dx-c-content-sidebar-sticky-top",
258
- docPhaseEl
259
- ? `${
260
- totalHeaderHeight +
261
- docPhaseEl.getBoundingClientRect().height
262
- }px`
263
- : `${totalHeaderHeight}px`
264
- );
265
- }
239
+ docHeaderEl.style.setProperty(
240
+ "--dx-g-global-header-height",
241
+ `${globalNavHeight}px`
242
+ );
266
243
 
267
244
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
268
245
  if (docPhaseEl) {
@@ -276,6 +253,31 @@ export default class ContentLayout extends LightningElement {
276
253
  : globalNavHeight + docHeaderHeight
277
254
  }px`
278
255
  );
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
+ 50
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
+ }
279
281
  }
280
282
  });
281
283
  };