@salesforcedevs/docs-components 1.3.196 → 1.3.199

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.196",
3
+ "version": "1.3.199",
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": "3ca1796a050dd87c8083f73e41d8cb0cfb15328d"
27
+ "gitHead": "d6096f0f0260b2007a3077f47ce588ef6cf32742"
28
28
  }
@@ -51,7 +51,10 @@
51
51
  <template if:true={showSpecBasedReference}>
52
52
  <div class="container">
53
53
  <div class="api-documentation">
54
- <doc-amf-topic model={topicModel}></doc-amf-topic>
54
+ <doc-amf-topic
55
+ if:true={topicModel}
56
+ model={topicModel}
57
+ ></doc-amf-topic>
55
58
  </div>
56
59
  </div>
57
60
  </template>
@@ -1 +1,21 @@
1
1
  @import "docHelpers/amfStyle";
2
+
3
+ :host {
4
+ --reference-container-margin-top: var(--dx-g-spacing-sm);
5
+ --api-documentation-margin-top: var(--dx-g-spacing-3xl);
6
+ }
7
+
8
+ /**
9
+ * 1. We need to scroll to top from the tablet size as side nav bar and content in side by side from tablet size
10
+ * 2. Consider global nav height, doc header height and content margins to scroll to the right position
11
+ */
12
+
13
+ @media screen and (min-width: 769px) {
14
+ .topic-container {
15
+ scroll-margin-top: calc(
16
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
17
+ var(--reference-container-margin-top) +
18
+ var(--api-documentation-margin-top)
19
+ );
20
+ }
21
+ }
@@ -10,6 +10,8 @@ import {
10
10
  import type { TopicModel } from "./types";
11
11
  import { Json } from "typings/custom";
12
12
 
13
+ const TABLE_SIZE_MATCH = "769px";
14
+
13
15
  export default class AmfTopic extends LightningElement {
14
16
  private _model: TopicModel | undefined;
15
17
  private amf: Json;
@@ -85,6 +87,22 @@ export default class AmfTopic extends LightningElement {
85
87
  container.firstChild.remove();
86
88
  }
87
89
  container?.appendChild(element as Node);
90
+
91
+ this.scrollToTop(container);
92
+ }
93
+
94
+ scrollToTop(container: Element) {
95
+ const isTabletOrDesktop = window.matchMedia(
96
+ `(min-width: ${TABLE_SIZE_MATCH})`
97
+ ).matches;
98
+
99
+ // We need to scroll to top from the tablet size as side nav bar and content in side by side from tablet size
100
+ if (isTabletOrDesktop) {
101
+ // Sync with the browser to account for any reflows that may have happened
102
+ requestAnimationFrame(() => {
103
+ container?.scrollIntoView(true);
104
+ });
105
+ }
88
106
  }
89
107
 
90
108
  renderedCallback(): void {