@salesforcedevs/docs-components 1.28.5-redoc-alpha1 → 1.28.5-redoc-alpha2
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
|
@@ -533,32 +533,32 @@ export default class AmfReference extends LightningElement {
|
|
|
533
533
|
for (const [index, amfConfig] of this._amfConfigList.entries()) {
|
|
534
534
|
let navItemChildren = [] as ParsedMarkdownTopic[];
|
|
535
535
|
let isChildrenLoading = false;
|
|
536
|
-
if (amfConfig.renderWith
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
536
|
+
if (amfConfig.renderWith !== RENDER_WITH.redoc) {
|
|
537
|
+
if (amfConfig.referenceType !== REFERENCE_TYPES.markdown) {
|
|
538
|
+
if (amfConfig.isSelected) {
|
|
539
|
+
const amfPromise = this.fetchAmf(amfConfig).then(
|
|
540
|
+
(amfJson) => {
|
|
541
|
+
this.updateModel(amfConfig.id, amfJson);
|
|
542
|
+
this.assignNavigationItemsFromAmf(
|
|
543
|
+
amfConfig,
|
|
544
|
+
index
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
);
|
|
548
|
+
this.amfFetchPromiseMap[amfConfig.id] = amfPromise;
|
|
549
|
+
}
|
|
550
|
+
isChildrenLoading = true;
|
|
551
|
+
} else {
|
|
552
|
+
const isExpandChildrenEnabled =
|
|
553
|
+
this.isExpandChildrenEnabled(amfConfig.id);
|
|
554
|
+
// check whether we should expand all the child nodes, this is required for Coveo to crawl.
|
|
555
|
+
if (isExpandChildrenEnabled) {
|
|
556
|
+
this.expandChildrenForMarkdownReferences(
|
|
557
|
+
amfConfig.topic!.children
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
navItemChildren = amfConfig.topic!.children;
|
|
560
561
|
}
|
|
561
|
-
navItemChildren = amfConfig.topic!.children;
|
|
562
562
|
}
|
|
563
563
|
// store nav items for each spec in order
|
|
564
564
|
navAmfOrder[index] = {
|
|
@@ -80,15 +80,12 @@ export interface AmfConfig {
|
|
|
80
80
|
topic?: ParsedMarkdownTopic;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
84
|
-
* When "redoc", spec-based references are rendered with Redoc instead of
|
|
85
|
-
* the AMF-based topic view. Other values fall back to the default pipeline.
|
|
83
|
+
* Required for rendering the arrow on LNB
|
|
86
84
|
*/
|
|
87
85
|
renderWith?: string;
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
|
-
* Spec URL consumed by alternate renderers (e.g. Redoc).
|
|
91
|
-
* references this is the OpenAPI document URL.
|
|
88
|
+
* Spec URL consumed by alternate renderers (e.g. Redoc, Mulesoft).
|
|
92
89
|
*/
|
|
93
90
|
source?: string;
|
|
94
91
|
}
|
|
@@ -15,12 +15,19 @@ declare global {
|
|
|
15
15
|
|
|
16
16
|
declare const Sprig: (eventType: string, eventName: string) => void;
|
|
17
17
|
|
|
18
|
+
type ReferenceTopic = {
|
|
19
|
+
link?: { href?: string };
|
|
20
|
+
children?: ReferenceTopic[];
|
|
21
|
+
};
|
|
22
|
+
|
|
18
23
|
type ReferenceItem = {
|
|
19
24
|
source: string;
|
|
20
25
|
href: string;
|
|
21
26
|
title?: string;
|
|
22
27
|
isSelected?: boolean;
|
|
23
28
|
docPhase?: string | null;
|
|
29
|
+
referenceType?: string;
|
|
30
|
+
topic?: ReferenceTopic;
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
type ReferenceConfig = {
|
|
@@ -84,14 +91,11 @@ export default class RedocReference extends LightningElement {
|
|
|
84
91
|
/** Title of the currently selected spec, shown beneath the project title. */
|
|
85
92
|
@api
|
|
86
93
|
get specTitle(): string | null {
|
|
87
|
-
|
|
88
|
-
return this._specTitle;
|
|
89
|
-
}
|
|
90
|
-
return this.getSelectedReference()?.title ?? null;
|
|
94
|
+
return this._specTitle;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
set specTitle(value: string | null) {
|
|
94
|
-
this._specTitle = value;
|
|
98
|
+
this._specTitle = value || this.getSelectedReference()?.title || null;
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/**
|
|
@@ -104,13 +108,12 @@ export default class RedocReference extends LightningElement {
|
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
/**
|
|
107
|
-
* Navigates back to
|
|
108
|
-
* project-title back link rendered above the Redoc UI.
|
|
111
|
+
* Navigates back to reference doc.
|
|
109
112
|
*/
|
|
110
|
-
private onBackClick(event: Event): void {
|
|
113
|
+
private onBackClick = (event: Event): void => {
|
|
111
114
|
event.preventDefault();
|
|
112
115
|
window.history.back();
|
|
113
|
-
}
|
|
116
|
+
};
|
|
114
117
|
|
|
115
118
|
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
116
119
|
get effectiveFooterOrigin(): string {
|
|
@@ -373,27 +376,18 @@ export default class RedocReference extends LightningElement {
|
|
|
373
376
|
if (!this.showRedocHeader) {
|
|
374
377
|
return;
|
|
375
378
|
}
|
|
376
|
-
const menuContent =
|
|
377
|
-
redocContainer.querySelector<HTMLElement>(".menu-content");
|
|
378
|
-
if (
|
|
379
|
-
menuContent &&
|
|
380
|
-
!menuContent.querySelector(":scope > .redoc-project-header")
|
|
381
|
-
) {
|
|
382
|
-
menuContent.insertBefore(
|
|
383
|
-
this.buildProjectHeaderDom(),
|
|
384
|
-
menuContent.firstChild
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
379
|
|
|
388
|
-
const
|
|
389
|
-
redocContainer.querySelector<HTMLElement>(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
380
|
+
for (const selector of [".menu-content", ".api-content"]) {
|
|
381
|
+
const target = redocContainer.querySelector<HTMLElement>(selector);
|
|
382
|
+
if (
|
|
383
|
+
!target ||
|
|
384
|
+
target.querySelector(":scope > .redoc-project-header")
|
|
385
|
+
) {
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
target.insertBefore(
|
|
395
389
|
this.buildProjectHeaderDom(),
|
|
396
|
-
|
|
390
|
+
target.firstChild
|
|
397
391
|
);
|
|
398
392
|
}
|
|
399
393
|
}
|
|
@@ -405,37 +399,40 @@ export default class RedocReference extends LightningElement {
|
|
|
405
399
|
const wrapper = document.createElement("div");
|
|
406
400
|
wrapper.className = "redoc-project-header";
|
|
407
401
|
|
|
408
|
-
|
|
402
|
+
/* TODO:
|
|
403
|
+
* Uncomment when doc-header is dropped with Vision state UX.
|
|
404
|
+
* if(this.projectTitle) {
|
|
405
|
+
*/
|
|
406
|
+
if (this.specTitle) {
|
|
409
407
|
const backLink = document.createElement("a");
|
|
410
408
|
backLink.className = "redoc-project-back";
|
|
411
409
|
backLink.href = "#";
|
|
412
|
-
backLink.addEventListener("click",
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
// 16x16 utility/back icon. dx-icon size="medium" maps to
|
|
417
|
-
// --dx-g-icon-size-md (16px).
|
|
418
|
-
const iconEl = createElement("dx-icon", { is: DxIcon });
|
|
419
|
-
Object.assign(iconEl, {
|
|
410
|
+
backLink.addEventListener("click", this.onBackClick);
|
|
411
|
+
|
|
412
|
+
const icon = createElement("dx-icon", { is: DxIcon });
|
|
413
|
+
Object.assign(icon, {
|
|
420
414
|
sprite: "utility",
|
|
421
415
|
symbol: "back",
|
|
422
416
|
size: "medium"
|
|
423
417
|
});
|
|
424
|
-
|
|
418
|
+
icon.classList.add("redoc-project-back-arrow");
|
|
419
|
+
|
|
425
420
|
const label = document.createElement("span");
|
|
426
421
|
label.className = "redoc-project-title";
|
|
427
|
-
label.textContent = this.
|
|
428
|
-
|
|
422
|
+
label.textContent = this.specTitle;
|
|
423
|
+
|
|
424
|
+
backLink.appendChild(icon);
|
|
429
425
|
backLink.appendChild(label);
|
|
430
426
|
wrapper.appendChild(backLink);
|
|
431
427
|
}
|
|
432
428
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
429
|
+
// TODO: Uncomment when we we have vision state UX with no doc-header
|
|
430
|
+
// if (this.specTitle) {
|
|
431
|
+
// const specEl = document.createElement("h2");
|
|
432
|
+
// specEl.className = "redoc-spec-title";
|
|
433
|
+
// specEl.textContent = this.specTitle;
|
|
434
|
+
// wrapper.appendChild(specEl);
|
|
435
|
+
// }
|
|
439
436
|
|
|
440
437
|
return wrapper;
|
|
441
438
|
}
|