@salesforcedevs/docs-components 1.38.0-alpha.0 → 1.38.0-node24-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/lwc.config.json CHANGED
@@ -26,7 +26,6 @@
26
26
  "doc/phase",
27
27
  "doc/redocReference",
28
28
  "doc/specificationContent",
29
- "doc/versionPicker",
30
29
  "doc/xmlContent",
31
30
  "docUtils/searchClient",
32
31
  "docUtils/searchController",
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
- "name": "@salesforcedevs/docs-components",
3
- "version": "1.38.0-alpha.0",
4
- "description": "Docs Lightning web components for DSC",
5
- "license": "MIT",
6
- "main": "index.js",
7
- "engines": {
8
- "node": "22.x"
9
- },
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "dependencies": {
14
- "@api-components/amf-helper-mixin": "4.5.29",
15
- "classnames": "2.5.1",
16
- "dompurify": "3.2.4",
17
- "kagekiri": "1.4.2",
18
- "lodash.orderby": "4.6.0",
19
- "lodash.uniqby": "4.7.0",
20
- "query-string": "7.1.3",
21
- "sentence-case": "3.0.4"
22
- },
23
- "devDependencies": {
24
- "@types/classnames": "2.3.1",
25
- "@types/lodash.orderby": "4.6.9",
26
- "@types/lodash.uniqby": "4.7.9"
27
- },
28
- "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
29
- }
2
+ "name": "@salesforcedevs/docs-components",
3
+ "version": "1.38.0-node24-1",
4
+ "description": "Docs Lightning web components for DSC",
5
+ "license": "MIT",
6
+ "main": "index.js",
7
+ "engines": {
8
+ "node": "24.x"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "dependencies": {
14
+ "@api-components/amf-helper-mixin": "4.5.29",
15
+ "classnames": "2.5.1",
16
+ "dompurify": "3.2.4",
17
+ "kagekiri": "1.4.2",
18
+ "lodash.orderby": "4.6.0",
19
+ "lodash.uniqby": "4.7.0",
20
+ "query-string": "7.1.3",
21
+ "sentence-case": "3.0.4"
22
+ },
23
+ "devDependencies": {
24
+ "@types/classnames": "2.3.1",
25
+ "@types/lodash.orderby": "4.6.9",
26
+ "@types/lodash.uniqby": "4.7.9"
27
+ },
28
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
29
+ }
@@ -35,13 +35,13 @@
35
35
  ondismissphase={handleDismissVersionBanner}
36
36
  ></doc-phase>
37
37
  <div lwc:if={isVersionEnabled} slot="sidebar-header">
38
- <doc-version-picker
38
+ <dx-version-picker
39
39
  onchange={handleVersionChange}
40
40
  data-type="version"
41
41
  versions={versions}
42
42
  selected-version={selectedVersion}
43
43
  latest-version={latestVersion}
44
- ></doc-version-picker>
44
+ ></dx-version-picker>
45
45
  </div>
46
46
  <template lwc:if={showSpecBasedReference}>
47
47
  <div class="container">
@@ -29,7 +29,6 @@ import {
29
29
  import { restoreScroll } from "dx/scrollManager";
30
30
  import { DocPhaseInfo } from "typings/custom";
31
31
  import { oldVersionDocInfo } from "docUtils/utils";
32
- import { loadSidebar } from "docUtils/sidebarLoader";
33
32
  import { track as trackEvent } from "dxUtils/analytics";
34
33
 
35
34
  type NavigationItem = {
@@ -101,7 +100,6 @@ export default class AmfReference extends LightningElement {
101
100
  };
102
101
  }
103
102
 
104
- this.markdownTopicsPromise = undefined;
105
103
  this._amfConfigList = this._referenceSetConfig.refList || [];
106
104
 
107
105
  this._amfConfigList.forEach((amfConfig) => {
@@ -166,20 +164,6 @@ export default class AmfReference extends LightningElement {
166
164
  this._expandChildren = normalizeBoolean(value);
167
165
  }
168
166
 
169
- /**
170
- * URL of the left-nav JSON file with the topic trees of the markdown
171
- * references, used when the reference set config omits them.
172
- */
173
- @api
174
- get sidebarSrc(): string | undefined {
175
- return this._sidebarSrc;
176
- }
177
-
178
- set sidebarSrc(value: string | undefined) {
179
- this._sidebarSrc = value || undefined;
180
- this.loadMarkdownTopics();
181
- }
182
-
183
167
  private get enableFooter(): boolean {
184
168
  return !this.hideFooter;
185
169
  }
@@ -212,9 +196,6 @@ export default class AmfReference extends LightningElement {
212
196
  private isParentLevelDocPhaseEnabled = false;
213
197
  private selectedReferenceDocPhase?: string | null = null;
214
198
  private _expandChildren?: boolean = false;
215
- private _sidebarSrc?: string;
216
- /** Set while the markdown reference topics load from `sidebarSrc`. */
217
- private markdownTopicsPromise?: Promise<void>;
218
199
  private isVersionFetched = false;
219
200
  private latestVersion = false;
220
201
 
@@ -418,7 +399,6 @@ export default class AmfReference extends LightningElement {
418
399
  if (this._amfConfigList && this._amfConfigList.length) {
419
400
  // fetch AMF Json as soon as config is set
420
401
  this.populateReferenceItems();
421
- this.loadMarkdownTopics();
422
402
  // update() must be called after renderedCallback.
423
403
  if (this.hasRendered) {
424
404
  this.updateView();
@@ -501,7 +481,16 @@ export default class AmfReference extends LightningElement {
501
481
  isChildrenLoading = true;
502
482
  }
503
483
  } else {
504
- navItemChildren = this.getMarkdownNavItemChildren(amfConfig);
484
+ const isExpandChildrenEnabled = this.isExpandChildrenEnabled(
485
+ amfConfig.id
486
+ );
487
+ // check whether we should expand all the child nodes, this is required for Coveo to crawl.
488
+ if (isExpandChildrenEnabled) {
489
+ this.expandChildrenForMarkdownReferences(
490
+ amfConfig.topic!.children
491
+ );
492
+ }
493
+ navItemChildren = amfConfig.topic!.children;
505
494
  }
506
495
  // store nav items for each spec in order
507
496
  navAmfOrder[index] = {
@@ -519,118 +508,6 @@ export default class AmfReference extends LightningElement {
519
508
  this.navigation = navAmfOrder;
520
509
  }
521
510
 
522
- /**
523
- * Returns the sidebar children of a markdown reference, expanded when
524
- * expand children is enabled for it.
525
- */
526
- private getMarkdownNavItemChildren(
527
- amfConfig: AmfConfig
528
- ): ParsedMarkdownTopic[] {
529
- // check whether we should expand all the child nodes, this is required for Coveo to crawl.
530
- if (this.isExpandChildrenEnabled(amfConfig.id)) {
531
- this.expandChildrenForMarkdownReferences(amfConfig.topic!.children);
532
- }
533
- return amfConfig.topic!.children;
534
- }
535
-
536
- /**
537
- * Loads the topic trees of the markdown references from `sidebarSrc`
538
- * when the reference set config does not include them.
539
- */
540
- private loadMarkdownTopics(): void {
541
- const src = this._sidebarSrc;
542
- const referenceSetConfig = this._referenceSetConfig;
543
- const pendingIds = this._amfConfigList
544
- .filter(
545
- (amfConfig) =>
546
- amfConfig.referenceType === REFERENCE_TYPES.markdown &&
547
- !amfConfig.topic?.children?.length
548
- )
549
- .map((amfConfig) => amfConfig.id);
550
- if (!src || !pendingIds.length || this.markdownTopicsPromise) {
551
- return;
552
- }
553
-
554
- this.updateMarkdownNavItems(pendingIds, true);
555
- this.markdownTopicsPromise = loadSidebar<
556
- Record<string, ParsedMarkdownTopic>
557
- >(src)
558
- .then(
559
- (topics) => {
560
- if (referenceSetConfig !== this._referenceSetConfig) {
561
- return;
562
- }
563
- // the config can be read-only, so replace the entries with copies
564
- this._amfConfigList = this._amfConfigList.map(
565
- (amfConfig) => {
566
- const topic = pendingIds.includes(amfConfig.id)
567
- ? topics[amfConfig.id]
568
- : undefined;
569
- if (!topic?.children) {
570
- return amfConfig;
571
- }
572
- const loadedConfig = {
573
- ...amfConfig,
574
- topic: amfConfig.topic
575
- ? {
576
- ...amfConfig.topic,
577
- children: topic.children
578
- }
579
- : topic
580
- };
581
- this._amfConfigMap.set(amfConfig.id, loadedConfig);
582
- return loadedConfig;
583
- }
584
- );
585
- },
586
- (error) => console.error(error)
587
- )
588
- .then(() => {
589
- if (referenceSetConfig !== this._referenceSetConfig) {
590
- return;
591
- }
592
- this.markdownTopicsPromise = undefined;
593
- this.updateMarkdownNavItems(pendingIds, false);
594
- });
595
- }
596
-
597
- /**
598
- * Rebuilds the sidebar items of the given markdown references.
599
- */
600
- private updateMarkdownNavItems(
601
- referenceIds: string[],
602
- isChildrenLoading: boolean
603
- ): void {
604
- this.navigation = this.navigation.map((navItem, index) => {
605
- const amfConfig = this._amfConfigList[index];
606
- return referenceIds.includes(amfConfig.id)
607
- ? {
608
- ...navItem,
609
- children: this.getMarkdownNavItemChildren(amfConfig),
610
- isChildrenLoading
611
- }
612
- : navItem;
613
- });
614
- }
615
-
616
- /**
617
- * Runs the callback once the markdown reference topics are loaded, or
618
- * right away when they are not loading.
619
- */
620
- private afterMarkdownTopics(callback: () => void): void {
621
- const promise = this.markdownTopicsPromise;
622
- if (!promise) {
623
- callback();
624
- return;
625
- }
626
- const referenceSetConfig = this._referenceSetConfig;
627
- promise.then(() => {
628
- if (referenceSetConfig === this._referenceSetConfig) {
629
- callback();
630
- }
631
- });
632
- }
633
-
634
511
  /**
635
512
  * Determines whether the sidebar tile should render a forward arrow for
636
513
  * this reference. Honors `redoc` set on the config, and also infers it
@@ -1052,7 +929,7 @@ export default class AmfReference extends LightningElement {
1052
929
  );
1053
930
  }
1054
931
  } else {
1055
- this.afterMarkdownTopics(() => this.loadMarkdownBasedReference());
932
+ this.loadMarkdownBasedReference();
1056
933
  }
1057
934
 
1058
935
  restoreScroll(); // don't try this at home kids
@@ -1087,7 +964,7 @@ export default class AmfReference extends LightningElement {
1087
964
  );
1088
965
  }
1089
966
  } else {
1090
- this.afterMarkdownTopics(() => this.loadMarkdownBasedReference());
967
+ this.loadMarkdownBasedReference();
1091
968
  }
1092
969
  }
1093
970
 
@@ -1365,21 +1242,18 @@ export default class AmfReference extends LightningElement {
1365
1242
  }
1366
1243
  });
1367
1244
  } else {
1368
- this.afterMarkdownTopics(() => {
1369
- let invalidTopicReferenceUrl: string | null = "";
1370
- if (topicId) {
1371
- const referenceDetails =
1372
- this.getRefDetailsForGivenTopicMeta(
1373
- referenceId,
1374
- topicId
1375
- );
1376
- const selectedItemUrl = referenceDetails?.referenceUrl;
1377
- if (!selectedItemUrl) {
1378
- invalidTopicReferenceUrl = previousRefUrlInSession;
1379
- }
1245
+ let invalidTopicReferenceUrl: string | null = "";
1246
+ if (topicId) {
1247
+ const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1248
+ referenceId,
1249
+ topicId
1250
+ );
1251
+ const selectedItemUrl = referenceDetails?.referenceUrl;
1252
+ if (!selectedItemUrl) {
1253
+ invalidTopicReferenceUrl = previousRefUrlInSession;
1380
1254
  }
1381
- this.loadMarkdownBasedReference(invalidTopicReferenceUrl);
1382
- });
1255
+ }
1256
+ this.loadMarkdownBasedReference(invalidTopicReferenceUrl);
1383
1257
  }
1384
1258
  }
1385
1259
 
@@ -1617,9 +1491,7 @@ export default class AmfReference extends LightningElement {
1617
1491
  }
1618
1492
  }
1619
1493
  } else {
1620
- this.afterMarkdownTopics(() =>
1621
- this.loadMarkdownBasedReference(name)
1622
- );
1494
+ this.loadMarkdownBasedReference(name);
1623
1495
  }
1624
1496
  }
1625
1497
  }
@@ -31,7 +31,6 @@
31
31
  dev-center={devCenter}
32
32
  brand={brand}
33
33
  empty-state-message={emptyStateMessage}
34
- loading={showSidebarLoading}
35
34
  >
36
35
  <slot name="sidebar-header" slot="version-picker"></slot>
37
36
  </dx-sidebar-old>
@@ -5,7 +5,6 @@ import { closest, querySelector } from "kagekiri";
5
5
  import { toJson, normalizeBoolean } from "dxUtils/normalizers";
6
6
  import { highlightTerms } from "dxUtils/highlight";
7
7
  import { SearchSyncer } from "docUtils/searchSyncer";
8
- import { loadSidebar } from "docUtils/sidebarLoader";
9
8
  import type { OptionWithLink } from "typings/custom";
10
9
  import { buildDocLinkClickHandler } from "dxUtils/analytics";
11
10
  import ContentActionToolbar from "doc/contentActionToolbar";
@@ -132,34 +131,7 @@ export default class ContentLayout extends LightningElement {
132
131
  }
133
132
 
134
133
  set sidebarContent(value: any) {
135
- // An empty attribute means the page has no inline tree (see sidebarSrc).
136
- this._sidebarContent = value === "" ? null : toJson(value);
137
- }
138
-
139
- /**
140
- * URL of the left-nav JSON, loaded when the page has no inline
141
- * `sidebar-content`.
142
- */
143
- @api
144
- get sidebarSrc(): string | undefined {
145
- return this._sidebarSrc;
146
- }
147
-
148
- set sidebarSrc(value: string | undefined) {
149
- this._sidebarSrc = value || undefined;
150
- if (this.hasConnected) {
151
- this.loadSidebarContent();
152
- }
153
- }
154
-
155
- /** Set by wrapping layouts that load the sidebar content themselves. */
156
- @api
157
- get sidebarLoading(): boolean {
158
- return this._sidebarLoading;
159
- }
160
-
161
- set sidebarLoading(value) {
162
- this._sidebarLoading = normalizeBoolean(value);
134
+ this._sidebarContent = toJson(value);
163
135
  }
164
136
 
165
137
  @api
@@ -196,14 +168,6 @@ export default class ContentLayout extends LightningElement {
196
168
 
197
169
  @track
198
170
  protected _sidebarContent: unknown;
199
- protected _sidebarSrc?: string;
200
- protected _sidebarLoading = false;
201
- protected isSidebarSrcLoading = false;
202
- private hasConnected = false;
203
-
204
- protected get showSidebarLoading(): boolean {
205
- return this.sidebarLoading || this.isSidebarSrcLoading;
206
- }
207
171
 
208
172
  protected _breadcrumbs = null;
209
173
 
@@ -306,35 +270,6 @@ export default class ContentLayout extends LightningElement {
306
270
 
307
271
  // Add click handler for all links
308
272
  this.template.addEventListener("click", this.handleLinkClick);
309
-
310
- this.hasConnected = true;
311
- this.loadSidebarContent();
312
- }
313
-
314
- /**
315
- * Loads the sidebar content from `sidebarSrc`. Inline `sidebar-content`
316
- * wins; on failure the sidebar shows its empty state.
317
- */
318
- protected loadSidebarContent(): void {
319
- const src = this._sidebarSrc;
320
- if (!src || this._sidebarContent) {
321
- return;
322
- }
323
- this.isSidebarSrcLoading = true;
324
- loadSidebar(src)
325
- .then(
326
- (topics) => {
327
- if (src === this._sidebarSrc && !this._sidebarContent) {
328
- this._sidebarContent = topics;
329
- }
330
- },
331
- (error) => console.error(error)
332
- )
333
- .then(() => {
334
- if (src === this._sidebarSrc) {
335
- this.isSidebarSrcLoading = false;
336
- }
337
- });
338
273
  }
339
274
 
340
275
  // Placeholder for childs renderedCallback
@@ -406,7 +341,6 @@ export default class ContentLayout extends LightningElement {
406
341
  }
407
342
 
408
343
  disconnectedCallback(): void {
409
- this.hasConnected = false;
410
344
  this.disconnectObserver();
411
345
  window.removeEventListener(
412
346
  "highlightedtermchange",
@@ -13,7 +13,6 @@
13
13
  bail-label={bailLabel}
14
14
  dev-center={devCenter}
15
15
  brand={brand}
16
- loading={showSidebarLoading}
17
16
  >
18
17
  <slot name="sidebar-header" slot="version-picker"></slot>
19
18
  </dx-sidebar-old>
@@ -3,4 +3,5 @@
3
3
  --doc-c-redoc-sidebar-top: calc(
4
4
  var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
5
5
  );
6
+ --doc-c-redoc-sidebar-bg: white;
6
7
  }