@salesforcedevs/docs-components 1.34.0-docs-feedback → 1.34.0-docs-feedback-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/package.json
CHANGED
|
@@ -74,6 +74,13 @@ export default class Header extends HeaderBase {
|
|
|
74
74
|
return (this.hideDocHeader && !this.mobile) || this.showDocDivider;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
private get isDocsPath(): boolean {
|
|
78
|
+
return (
|
|
79
|
+
window.location.pathname.includes("/docs/") &&
|
|
80
|
+
window.location.pathname !== "/docs/apis"
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
connectedCallback(): void {
|
|
78
85
|
super.connectedCallback();
|
|
79
86
|
this.tabletMatchMedia = window.matchMedia(
|
|
@@ -83,9 +90,7 @@ export default class Header extends HeaderBase {
|
|
|
83
90
|
this.tabletMatchMedia.addEventListener("change", this.onTabletChange);
|
|
84
91
|
|
|
85
92
|
if (
|
|
86
|
-
(!this.shouldHideHeader &&
|
|
87
|
-
window.location.pathname.includes("/docs/") &&
|
|
88
|
-
window.location.pathname !== "/docs/apis") ||
|
|
93
|
+
(!this.shouldHideHeader && this.isDocsPath) ||
|
|
89
94
|
window.location.pathname ===
|
|
90
95
|
"/tableau/embedding-playground/overview" ||
|
|
91
96
|
isStorybook()
|
|
@@ -109,6 +114,12 @@ export default class Header extends HeaderBase {
|
|
|
109
114
|
);
|
|
110
115
|
}
|
|
111
116
|
|
|
117
|
+
renderedCallback(): void {
|
|
118
|
+
if (this.hideDocHeader) {
|
|
119
|
+
this.shouldRender = !this.shouldHideHeader && this.isDocsPath;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
112
123
|
private onTabletChange = (e: MediaQueryListEvent | MediaQueryList) =>
|
|
113
124
|
(this.tablet = e.matches);
|
|
114
125
|
|
|
@@ -10,32 +10,30 @@ import type { OptionWithLink, TreeNode } from "typings/custom";
|
|
|
10
10
|
*/
|
|
11
11
|
const TOPIC_TYPE_SPEC = "spec";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (child.link?.href) {
|
|
23
|
-
return child;
|
|
24
|
-
}
|
|
13
|
+
/**
|
|
14
|
+
* Returns the parent's first direct child when it is a markdown content
|
|
15
|
+
* page or undefined otherwise.
|
|
16
|
+
*/
|
|
17
|
+
function firstChildContentPage(node: TreeNode): TreeNode | undefined {
|
|
18
|
+
const firstChild = node.children?.[0];
|
|
19
|
+
if (!firstChild) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
const isSpec =
|
|
24
|
+
(firstChild as { topicType?: string }).topicType === TOPIC_TYPE_SPEC;
|
|
25
|
+
const isExternal = firstChild.link?.target === "_blank";
|
|
26
|
+
if (isSpec || isExternal || !firstChild.link?.href) {
|
|
27
|
+
return undefined;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
return
|
|
30
|
+
return firstChild;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
34
|
* Translates per-topic `topicType` into the generic `showForwardArrow` flag
|
|
37
35
|
* that `dx-tree-tile` reads (spec topics get the forward arrow icon for Redoc),
|
|
38
|
-
* and redirects content-less parent topics
|
|
36
|
+
* and redirects content-less parent topics whose first child is a content page
|
|
39
37
|
*/
|
|
40
38
|
function decorateTopics(
|
|
41
39
|
topics: Array<TreeNode & { topicType?: string }> | undefined
|
|
@@ -49,15 +47,17 @@ function decorateTopics(
|
|
|
49
47
|
decorated.children = decorateTopics(decorated.children);
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/** Redirect a parent that has no content of its own to its first child
|
|
51
|
+
* but only when that first child is itself a content page
|
|
52
|
+
*/
|
|
54
53
|
const isContentlessParent =
|
|
55
54
|
!!decorated.children?.length && !decorated.link?.href;
|
|
56
55
|
|
|
57
56
|
if (isContentlessParent) {
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
decorated.link = { ...
|
|
57
|
+
const firstChild = firstChildContentPage(topic);
|
|
58
|
+
if (firstChild?.link) {
|
|
59
|
+
decorated.link = { ...firstChild.link };
|
|
60
|
+
decorated.redirectToChild = true;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|