@salesforcedevs/docs-components 1.3.324 → 1.3.325

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.324",
3
+ "version": "1.3.325",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "f005d7f0cbb1ce8f67f11d7267cfeb893d2c031a"
27
+ "gitHead": "142d2d19228378de3cf5a98e3f0586a34626fed3"
28
28
  }
@@ -384,7 +384,10 @@ mark {
384
384
 
385
385
  /* offset page jump link due to fixed header */
386
386
  [id] {
387
- scroll-margin-top: calc(
388
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
387
+ --dx-c-content-scroll-margin-top: calc(
388
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
389
+ var(--dx-g-spacing-2xl)
389
390
  );
391
+
392
+ scroll-margin-top: var(--dx-c-content-scroll-margin-top);
390
393
  }
@@ -9,6 +9,10 @@
9
9
  var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
10
10
  )
11
11
  );
12
+ --dx-c-content-scroll-margin-top: calc(
13
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
14
+ var(--dx-g-spacing-2xl)
15
+ );
12
16
 
13
17
  display: block;
14
18
  }
@@ -42,9 +46,7 @@ dx-toc {
42
46
 
43
47
  /* offset page jump link due to fixed header */
44
48
  ::slotted(doc-heading) {
45
- scroll-margin-top: calc(
46
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
47
- );
49
+ scroll-margin-top: var(--dx-c-content-scroll-margin-top);
48
50
  }
49
51
 
50
52
  .content {
@@ -215,10 +215,16 @@ export default class ContentLayout extends LightningElement {
215
215
  ".sticky-doc-header"
216
216
  ) as HTMLElement;
217
217
 
218
- const docPhaseEl = (
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;
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,27 @@ 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
+ 40
265
+ }px`
266
+ : `${totalHeaderHeight + 40}px`;
267
+ });
268
+
269
+ // Adjusting the right nav bar on scroll.
270
+ if (rightNavBarEl) {
271
+ rightNavBarEl.style.top = docPhaseEl
272
+ ? `${
273
+ totalHeaderHeight +
274
+ docPhaseEl.getBoundingClientRect().height
275
+ }px`
276
+ : `${totalHeaderHeight}px`;
277
+ }
278
+
244
279
  // 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
280
  if (docPhaseEl) {
246
281
  docPhaseEl.style.setProperty(
@@ -253,30 +288,6 @@ export default class ContentLayout extends LightningElement {
253
288
  : globalNavHeight + docHeaderHeight
254
289
  }px`
255
290
  );
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
- }px`;
267
- });
268
-
269
- // Adjust right nav bar position when doc phase is present
270
- const rightNavBarEl =
271
- this.template.querySelector(".right-nav-bar");
272
-
273
- if (rightNavBarEl) {
274
- rightNavBarEl.style.top = `${
275
- globalNavHeight +
276
- docHeaderHeight +
277
- docPhaseEl.getBoundingClientRect().height
278
- }px`;
279
- }
280
291
  }
281
292
  });
282
293
  };