@salesforcedevs/docs-components 0.17.0 → 0.17.12-search-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 +18 -3
- package/package.json +18 -7
- package/src/modules/README.md +41 -0
- package/src/modules/doc/amfModelParser/amfModelParser.ts +674 -0
- package/src/modules/doc/amfReference/amfReference.css +25 -0
- package/src/modules/doc/amfReference/amfReference.html +55 -0
- package/src/modules/doc/amfReference/amfReference.ts +1467 -0
- package/src/modules/doc/amfReference/constants.ts +76 -0
- package/src/modules/doc/amfReference/types.ts +125 -0
- package/src/modules/doc/amfTopic/amfTopic.css +21 -0
- package/src/modules/doc/amfTopic/amfTopic.html +3 -0
- package/src/modules/doc/amfTopic/amfTopic.ts +111 -0
- package/src/modules/doc/amfTopic/types.ts +56 -0
- package/src/modules/doc/amfTopic/utils.ts +136 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +51 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +5 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +71 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +58 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +183 -0
- package/src/modules/doc/componentPlayground/componentPlayground.css +22 -0
- package/src/modules/doc/componentPlayground/componentPlayground.html +20 -0
- package/src/modules/doc/componentPlayground/componentPlayground.ts +42 -0
- package/src/modules/doc/content/content.css +89 -70
- package/src/modules/doc/content/content.html +1 -0
- package/src/modules/doc/content/content.ts +188 -195
- package/src/modules/doc/contentCallout/contentCallout.css +17 -23
- package/src/modules/doc/contentCallout/contentCallout.html +13 -4
- package/src/modules/doc/contentCallout/contentCallout.ts +16 -3
- package/src/modules/doc/contentLayout/contentLayout.css +1 -0
- package/src/modules/doc/contentLayout/contentLayout.html +46 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +524 -0
- package/src/modules/doc/doDont/doDont.css +47 -0
- package/src/modules/doc/doDont/doDont.html +27 -0
- package/src/modules/doc/doDont/doDont.ts +17 -0
- package/src/modules/doc/header/header.css +70 -37
- package/src/modules/doc/header/header.html +41 -138
- package/src/modules/doc/header/header.ts +56 -78
- package/src/modules/doc/heading/heading.css +33 -0
- package/src/modules/doc/heading/heading.html +14 -0
- package/src/modules/doc/heading/heading.ts +67 -0
- package/src/modules/doc/headingAnchor/headingAnchor.css +3 -3
- package/src/modules/doc/headingAnchor/headingAnchor.ts +2 -2
- package/src/modules/doc/headingContent/headingContent.css +53 -0
- package/src/modules/doc/headingContent/headingContent.html +13 -0
- package/src/modules/doc/headingContent/headingContent.ts +30 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +1 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +45 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +256 -0
- package/src/modules/doc/overview/overview.css +40 -0
- package/src/modules/doc/overview/overview.html +34 -0
- package/src/modules/doc/overview/overview.ts +12 -0
- package/src/modules/doc/phase/phase.css +70 -0
- package/src/modules/doc/phase/phase.html +38 -0
- package/src/modules/doc/phase/phase.ts +93 -0
- package/src/modules/doc/specificationContent/specificationContent.css +36 -0
- package/src/modules/doc/specificationContent/specificationContent.html +167 -0
- package/src/modules/doc/specificationContent/specificationContent.ts +127 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
- package/src/modules/doc/toc/toc.ts +1 -1
- package/src/modules/doc/versionPicker/versionPicker.css +64 -0
- package/src/modules/doc/versionPicker/versionPicker.html +38 -0
- package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
- package/src/modules/doc/xmlContent/types.ts +120 -0
- package/src/modules/doc/xmlContent/utils.ts +163 -0
- package/src/modules/doc/xmlContent/xmlContent.css +54 -0
- package/src/modules/doc/xmlContent/xmlContent.html +54 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +763 -0
- package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +131 -0
- package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
- package/src/modules/docHelpers/status/status.css +22 -0
- package/src/modules/docUtils/searchSyncer/searchSyncer.ts +86 -0
- package/src/modules/docUtils/utils/__mocks__/coveo.analytics.ts +16 -0
- package/src/modules/docUtils/utils/coveo.analytics.d.ts +10 -0
- package/src/modules/docUtils/utils/utils.ts +32 -0
- package/LICENSE +0 -12
- package/src/modules/doc/content/__tests__/content.test.ts +0 -312
- package/src/modules/doc/content/__tests__/mockDocContent.ts +0 -348
- package/src/modules/doc/content/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/content/__tests__/mockSidebar.ts +0 -81
- package/src/modules/doc/content/content.stories.ts +0 -148
- package/src/modules/doc/contentCallout/__tests__/contentCallout.test.ts +0 -80
- package/src/modules/doc/contentCallout/__tests__/mockProps.ts +0 -14
- package/src/modules/doc/contentCallout/contentCallout.stories.ts +0 -29
- package/src/modules/doc/contentMedia/__tests__/contentMedia.test.ts +0 -97
- package/src/modules/doc/contentMedia/contentMedia.stories.ts +0 -113
- package/src/modules/doc/header/__tests__/coveoConfig.ts +0 -12
- package/src/modules/doc/header/__tests__/header.test.ts +0 -445
- package/src/modules/doc/header/__tests__/mockNavDevelopers.ts +0 -427
- package/src/modules/doc/header/__tests__/mockNavs.ts +0 -115
- package/src/modules/doc/header/__tests__/mockProps.ts +0 -152
- package/src/modules/doc/header/header.stories.ts +0 -190
- package/src/modules/doc/headingAnchor/__tests__/headingAnchor.test.ts +0 -111
- package/src/modules/doc/headingAnchor/headingAnchor.stories.ts +0 -33
- package/src/modules/doc/nav/__tests__/mockAvailableLanguages.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockAvailableVersions.ts +0 -122
- package/src/modules/doc/nav/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockPdfUrl.ts +0 -1
- package/src/modules/doc/nav/__tests__/mockSelectedLanguage.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockSelectedVersion.ts +0 -8
- package/src/modules/doc/nav/__tests__/mockToc.ts +0 -146
- package/src/modules/doc/nav/__tests__/nav.test.ts +0 -58
- package/src/modules/doc/toc/__tests__/mockPageReference.ts +0 -8
- package/src/modules/doc/toc/__tests__/mockToc.ts +0 -146
- package/src/modules/doc/toc/__tests__/toc.test.ts +0 -29
- package/src/modules/doc/toolbar/__tests__/mockAvailableLanguages.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/mockAvailableVersions.ts +0 -122
- package/src/modules/doc/toolbar/__tests__/mockPdfUrl.ts +0 -1
- package/src/modules/doc/toolbar/__tests__/mockSelectedLanguage.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/mockSelectedVersion.ts +0 -8
- package/src/modules/doc/toolbar/__tests__/toolbar.test.ts +0 -44
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
2
|
|
|
3
3
|
button {
|
|
4
4
|
opacity: 0;
|
|
5
|
-
color: rgb(11
|
|
5
|
+
color: rgb(11 92 171);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
button:hover {
|
|
@@ -17,7 +17,7 @@ button:focus {
|
|
|
17
17
|
|
|
18
18
|
button:focus-visible {
|
|
19
19
|
border-radius: 4px;
|
|
20
|
-
border: 2px solid rgb(11
|
|
20
|
+
border: 2px solid rgb(11 92 171);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.icon-wrapper {
|
|
@@ -6,7 +6,7 @@ export default class HeadingAnchor extends LightningElement {
|
|
|
6
6
|
@api iconSize?: IconSize = "override";
|
|
7
7
|
@api iconSprite?: IconSprite = "utility";
|
|
8
8
|
@api iconSymbol?: IconSymbol;
|
|
9
|
-
@api
|
|
9
|
+
@api header: string = "";
|
|
10
10
|
@api urlText: string = "";
|
|
11
11
|
|
|
12
12
|
label: string = "Copy link to clipboard";
|
|
@@ -22,7 +22,7 @@ export default class HeadingAnchor extends LightningElement {
|
|
|
22
22
|
}, 2000);
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
if (this.
|
|
25
|
+
if (this.header && this.urlText) {
|
|
26
26
|
const [hostUrl] = window.location.href.split("#");
|
|
27
27
|
const url = `${hostUrl}#${this.urlText}`;
|
|
28
28
|
await navigator.clipboard.writeText(url);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--doc-c-heading-anchor-button-bottom: 0;
|
|
5
|
+
--doc-c-heading-anchor-icon-size: 18px;
|
|
6
|
+
--button-size: var(--dx-g-spacing-xl);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
dx-tooltip {
|
|
10
|
+
line-height: var(--button-size);
|
|
11
|
+
padding-right: var(--dx-g-spacing-xs);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.button-container {
|
|
15
|
+
height: 100%;
|
|
16
|
+
margin-right: calc(var(--dx-g-spacing-xl) - 4px);
|
|
17
|
+
position: relative;
|
|
18
|
+
padding-right: var(--dx-g-spacing-xs);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button {
|
|
22
|
+
position: absolute;
|
|
23
|
+
bottom: var(--doc-c-heading-anchor-button-bottom);
|
|
24
|
+
left: 0;
|
|
25
|
+
opacity: 0;
|
|
26
|
+
color: rgb(11 92 171);
|
|
27
|
+
display: flex;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
height: var(--button-size);
|
|
31
|
+
width: var(--button-size);
|
|
32
|
+
border-radius: 4px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
dx-icon {
|
|
36
|
+
--dx-c-icon-size: var(--doc-c-heading-anchor-icon-size);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.title {
|
|
40
|
+
word-break: break-word;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
button:focus {
|
|
44
|
+
box-shadow: 0 0 0 2px rgb(11 92 171);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
button:focus,
|
|
48
|
+
button:hover,
|
|
49
|
+
span:hover dx-tooltip button,
|
|
50
|
+
span:hover ~ dx-tooltip button {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template if:false={hash}>{header}</template>
|
|
3
|
+
<template if:true={hash}>
|
|
4
|
+
<span class="title">{header} </span>
|
|
5
|
+
<dx-tooltip placement="top" label={label}>
|
|
6
|
+
<span class="button-container">
|
|
7
|
+
<button onclick={copy} aria-label="copy">
|
|
8
|
+
<dx-icon size="override" symbol="link"></dx-icon>
|
|
9
|
+
</button>
|
|
10
|
+
</span>
|
|
11
|
+
</dx-tooltip>
|
|
12
|
+
</template>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
export default class HeadingContent extends LightningElement {
|
|
4
|
+
@api header: string = "";
|
|
5
|
+
@api hash: string | null = null;
|
|
6
|
+
|
|
7
|
+
label: string = "Copy link to clipboard";
|
|
8
|
+
timeout: number | null = null;
|
|
9
|
+
|
|
10
|
+
private async copy() {
|
|
11
|
+
if (this.timeout) {
|
|
12
|
+
window.clearTimeout(this.timeout);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
this.label = "Copied";
|
|
16
|
+
this.timeout = window.setTimeout(() => {
|
|
17
|
+
this.label = "Copy link to clipboard";
|
|
18
|
+
}, 2000);
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
if (this.header && this.hash) {
|
|
22
|
+
const [hostUrl] = window.location.href.split("#");
|
|
23
|
+
const url = `${hostUrl}#${this.hash}`;
|
|
24
|
+
await navigator.clipboard.writeText(url);
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "docHelpers/contentLayoutStyle";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="content">
|
|
3
|
+
<dx-sidebar-old
|
|
4
|
+
class="is-sticky left-nav-bar"
|
|
5
|
+
trees={sidebarContent}
|
|
6
|
+
value={sidebarValue}
|
|
7
|
+
header={sidebarHeader}
|
|
8
|
+
ontogglesidebar={onToggleSidebar}
|
|
9
|
+
languages={languages}
|
|
10
|
+
language={language}
|
|
11
|
+
bail-href={bailHref}
|
|
12
|
+
bail-label={bailLabel}
|
|
13
|
+
dev-center={devCenter}
|
|
14
|
+
brand={brand}
|
|
15
|
+
>
|
|
16
|
+
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
17
|
+
</dx-sidebar-old>
|
|
18
|
+
<div class="content-body-doc-phase-container">
|
|
19
|
+
<slot name="doc-phase"></slot>
|
|
20
|
+
<slot name="version-banner"></slot>
|
|
21
|
+
<div class="content-body-container">
|
|
22
|
+
<div class="content-body">
|
|
23
|
+
<doc-breadcrumbs
|
|
24
|
+
lwc:if={showBreadcrumbs}
|
|
25
|
+
breadcrumbs={breadcrumbs}
|
|
26
|
+
></doc-breadcrumbs>
|
|
27
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
28
|
+
<doc-sprig-survey
|
|
29
|
+
lwc:if={shouldDisplayFeedback}
|
|
30
|
+
></doc-sprig-survey>
|
|
31
|
+
</div>
|
|
32
|
+
<div lwc:if={showToc} class="right-nav-bar is-sticky">
|
|
33
|
+
<dx-toc
|
|
34
|
+
header={tocTitle}
|
|
35
|
+
options={tocOptions}
|
|
36
|
+
value={tocValue}
|
|
37
|
+
></dx-toc>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div lwc:if={showFooter} class="footer-container">
|
|
41
|
+
<dx-footer variant="no-signup"></dx-footer>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import ContentLayout from "doc/contentLayout";
|
|
2
|
+
|
|
3
|
+
const TOC_HEADER_TAG = "doc-heading";
|
|
4
|
+
const RNB_BY_TAB = "docs-tab";
|
|
5
|
+
const SPECIFICATION_TAG = "doc-specification-content";
|
|
6
|
+
export const OBSERVER_ATTACH_WAIT_TIME = 500;
|
|
7
|
+
|
|
8
|
+
export default class LwcContentLayout extends ContentLayout {
|
|
9
|
+
private rnbByTab: boolean = false;
|
|
10
|
+
|
|
11
|
+
// DOM element caches to avoid repeated queries
|
|
12
|
+
private tabPanelListCache: any = null;
|
|
13
|
+
private hasSpecContentCache: boolean | null = null;
|
|
14
|
+
private allTabsCache: any[] | null = null;
|
|
15
|
+
private mainSlotCache: any = null;
|
|
16
|
+
|
|
17
|
+
private setRNBByTab() {
|
|
18
|
+
const tabPanelListItem = this.getTabPanelList();
|
|
19
|
+
this.rnbByTab = tabPanelListItem?.id === RNB_BY_TAB;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get showTabBasedRNB() {
|
|
23
|
+
return this.rnbByTab;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Check if the main slot contains doc-specification-content
|
|
28
|
+
* Uses caching to avoid repeated DOM queries
|
|
29
|
+
*/
|
|
30
|
+
private hasSpecificationContent(): boolean {
|
|
31
|
+
if (this.hasSpecContentCache !== null) {
|
|
32
|
+
return this.hasSpecContentCache;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const mainSlot = this.getMainSlot();
|
|
36
|
+
if (mainSlot) {
|
|
37
|
+
const assignedElements = (mainSlot as any).assignedElements();
|
|
38
|
+
|
|
39
|
+
for (const element of assignedElements) {
|
|
40
|
+
if (
|
|
41
|
+
element.tagName === SPECIFICATION_TAG ||
|
|
42
|
+
element.querySelector(SPECIFICATION_TAG) ||
|
|
43
|
+
element.shadowRoot?.querySelector(SPECIFICATION_TAG)
|
|
44
|
+
) {
|
|
45
|
+
return (this.hasSpecContentCache = true);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return (this.hasSpecContentCache = false);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Clear all caches when content changes
|
|
54
|
+
*/
|
|
55
|
+
private clearAllCaches(): void {
|
|
56
|
+
this.hasSpecContentCache = null;
|
|
57
|
+
this.tabPanelListCache = null;
|
|
58
|
+
this.allTabsCache = null;
|
|
59
|
+
this.mainSlotCache = null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Get the main slot element with caching
|
|
64
|
+
*/
|
|
65
|
+
private getMainSlot(): any {
|
|
66
|
+
if (!this.mainSlotCache) {
|
|
67
|
+
this.mainSlotCache =
|
|
68
|
+
this.template.querySelector("slot:not([name])");
|
|
69
|
+
}
|
|
70
|
+
return this.mainSlotCache;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get tab panel list with caching
|
|
75
|
+
*/
|
|
76
|
+
private getTabPanelList(): any {
|
|
77
|
+
if (!this.tabPanelListCache) {
|
|
78
|
+
// eslint-disable-next-line @lwc/lwc/no-document-query
|
|
79
|
+
this.tabPanelListCache =
|
|
80
|
+
document.querySelector("dx-tab-panel-list");
|
|
81
|
+
}
|
|
82
|
+
return this.tabPanelListCache;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
onRNBClick = (event: CustomEvent) => {
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
if (this.hasSpecificationContent()) {
|
|
88
|
+
this.didScrollToSelectedHash = false;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
onTabChanged = () => {
|
|
93
|
+
this.updateRNB();
|
|
94
|
+
|
|
95
|
+
const { hash } = window.location;
|
|
96
|
+
if (this.hasSpecificationContent() && hash) {
|
|
97
|
+
this.didScrollToSelectedHash = false;
|
|
98
|
+
|
|
99
|
+
requestAnimationFrame(() => this.updateHeadingForRNB());
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
protected getHeadingElements() {
|
|
104
|
+
let headingElements = super.getHeadingElements();
|
|
105
|
+
if (this.showTabBasedRNB) {
|
|
106
|
+
const tabPanelListItem = this.getTabPanelList();
|
|
107
|
+
const tabPanels =
|
|
108
|
+
tabPanelListItem?.querySelectorAll("dx-tab-panel");
|
|
109
|
+
|
|
110
|
+
for (const tabPanelItem of tabPanels) {
|
|
111
|
+
if (tabPanelItem.active) {
|
|
112
|
+
// This is needed for Specification tab content
|
|
113
|
+
const specificationElement = tabPanelItem.querySelector(
|
|
114
|
+
"doc-specification-content"
|
|
115
|
+
);
|
|
116
|
+
if (specificationElement) {
|
|
117
|
+
headingElements =
|
|
118
|
+
specificationElement.shadowRoot.querySelectorAll(
|
|
119
|
+
TOC_HEADER_TAG
|
|
120
|
+
);
|
|
121
|
+
} else {
|
|
122
|
+
headingElements =
|
|
123
|
+
tabPanelItem.querySelectorAll(TOC_HEADER_TAG);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return headingElements;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private updateURL() {
|
|
133
|
+
const tabs = this.getAllTabs();
|
|
134
|
+
const selectedTabId = this.getSelectedTabId();
|
|
135
|
+
|
|
136
|
+
tabs.forEach((tab: any) => {
|
|
137
|
+
if (tab.getAttribute("aria-selected") === "true") {
|
|
138
|
+
const tabID = tab.getAttribute("aria-label");
|
|
139
|
+
const url = new URL(window.location.href);
|
|
140
|
+
if (selectedTabId !== tabID) {
|
|
141
|
+
url.searchParams.set("type", tabID);
|
|
142
|
+
url.hash = "";
|
|
143
|
+
window.history.pushState({}, "", url.toString());
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// This event gets triggered when navigating back/forward
|
|
150
|
+
handlePopState = (): void => {
|
|
151
|
+
if (this.showTabBasedRNB) {
|
|
152
|
+
this.restoreTabSelection();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
connectedCallback(): void {
|
|
157
|
+
super.connectedCallback();
|
|
158
|
+
window.addEventListener("popstate", this.handlePopState);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private getSelectedTabId() {
|
|
162
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
163
|
+
const selectedTabId = urlParams.get("type");
|
|
164
|
+
return selectedTabId;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private restoreTabSelection() {
|
|
168
|
+
requestAnimationFrame(() => {
|
|
169
|
+
const selectedTabId = this.getSelectedTabId();
|
|
170
|
+
if (selectedTabId) {
|
|
171
|
+
this.selectTabById(selectedTabId);
|
|
172
|
+
|
|
173
|
+
// If there's a hash and we have specification content,
|
|
174
|
+
// we need to wait for the content to load before scrolling
|
|
175
|
+
const { hash } = window.location;
|
|
176
|
+
if (this.hasSpecificationContent() && hash) {
|
|
177
|
+
// Reset the scroll flag to allow scrolling once content is loaded
|
|
178
|
+
this.didScrollToSelectedHash = false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private getAllTabs(): any[] {
|
|
185
|
+
// Return cached result if available
|
|
186
|
+
if (this.allTabsCache) {
|
|
187
|
+
return this.allTabsCache;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const tabPanelListItem = this.getTabPanelList();
|
|
191
|
+
if (tabPanelListItem?.shadowRoot) {
|
|
192
|
+
this.allTabsCache = Array.from(
|
|
193
|
+
tabPanelListItem.shadowRoot.querySelectorAll(
|
|
194
|
+
"dx-tab-panel-item"
|
|
195
|
+
)
|
|
196
|
+
).map((tabPanelItem: any) =>
|
|
197
|
+
tabPanelItem.shadowRoot.querySelector("button")
|
|
198
|
+
);
|
|
199
|
+
} else {
|
|
200
|
+
this.allTabsCache = [];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return this.allTabsCache;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private selectTabById(tabId: string) {
|
|
207
|
+
const tabs = this.getAllTabs();
|
|
208
|
+
tabs.forEach((tab: any) => {
|
|
209
|
+
if (tab.getAttribute("aria-label") === tabId) {
|
|
210
|
+
tab.click();
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
postRenderedCallback(): void {
|
|
216
|
+
this.setRNBByTab();
|
|
217
|
+
if (this.showTabBasedRNB) {
|
|
218
|
+
window.addEventListener("tabchanged", this.onTabChanged);
|
|
219
|
+
window.addEventListener(
|
|
220
|
+
"specificationdatarendered",
|
|
221
|
+
this.onTabChanged
|
|
222
|
+
);
|
|
223
|
+
window.addEventListener("selectedcontent", (event) =>
|
|
224
|
+
this.onRNBClick(event as CustomEvent)
|
|
225
|
+
);
|
|
226
|
+
this.restoreTabSelection();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
disconnectedCallback(): void {
|
|
231
|
+
super.disconnectedCallback();
|
|
232
|
+
if (this.showTabBasedRNB) {
|
|
233
|
+
window.removeEventListener("tabchanged", this.onTabChanged);
|
|
234
|
+
window.removeEventListener(
|
|
235
|
+
"specificationdatarendered",
|
|
236
|
+
this.onTabChanged
|
|
237
|
+
);
|
|
238
|
+
window.removeEventListener("selectedcontent", (event) =>
|
|
239
|
+
this.onRNBClick(event as CustomEvent)
|
|
240
|
+
);
|
|
241
|
+
window.removeEventListener("popstate", this.handlePopState);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
onSlotChange(): void {
|
|
246
|
+
this.clearAllCaches();
|
|
247
|
+
super.onSlotChange();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
updateHeadingForRNB(): void {
|
|
251
|
+
if (this.showTabBasedRNB) {
|
|
252
|
+
this.updateURL();
|
|
253
|
+
}
|
|
254
|
+
super.updateHeadingForRNB();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
doc-phase {
|
|
2
|
+
--doc-c-phase-top: calc(
|
|
3
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dx-section {
|
|
8
|
+
--dx-c-section-padding-top: 0;
|
|
9
|
+
--dx-c-section-padding-bottom: var(--dx-g-spacing-2xl);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
dx-section::part(content) {
|
|
13
|
+
max-width: 1280px;
|
|
14
|
+
margin: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
dx-group-text:first-of-type {
|
|
18
|
+
margin-top: var(--dx-g-spacing-2xl);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dx-group-text.features {
|
|
22
|
+
margin-top: var(--dx-g-spacing-xl);
|
|
23
|
+
margin-bottom: var(--dx-g-spacing-xl);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.content {
|
|
27
|
+
padding-right: var(--dx-g-spacing-xl);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (max-width: 1024px) {
|
|
31
|
+
.content {
|
|
32
|
+
padding-right: 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (max-width: 800px) {
|
|
37
|
+
dx-group-text.description {
|
|
38
|
+
margin-top: var(--dx-g-spacing-lg);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<doc-phase
|
|
4
|
+
if:true={docPhaseInfo}
|
|
5
|
+
doc-phase-info={docPhaseInfo}
|
|
6
|
+
></doc-phase>
|
|
7
|
+
|
|
8
|
+
<dx-section>
|
|
9
|
+
<dx-grid columns="two-slim-right">
|
|
10
|
+
<div class="content">
|
|
11
|
+
<dx-group-text
|
|
12
|
+
class="description"
|
|
13
|
+
header={header}
|
|
14
|
+
body={description}
|
|
15
|
+
size="large"
|
|
16
|
+
title-aria-level="1"
|
|
17
|
+
primary-link={primaryLink}
|
|
18
|
+
secondary-link={secondaryLink}
|
|
19
|
+
></dx-group-text>
|
|
20
|
+
</div>
|
|
21
|
+
<div>
|
|
22
|
+
<dx-group-text
|
|
23
|
+
header={featuresListTitle}
|
|
24
|
+
size="medium"
|
|
25
|
+
class="features"
|
|
26
|
+
></dx-group-text>
|
|
27
|
+
<dx-features-list
|
|
28
|
+
options={featuresListOptions}
|
|
29
|
+
></dx-features-list>
|
|
30
|
+
</div>
|
|
31
|
+
</dx-grid>
|
|
32
|
+
</dx-section>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { DocPhaseInfo, FeatureItem, Link } from "typings/custom";
|
|
3
|
+
|
|
4
|
+
export default class Overview extends LightningElement {
|
|
5
|
+
@api docPhaseInfo!: DocPhaseInfo;
|
|
6
|
+
@api header!: string;
|
|
7
|
+
@api description!: string;
|
|
8
|
+
@api primaryLink!: Link;
|
|
9
|
+
@api secondaryLink!: Link;
|
|
10
|
+
@api featuresListTitle!: string;
|
|
11
|
+
@api featuresListOptions!: FeatureItem[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
@import "docHelpers/status";
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
--doc-c-phase-top: 0;
|
|
7
|
+
--doc-c-phase-container-align-items: flex-start;
|
|
8
|
+
|
|
9
|
+
position: sticky;
|
|
10
|
+
top: var(--doc-c-phase-top);
|
|
11
|
+
|
|
12
|
+
/* NOTE: If you are changing z-index value here, ensure it's less than z-index of dx-sidebar in contentLayout.css */
|
|
13
|
+
z-index: var(--dx-g-z-index-100);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.doc-phase-container {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: var(--doc-c-phase-container-align-items);
|
|
20
|
+
padding-left: var(--dx-g-global-header-padding-horizontal);
|
|
21
|
+
padding-right: var(--dx-g-global-header-padding-horizontal);
|
|
22
|
+
width: 100%;
|
|
23
|
+
border: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.doc-phase-title-container {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: center;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
dx-button {
|
|
34
|
+
margin-left: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
NOTE: Here we are assuming that indicator height won't go beyond 1000px.
|
|
39
|
+
|
|
40
|
+
It's one of the suggested way to achieve the expand/collapse animation
|
|
41
|
+
Ref: https://stackoverflow.com/a/41164095
|
|
42
|
+
|
|
43
|
+
Otherwise we need to change the height when user clicks on button
|
|
44
|
+
Ref: https://stackoverflow.com/a/11837673
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
.doc-phase-body {
|
|
48
|
+
display: block;
|
|
49
|
+
max-height: 1000px;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
padding-top: var(--dx-g-spacing-smd);
|
|
52
|
+
transition: max-height 0.25s ease, padding 0.25s ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.doc-phase-body-hidden {
|
|
56
|
+
max-height: 0;
|
|
57
|
+
padding-top: 0;
|
|
58
|
+
transition: max-height 0.1s ease-out, padding 0.25s ease-out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.doc-phase-body a {
|
|
62
|
+
color: var(--dx-g-blue-vibrant-50);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Small Devices */
|
|
66
|
+
@media screen and (max-width: 480px) {
|
|
67
|
+
.doc-phase-container {
|
|
68
|
+
padding: var(--doc-status-vertical-padding);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={className} part="container">
|
|
3
|
+
<div class="doc-phase-title-container">
|
|
4
|
+
<dx-icon
|
|
5
|
+
class="doc-status-icon doc-phase-icon"
|
|
6
|
+
symbol={iconName}
|
|
7
|
+
size="large"
|
|
8
|
+
color="status-icon-color"
|
|
9
|
+
></dx-icon>
|
|
10
|
+
<p class="doc-status-title doc-phase-title dx-text-body-3">
|
|
11
|
+
{docPhaseTitle}
|
|
12
|
+
</p>
|
|
13
|
+
<dx-button
|
|
14
|
+
lwc:if={dismissible}
|
|
15
|
+
aria-label="Dismiss"
|
|
16
|
+
icon-color="status-icon-color"
|
|
17
|
+
icon-size="large"
|
|
18
|
+
icon-symbol="close"
|
|
19
|
+
variant="icon-only"
|
|
20
|
+
onclick={onDismiss}
|
|
21
|
+
></dx-button>
|
|
22
|
+
<dx-button
|
|
23
|
+
lwc:else
|
|
24
|
+
variant="inline"
|
|
25
|
+
onclick={onShowHide}
|
|
26
|
+
aria-label={hideBodyText}
|
|
27
|
+
>
|
|
28
|
+
{hideBodyText}
|
|
29
|
+
</dx-button>
|
|
30
|
+
</div>
|
|
31
|
+
<!--
|
|
32
|
+
NOTE: Here we are rendering mark up using lwc:dom & innerHTML
|
|
33
|
+
option instead of slots because the html markup will come as a
|
|
34
|
+
property to the component from a configuration
|
|
35
|
+
-->
|
|
36
|
+
<span lwc:dom="manual" class={bodyClassName}></span>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|