@salesforcedevs/docs-components 1.20.7 → 1.20.9

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.20.7",
3
+ "version": "1.20.9",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -25,7 +25,7 @@
25
25
  "@types/lodash.orderby": "4.6.9",
26
26
  "@types/lodash.uniqby": "4.7.9"
27
27
  },
28
- "gitHead": "fffbef4d7b536a321824457c6a987e53830a78f1",
28
+ "gitHead": "f059ed735a63a7da1639c89388548ff6ff351c8a",
29
29
  "volta": {
30
30
  "node": "20.19.0",
31
31
  "yarn": "1.22.19"
@@ -1,10 +1,3 @@
1
- doc-phase {
2
- --doc-c-phase-top: calc(
3
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
4
- var(--dx-g-spacing-xl)
5
- );
6
- }
7
-
8
1
  /* We need to apply some borders when there are two doc phases */
9
2
  doc-phase:not(:only-of-type)::part(container) {
10
3
  border-top: 1px solid var(--dx-g-yellow-vibrant-90);
@@ -15,11 +8,6 @@ doc-phase:nth-child(2)::part(container) {
15
8
  border-bottom: 1px solid var(--dx-g-yellow-vibrant-90);
16
9
  }
17
10
 
18
- /* We don't want second component to sticky as we need to handle different cases like position */
19
- doc-phase:nth-child(2) {
20
- position: static;
21
- }
22
-
23
11
  .api-documentation {
24
12
  margin-top: 48px;
25
13
  }
@@ -17,8 +17,12 @@
17
17
  <slot name="sidebar-header" slot="version-picker"></slot>
18
18
  </dx-sidebar-old>
19
19
  <div class="content-body-doc-phase-container">
20
- <slot name="doc-phase"></slot>
21
- <slot name="version-banner"></slot>
20
+ <div class="doc-phase-wrapper">
21
+ <slot name="doc-phase"></slot>
22
+ </div>
23
+ <div class="version-wrapper">
24
+ <slot name="version-banner"></slot>
25
+ </div>
22
26
  <div class="content-body-container">
23
27
  <div class="content-body">
24
28
  <doc-breadcrumbs
@@ -223,15 +223,20 @@ export default class ContentLayout extends LightningElement {
223
223
  ".sticky-doc-header"
224
224
  ) as HTMLElement;
225
225
 
226
- let docPhaseEl = (
227
- this.template.querySelector("[name=doc-phase]")! as any
226
+ const docPhaseWrapper = this.template.querySelector(
227
+ ".doc-phase-wrapper"
228
+ ) as HTMLElement;
229
+ const versionWrapper = this.template.querySelector(
230
+ ".version-wrapper"
231
+ ) as HTMLElement;
232
+
233
+ const docPhaseEl = (
234
+ docPhaseWrapper.querySelector("[name=doc-phase]")! as any
228
235
  ).assignedElements()[0] as HTMLSlotElement;
229
236
 
230
- if (!docPhaseEl) {
231
- docPhaseEl = (
232
- this.template.querySelector("[name=version-banner]")! as any
233
- ).assignedElements()[0] as HTMLSlotElement;
234
- }
237
+ const verBannerEl = (
238
+ versionWrapper.querySelector("[name=version-banner]")! as any
239
+ ).assignedElements()[0] as HTMLSlotElement;
235
240
 
236
241
  if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
237
242
  console.warn("One or more required elements are missing.");
@@ -263,23 +268,21 @@ export default class ContentLayout extends LightningElement {
263
268
  `${globalNavHeight}px`
264
269
  );
265
270
 
271
+ const docPhaseElHeight =
272
+ docPhaseEl || verBannerEl
273
+ ? (docPhaseEl || verBannerEl).getBoundingClientRect().height
274
+ : 0;
275
+
266
276
  // Adjusting the doc section heading on scroll.
267
277
  docHeadingEls.forEach((docHeadingEl) => {
268
- (docHeadingEl as any).style.scrollMarginTop = docPhaseEl
269
- ? `${
270
- totalHeaderHeight +
271
- docPhaseEl.getBoundingClientRect().height +
272
- 40
273
- }px`
274
- : `${totalHeaderHeight + 40}px`;
278
+ (docHeadingEl as any).style.scrollMarginTop = `${
279
+ totalHeaderHeight + docPhaseElHeight + 40
280
+ }px`;
275
281
  });
276
282
 
277
283
  // Adjusting the right nav bar on scroll.
278
284
  // setting maxheight to make the RNB scrollable based on different parent elements
279
285
  if (rightNavBarEl) {
280
- const docPhaseElHeight = docPhaseEl
281
- ? docPhaseEl.getBoundingClientRect().height
282
- : 0;
283
286
  const viewportHeight = window.innerHeight;
284
287
  const maxHeight =
285
288
  viewportHeight -
@@ -299,18 +302,20 @@ export default class ContentLayout extends LightningElement {
299
302
  }
300
303
  }
301
304
 
305
+ const docPhaseTop =
306
+ window.innerWidth < 769
307
+ ? globalNavHeight +
308
+ docHeaderHeight +
309
+ sidebarEl.getBoundingClientRect().height
310
+ : globalNavHeight + docHeaderHeight;
311
+
302
312
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
313
+ // To handle sticky position for safari browser, position sticky given to wrapper class
303
314
  if (docPhaseEl) {
304
- docPhaseEl.style.setProperty(
305
- "--doc-c-phase-top",
306
- `${
307
- window.innerWidth < 769
308
- ? globalNavHeight +
309
- docHeaderHeight +
310
- sidebarEl.getBoundingClientRect().height
311
- : globalNavHeight + docHeaderHeight
312
- }px`
313
- );
315
+ docPhaseWrapper.style.top = `${docPhaseTop}px`;
316
+ } else if (verBannerEl) {
317
+ versionWrapper.style.position = "sticky";
318
+ versionWrapper.style.top = `${docPhaseTop}px`;
314
319
  }
315
320
  });
316
321
  };
@@ -16,8 +16,12 @@
16
16
  <slot name="sidebar-header" slot="version-picker"></slot>
17
17
  </dx-sidebar-old>
18
18
  <div class="content-body-doc-phase-container">
19
- <slot name="doc-phase"></slot>
20
- <slot name="version-banner"></slot>
19
+ <div class="doc-phase-wrapper">
20
+ <slot name="doc-phase"></slot>
21
+ </div>
22
+ <div class="version-wrapper">
23
+ <slot name="version-banner"></slot>
24
+ </div>
21
25
  <div class="content-body-container">
22
26
  <div class={contentBodyClasses}>
23
27
  <doc-breadcrumbs
@@ -3,14 +3,7 @@
3
3
  @import "docHelpers/status";
4
4
 
5
5
  :host {
6
- --doc-c-phase-top: 0;
7
6
  --doc-c-phase-container-align-items: flex-start;
8
-
9
- position: sticky;
10
- top: var(--doc-c-phase-top);
11
-
12
- /* NOTE: If you are changing z-index value here, ensure it's less than z-index of dx-sidebar in contentLayout.css */
13
- z-index: var(--dx-g-z-index-100);
14
7
  }
15
8
 
16
9
  .doc-phase-container {
@@ -31,10 +31,6 @@ dx-dropdown > dx-button:hover {
31
31
  --border-color: var(--button-primary-color-hover);
32
32
  }
33
33
 
34
- doc-phase {
35
- --doc-c-phase-top: var(--dx-g-global-header-height);
36
- }
37
-
38
34
  @media screen and (max-width: 768px) {
39
35
  doc-content-layout {
40
36
  --dx-g-doc-header-main-nav-height: 41px;
@@ -45,10 +41,4 @@ doc-phase {
45
41
  var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
46
42
  );
47
43
  }
48
-
49
- doc-phase {
50
- --doc-c-phase-top: calc(
51
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
52
- );
53
- }
54
44
  }
@@ -59,6 +59,21 @@ dx-toc {
59
59
  border-left: 1px solid var(--dx-g-gray-90);
60
60
  }
61
61
 
62
+ .doc-phase-wrapper,
63
+ .version-wrapper {
64
+ /* NOTE: If you are changing z-index value here, ensure it's less than z-index of dx-sidebar in contentLayout.css */
65
+ z-index: var(--dx-g-z-index-100);
66
+ }
67
+
68
+ .doc-phase-wrapper {
69
+ position: sticky;
70
+ }
71
+
72
+ /* We don't want second component to sticky */
73
+ .version-wrapper {
74
+ position: static;
75
+ }
76
+
62
77
  .content-body-container {
63
78
  display: flex;
64
79
  flex-direction: row;