@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,12 +1,40 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "dxHelpers/commonHeader";
|
|
2
2
|
|
|
3
3
|
dx-logo {
|
|
4
4
|
min-width: fit-content;
|
|
5
|
-
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dev-center-link {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-lg) 0
|
|
10
|
+
var(--dx-g-global-header-padding-horizontal);
|
|
11
|
+
height: var(--dx-g-spacing-xl);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dev-center-content {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
color: inherit;
|
|
19
|
+
font-weight: var(--dx-g-font-bold);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dx-icon {
|
|
23
|
+
--dx-c-icon-size: var(--dx-g-icon-size-xs);
|
|
24
|
+
--dx-c-icon-color: var(--dx-g-blue-vibrant-20);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dev-center-content > * + * {
|
|
28
|
+
margin-left: 8px; /* Adjust this value to your desired spacing */
|
|
6
29
|
}
|
|
7
30
|
|
|
8
31
|
.header_l2 {
|
|
9
32
|
justify-content: space-between;
|
|
33
|
+
height: var(--dx-g-doc-header-main-nav-height);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.has-brand .header_l2 {
|
|
37
|
+
height: var(--dx-g-spacing-3xl);
|
|
10
38
|
}
|
|
11
39
|
|
|
12
40
|
.nav_menu-button {
|
|
@@ -16,84 +44,89 @@ dx-logo {
|
|
|
16
44
|
);
|
|
17
45
|
}
|
|
18
46
|
|
|
47
|
+
.has-brand.has-scoped-nav-items {
|
|
48
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
49
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
50
|
+
}
|
|
51
|
+
|
|
19
52
|
.nav_menu-ctas {
|
|
20
53
|
margin-right: var(--dx-g-spacing-sm);
|
|
21
54
|
}
|
|
22
55
|
|
|
23
56
|
header:not(.has-brand) > .header_l1 {
|
|
24
|
-
background:
|
|
57
|
+
background: white;
|
|
58
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
25
59
|
}
|
|
26
60
|
|
|
27
61
|
header:not(.has-brand) > .header_l2 {
|
|
28
|
-
|
|
62
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
63
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
29
64
|
}
|
|
30
65
|
|
|
31
66
|
.header_l2_group.header_l2_group-right-ctas {
|
|
32
67
|
align-items: baseline;
|
|
33
68
|
}
|
|
34
69
|
|
|
35
|
-
.
|
|
36
|
-
--dx-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.header_lang-dropdown {
|
|
42
|
-
--button-primary-color: var(--dx-g-blue-vibrant-50);
|
|
43
|
-
--button-primary-color-hover: var(--dx-g-blue-vibrant-40);
|
|
70
|
+
.has-brand .header_l2_group-title {
|
|
71
|
+
padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-xl)
|
|
72
|
+
calc(var(--dx-g-spacing-smd) - 1px) 0;
|
|
73
|
+
min-width: 320px;
|
|
44
74
|
}
|
|
45
75
|
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
--dx-c-button-primary-color-hover: var(--button-primary-color-hover);
|
|
49
|
-
--dx-c-slot-empty-width: min-content;
|
|
50
|
-
--border-color: var(--button-primary-color);
|
|
51
|
-
|
|
52
|
-
border-bottom: 1px dashed var(--border-color);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.header_lang-dropdown > dx-button:hover {
|
|
56
|
-
--border-color: var(--button-primary-color-hover);
|
|
76
|
+
.no-header-content {
|
|
77
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
57
78
|
}
|
|
58
79
|
|
|
59
|
-
@media (max-width:
|
|
80
|
+
@media (max-width: 768px) {
|
|
60
81
|
.header_l2 {
|
|
61
82
|
padding: 0;
|
|
62
83
|
flex-wrap: wrap;
|
|
84
|
+
height: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.has-nav-items .header_l2 {
|
|
88
|
+
height: initial;
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
.header_l2_group {
|
|
66
92
|
width: 100%;
|
|
67
93
|
}
|
|
68
94
|
|
|
95
|
+
.header_l2_group-title {
|
|
96
|
+
margin-right: 0;
|
|
97
|
+
padding: var(--dx-g-spacing-sm) 0 2px
|
|
98
|
+
var(--dx-g-global-header-padding-horizontal);
|
|
99
|
+
min-height: var(--dx-g-doc-header-main-nav-height);
|
|
100
|
+
}
|
|
101
|
+
|
|
69
102
|
.header_l2_group-nav {
|
|
70
103
|
height: var(--dx-g-spacing-3xl);
|
|
71
104
|
padding: 0;
|
|
72
|
-
|
|
105
|
+
margin-top: calc(var(--dx-g-spacing-2xs) + 1px);
|
|
73
106
|
}
|
|
74
107
|
|
|
75
108
|
.header_l2_group-nav_overflow {
|
|
109
|
+
height: var(--dx-g-spacing-3xl);
|
|
76
110
|
margin-right: var(--dx-g-spacing-sm);
|
|
77
111
|
}
|
|
78
112
|
|
|
79
|
-
.
|
|
80
|
-
|
|
81
|
-
|
|
113
|
+
.subtitle {
|
|
114
|
+
font-weight: var(--dx-g-font-demi);
|
|
115
|
+
letter-spacing: -0.08px;
|
|
82
116
|
}
|
|
83
117
|
|
|
84
|
-
.
|
|
85
|
-
margin-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.header_lang-dropdown > dx-button {
|
|
89
|
-
padding: var(--dx-g-spacing-2xs) 0;
|
|
118
|
+
.has-brand .header_l2_group-title {
|
|
119
|
+
margin-right: 0;
|
|
120
|
+
padding: var(--dx-g-spacing-sm) 0 var(--dx-g-spacing-2xs)
|
|
121
|
+
var(--dx-g-global-header-padding-horizontal);
|
|
90
122
|
}
|
|
91
123
|
|
|
92
124
|
.has-scoped-nav-items > .header_l2 {
|
|
93
125
|
height: unset;
|
|
94
126
|
}
|
|
95
127
|
|
|
96
|
-
.has-
|
|
97
|
-
|
|
128
|
+
header:not(.has-brand) > .header_l2 {
|
|
129
|
+
padding-bottom: 0;
|
|
130
|
+
border: 0;
|
|
98
131
|
}
|
|
99
132
|
}
|
|
@@ -1,152 +1,55 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
icon-size="large"
|
|
14
|
-
icon-symbol={mobileMenuIconSymbol}
|
|
15
|
-
variant="tertiary"
|
|
16
|
-
onclick={toggleMobileNavMenu}
|
|
17
|
-
></dx-button>
|
|
18
|
-
</div>
|
|
19
|
-
<dx-logo label={title}></dx-logo>
|
|
20
|
-
<dx-header-nav
|
|
21
|
-
if:true={showDesktopNavItems}
|
|
22
|
-
aria-label="Global Navigation Bar"
|
|
23
|
-
nav-items={navItems}
|
|
24
|
-
onrequestopennavmenu={onRequestOpenNavMenu}
|
|
25
|
-
pathname={pathname}
|
|
26
|
-
variant="small"
|
|
27
|
-
></dx-header-nav>
|
|
28
|
-
<div class="header-cta-container">
|
|
29
|
-
<dx-header-search
|
|
30
|
-
if:true={hasSearch}
|
|
31
|
-
coveo-organization-id={coveoOrganizationId}
|
|
32
|
-
coveo-public-access-token={coveoPublicAccessToken}
|
|
33
|
-
coveo-search-pipeline={coveoSearchPipeline}
|
|
34
|
-
coveo-search-hub={coveoSearchHub}
|
|
35
|
-
mobile={tablet}
|
|
36
|
-
onstatechange={handleStateChange}
|
|
37
|
-
></dx-header-search>
|
|
38
|
-
</div>
|
|
39
|
-
<div if:true={showSignup} class="header-login-signup">
|
|
40
|
-
<dx-button
|
|
41
|
-
aria-label="Sign Up For Salesforce Developer Edition"
|
|
42
|
-
size="small"
|
|
43
|
-
href={signupLink}
|
|
44
|
-
onclick={handleSignUpClick}
|
|
45
|
-
>
|
|
46
|
-
Sign Up
|
|
47
|
-
</dx-button>
|
|
48
|
-
</div>
|
|
49
|
-
<dx-header-mobile-nav-menu
|
|
50
|
-
if:true={hasNavItems}
|
|
51
|
-
nav-items={navItems}
|
|
52
|
-
open={showMobileNavMenu}
|
|
53
|
-
pathname={pathname}
|
|
54
|
-
value={mobileNavMenuValue}
|
|
55
|
-
onchange={onMobileNavMenuChange}
|
|
56
|
-
onrequestclose={closeMobileNavMenu}
|
|
57
|
-
>
|
|
58
|
-
<dx-button
|
|
59
|
-
aria-label={bailLabel}
|
|
60
|
-
if:true={hasBailLink}
|
|
61
|
-
href={bailHref}
|
|
62
|
-
variant="tertiary"
|
|
63
|
-
icon-symbol="new_window"
|
|
64
|
-
>
|
|
65
|
-
{bailLabel}
|
|
66
|
-
</dx-button>
|
|
67
|
-
</dx-header-mobile-nav-menu>
|
|
68
|
-
</div>
|
|
69
|
-
<div class="header_l2">
|
|
70
|
-
<div class="header_l2_group header_l2_group-title">
|
|
71
|
-
<a href={headerHref} class="home-link">
|
|
2
|
+
<template lwc:if={shouldRender}>
|
|
3
|
+
<dx-brand-theme-provider brand={brand}>
|
|
4
|
+
<header class={className}>
|
|
5
|
+
<dx-banner
|
|
6
|
+
lwc:if={showBanner}
|
|
7
|
+
banner-markup={bannerMarkup}
|
|
8
|
+
></dx-banner>
|
|
9
|
+
<!-- To-Do: Move the devCenter as a new component and use it here, as devCenter is also used in Sidebar now -->
|
|
10
|
+
<div lwc:if={devCenter} class="dev-center-link">
|
|
11
|
+
<a href={devCenter.link} class="dev-center-content">
|
|
12
|
+
<dx-icon symbol="back"></dx-icon>
|
|
72
13
|
<dx-icon
|
|
73
14
|
class="brand-icon"
|
|
74
|
-
if
|
|
15
|
+
lwc:if={devCenter.icon}
|
|
75
16
|
sprite="salesforcebrand"
|
|
76
17
|
symbol={brand}
|
|
77
|
-
size="
|
|
18
|
+
size="large"
|
|
78
19
|
></dx-icon>
|
|
79
|
-
<span class="subtitle dx-text-
|
|
80
|
-
{
|
|
20
|
+
<span class="subtitle dx-text-body-4">
|
|
21
|
+
{devCenter.title}
|
|
81
22
|
</span>
|
|
82
23
|
</a>
|
|
83
|
-
<dx-dropdown
|
|
84
|
-
if:true={showMobileLanguages}
|
|
85
|
-
class="header_lang-dropdown"
|
|
86
|
-
options={languages}
|
|
87
|
-
small
|
|
88
|
-
value={language}
|
|
89
|
-
value-path={langValuePath}
|
|
90
|
-
onchange={onLangChange}
|
|
91
|
-
>
|
|
92
|
-
<dx-button
|
|
93
|
-
aria-label="Select Language"
|
|
94
|
-
variant="inline"
|
|
95
|
-
icon-size="large"
|
|
96
|
-
icon-symbol="world"
|
|
97
|
-
></dx-button>
|
|
98
|
-
</dx-dropdown>
|
|
99
24
|
</div>
|
|
100
|
-
<div
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
>
|
|
108
|
-
<dx-header-nav
|
|
109
|
-
aria-label="Scoped Navigation Bar"
|
|
110
|
-
nav-items={scopedNavItems}
|
|
111
|
-
pathname={pathname}
|
|
112
|
-
></dx-header-nav>
|
|
25
|
+
<div class="header_l2">
|
|
26
|
+
<div class="header_l2_group header_l2_group-title">
|
|
27
|
+
<a href={headerHref} class="home-link">
|
|
28
|
+
<span class="subtitle dx-text-display-7">
|
|
29
|
+
{subtitle}
|
|
30
|
+
</span>
|
|
31
|
+
</a>
|
|
113
32
|
</div>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
class="header_l2_group header_l2_group-right-ctas"
|
|
118
|
-
>
|
|
119
|
-
<dx-dropdown
|
|
120
|
-
if:true={hasLanguages}
|
|
121
|
-
class="header_lang-dropdown"
|
|
122
|
-
options={languages}
|
|
123
|
-
small
|
|
124
|
-
value-path={langValuePath}
|
|
125
|
-
value={language}
|
|
126
|
-
onchange={onLangChange}
|
|
33
|
+
<div
|
|
34
|
+
lwc:if={showScopedNavItems}
|
|
35
|
+
class="header_l2_group header_l2_group-nav"
|
|
127
36
|
>
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
icon-size="small"
|
|
132
|
-
icon-symbol="world"
|
|
37
|
+
<div
|
|
38
|
+
class="header_l2_group-nav_overflow"
|
|
39
|
+
onscroll={onNavScroll}
|
|
133
40
|
>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
href={bailHref}
|
|
142
|
-
variant="tertiary"
|
|
143
|
-
icon-symbol="new_window"
|
|
144
|
-
target="_blank"
|
|
145
|
-
>
|
|
146
|
-
{bailLabel}
|
|
147
|
-
</dx-button>
|
|
41
|
+
<dx-header-nav
|
|
42
|
+
aria-label="Scoped Navigation Bar"
|
|
43
|
+
nav-items={scopedNavItems}
|
|
44
|
+
pathname={pathname}
|
|
45
|
+
></dx-header-nav>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
148
48
|
</div>
|
|
149
|
-
</
|
|
150
|
-
</
|
|
151
|
-
</
|
|
49
|
+
</header>
|
|
50
|
+
</dx-brand-theme-provider>
|
|
51
|
+
</template>
|
|
52
|
+
<template lwc:if={shouldHideHeader}>
|
|
53
|
+
<div class="no-header-content"></div>
|
|
54
|
+
</template>
|
|
152
55
|
</template>
|
|
@@ -1,93 +1,76 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import type {
|
|
4
|
-
import { HeaderBase } from "
|
|
5
|
-
import { toJson } from "
|
|
6
|
-
import get from "lodash.get";
|
|
3
|
+
import type { OptionWithNested, DevCenterConfig } from "typings/custom";
|
|
4
|
+
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
5
|
+
import { toJson, normalizeBoolean } from "dxUtils/normalizers";
|
|
7
6
|
|
|
8
7
|
const TABLET_MATCH = "980px";
|
|
9
|
-
const MOBILE_MATCH = "
|
|
10
|
-
|
|
8
|
+
const MOBILE_MATCH = "768px";
|
|
9
|
+
|
|
10
|
+
const isStorybook = () => {
|
|
11
|
+
const { host } = window.location;
|
|
12
|
+
return (
|
|
13
|
+
host === "localhost:6006" || /^dsc-comp.*\.herokuapp\.com$/.test(host)
|
|
14
|
+
);
|
|
15
|
+
};
|
|
11
16
|
|
|
12
17
|
export default class Header extends HeaderBase {
|
|
13
18
|
@api langValuePath: string = "id"; // allows to override how language property is interpreted, follows valuePath dropdown api.
|
|
14
19
|
@api headerHref: string = "/";
|
|
15
20
|
|
|
16
21
|
@api
|
|
17
|
-
get
|
|
18
|
-
return this.
|
|
22
|
+
get hideDocHeader() {
|
|
23
|
+
return this._hideDocHeader;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
set
|
|
22
|
-
this.
|
|
26
|
+
set hideDocHeader(value) {
|
|
27
|
+
this._hideDocHeader = normalizeBoolean(value);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
@api
|
|
26
|
-
get
|
|
27
|
-
return this.
|
|
31
|
+
get scopedNavItems() {
|
|
32
|
+
return this._scopedNavItems;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
set
|
|
31
|
-
this.
|
|
35
|
+
set scopedNavItems(value) {
|
|
36
|
+
this._scopedNavItems = toJson(value);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
@api
|
|
35
|
-
get
|
|
36
|
-
return this.
|
|
40
|
+
get devCenter(): DevCenterConfig {
|
|
41
|
+
return this._devCenter;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
set
|
|
40
|
-
|
|
41
|
-
this._language = value;
|
|
42
|
-
}
|
|
44
|
+
set devCenter(value) {
|
|
45
|
+
this._devCenter = toJson(value);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
private
|
|
46
|
-
private _languages!: Option[];
|
|
47
|
-
private _scopedNavItems!: Option[];
|
|
48
|
-
private smallMobile = false;
|
|
49
|
-
private smallMobileMatchMedia!: MediaQueryList;
|
|
48
|
+
private _scopedNavItems!: OptionWithNested[];
|
|
50
49
|
private tablet = false;
|
|
51
50
|
private tabletMatchMedia!: MediaQueryList;
|
|
51
|
+
private shouldRender: boolean = false;
|
|
52
|
+
private showDocDivider: boolean = false;
|
|
53
|
+
private _devCenter!: DevCenterConfig;
|
|
54
|
+
private _hideDocHeader: boolean = false;
|
|
52
55
|
|
|
53
56
|
protected mobileBreakpoint(): string {
|
|
54
57
|
return MOBILE_MATCH;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
private get
|
|
58
|
-
return this.scopedNavItems && this.scopedNavItems.length > 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private get showDesktopNavItems(): boolean {
|
|
62
|
-
return !this.mobile && this.hasNavItems;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private get showSignup(): boolean {
|
|
66
|
-
return this.signupLink
|
|
67
|
-
? (this.tablet && !this.isSearchOpen) || !this.tablet
|
|
68
|
-
: false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private get hasLanguages(): boolean {
|
|
72
|
-
return !!(this.languages && this.languages.length);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
private get showMobileLanguages(): boolean {
|
|
76
|
-
return this.smallMobile && this.hasLanguages;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private get languageLabel(): string {
|
|
60
|
+
private get showScopedNavItems(): boolean {
|
|
80
61
|
return (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)?.label) ||
|
|
85
|
-
this.languages[0].label
|
|
62
|
+
this.scopedNavItems &&
|
|
63
|
+
this.scopedNavItems.length > 0 &&
|
|
64
|
+
!this.hideDocHeader
|
|
86
65
|
);
|
|
87
66
|
}
|
|
88
67
|
|
|
89
|
-
|
|
90
|
-
|
|
68
|
+
/**
|
|
69
|
+
* This function returns true if the hideDocHeader is true and the view is not mobile.
|
|
70
|
+
* Also we need to show the header border in case the doc is hidden or if the brand information doesn't exists.
|
|
71
|
+
*/
|
|
72
|
+
private get shouldHideHeader(): boolean {
|
|
73
|
+
return (this.hideDocHeader && !this.mobile) || this.showDocDivider;
|
|
91
74
|
}
|
|
92
75
|
|
|
93
76
|
connectedCallback(): void {
|
|
@@ -98,14 +81,23 @@ export default class Header extends HeaderBase {
|
|
|
98
81
|
this.onTabletChange(this.tabletMatchMedia);
|
|
99
82
|
this.tabletMatchMedia.addEventListener("change", this.onTabletChange);
|
|
100
83
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
)
|
|
84
|
+
if (
|
|
85
|
+
(!this.shouldHideHeader &&
|
|
86
|
+
window.location.pathname.includes("/docs/") &&
|
|
87
|
+
window.location.pathname !== "/docs/apis") ||
|
|
88
|
+
window.location.pathname ===
|
|
89
|
+
"/tableau/embedding-playground/overview" ||
|
|
90
|
+
isStorybook()
|
|
91
|
+
) {
|
|
92
|
+
this.shouldRender = true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (this.shouldRender && window.location.pathname.includes("/docs/")) {
|
|
96
|
+
if (!this.brand && !this.mobile) {
|
|
97
|
+
this.shouldRender = false;
|
|
98
|
+
this.showDocDivider = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
109
101
|
}
|
|
110
102
|
|
|
111
103
|
disconnectedCallback(): void {
|
|
@@ -114,29 +106,15 @@ export default class Header extends HeaderBase {
|
|
|
114
106
|
"change",
|
|
115
107
|
this.onTabletChange
|
|
116
108
|
);
|
|
117
|
-
|
|
118
|
-
this.smallMobileMatchMedia.removeEventListener(
|
|
119
|
-
"change",
|
|
120
|
-
this.onSmallMobileChange
|
|
121
|
-
);
|
|
122
109
|
}
|
|
123
110
|
|
|
124
111
|
private onTabletChange = (e: MediaQueryListEvent | MediaQueryList) =>
|
|
125
112
|
(this.tablet = e.matches);
|
|
126
113
|
|
|
127
|
-
private onSmallMobileChange = (e: MediaQueryListEvent | MediaQueryList) =>
|
|
128
|
-
(this.smallMobile = e.matches);
|
|
129
|
-
|
|
130
114
|
protected additionalClasses(): string {
|
|
131
115
|
return cx(
|
|
132
116
|
this.brand && "has-brand",
|
|
133
|
-
this.
|
|
117
|
+
this.showScopedNavItems && "has-scoped-nav-items"
|
|
134
118
|
);
|
|
135
119
|
}
|
|
136
|
-
|
|
137
|
-
private onLangChange(event: CustomEvent<string>): void {
|
|
138
|
-
const { detail } = event;
|
|
139
|
-
this._language = detail;
|
|
140
|
-
this.dispatchEvent(new CustomEvent("langchange", { detail }));
|
|
141
|
-
}
|
|
142
120
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import "dxHelpers/text";
|
|
2
|
+
|
|
3
|
+
h1 {
|
|
4
|
+
margin: var(--dx-g-spacing-2xl) 0 var(--dx-g-spacing-md) 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
h1 doc-heading-content {
|
|
8
|
+
--doc-c-heading-anchor-button-bottom: 9.5px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
h2 {
|
|
12
|
+
margin: var(--dx-g-spacing-2xl) 0 var(--dx-g-spacing-md) 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
h2 doc-heading-content {
|
|
16
|
+
--doc-c-heading-anchor-button-bottom: 3px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h3 {
|
|
20
|
+
margin: var(--dx-g-spacing-xl) 0 var(--dx-g-spacing-md) 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
h3 doc-heading-content {
|
|
24
|
+
--doc-c-heading-anchor-button-bottom: -0.5px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h4 {
|
|
28
|
+
margin: var(--dx-g-spacing-lg) 0 var(--dx-g-spacing-sm) 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
h4 doc-heading-content {
|
|
32
|
+
--doc-c-heading-anchor-button-bottom: -6px;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<h1 class={className} if:true={isAriaLevelOne}>
|
|
3
|
+
<doc-heading-content header={header} hash={hash}></doc-heading-content>
|
|
4
|
+
</h1>
|
|
5
|
+
<h2 class={className} if:true={isAriaLevelTwo}>
|
|
6
|
+
<doc-heading-content header={header} hash={hash}></doc-heading-content>
|
|
7
|
+
</h2>
|
|
8
|
+
<h3 class={className} if:true={isAriaLevelThree}>
|
|
9
|
+
<doc-heading-content header={header} hash={hash}></doc-heading-content>
|
|
10
|
+
</h3>
|
|
11
|
+
<h4 class={className} if:true={isAriaLevelFour}>
|
|
12
|
+
<doc-heading-content header={header} hash={hash}></doc-heading-content>
|
|
13
|
+
</h4>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
export const ariaDisplayLevels: { [key: string]: string } = {
|
|
4
|
+
"1": "4",
|
|
5
|
+
"2": "5",
|
|
6
|
+
"3": "6",
|
|
7
|
+
"4": "8"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const ariaLevels = Object.keys(ariaDisplayLevels);
|
|
11
|
+
|
|
12
|
+
export const displayLevels = Object.values(ariaDisplayLevels);
|
|
13
|
+
|
|
14
|
+
// @ts-ignore: Really Dark Magic (TM) to do with ariaLevel needing explicit getter/setters
|
|
15
|
+
export default class Heading extends LightningElement {
|
|
16
|
+
@api header: string = "";
|
|
17
|
+
@api hash: string | null = null;
|
|
18
|
+
|
|
19
|
+
@api
|
|
20
|
+
private get ariaLevel(): string {
|
|
21
|
+
// Really Dark Magic (TM)
|
|
22
|
+
return this._ariaLevel || "2";
|
|
23
|
+
}
|
|
24
|
+
private set ariaLevel(value: string | null) {
|
|
25
|
+
if (value && !ariaLevels.includes(value)) {
|
|
26
|
+
console.error(`Invalid aria-level: "${value}"`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (value) {
|
|
30
|
+
this._ariaLevel = value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@api
|
|
35
|
+
private get displayLevel(): string {
|
|
36
|
+
return this._displayLevel || ariaDisplayLevels[this.ariaLevel];
|
|
37
|
+
}
|
|
38
|
+
private set displayLevel(value: string | null) {
|
|
39
|
+
if (value && !displayLevels.includes(value)) {
|
|
40
|
+
console.error(`Invalid display-level: "${value}"`);
|
|
41
|
+
value = null;
|
|
42
|
+
}
|
|
43
|
+
if (value) {
|
|
44
|
+
this._displayLevel = value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private _ariaLevel: string | null = null;
|
|
49
|
+
private _displayLevel: string | null = null;
|
|
50
|
+
|
|
51
|
+
private get isAriaLevelOne(): boolean {
|
|
52
|
+
return this.ariaLevel === "1";
|
|
53
|
+
}
|
|
54
|
+
private get isAriaLevelTwo(): boolean {
|
|
55
|
+
return this.ariaLevel === "2";
|
|
56
|
+
}
|
|
57
|
+
private get isAriaLevelThree(): boolean {
|
|
58
|
+
return this.ariaLevel === "3";
|
|
59
|
+
}
|
|
60
|
+
private get isAriaLevelFour(): boolean {
|
|
61
|
+
return this.ariaLevel === "4";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private get className(): string {
|
|
65
|
+
return `dx-text-display-${this.displayLevel}`;
|
|
66
|
+
}
|
|
67
|
+
}
|