@salesforcedevs/docs-components 0.64.2-test2 → 0.66.1-miles

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": "0.64.2-test2",
3
+ "version": "0.66.1-miles",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -165,6 +165,7 @@ export default class AmfReference extends LightningElement {
165
165
 
166
166
  constructor() {
167
167
  super();
168
+
168
169
  this._boundOnApiNavigationChanged =
169
170
  this.onApiNavigationChanged.bind(this);
170
171
  this._boundUpdateSelectedItemFromUrlQuery =
@@ -193,6 +194,16 @@ export default class AmfReference extends LightningElement {
193
194
  );
194
195
  }
195
196
 
197
+ saveScroll() {
198
+ console.log('saving scroll ' + document.body.scrollTop + ' to url ' + window.location.href);
199
+ window.history.replaceState({ scrollValue: document.body.scrollTop }, "", window.location.href);
200
+ }
201
+
202
+ restoreScroll() {
203
+ console.log('restoring scroll ' + window.history.state.scrollValue + ' from url ' + window.location.href);
204
+ document.body.scrollTop = document.documentElement.scrollTop = window.history.state.scrollValue;
205
+ }
206
+
196
207
  renderedCallback(): void {
197
208
  if (!this.hasRendered) {
198
209
  this.hasRendered = true;
@@ -760,8 +771,9 @@ export default class AmfReference extends LightningElement {
760
771
  if (meta) {
761
772
  // update the encoded url meta param
762
773
  const encodedMeta = this.getUrlEncoded(meta);
774
+
763
775
  window.history.pushState(
764
- {},
776
+ { },
765
777
  "",
766
778
  `${parentReferencePath}?meta=${encodedMeta}`
767
779
  );
@@ -779,7 +791,7 @@ export default class AmfReference extends LightningElement {
779
791
  // update the encoded url meta param
780
792
  const encodedMeta = this.getUrlEncoded(meta);
781
793
  window.history.replaceState(
782
- {},
794
+ window.history.state,
783
795
  "",
784
796
  `${parentReferencePath}?meta=${encodedMeta}`
785
797
  );
@@ -827,6 +839,8 @@ export default class AmfReference extends LightningElement {
827
839
  * @param event
828
840
  */
829
841
  protected onApiNavigationChanged(): void {
842
+ this.saveScroll();
843
+
830
844
  const specBasedReference = this.isSpecBasedReference(
831
845
  this._currentReferenceId
832
846
  );
@@ -853,6 +867,8 @@ export default class AmfReference extends LightningElement {
853
867
  } else {
854
868
  this.loadMarkdownBasedReference();
855
869
  }
870
+
871
+ this.restoreScroll();
856
872
  }
857
873
 
858
874
  /**
@@ -1207,7 +1223,7 @@ export default class AmfReference extends LightningElement {
1207
1223
  window.location.href = redirectReferenceUrl;
1208
1224
  } else {
1209
1225
  // This is for CASE 1,3 and 4 mentioned above, Where we need to update the browser history
1210
- window.history.replaceState({}, "", redirectReferenceUrl);
1226
+ window.history.replaceState(window.history.state, "", redirectReferenceUrl);
1211
1227
  }
1212
1228
  }
1213
1229
  }
@@ -1317,6 +1333,7 @@ export default class AmfReference extends LightningElement {
1317
1333
  }
1318
1334
 
1319
1335
  handleSelectedItem(): void {
1336
+
1320
1337
  // update topic view
1321
1338
  const { referenceId, amfId, type } = this.selectedTopic;
1322
1339
 
@@ -1328,6 +1345,6 @@ export default class AmfReference extends LightningElement {
1328
1345
  id: amfId
1329
1346
  };
1330
1347
 
1331
- window.scrollTo({ top: 0, behavior: "smooth" });
1348
+ document.body.scrollTop = document.documentElement.scrollTop = 0;
1332
1349
  }
1333
1350
  }
@@ -26,6 +26,11 @@
26
26
  border-color: var(--dx-g-red-vibrant-50);
27
27
  }
28
28
 
29
+ .dx-callout-warning {
30
+ background-color: var(--dx-g-red-natural-95);
31
+ border-color: var(--dx-g-red-vibrant-50);
32
+ }
33
+
29
34
  .dx-callout-base_section {
30
35
  width: 100%;
31
36
  }
@@ -18,7 +18,7 @@ export default class ContentCallout extends LightningElement {
18
18
  break;
19
19
  case "warning":
20
20
  this.cardVariant = "doc-status-container dx-callout-warning";
21
- this.iconColor = "gray-10";
21
+ this.iconColor = "red-vibrant-50";
22
22
  this.iconName = "warning";
23
23
  break;
24
24
  case "caution":
@@ -8,12 +8,14 @@
8
8
 
9
9
  dx-tooltip {
10
10
  line-height: var(--button-size);
11
+ padding-right: var(--dx-g-spacing-xs);
11
12
  }
12
13
 
13
14
  .button-container {
14
15
  height: 100%;
15
16
  margin-right: calc(var(--dx-g-spacing-xl) - 4px);
16
17
  position: relative;
18
+ padding-right: var(--dx-g-spacing-xs);
17
19
  }
18
20
 
19
21
  button {
@@ -34,12 +36,8 @@ dx-icon {
34
36
  --dx-c-icon-size: var(--doc-c-heading-anchor-icon-size);
35
37
  }
36
38
 
37
- span:last-of-type {
38
- padding-right: var(--dx-g-spacing-xs);
39
- }
40
-
41
- .nowrap {
42
- white-space: nowrap;
39
+ .title {
40
+ word-break: break-word;
43
41
  }
44
42
 
45
43
  button:focus {
@@ -49,7 +47,7 @@ button:focus {
49
47
  button:focus,
50
48
  button:hover,
51
49
  span:hover dx-tooltip button,
52
- span:hover ~ span dx-tooltip button {
50
+ span:hover ~ dx-tooltip button {
53
51
  opacity: 1;
54
52
  outline: none;
55
53
  }
@@ -1,19 +1,13 @@
1
1
  <template>
2
2
  <template if:false={hash}>{title}</template>
3
3
  <template if:true={hash}>
4
- <template if:true={needsSpace}>
5
- <span>{titleToWrap}</span>
6
- <span>&#32;</span>
7
- </template>
8
- <span class="nowrap">
9
- {titleNoWrap}&nbsp;
10
- <dx-tooltip placement="top" label={label}>
11
- <span class="button-container">
12
- <button onclick={copy} aria-label="copy">
13
- <dx-icon size="override" symbol="link"></dx-icon>
14
- </button>
15
- </span>
16
- </dx-tooltip>
17
- </span>
4
+ <span class="title">{title}&nbsp;</span>
5
+ <dx-tooltip placement="top" label={label}>
6
+ <span class="button-container">
7
+ <button onclick={copy} aria-label="copy">
8
+ <dx-icon size="override" symbol="link"></dx-icon>
9
+ </button>
10
+ </span>
11
+ </dx-tooltip>
18
12
  </template>
19
13
  </template>
@@ -7,18 +7,6 @@ export default class HeadingContent extends LightningElement {
7
7
  label: string = "Copy link to clipboard";
8
8
  timeout: number | null = null;
9
9
 
10
- private get titleToWrap(): string {
11
- return this.title.substring(0, this.title.lastIndexOf(" "));
12
- }
13
-
14
- private get needsSpace(): boolean {
15
- return this.titleToWrap.length > 0;
16
- }
17
-
18
- private get titleNoWrap(): string {
19
- return this.title.substring(this.title.lastIndexOf(" ") + 1);
20
- }
21
-
22
10
  private async copy() {
23
11
  if (this.timeout) {
24
12
  window.clearTimeout(this.timeout);