@salesforcedevs/docs-components 1.20.6-sticky-banner → 1.20.6-sticky-banner2

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,12 +1,11 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.20.6-sticky-banner",
3
+ "version": "1.20.6-sticky-banner2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "engines": {
8
- "node": "20.x",
9
- "yarn": "1.22.19"
8
+ "node": "20.x"
10
9
  },
11
10
  "publishConfig": {
12
11
  "access": "public"
@@ -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
  }
@@ -20,7 +20,7 @@
20
20
  <div class="doc-phase-wrapper">
21
21
  <slot name="doc-phase"></slot>
22
22
  </div>
23
- <div class="version-banner-wrapper">
23
+ <div class="version-wrapper">
24
24
  <slot name="version-banner"></slot>
25
25
  </div>
26
26
  <div class="content-body-container">
@@ -217,15 +217,19 @@ export default class ContentLayout extends LightningElement {
217
217
  ".sticky-doc-header"
218
218
  ) as HTMLElement;
219
219
 
220
- const docPhaseWrapper = this.template.querySelector(".doc-phase-wrapper") as HTMLElement;
221
- const versionBannerWrapper = this.template.querySelector(".version-banner-wrapper") as HTMLElement;
220
+ const docPhaseWrapper = this.template.querySelector(
221
+ ".doc-phase-wrapper"
222
+ ) as HTMLElement;
223
+ const versionWrapper = this.template.querySelector(
224
+ ".version-wrapper"
225
+ ) as HTMLElement;
222
226
 
223
227
  const docPhaseEl = (
224
228
  docPhaseWrapper.querySelector("[name=doc-phase]")! as any
225
229
  ).assignedElements()[0] as HTMLSlotElement;
226
230
 
227
231
  const verBannerEl = (
228
- versionBannerWrapper.querySelector("[name=version-banner]")! as any
232
+ versionWrapper.querySelector("[name=version-banner]")! as any
229
233
  ).assignedElements()[0] as HTMLSlotElement;
230
234
 
231
235
  if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
@@ -258,13 +262,16 @@ export default class ContentLayout extends LightningElement {
258
262
  `${globalNavHeight}px`
259
263
  );
260
264
 
261
- const docPhaseElHeight = (docPhaseEl || verBannerEl)
265
+ const docPhaseElHeight =
266
+ docPhaseEl || verBannerEl
262
267
  ? (docPhaseEl || verBannerEl).getBoundingClientRect().height
263
268
  : 0;
264
269
 
265
270
  // Adjusting the doc section heading on scroll.
266
271
  docHeadingEls.forEach((docHeadingEl) => {
267
- (docHeadingEl as any).style.scrollMarginTop = `${totalHeaderHeight + docPhaseElHeight + 40}px`;
272
+ (docHeadingEl as any).style.scrollMarginTop = `${
273
+ totalHeaderHeight + docPhaseElHeight + 40
274
+ }px`;
268
275
  });
269
276
 
270
277
  // Adjusting the right nav bar on scroll.
@@ -289,15 +296,20 @@ export default class ContentLayout extends LightningElement {
289
296
  }
290
297
  }
291
298
 
292
- const docPhaseTop = window.innerWidth < 769 ? globalNavHeight + docHeaderHeight + sidebarEl.getBoundingClientRect().height : globalNavHeight + docHeaderHeight
299
+ const docPhaseTop =
300
+ window.innerWidth < 769
301
+ ? globalNavHeight +
302
+ docHeaderHeight +
303
+ sidebarEl.getBoundingClientRect().height
304
+ : globalNavHeight + docHeaderHeight;
293
305
 
294
306
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
295
307
  // To handle sticky position for safari browser, position sticky given to wrapper class
296
308
  if (docPhaseEl) {
297
309
  docPhaseWrapper.style.top = `${docPhaseTop}px`;
298
- } else if(verBannerEl) {
299
- versionBannerWrapper.style.position = 'sticky';
300
- versionBannerWrapper.style.top = `${docPhaseTop}px`;
310
+ } else if (verBannerEl) {
311
+ versionWrapper.style.position = "sticky";
312
+ versionWrapper.style.top = `${docPhaseTop}px`;
301
313
  }
302
314
  });
303
315
  };
@@ -19,7 +19,7 @@
19
19
  <div class="doc-phase-wrapper">
20
20
  <slot name="doc-phase"></slot>
21
21
  </div>
22
- <div class="version-banner-wrapper">
22
+ <div class="version-wrapper">
23
23
  <slot name="version-banner"></slot>
24
24
  </div>
25
25
  <div class="content-body-container">
@@ -3,7 +3,6 @@
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
7
  }
9
8
 
@@ -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
  }
@@ -60,15 +60,17 @@ dx-toc {
60
60
  }
61
61
 
62
62
  .doc-phase-wrapper,
63
- .version-banner-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 */
64
65
  z-index: var(--dx-g-z-index-100);
65
66
  }
66
67
 
67
68
  .doc-phase-wrapper {
68
69
  position: sticky;
69
70
  }
70
-
71
- .version-banner-wrapper {
71
+
72
+ /* We don't want second component to sticky */
73
+ .version-wrapper {
72
74
  position: static;
73
75
  }
74
76