@salesforcedevs/docs-components 1.38.0-alpha.0 → 1.38.0-plv-alpha
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 +0 -1
- package/package.json +28 -28
- package/src/modules/doc/amfReference/amfReference.html +2 -2
- package/src/modules/doc/amfReference/amfReference.ts +24 -152
- package/src/modules/doc/contentLayout/contentLayout.html +0 -1
- package/src/modules/doc/contentLayout/contentLayout.ts +1 -67
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +0 -1
- package/src/modules/doc/redocReference/redocReference.css +1 -0
- package/src/modules/doc/redocReference/redocReference.ts +510 -23
- package/src/modules/doc/unifiedContentLayout/unifiedContentLayout.html +16 -1
- package/src/modules/doc/unifiedContentLayout/unifiedContentLayout.ts +236 -85
- package/src/modules/doc/xmlContent/xmlContent.html +2 -2
- package/src/modules/docUtils/utils/utils.ts +22 -2
- package/src/modules/doc/versionPicker/versionPicker.css +0 -64
- package/src/modules/doc/versionPicker/versionPicker.html +0 -40
- package/src/modules/doc/versionPicker/versionPicker.ts +0 -65
- package/src/modules/docUtils/sidebarLoader/sidebarLoader.ts +0 -50
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loads the left-nav JSON that the doc framework writes once per content type
|
|
3
|
-
* (`lnb.<hash>.json`) and references from each page as `sidebar-src`.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** Schema version of the left-nav JSON files this loader understands. */
|
|
7
|
-
export const SIDEBAR_SCHEMA_VERSION = 1;
|
|
8
|
-
|
|
9
|
-
type SidebarFile<T> = { schemaVersion: number; topics: T };
|
|
10
|
-
|
|
11
|
-
const requests = new Map<string, Promise<unknown>>();
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Fetches the left-nav JSON at `src` and returns its `topics`.
|
|
15
|
-
* Requests are shared per URL; a failed request is dropped so the next call
|
|
16
|
-
* retries. The returned topics are shared between callers.
|
|
17
|
-
*/
|
|
18
|
-
export function loadSidebar<T>(src: string): Promise<T> {
|
|
19
|
-
let request = requests.get(src);
|
|
20
|
-
if (!request) {
|
|
21
|
-
request = fetch(src, { credentials: "same-origin" })
|
|
22
|
-
.then((response) => {
|
|
23
|
-
if (!response.ok) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Failed to load the sidebar ${src}: ${response.status}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
return response.json();
|
|
29
|
-
})
|
|
30
|
-
.then((file: SidebarFile<T>) => {
|
|
31
|
-
if (file?.schemaVersion !== SIDEBAR_SCHEMA_VERSION) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
`Unsupported sidebar schema version ${file?.schemaVersion} in ${src}`
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
return file.topics;
|
|
37
|
-
})
|
|
38
|
-
.catch((error) => {
|
|
39
|
-
requests.delete(src);
|
|
40
|
-
throw error;
|
|
41
|
-
});
|
|
42
|
-
requests.set(src, request);
|
|
43
|
-
}
|
|
44
|
-
return request as Promise<T>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Drops all cached requests. Used by tests. */
|
|
48
|
-
export function clearSidebarRequests(): void {
|
|
49
|
-
requests.clear();
|
|
50
|
-
}
|