@salesforcedevs/docs-components 1.3.300-scroll-fix-alpha3 → 1.3.300-scroll-alpha1

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-alpha3",
3
+ "version": "1.3.300-scroll-alpha1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -385,6 +385,7 @@ 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) +
389
+ var(--dx-g-spacing-2xl)
389
390
  );
390
391
  }
@@ -43,7 +43,8 @@ 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) +
47
+ var(--dx-g-spacing-2xl)
47
48
  );
48
49
  }
49
50
 
@@ -231,14 +231,6 @@ 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
- // Selecting the doc section heading and RNB here.
237
- const docHeadingEls = Array.from(
238
- document.querySelectorAll("doc-heading")
239
- );
240
- const rightNavBarEl = this.template.querySelector(".right-nav-bar");
241
-
242
234
  sidebarEl.style.setProperty(
243
235
  "--dx-c-content-sidebar-sticky-top",
244
236
  `${globalNavHeight + docHeaderHeight}px`
@@ -249,26 +241,6 @@ export default class ContentLayout extends LightningElement {
249
241
  `${globalNavHeight}px`
250
242
  );
251
243
 
252
- // Adjusting the doc section heading on scroll.
253
- docHeadingEls.forEach((docHeadingEl) => {
254
- (docHeadingEl as any).style.scrollMarginTop = docPhaseEl
255
- ? `${
256
- totalHeaderHeight +
257
- docPhaseEl.getBoundingClientRect().height
258
- }px`
259
- : `${totalHeaderHeight + 30}px`;
260
- });
261
-
262
- // Adjusting the right nav bar on scroll.
263
- if (rightNavBarEl) {
264
- rightNavBarEl.style.top = docPhaseEl
265
- ? `${
266
- totalHeaderHeight +
267
- docPhaseEl.getBoundingClientRect().height
268
- }px`
269
- : `${totalHeaderHeight}px`;
270
- }
271
-
272
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).
273
245
  if (docPhaseEl) {
274
246
  docPhaseEl.style.setProperty(
@@ -281,6 +253,31 @@ export default class ContentLayout extends LightningElement {
281
253
  : globalNavHeight + docHeaderHeight
282
254
  }px`
283
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
+ 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
+ }
284
281
  }
285
282
  });
286
283
  };