@salesforcedevs/docs-components 1.3.194-langpicker2-alpha → 1.3.194-reference-scroll1

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.194-langpicker2-alpha",
3
+ "version": "1.3.194-reference-scroll1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -16,8 +16,6 @@
16
16
  toc-title={tocTitle}
17
17
  toc-options={tocOptions}
18
18
  enable-slot-change="true"
19
- languages={languages}
20
- language={language}
21
19
  >
22
20
  <doc-phase
23
21
  slot="doc-phase"
@@ -53,7 +51,10 @@
53
51
  <template if:true={showSpecBasedReference}>
54
52
  <div class="container">
55
53
  <div class="api-documentation">
56
- <doc-amf-topic model={topicModel}></doc-amf-topic>
54
+ <doc-amf-topic
55
+ if:true={topicModel}
56
+ model={topicModel}
57
+ ></doc-amf-topic>
57
58
  </div>
58
59
  </div>
59
60
  </template>
@@ -4,7 +4,6 @@ import { sentenceCase } from "sentence-case";
4
4
  import qs from "query-string";
5
5
  import { AmfModelParser } from "doc/amfModelParser";
6
6
  import { normalizeBoolean } from "dxUtils/normalizers";
7
- import type { OptionWithLink } from "typings/custom";
8
7
  import type {
9
8
  AmfConfig,
10
9
  AmfMetadataTopic,
@@ -49,8 +48,6 @@ export default class AmfReference extends LightningElement {
49
48
  @api useOldSidebar: boolean = false;
50
49
  @api tocTitle?: string;
51
50
  @api tocOptions?: string;
52
- @api languages!: OptionWithLink[];
53
- @api language!: string;
54
51
  @track navigation = [] as NavigationItem[];
55
52
  @track versions: Array<ReferenceVersion> = [];
56
53
  @track showVersionBanner = false;
@@ -188,10 +185,12 @@ export default class AmfReference extends LightningElement {
188
185
  constructor() {
189
186
  super();
190
187
 
191
- this._boundOnApiNavigationChanged =
192
- this.onApiNavigationChanged.bind(this);
193
- this._boundUpdateSelectedItemFromUrlQuery =
194
- this.updateSelectedItemFromUrlQuery.bind(this);
188
+ this._boundOnApiNavigationChanged = this.onApiNavigationChanged.bind(
189
+ this
190
+ );
191
+ this._boundUpdateSelectedItemFromUrlQuery = this.updateSelectedItemFromUrlQuery.bind(
192
+ this
193
+ );
195
194
  }
196
195
 
197
196
  connectedCallback(): void {
@@ -247,8 +246,9 @@ export default class AmfReference extends LightningElement {
247
246
  const updatedReferenceId =
248
247
  oldReferenceIdNewReferenceIdMap[referenceId];
249
248
  const newReferenceId = updatedReferenceId || referenceId;
250
- const referenceItemConfig =
251
- this.getAmfConfigWithId(newReferenceId);
249
+ const referenceItemConfig = this.getAmfConfigWithId(
250
+ newReferenceId
251
+ );
252
252
  if (referenceItemConfig) {
253
253
  hashBasedRedirectUrl = `${referenceItemConfig.href}?meta=${encodedMeta}`;
254
254
  }
@@ -328,8 +328,9 @@ export default class AmfReference extends LightningElement {
328
328
  for (let i = 0; i < allVersions.length; i++) {
329
329
  const versionItem = allVersions[i];
330
330
  const referenceLink = versionItem.link.href;
331
- const referenceId =
332
- this.getReferenceIdFromUrl(referenceLink);
331
+ const referenceId = this.getReferenceIdFromUrl(
332
+ referenceLink
333
+ );
333
334
  if (this._currentReferenceId === referenceId) {
334
335
  // This is to navigate to respective topic in the changed version
335
336
  versionItem.link.href = `${referenceLink}/${currentRefMeta}`;
@@ -843,8 +844,9 @@ export default class AmfReference extends LightningElement {
843
844
  this._currentReferenceId
844
845
  );
845
846
  if (specBasedReference) {
846
- const currentMeta: RouteMeta | undefined =
847
- this.getReferenceMetaInfo(window.location.href);
847
+ const currentMeta:
848
+ | RouteMeta
849
+ | undefined = this.getReferenceMetaInfo(window.location.href);
848
850
  const metadata =
849
851
  currentMeta && this.getMetadataByUrlQuery(currentMeta);
850
852
  if (metadata) {
@@ -1270,10 +1272,12 @@ export default class AmfReference extends LightningElement {
1270
1272
  }
1271
1273
  if (!isRedirecting) {
1272
1274
  const currentReferenceUrl = window.location.href;
1273
- const referenceMeta =
1274
- this.getMarkdownReferenceMeta(currentReferenceUrl);
1275
- const selectedItemRefId =
1276
- this.getReferenceIdFromUrl(currentReferenceUrl);
1275
+ const referenceMeta = this.getMarkdownReferenceMeta(
1276
+ currentReferenceUrl
1277
+ );
1278
+ const selectedItemRefId = this.getReferenceIdFromUrl(
1279
+ currentReferenceUrl
1280
+ );
1277
1281
  const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1278
1282
  selectedItemRefId,
1279
1283
  referenceMeta
@@ -1320,8 +1324,9 @@ export default class AmfReference extends LightningElement {
1320
1324
  const name = event.detail.name;
1321
1325
  if (name) {
1322
1326
  const urlReferenceId = this.getReferenceIdFromUrl(name);
1323
- const specBasedReference =
1324
- this.isSpecBasedReference(urlReferenceId);
1327
+ const specBasedReference = this.isSpecBasedReference(
1328
+ urlReferenceId
1329
+ );
1325
1330
  if (specBasedReference) {
1326
1331
  const metaVal = this.getMetaFromUrl(name);
1327
1332
  const currentSelectedMeta = this.selectedTopic
@@ -1376,8 +1381,9 @@ export default class AmfReference extends LightningElement {
1376
1381
  const currentReferenceId = this.getReferenceIdFromUrl(currentUrl);
1377
1382
  //No need to do anything if user is expanding currently selected reference
1378
1383
  if (referenceId !== currentReferenceId) {
1379
- const isSpecBasedReference =
1380
- this.isSpecBasedReference(referenceId);
1384
+ const isSpecBasedReference = this.isSpecBasedReference(
1385
+ referenceId
1386
+ );
1381
1387
  if (isSpecBasedReference) {
1382
1388
  // Perform functionality same as item selection
1383
1389
  this.onNavSelect(event);
@@ -1 +1,22 @@
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(--dx-g-doc-header-height) +
18
+ var(--reference-container-margin-top) +
19
+ var(--api-documentation-margin-top)
20
+ );
21
+ }
22
+ }
@@ -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: HTMLElement) {
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 {
@@ -106,7 +106,7 @@ h6 {
106
106
  }
107
107
 
108
108
  img {
109
- image-rendering: -webkit-optimize-contrast;
109
+ image-rendering: optimize-contrast;
110
110
  }
111
111
 
112
112
  p,
@@ -61,16 +61,12 @@ dx-toc {
61
61
  flex-direction: row;
62
62
  justify-content: center;
63
63
  max-width: var(--dx-g-doc-content-max-width);
64
-
65
- /* Derived this manually by substracting (topHeader, doc header, banner and the content). */
66
- min-height: 62vh;
67
64
  margin: auto;
68
65
  padding: 0 var(--dx-g-global-header-padding-horizontal);
69
- margin-bottom: calc(2 * (var(--dx-g-spacing-5xl) + 4px));
70
66
  }
71
67
 
72
68
  .content-body {
73
- margin: var(--dx-g-spacing-sm) 0 0;
69
+ margin: var(--dx-g-spacing-sm) 0 var(--dx-g-spacing-xl);
74
70
  max-width: 900px;
75
71
  flex: 1;
76
72
  width: 0;
@@ -110,7 +106,6 @@ dx-toc {
110
106
  .content-body-container {
111
107
  padding-right: 0;
112
108
  overflow-x: auto;
113
- margin-bottom: calc(var(--dx-g-spacing-5xl) + 4px);
114
109
  }
115
110
 
116
111
  .left-nav-bar {
@@ -7,8 +7,6 @@
7
7
  value={sidebarValue}
8
8
  header={sidebarHeader}
9
9
  ontogglesidebar={onToggleSidebar}
10
- languages={languages}
11
- language={language}
12
10
  >
13
11
  <slot name="sidebar-header" slot="header"></slot>
14
12
  </dx-sidebar-old>
@@ -50,9 +48,6 @@
50
48
  ></dx-toc>
51
49
  </div>
52
50
  </div>
53
- <div class="footer-container">
54
- <dx-footer variant="no-signup"></dx-footer>
55
- </div>
56
51
  </div>
57
52
  </div>
58
53
  </template>
@@ -4,7 +4,6 @@ import { closest } from "kagekiri";
4
4
  import { toJson } from "dxUtils/normalizers";
5
5
  import { highlightTerms } from "dxUtils/highlight";
6
6
  import { SearchSyncer } from "docUtils/searchSyncer";
7
- import type { OptionWithLink } from "typings/custom";
8
7
 
9
8
  type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
10
9
 
@@ -74,26 +73,6 @@ export default class ContentLayout extends LightningElement {
74
73
  );
75
74
  }
76
75
 
77
- @api
78
- get languages() {
79
- return this._languages;
80
- }
81
-
82
- set languages(value) {
83
- this._languages = toJson(value);
84
- }
85
-
86
- @api
87
- get language() {
88
- return this._language;
89
- }
90
-
91
- set language(value) {
92
- if (this._language !== value) {
93
- this._language = value;
94
- }
95
- }
96
-
97
76
  @track
98
77
  private _sidebarContent: unknown;
99
78
 
@@ -109,8 +88,6 @@ export default class ContentLayout extends LightningElement {
109
88
  private hasRendered: boolean = false;
110
89
  private contentLoaded: boolean = false;
111
90
  private sidebarOpen: boolean = false;
112
- private _languages!: OptionWithLink[];
113
- private _language: string | null = null;
114
91
 
115
92
  get shouldDisplayFeedback() {
116
93
  return this.contentLoaded && typeof Sprig !== "undefined";
@@ -230,9 +207,9 @@ export default class ContentLayout extends LightningElement {
230
207
  ".sticky-doc-header"
231
208
  ) as HTMLElement;
232
209
 
233
- const docPhaseEl = (
234
- this.template.querySelector("[name=doc-phase]")! as any
235
- ).assignedElements()[0] as HTMLSlotElement;
210
+ const docPhaseEl = (this.template.querySelector(
211
+ "[name=doc-phase]"
212
+ )! as any).assignedElements()[0] as HTMLSlotElement;
236
213
 
237
214
  if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
238
215
  console.warn("One or more required elements are missing.");
@@ -282,8 +259,9 @@ export default class ContentLayout extends LightningElement {
282
259
  });
283
260
 
284
261
  // Adjust right nav bar position when doc phase is present
285
- const rightNavBarEl =
286
- this.template.querySelector(".right-nav-bar");
262
+ const rightNavBarEl = this.template.querySelector(
263
+ ".right-nav-bar"
264
+ );
287
265
 
288
266
  if (rightNavBarEl) {
289
267
  rightNavBarEl.style.top = `${
@@ -345,17 +323,14 @@ export default class ContentLayout extends LightningElement {
345
323
  };
346
324
 
347
325
  onSlotChange(event: Event): void {
348
- const slotElements = (
349
- event.target as HTMLSlotElement
350
- ).assignedElements();
326
+ const slotElements = (event.target as HTMLSlotElement).assignedElements();
351
327
 
352
328
  if (slotElements.length) {
353
329
  this.contentLoaded = true;
354
330
  const slotContentElement = slotElements[0];
355
- const headingElements =
356
- slotContentElement.ownerDocument?.getElementsByTagName(
357
- TOC_HEADER_TAG
358
- );
331
+ const headingElements = slotContentElement.ownerDocument?.getElementsByTagName(
332
+ TOC_HEADER_TAG
333
+ );
359
334
 
360
335
  for (const headingElement of headingElements as any) {
361
336
  // Sometimes elements hash is not being set when slot content is wrapped with div
@@ -415,9 +390,9 @@ export default class ContentLayout extends LightningElement {
415
390
  globalNavEl?.offsetHeight +
416
391
  contextNavEl?.offsetHeight;
417
392
 
418
- const docPhaseEl = (
419
- this.template.querySelector("[name=doc-phase]")! as any
420
- ).assignedElements()[0] as HTMLSlotElement;
393
+ const docPhaseEl = (this.template.querySelector(
394
+ "[name=doc-phase]"
395
+ )! as any).assignedElements()[0] as HTMLSlotElement;
421
396
 
422
397
  const offset = docPhaseEl
423
398
  ? headerHeight + docPhaseEl.offsetHeight
@@ -2,14 +2,11 @@
2
2
 
3
3
  dx-logo {
4
4
  min-width: fit-content;
5
- min-width: -moz-fit-content;
6
5
  }
7
6
 
8
7
  .header_l2 {
9
8
  justify-content: space-between;
10
9
  height: var(--dx-g-doc-header-main-nav-height);
11
- padding-bottom: var(--dx-g-spacing-xs);
12
- background: white;
13
10
  }
14
11
 
15
12
  .nav_menu-button {
@@ -19,24 +16,16 @@ dx-logo {
19
16
  );
20
17
  }
21
18
 
22
- .has-brand.has-scoped-nav-items {
23
- border-bottom: 1px solid var(--dx-g-gray-90);
24
- border-top: 1px solid var(--dx-g-gray-90);
25
- }
26
-
27
19
  .nav_menu-ctas {
28
20
  margin-right: var(--dx-g-spacing-sm);
29
21
  }
30
22
 
31
23
  header:not(.has-brand) > .header_l1 {
32
- background: white;
33
- border-bottom: 1px solid var(--dx-g-gray-90);
24
+ background: var(--dx-g-brand-current-color-background);
34
25
  }
35
26
 
36
27
  header:not(.has-brand) > .header_l2 {
37
- border-bottom: 1px solid var(--dx-g-gray-90);
38
- border-top: 1px solid var(--dx-g-gray-90);
39
- padding-bottom: var(--dx-g-spacing-lg);
28
+ background: var(--dx-g-brand-current-color-background-2);
40
29
  }
41
30
 
42
31
  .header_l2_group.header_l2_group-right-ctas {
@@ -67,10 +56,6 @@ header:not(.has-brand) > .header_l2 {
67
56
  --border-color: var(--button-primary-color-hover);
68
57
  }
69
58
 
70
- .has-brand .header_l2_group-title {
71
- padding-bottom: calc(var(--dx-g-spacing-md) + 2px);
72
- }
73
-
74
59
  @media (max-width: 768px) {
75
60
  .header_l2 {
76
61
  padding: 0;
@@ -97,10 +82,6 @@ header:not(.has-brand) > .header_l2 {
97
82
  margin-right: var(--dx-g-spacing-sm);
98
83
  }
99
84
 
100
- .has-brand .header_l2_group-title {
101
- padding-bottom: var(--dx-g-spacing-smd);
102
- }
103
-
104
85
  .header_l2_group-title {
105
86
  margin-right: 0;
106
87
  padding: var(--dx-g-spacing-smd)
@@ -121,10 +102,6 @@ header:not(.has-brand) > .header_l2 {
121
102
  }
122
103
 
123
104
  .has-scoped-nav-items .header_l2_group-title {
124
- border-bottom: 1px solid var(--dx-g-gray-90);
125
- }
126
-
127
- header:not(.has-brand) > .header_l2 {
128
- padding-bottom: 0;
105
+ border-bottom: 1px solid var(--dx-g-brand-current-color-border-2);
129
106
  }
130
107
  }
@@ -14,9 +14,9 @@
14
14
  if:true={isValidBrand}
15
15
  sprite="salesforcebrand"
16
16
  symbol={brand}
17
- size="large"
17
+ size="xlarge"
18
18
  ></dx-icon>
19
- <span class="subtitle dx-text-display-7">
19
+ <span class="subtitle dx-text-display-6">
20
20
  {subtitle}
21
21
  </span>
22
22
  </a>
@@ -2,7 +2,7 @@
2
2
 
3
3
  button {
4
4
  opacity: 0;
5
- color: rgb(11, 92, 171);
5
+ color: rgb(11 92 171);
6
6
  }
7
7
 
8
8
  button:hover {
@@ -17,7 +17,7 @@ button:focus {
17
17
 
18
18
  button:focus-visible {
19
19
  border-radius: 4px;
20
- border: 2px solid rgb(11, 92, 171);
20
+ border: 2px solid rgb(11 92 171);
21
21
  }
22
22
 
23
23
  .icon-wrapper {
@@ -23,7 +23,7 @@ button {
23
23
  bottom: var(--doc-c-heading-anchor-button-bottom);
24
24
  left: 0;
25
25
  opacity: 0;
26
- color: rgb(11, 92, 171);
26
+ color: rgb(11 92 171);
27
27
  display: flex;
28
28
  justify-content: center;
29
29
  align-items: center;
@@ -4,7 +4,7 @@
4
4
  width: 100%;
5
5
  display: flex;
6
6
  flex-direction: row;
7
- margin: 20px 0 20px 0;
7
+ margin: 20px 0;
8
8
  }
9
9
 
10
10
  dx-hr:first-of-type::part(hr) {
@@ -252,11 +252,14 @@ export default class DocXmlContent extends LightningElementWithState<{
252
252
  }
253
253
 
254
254
  private get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
255
- const config: { locale?: string; topicid?: string; version?: string } =
256
- {
257
- locale: this.languageId,
258
- topicid: this.deliverable
259
- };
255
+ const config: {
256
+ locale?: string;
257
+ topicid?: string;
258
+ version?: string;
259
+ } = {
260
+ locale: this.languageId,
261
+ topicid: this.deliverable
262
+ };
260
263
 
261
264
  if (this.releaseVersionId && this.releaseVersionId !== "noversion") {
262
265
  config.version = this.releaseVersionId;
@@ -411,8 +414,12 @@ export default class DocXmlContent extends LightningElementWithState<{
411
414
  }
412
415
 
413
416
  getReferenceFromUrl(): PageReference {
414
- const [page, docId, deliverable, contentDocumentId] =
415
- window.location.pathname.substr(1).split("/");
417
+ const [
418
+ page,
419
+ docId,
420
+ deliverable,
421
+ contentDocumentId
422
+ ] = window.location.pathname.substr(1).split("/");
416
423
 
417
424
  const { origin: domain, hash, search } = window.location;
418
425
 
@@ -574,14 +581,20 @@ export default class DocXmlContent extends LightningElementWithState<{
574
581
  }
575
582
 
576
583
  private updateSearchInput(searchParam: string): void {
577
- (
578
- this.template.querySelector("doc-content-layout") as any
579
- )?.setSidebarInputValue(searchParam);
584
+ (this.template.querySelector(
585
+ "doc-content-layout"
586
+ ) as any)?.setSidebarInputValue(searchParam);
580
587
  }
581
588
 
582
589
  private pageReferenceToString(reference: PageReference): string {
583
- const { page, docId, deliverable, contentDocumentId, hash, search } =
584
- reference;
590
+ const {
591
+ page,
592
+ docId,
593
+ deliverable,
594
+ contentDocumentId,
595
+ hash,
596
+ search
597
+ } = reference;
585
598
  return `/${page}/${docId}/${deliverable}/${contentDocumentId}${this.normalizeSearch(
586
599
  search!
587
600
  )}${this.normalizeHash(hash)}`;
@@ -166,12 +166,12 @@ api-security-documentation {
166
166
  --anypoint-button-emphasis-high-active-background-color: transparent;
167
167
 
168
168
  /* api example */
169
- --api-example-accent-color: rgb(250, 250, 250);
170
- --api-example-background-color: rgb(250, 250, 250);
169
+ --api-example-accent-color: rgb(250 250 250);
170
+ --api-example-background-color: rgb(250 250 250);
171
171
  --api-example-title-background-color: transparent;
172
172
 
173
173
  /* code snippets */
174
- --http-code-snippet-container-background-color: rgb(250, 250, 250);
174
+ --http-code-snippet-container-background-color: rgb(250 250 250);
175
175
  --http-code-snippet-container-padding: var(--dx-g-spacing-md);
176
176
 
177
177
  /* prism */
@@ -208,7 +208,7 @@ api-endpoint-documentation {
208
208
  );
209
209
 
210
210
  /* description */
211
- --api-endpoint-documentation-description-color: rgb(24, 24, 24);
211
+ --api-endpoint-documentation-description-color: rgb(24 24 24);
212
212
  }
213
213
 
214
214
  api-endpoint-documentation,
@@ -271,11 +271,11 @@ api-method-documentation {
271
271
  --api-method-documentation-http-method-label-font-weight: var(
272
272
  --dx-g-font-bold
273
273
  );
274
- --api-method-documentation-description-color: rgb(24, 24, 24);
274
+ --api-method-documentation-description-color: rgb(24 24 24);
275
275
  --api-method-documentation-operation-id-color: var(--dx-g-gray-50);
276
276
 
277
277
  /* body */
278
- --api-body-document-description-color: rgb(24, 24, 24);
278
+ --api-body-document-description-color: rgb(24 24 24);
279
279
  --api-body-document-media-type-selector-color: var(--dx-g-blue-vibrant-20);
280
280
  --api-body-document-media-type-selector-font-size: var(
281
281
  --amf-h8-mod-font-size
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .doc-status-container {
12
- background-color: rgb(254, 243, 217);
12
+ background-color: rgb(254 243 217);
13
13
  border-color: var(--dx-g-yellow-vibrant-80);
14
14
  }
15
15