@salesforcedevs/docs-components 0.74.3 → 0.79.1

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.74.3",
3
+ "version": "0.79.1",
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": "5b1dbe02a568ae6db02402a2d9e420b5b09b0f47"
27
+ "gitHead": "31fa5005b9be9a1e38f71f6ee6a8cd45f75eb40a"
28
28
  }
@@ -184,7 +184,7 @@ export default class AmfReference extends LightningElement {
184
184
  );
185
185
  this._scrollInterval = window.setInterval(() => {
186
186
  this.saveScroll();
187
- }, 1000);
187
+ }, 1000);
188
188
  }
189
189
 
190
190
  disconnectedCallback(): void {
@@ -200,11 +200,16 @@ export default class AmfReference extends LightningElement {
200
200
  }
201
201
 
202
202
  saveScroll() {
203
- window.history.replaceState({ scrollValue: document.body.scrollTop }, "", window.location.href);
203
+ window.history.replaceState(
204
+ { scrollValue: document.body.scrollTop },
205
+ "",
206
+ window.location.href
207
+ );
204
208
  }
205
209
 
206
210
  restoreScroll() {
207
- document.body.scrollTop = document.documentElement.scrollTop = window.history.state?.scrollValue;
211
+ document.body.scrollTop = document.documentElement.scrollTop =
212
+ window.history.state?.scrollValue;
208
213
  }
209
214
 
210
215
  renderedCallback(): void {
@@ -776,7 +781,7 @@ export default class AmfReference extends LightningElement {
776
781
  const encodedMeta = this.getUrlEncoded(meta);
777
782
 
778
783
  window.history.pushState(
779
- { },
784
+ {},
780
785
  "",
781
786
  `${parentReferencePath}?meta=${encodedMeta}`
782
787
  );
@@ -885,7 +890,6 @@ export default class AmfReference extends LightningElement {
885
890
  elementId: string,
886
891
  meta: string
887
892
  ): void {
888
-
889
893
  this.selectedTopic = {
890
894
  referenceId,
891
895
  parentReferencePath,
@@ -1227,8 +1231,11 @@ export default class AmfReference extends LightningElement {
1227
1231
  window.location.href = redirectReferenceUrl;
1228
1232
  } else {
1229
1233
  // This is for CASE 1,3 and 4 mentioned above, Where we need to update the browser history
1230
- window.history.replaceState(window.history.state, "", redirectReferenceUrl);
1231
-
1234
+ window.history.replaceState(
1235
+ window.history.state,
1236
+ "",
1237
+ redirectReferenceUrl
1238
+ );
1232
1239
  }
1233
1240
  }
1234
1241
  }
@@ -1274,7 +1281,7 @@ export default class AmfReference extends LightningElement {
1274
1281
 
1275
1282
  onNavSelect(event: CustomEvent): void {
1276
1283
  this.saveScroll();
1277
-
1284
+
1278
1285
  const name = event.detail.name;
1279
1286
  if (name) {
1280
1287
  const urlReferenceId = this.getReferenceIdFromUrl(name);
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <nav role="navigation" aria-label={ariaLabel}>
3
- <template if:false={renderSmallVariant}>
4
- <template if:true={renderFirstCrumb}>
3
+ <template if:true={displayCrumbs}>
4
+ <template if:false={renderSmallVariant}>
5
5
  <doc-breadcrumb-item
6
6
  analytics-event={analyticsEventName}
7
7
  analytics-base-payload={analyticsBasePayload}
@@ -9,50 +9,52 @@
9
9
  label={firstCrumb.label}
10
10
  ></doc-breadcrumb-item>
11
11
  <span class="breadcrumb-item_slash">/</span>
12
+ <template if:true={renderDropdown}>
13
+ <dx-dropdown
14
+ if:true={renderDropdown}
15
+ analytics-event={analyticsEventName}
16
+ analytics-base-payload={analyticsBasePayload}
17
+ options={dropdownOptions}
18
+ open-on-hover
19
+ placement="bottom"
20
+ suppress-gtm-nav-headings
21
+ variant="indented"
22
+ width="fit-content"
23
+ >
24
+ <dx-button
25
+ aria-label="Open Breadcrumbs Dropdown"
26
+ icon-size="large"
27
+ icon-symbol="threedots"
28
+ variant="tertiary"
29
+ ></dx-button>
30
+ </dx-dropdown>
31
+ <span class="breadcrumb-item_slash">/</span>
32
+ </template>
33
+ <template for:each={breadcrumbItems} for:item="breadcrumb">
34
+ <doc-breadcrumb-item
35
+ analytics-event={analyticsEventName}
36
+ analytics-base-payload={analyticsBasePayload}
37
+ href={breadcrumb.href}
38
+ key={breadcrumb.id}
39
+ label={breadcrumb.label}
40
+ ></doc-breadcrumb-item>
41
+ <span class="breadcrumb-item_slash" key={breadcrumb.label}>
42
+ /
43
+ </span>
44
+ </template>
45
+ <doc-breadcrumb-item
46
+ label={lastCrumb.label}
47
+ ></doc-breadcrumb-item>
12
48
  </template>
13
- <template if:true={renderDropdown}>
14
- <dx-dropdown
15
- if:true={renderDropdown}
16
- analytics-event={analyticsEventName}
17
- analytics-base-payload={analyticsBasePayload}
18
- options={dropdownOptions}
19
- open-on-hover
20
- placement="bottom"
21
- suppress-gtm-nav-headings
22
- variant="indented"
23
- width="fit-content"
24
- >
25
- <dx-button
26
- aria-label="Open Breadcrumbs Dropdown"
27
- icon-size="large"
28
- icon-symbol="threedots"
29
- variant="tertiary"
30
- ></dx-button>
31
- </dx-dropdown>
32
- <span class="breadcrumb-item_slash">/</span>
33
- </template>
34
- <template for:each={breadcrumbItems} for:item="breadcrumb">
49
+ <template if:true={renderSmallVariant}>
35
50
  <doc-breadcrumb-item
36
51
  analytics-event={analyticsEventName}
37
52
  analytics-base-payload={analyticsBasePayload}
38
- href={breadcrumb.href}
39
- key={breadcrumb.id}
40
- label={breadcrumb.label}
53
+ href={lastLinkCrump.href}
54
+ label={lastLinkCrump.label}
55
+ variant="back-arrow"
41
56
  ></doc-breadcrumb-item>
42
- <span class="breadcrumb-item_slash" key={breadcrumb.label}>
43
- /
44
- </span>
45
57
  </template>
46
- <doc-breadcrumb-item label={lastCrumb.label}></doc-breadcrumb-item>
47
- </template>
48
- <template if:true={renderSmallVariant}>
49
- <doc-breadcrumb-item
50
- analytics-event={analyticsEventName}
51
- analytics-base-payload={analyticsBasePayload}
52
- href={lastLinkCrump.href}
53
- label={lastLinkCrump.label}
54
- variant="back-arrow"
55
- ></doc-breadcrumb-item>
56
58
  </template>
57
59
  </nav>
58
60
  </template>
@@ -92,7 +92,7 @@ export default class Breadcrumbs extends LightningElement {
92
92
  );
93
93
  }
94
94
 
95
- private get renderFirstCrumb(): boolean {
95
+ private get displayCrumbs(): boolean {
96
96
  return this.breadcrumbs.length > 1;
97
97
  }
98
98
 
@@ -4,7 +4,9 @@
4
4
  <dx-icon symbol={iconName} size="large" color={iconColor}></dx-icon>
5
5
  </div>
6
6
  <div class="dx-callout-content">
7
- <p class="doc-status-title dx-callout-title dx-text-body-3">{title}</p>
7
+ <p class="doc-status-title dx-callout-title dx-text-body-3">
8
+ {title}
9
+ </p>
8
10
  <span class="dx-callout-body dx-text-body-3">
9
11
  <slot onslotchange={onSlotChange}></slot>
10
12
  </span>
@@ -29,10 +29,12 @@
29
29
  <div class="content-body-container">
30
30
  <div class="content-body">
31
31
  <doc-breadcrumbs
32
- if:true={breadcrumbs}
32
+ if:true={showBreadcrumbs}
33
33
  breadcrumbs={breadcrumbs}
34
34
  ></doc-breadcrumbs>
35
- <slot onslotchange={onSlotChange}></slot>
35
+ <div style={docContentStyle}>
36
+ <slot onslotchange={onSlotChange}></slot>
37
+ </div>
36
38
  </div>
37
39
  <div class="right-nav-bar is-sticky">
38
40
  <dx-toc
@@ -38,7 +38,7 @@ export default class ContentLayout extends LightningElement {
38
38
  return this._breadcrumbs;
39
39
  }
40
40
 
41
- set breadcrumbs(value) {
41
+ set breadcrumbs(value): [] {
42
42
  if (value) {
43
43
  this._breadcrumbs = toJson(value);
44
44
  }
@@ -79,7 +79,7 @@ export default class ContentLayout extends LightningElement {
79
79
  private lastScrollPosition: number;
80
80
  private observer?: IntersectionObserver;
81
81
  private hasRendered: boolean = false;
82
-
82
+
83
83
  private searchSyncer = new SearchSyncer({
84
84
  callbacks: {
85
85
  onUrlChange: (nextSearchString: string): void => {
@@ -111,6 +111,16 @@ export default class ContentLayout extends LightningElement {
111
111
  return window.location.pathname;
112
112
  }
113
113
 
114
+ get showBreadcrumbs(): boolean {
115
+ return (
116
+ this.breadcrumbs != null && (this.breadcrumbs as any[]).length > 1
117
+ );
118
+ }
119
+
120
+ get docContentStyle(): string {
121
+ return this.showBreadcrumbs ? "" : "margin-top: 48px";
122
+ }
123
+
114
124
  connectedCallback(): void {
115
125
  const hasParentHighlightListener = closest(
116
126
  "doc-xml-content",
@@ -126,9 +136,7 @@ export default class ContentLayout extends LightningElement {
126
136
 
127
137
  this._scrollInterval = window.setInterval(() => {
128
138
  this.saveScroll();
129
- }, 1000);
130
-
131
-
139
+ }, 1000);
132
140
  }
133
141
 
134
142
  renderedCallback(): void {
@@ -141,7 +149,7 @@ export default class ContentLayout extends LightningElement {
141
149
  this.attachInteractionObserver,
142
150
  OBSERVER_ATTACH_WAIT_TIME
143
151
  );
144
- if(!this.hasRendered) {
152
+ if (!this.hasRendered) {
145
153
  this.hasRendered = true;
146
154
  this.restoreScroll();
147
155
  }
@@ -160,11 +168,16 @@ export default class ContentLayout extends LightningElement {
160
168
  }
161
169
 
162
170
  saveScroll() {
163
- window.history.replaceState({ scrollValue: document.body.scrollTop }, "", window.location.href);
171
+ window.history.replaceState(
172
+ { scrollValue: document.body.scrollTop },
173
+ "",
174
+ window.location.href
175
+ );
164
176
  }
165
177
 
166
178
  restoreScroll() {
167
- document.body.scrollTop = document.documentElement.scrollTop = window.history.state?.scrollValue;
179
+ document.body.scrollTop = document.documentElement.scrollTop =
180
+ window.history.state?.scrollValue;
168
181
  }
169
182
 
170
183
  clearRenderObserverTimer = () => {
@@ -224,8 +237,7 @@ export default class ContentLayout extends LightningElement {
224
237
  );
225
238
  for (const headingElement of headingElements) {
226
239
  // Sometimes elements hash is not being set when slot content is wrapped with div
227
- headingElement.hash =
228
- headingElement.attributes.hash?.nodeValue;
240
+ headingElement.hash = headingElement.attributes.hash?.nodeValue;
229
241
  }
230
242
  const tocOptions = [];
231
243
  for (const headingElement of headingElements) {
@@ -7,7 +7,9 @@
7
7
  size="large"
8
8
  color="status-icon-color"
9
9
  ></dx-icon>
10
- <p class="doc-status-title doc-phase-title dx-text-body-3">{docPhaseTitle}</p>
10
+ <p class="doc-status-title doc-phase-title dx-text-body-3">
11
+ {docPhaseTitle}
12
+ </p>
11
13
  <dx-button
12
14
  variant="inline"
13
15
  onclick={onButtonClick}
@@ -96,7 +96,9 @@
96
96
  <a
97
97
  href={child5.a_attr.href}
98
98
  data-id={child5.id}
99
- class="nav1"
99
+ class="
100
+ nav1
101
+ "
100
102
  onclick={handleNavClick}
101
103
  >
102
104
  {child5.text}
@@ -40,9 +40,9 @@ export default class Toolbar extends LightningElement {
40
40
  "select[name=languages]"
41
41
  ) as HTMLSelectElement;
42
42
  if (languageEl) {
43
- const languageValue = (languageEl[
44
- languageEl.selectedIndex
45
- ] as HTMLOptionElement).value;
43
+ const languageValue = (
44
+ languageEl[languageEl.selectedIndex] as HTMLOptionElement
45
+ ).value;
46
46
  this.dispatchEvent(
47
47
  new CustomEvent("languageselected", {
48
48
  detail: {
@@ -61,9 +61,9 @@ export default class Toolbar extends LightningElement {
61
61
  "select[name=versions]"
62
62
  ) as HTMLSelectElement;
63
63
  if (versionEl) {
64
- const versionValue = (versionEl[
65
- versionEl.selectedIndex
66
- ] as HTMLOptionElement).value;
64
+ const versionValue = (
65
+ versionEl[versionEl.selectedIndex] as HTMLOptionElement
66
+ ).value;
67
67
  this.dispatchEvent(
68
68
  new CustomEvent("versionselected", {
69
69
  detail: {
@@ -34,6 +34,7 @@
34
34
  docs-data={docContent}
35
35
  page-reference={pageReference}
36
36
  onnavclick={handleNavClick}
37
+ style={docContentStyle}
37
38
  ></doc-content>
38
39
  </doc-content-layout>
39
40
  </template>
@@ -577,7 +577,11 @@ export default class DocXmlContent extends LightningElementWithState<{
577
577
  }
578
578
 
579
579
  get showBreadcrumbs(): boolean {
580
- return this.breadcrumbs && this.breadcrumbs.length > 0;
580
+ return this.breadcrumbs && this.breadcrumbs.length > 1;
581
+ }
582
+
583
+ get docContentStyle(): string {
584
+ return this.showBreadcrumbs ? "" : "margin-top: 48px";
581
585
  }
582
586
 
583
587
  private buildBreadcrumbs(): void {
@@ -588,8 +592,7 @@ export default class DocXmlContent extends LightningElementWithState<{
588
592
 
589
593
  const currentNode = this.tocMap[contentDocumentId];
590
594
 
591
-
592
- if(currentNode?.parent) {
595
+ if (currentNode?.parent) {
593
596
  this.breadcrumbs = this.nodeToBreadcrumb(currentNode);
594
597
  } else {
595
598
  this.breadcrumbs = [];