@salesforcedevs/docs-components 0.17.1 → 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.
Files changed (117) hide show
  1. package/lwc.config.json +17 -3
  2. package/package.json +18 -7
  3. package/src/modules/README.md +41 -0
  4. package/src/modules/doc/amfModelParser/amfModelParser.ts +674 -0
  5. package/src/modules/doc/amfReference/amfReference.css +25 -0
  6. package/src/modules/doc/amfReference/amfReference.html +55 -0
  7. package/src/modules/doc/amfReference/amfReference.ts +1467 -0
  8. package/src/modules/doc/amfReference/constants.ts +76 -0
  9. package/src/modules/doc/amfReference/types.ts +125 -0
  10. package/src/modules/doc/amfTopic/amfTopic.css +21 -0
  11. package/src/modules/doc/amfTopic/amfTopic.html +3 -0
  12. package/src/modules/doc/amfTopic/amfTopic.ts +111 -0
  13. package/src/modules/doc/amfTopic/types.ts +56 -0
  14. package/src/modules/doc/amfTopic/utils.ts +136 -0
  15. package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +51 -0
  16. package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +5 -0
  17. package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +71 -0
  18. package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
  19. package/src/modules/doc/breadcrumbs/breadcrumbs.html +58 -0
  20. package/src/modules/doc/breadcrumbs/breadcrumbs.ts +183 -0
  21. package/src/modules/doc/componentPlayground/componentPlayground.css +22 -0
  22. package/src/modules/doc/componentPlayground/componentPlayground.html +20 -0
  23. package/src/modules/doc/componentPlayground/componentPlayground.ts +42 -0
  24. package/src/modules/doc/content/content.css +89 -70
  25. package/src/modules/doc/content/content.html +1 -0
  26. package/src/modules/doc/content/content.ts +188 -195
  27. package/src/modules/doc/contentCallout/contentCallout.css +18 -10
  28. package/src/modules/doc/contentCallout/contentCallout.html +13 -4
  29. package/src/modules/doc/contentCallout/contentCallout.ts +14 -2
  30. package/src/modules/doc/contentLayout/contentLayout.css +1 -0
  31. package/src/modules/doc/contentLayout/contentLayout.html +46 -0
  32. package/src/modules/doc/contentLayout/contentLayout.ts +524 -0
  33. package/src/modules/doc/doDont/doDont.css +47 -0
  34. package/src/modules/doc/doDont/doDont.html +27 -0
  35. package/src/modules/doc/doDont/doDont.ts +17 -0
  36. package/src/modules/doc/header/header.css +70 -37
  37. package/src/modules/doc/header/header.html +41 -138
  38. package/src/modules/doc/header/header.ts +56 -78
  39. package/src/modules/doc/heading/heading.css +33 -0
  40. package/src/modules/doc/heading/heading.html +14 -0
  41. package/src/modules/doc/heading/heading.ts +67 -0
  42. package/src/modules/doc/headingAnchor/headingAnchor.css +3 -3
  43. package/src/modules/doc/headingAnchor/headingAnchor.ts +2 -2
  44. package/src/modules/doc/headingContent/headingContent.css +53 -0
  45. package/src/modules/doc/headingContent/headingContent.html +13 -0
  46. package/src/modules/doc/headingContent/headingContent.ts +30 -0
  47. package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +1 -0
  48. package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +45 -0
  49. package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +256 -0
  50. package/src/modules/doc/overview/overview.css +40 -0
  51. package/src/modules/doc/overview/overview.html +34 -0
  52. package/src/modules/doc/overview/overview.ts +12 -0
  53. package/src/modules/doc/phase/phase.css +21 -6
  54. package/src/modules/doc/phase/phase.html +15 -3
  55. package/src/modules/doc/phase/phase.ts +48 -12
  56. package/src/modules/doc/specificationContent/specificationContent.css +36 -0
  57. package/src/modules/doc/specificationContent/specificationContent.html +167 -0
  58. package/src/modules/doc/specificationContent/specificationContent.ts +127 -0
  59. package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
  60. package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
  61. package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
  62. package/src/modules/doc/toc/toc.ts +1 -1
  63. package/src/modules/doc/versionPicker/versionPicker.css +64 -0
  64. package/src/modules/doc/versionPicker/versionPicker.html +38 -0
  65. package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
  66. package/src/modules/doc/xmlContent/types.ts +120 -0
  67. package/src/modules/doc/xmlContent/utils.ts +163 -0
  68. package/src/modules/doc/xmlContent/xmlContent.css +54 -0
  69. package/src/modules/doc/xmlContent/xmlContent.html +54 -0
  70. package/src/modules/doc/xmlContent/xmlContent.ts +763 -0
  71. package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
  72. package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +131 -0
  73. package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
  74. package/src/modules/{helpers → docHelpers}/status/status.css +1 -1
  75. package/src/modules/docUtils/searchSyncer/searchSyncer.ts +86 -0
  76. package/src/modules/docUtils/utils/__mocks__/coveo.analytics.ts +16 -0
  77. package/src/modules/docUtils/utils/coveo.analytics.d.ts +10 -0
  78. package/src/modules/docUtils/utils/utils.ts +32 -0
  79. package/LICENSE +0 -12
  80. package/src/modules/doc/content/__tests__/content.test.ts +0 -312
  81. package/src/modules/doc/content/__tests__/mockDocContent.ts +0 -348
  82. package/src/modules/doc/content/__tests__/mockPageReference.ts +0 -8
  83. package/src/modules/doc/content/__tests__/mockSidebar.ts +0 -81
  84. package/src/modules/doc/content/content.stories.ts +0 -148
  85. package/src/modules/doc/contentCallout/__tests__/contentCallout.test.ts +0 -80
  86. package/src/modules/doc/contentCallout/__tests__/mockProps.ts +0 -14
  87. package/src/modules/doc/contentCallout/contentCallout.stories.ts +0 -29
  88. package/src/modules/doc/contentMedia/__tests__/contentMedia.test.ts +0 -97
  89. package/src/modules/doc/contentMedia/contentMedia.stories.ts +0 -113
  90. package/src/modules/doc/header/__tests__/coveoConfig.ts +0 -12
  91. package/src/modules/doc/header/__tests__/header.test.ts +0 -445
  92. package/src/modules/doc/header/__tests__/mockNavDevelopers.ts +0 -427
  93. package/src/modules/doc/header/__tests__/mockNavs.ts +0 -115
  94. package/src/modules/doc/header/__tests__/mockProps.ts +0 -152
  95. package/src/modules/doc/header/header.stories.ts +0 -190
  96. package/src/modules/doc/headingAnchor/__tests__/headingAnchor.test.ts +0 -111
  97. package/src/modules/doc/headingAnchor/headingAnchor.stories.ts +0 -33
  98. package/src/modules/doc/nav/__tests__/mockAvailableLanguages.ts +0 -8
  99. package/src/modules/doc/nav/__tests__/mockAvailableVersions.ts +0 -122
  100. package/src/modules/doc/nav/__tests__/mockPageReference.ts +0 -8
  101. package/src/modules/doc/nav/__tests__/mockPdfUrl.ts +0 -1
  102. package/src/modules/doc/nav/__tests__/mockSelectedLanguage.ts +0 -8
  103. package/src/modules/doc/nav/__tests__/mockSelectedVersion.ts +0 -8
  104. package/src/modules/doc/nav/__tests__/mockToc.ts +0 -146
  105. package/src/modules/doc/nav/__tests__/nav.test.ts +0 -58
  106. package/src/modules/doc/phase/__tests__/mockProps.ts +0 -13
  107. package/src/modules/doc/phase/__tests__/phase.test.ts +0 -60
  108. package/src/modules/doc/phase/phase.stories.ts +0 -12
  109. package/src/modules/doc/toc/__tests__/mockPageReference.ts +0 -8
  110. package/src/modules/doc/toc/__tests__/mockToc.ts +0 -146
  111. package/src/modules/doc/toc/__tests__/toc.test.ts +0 -29
  112. package/src/modules/doc/toolbar/__tests__/mockAvailableLanguages.ts +0 -8
  113. package/src/modules/doc/toolbar/__tests__/mockAvailableVersions.ts +0 -122
  114. package/src/modules/doc/toolbar/__tests__/mockPdfUrl.ts +0 -1
  115. package/src/modules/doc/toolbar/__tests__/mockSelectedLanguage.ts +0 -8
  116. package/src/modules/doc/toolbar/__tests__/mockSelectedVersion.ts +0 -8
  117. package/src/modules/doc/toolbar/__tests__/toolbar.test.ts +0 -44
@@ -1,12 +1,40 @@
1
- @import "helpers/commonHeader";
1
+ @import "dxHelpers/commonHeader";
2
2
 
3
3
  dx-logo {
4
4
  min-width: fit-content;
5
- min-width: -moz-fit-content;
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: var(--dx-g-brand-current-color-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
- background: var(--dx-g-brand-current-color-background-2);
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
- .header_bail-link {
36
- --dx-c-button-horizontal-spacing: var(--dx-g-spacing-sm);
37
-
38
- margin-left: var(--dx-g-spacing-sm);
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
- .header_lang-dropdown > dx-button {
47
- --dx-c-button-primary-color: var(--button-primary-color);
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: 740px) {
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
- padding-left: var(--dx-g-spacing-sm);
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
- .header_l2_group-title {
80
- margin-right: 0;
81
- padding: var(--dx-g-spacing-smd) var(--dx-g-page-padding-horizontal);
113
+ .subtitle {
114
+ font-weight: var(--dx-g-font-demi);
115
+ letter-spacing: -0.08px;
82
116
  }
83
117
 
84
- .header_l2_group-title .header_lang-dropdown {
85
- margin-left: auto;
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-scoped-nav-items .header_l2_group-title {
97
- border-bottom: 1px solid var(--dx-g-brand-current-color-border-2);
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
- <dx-brand-theme-provider brand={brand}>
3
- <header class={className}>
4
- <dx-banner
5
- if:true={bannerMarkup}
6
- banner-markup={bannerMarkup}
7
- ></dx-banner>
8
- <div class="header_l1">
9
- <div if:true={showMenuButton} class="nav_menu-ctas">
10
- <dx-button
11
- aria-label="Menu Button"
12
- class="nav_menu-button"
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:true={isValidBrand}
15
+ lwc:if={devCenter.icon}
75
16
  sprite="salesforcebrand"
76
17
  symbol={brand}
77
- size="xlarge"
18
+ size="large"
78
19
  ></dx-icon>
79
- <span class="subtitle dx-text-heading-4">
80
- {subtitle}
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
- if:true={hasScopedNavItems}
102
- class="header_l2_group header_l2_group-nav"
103
- >
104
- <div
105
- class="header_l2_group-nav_overflow"
106
- onscroll={onNavScroll}
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
- </div>
115
- <div
116
- if:false={smallMobile}
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
- <dx-button
129
- aria-label="Select Language"
130
- variant="inline"
131
- icon-size="small"
132
- icon-symbol="world"
37
+ <div
38
+ class="header_l2_group-nav_overflow"
39
+ onscroll={onNavScroll}
133
40
  >
134
- {languageLabel}
135
- </dx-button>
136
- </dx-dropdown>
137
- <dx-button
138
- if:true={hasBailLink}
139
- aria-label={bailLabel}
140
- class="header_bail-link"
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
- </div>
150
- </header>
151
- </dx-brand-theme-provider>
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 { Option } from "typings/custom";
4
- import { HeaderBase } from "utils/headerBase";
5
- import { toJson } from "utils/normalizers";
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 = "880px";
10
- const SMALL_MOBILE_MATCH = "740px";
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 scopedNavItems() {
18
- return this._scopedNavItems;
22
+ get hideDocHeader() {
23
+ return this._hideDocHeader;
19
24
  }
20
25
 
21
- set scopedNavItems(value) {
22
- this._scopedNavItems = toJson(value);
26
+ set hideDocHeader(value) {
27
+ this._hideDocHeader = normalizeBoolean(value);
23
28
  }
24
29
 
25
30
  @api
26
- get languages() {
27
- return this._languages;
31
+ get scopedNavItems() {
32
+ return this._scopedNavItems;
28
33
  }
29
34
 
30
- set languages(value) {
31
- this._languages = toJson(value);
35
+ set scopedNavItems(value) {
36
+ this._scopedNavItems = toJson(value);
32
37
  }
33
38
 
34
39
  @api
35
- get language() {
36
- return this._language;
40
+ get devCenter(): DevCenterConfig {
41
+ return this._devCenter;
37
42
  }
38
43
 
39
- set language(value) {
40
- if (this._language !== value) {
41
- this._language = value;
42
- }
44
+ set devCenter(value) {
45
+ this._devCenter = toJson(value);
43
46
  }
44
47
 
45
- private _language: string | null = null;
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 hasScopedNavItems(): boolean {
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
- (this.language &&
82
- this.languages.find(
83
- (lang) => get(lang, this.langValuePath) === this.language
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
- private get showMenuButton(): boolean {
90
- return this.mobile && this.hasNavItems;
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
- this.smallMobileMatchMedia = window.matchMedia(
102
- `(max-width: ${SMALL_MOBILE_MATCH})`
103
- );
104
- this.onSmallMobileChange(this.smallMobileMatchMedia);
105
- this.smallMobileMatchMedia.addEventListener(
106
- "change",
107
- this.onSmallMobileChange
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.hasScopedNavItems && "has-scoped-nav-items"
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
+ }