@salesforcedevs/docs-components 1.28.5-redoc-alpha1 → 1.28.5-redoc-alpha3
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 || this.getSelectedReference()?.title || null;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
set specTitle(value: string | null) {
|
|
94
|
-
this._specTitle = value;
|
|
98
|
+
this._specTitle = value || 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 {
|
|
@@ -149,13 +152,7 @@ export default class RedocReference extends LightningElement {
|
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
private getRedocContainer(): HTMLElement | null {
|
|
152
|
-
|
|
153
|
-
// component composes inside shadow trees; fall back to a global
|
|
154
|
-
// `.redoc-container` for legacy page-level integrations.
|
|
155
|
-
return (
|
|
156
|
-
this.querySelector<HTMLElement>(".redoc-container") ||
|
|
157
|
-
document.querySelector<HTMLElement>(".redoc-container")
|
|
158
|
-
);
|
|
155
|
+
return document.querySelector(".redoc-container");
|
|
159
156
|
}
|
|
160
157
|
|
|
161
158
|
private getSelectedReference(): ReferenceItem | null {
|
|
@@ -373,27 +370,18 @@ export default class RedocReference extends LightningElement {
|
|
|
373
370
|
if (!this.showRedocHeader) {
|
|
374
371
|
return;
|
|
375
372
|
}
|
|
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
373
|
|
|
388
|
-
const
|
|
389
|
-
redocContainer.querySelector<HTMLElement>(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
374
|
+
for (const selector of [".menu-content", ".api-content"]) {
|
|
375
|
+
const target = redocContainer.querySelector<HTMLElement>(selector);
|
|
376
|
+
if (
|
|
377
|
+
!target ||
|
|
378
|
+
target.querySelector(":scope > .redoc-project-header")
|
|
379
|
+
) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
target.insertBefore(
|
|
395
383
|
this.buildProjectHeaderDom(),
|
|
396
|
-
|
|
384
|
+
target.firstChild
|
|
397
385
|
);
|
|
398
386
|
}
|
|
399
387
|
}
|
|
@@ -405,37 +393,40 @@ export default class RedocReference extends LightningElement {
|
|
|
405
393
|
const wrapper = document.createElement("div");
|
|
406
394
|
wrapper.className = "redoc-project-header";
|
|
407
395
|
|
|
408
|
-
|
|
396
|
+
/* TODO:
|
|
397
|
+
* Uncomment when doc-header is dropped with Vision state UX.
|
|
398
|
+
* if(this.projectTitle) {
|
|
399
|
+
*/
|
|
400
|
+
if (this.specTitle) {
|
|
409
401
|
const backLink = document.createElement("a");
|
|
410
402
|
backLink.className = "redoc-project-back";
|
|
411
403
|
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, {
|
|
404
|
+
backLink.addEventListener("click", this.onBackClick);
|
|
405
|
+
|
|
406
|
+
const icon = createElement("dx-icon", { is: DxIcon });
|
|
407
|
+
Object.assign(icon, {
|
|
420
408
|
sprite: "utility",
|
|
421
409
|
symbol: "back",
|
|
422
410
|
size: "medium"
|
|
423
411
|
});
|
|
424
|
-
|
|
412
|
+
icon.classList.add("redoc-project-back-arrow");
|
|
413
|
+
|
|
425
414
|
const label = document.createElement("span");
|
|
426
415
|
label.className = "redoc-project-title";
|
|
427
|
-
label.textContent = this.
|
|
428
|
-
|
|
416
|
+
label.textContent = this.specTitle;
|
|
417
|
+
|
|
418
|
+
backLink.appendChild(icon);
|
|
429
419
|
backLink.appendChild(label);
|
|
430
420
|
wrapper.appendChild(backLink);
|
|
431
421
|
}
|
|
432
422
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
423
|
+
// TODO: Uncomment when we we have vision state UX with no doc-header
|
|
424
|
+
// if (this.specTitle) {
|
|
425
|
+
// const specEl = document.createElement("h2");
|
|
426
|
+
// specEl.className = "redoc-spec-title";
|
|
427
|
+
// specEl.textContent = this.specTitle;
|
|
428
|
+
// wrapper.appendChild(specEl);
|
|
429
|
+
// }
|
|
439
430
|
|
|
440
431
|
return wrapper;
|
|
441
432
|
}
|