@salesforcedevs/docs-components 1.27.21 → 1.27.22-banner0
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 +1 -0
- package/package.json +2 -2
- package/src/modules/doc/banner/banner.css +211 -0
- package/src/modules/doc/banner/banner.html +62 -0
- package/src/modules/doc/banner/banner.ts +92 -0
- package/src/modules/doc/contentLayout/contentLayout.html +77 -65
- package/src/modules/doc/contentLayout/contentLayout.ts +42 -11
- package/src/modules/doc/redocReference/redocReference.ts +11 -5
- package/src/modules/doc/xmlContent/xmlContent.html +13 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +43 -9
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +16 -1
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.22-banner0",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "db852f017ed4190096869aa447266cb9f3d89b38"
|
|
29
29
|
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
|
|
7
|
+
--doc-banner-bg: var(--neutral-90, #e5e5e5);
|
|
8
|
+
--doc-banner-height: 44px;
|
|
9
|
+
--doc-banner-padding-x-left: 40px;
|
|
10
|
+
--doc-banner-padding-x-right: var(--dx-g-spacing-lg);
|
|
11
|
+
--doc-banner-icon-size: 18.4615px;
|
|
12
|
+
--doc-banner-icon-frame-width: calc(
|
|
13
|
+
var(--doc-banner-padding-x-left) + var(--doc-banner-icon-size) +
|
|
14
|
+
var(--dx-g-spacing-sm)
|
|
15
|
+
);
|
|
16
|
+
--doc-banner-close-color: #747474;
|
|
17
|
+
--doc-banner-primary-bg: #0176d3;
|
|
18
|
+
--doc-banner-primary-bg-hover: #0160b3;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.doc-notification-bar {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
width: 100%;
|
|
26
|
+
margin: 0;
|
|
27
|
+
min-height: var(--doc-banner-height);
|
|
28
|
+
padding: 0 var(--doc-banner-padding-x-right) 0
|
|
29
|
+
var(--doc-banner-padding-x-left);
|
|
30
|
+
background: var(--doc-banner-bg);
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.doc-notification-bar .icon-wrap,
|
|
35
|
+
.doc-notification-bar .main,
|
|
36
|
+
.doc-notification-bar .content,
|
|
37
|
+
.doc-notification-bar .actions,
|
|
38
|
+
.doc-notification-bar .close-wrap {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.doc-notification-bar .icon-wrap,
|
|
44
|
+
.doc-notification-bar .close-wrap {
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.doc-notification-bar .main {
|
|
49
|
+
flex: 1 1 0;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
align-self: flex-start;
|
|
52
|
+
padding: 6px 0;
|
|
53
|
+
gap: var(--dx-g-spacing-md);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.doc-notification-bar .icon-wrap {
|
|
57
|
+
width: calc(var(--doc-banner-icon-size) + var(--dx-g-spacing-sm));
|
|
58
|
+
min-height: 32px;
|
|
59
|
+
align-self: flex-start;
|
|
60
|
+
justify-content: flex-start;
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.doc-notification-bar .icon-wrap dx-icon {
|
|
65
|
+
--dx-c-icon-size: var(--doc-banner-icon-size);
|
|
66
|
+
|
|
67
|
+
width: var(--doc-banner-icon-size);
|
|
68
|
+
height: var(--doc-banner-icon-size);
|
|
69
|
+
padding: 12px 8px 0 0;
|
|
70
|
+
box-sizing: content-box;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.doc-notification-bar .content {
|
|
74
|
+
flex: 0 1 auto;
|
|
75
|
+
min-width: 0;
|
|
76
|
+
max-width: 100%;
|
|
77
|
+
min-height: 32px;
|
|
78
|
+
align-items: flex-start;
|
|
79
|
+
gap: var(--dx-g-spacing-sm);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.doc-notification-bar .message {
|
|
83
|
+
margin: 0;
|
|
84
|
+
padding: 6px 0;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
font-weight: 400;
|
|
87
|
+
line-height: 20px;
|
|
88
|
+
color: var(--dx-g-neutral-30, #444);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.doc-notification-bar .message a {
|
|
92
|
+
color: var(--dx-g-cloud-blue-vibrant-50);
|
|
93
|
+
text-decoration: underline;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.doc-notification-bar .message a:hover {
|
|
97
|
+
opacity: 0.9;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.doc-notification-bar .actions {
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
min-height: 32px;
|
|
103
|
+
gap: var(--dx-g-spacing-smd);
|
|
104
|
+
flex-wrap: wrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.doc-notification-bar .primary-btn {
|
|
108
|
+
--dx-c-button-primary-color: var(--doc-banner-primary-bg);
|
|
109
|
+
--dx-c-button-primary-color-hover: var(--doc-banner-primary-bg-hover);
|
|
110
|
+
--dx-c-button-vertical-spacing: 0;
|
|
111
|
+
--dx-c-button-horizontal-spacing: var(--dx-g-spacing-md);
|
|
112
|
+
|
|
113
|
+
min-width: min(144px, 100%);
|
|
114
|
+
height: 32px;
|
|
115
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.doc-notification-bar .primary-btn::part(container) {
|
|
119
|
+
min-width: min(144px, 100%);
|
|
120
|
+
width: 100%;
|
|
121
|
+
height: 32px;
|
|
122
|
+
padding: 0 var(--dx-g-spacing-md);
|
|
123
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.doc-notification-bar .secondary-btn {
|
|
127
|
+
font-weight: var(--dx-g-font-normal);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.doc-notification-bar .close-wrap {
|
|
131
|
+
align-self: flex-start;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
align-items: center;
|
|
134
|
+
width: 52px;
|
|
135
|
+
height: 44px;
|
|
136
|
+
padding: 12px 8px 18px;
|
|
137
|
+
margin-left: auto;
|
|
138
|
+
box-sizing: border-box;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.doc-notification-bar .close-wrap .close-btn {
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 100%;
|
|
144
|
+
|
|
145
|
+
--dx-c-button-custom-color: var(--doc-banner-close-color);
|
|
146
|
+
--dx-c-button-custom-color-hover: var(--doc-banner-close-color);
|
|
147
|
+
--dx-c-button-custom-background: transparent;
|
|
148
|
+
--dx-c-button-custom-background-hover: rgb(0 0 0 / 5%);
|
|
149
|
+
--dx-c-button-custom-border: none;
|
|
150
|
+
--dx-c-button-custom-border-hover: none;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (max-width: 1279px) {
|
|
154
|
+
:host {
|
|
155
|
+
--doc-banner-padding-x-left: 32px;
|
|
156
|
+
--doc-banner-padding-x-right: var(--dx-g-spacing-md);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.doc-notification-bar {
|
|
160
|
+
position: relative;
|
|
161
|
+
max-width: 100%;
|
|
162
|
+
min-height: 78px;
|
|
163
|
+
flex-wrap: wrap;
|
|
164
|
+
align-content: space-between;
|
|
165
|
+
padding: 0 var(--doc-banner-padding-x-right) 0 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.doc-notification-bar .icon-wrap {
|
|
169
|
+
position: absolute;
|
|
170
|
+
left: 0;
|
|
171
|
+
top: 0;
|
|
172
|
+
bottom: 0;
|
|
173
|
+
width: var(--doc-banner-icon-frame-width);
|
|
174
|
+
min-height: 0;
|
|
175
|
+
padding: 0 0 0 var(--doc-banner-padding-x-left);
|
|
176
|
+
order: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.doc-notification-bar .main {
|
|
180
|
+
order: 1;
|
|
181
|
+
flex-wrap: wrap;
|
|
182
|
+
margin-left: var(--doc-banner-icon-frame-width);
|
|
183
|
+
gap: var(--dx-g-spacing-2xs);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.doc-notification-bar .content {
|
|
187
|
+
order: 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.doc-notification-bar .close-wrap {
|
|
191
|
+
order: 2;
|
|
192
|
+
min-height: 44px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.doc-notification-bar .actions {
|
|
196
|
+
order: 1;
|
|
197
|
+
flex: 0 0 100%;
|
|
198
|
+
width: 100%;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@media (max-width: 768px) {
|
|
203
|
+
:host {
|
|
204
|
+
--doc-banner-padding-x-left: 24px;
|
|
205
|
+
--doc-banner-padding-x-right: var(--dx-g-spacing-sm);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.doc-notification-bar {
|
|
209
|
+
min-height: 44px;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template lwc:if={showBanner}>
|
|
3
|
+
<div class="doc-notification-bar" part="container">
|
|
4
|
+
<div class="icon-wrap" part="icon-wrap">
|
|
5
|
+
<dx-icon symbol="info" part="icon" color="#747474"></dx-icon>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="main" part="main">
|
|
8
|
+
<div class="content" part="content">
|
|
9
|
+
<p class="message dx-text-body-4" part="message">
|
|
10
|
+
<template lwc:if={messageText}>{messageText}</template>
|
|
11
|
+
<template lwc:if={hasMessageLink}>
|
|
12
|
+
<a
|
|
13
|
+
href={messageLinkUrl}
|
|
14
|
+
target="_blank"
|
|
15
|
+
rel="noopener noreferrer"
|
|
16
|
+
part="message-link"
|
|
17
|
+
>
|
|
18
|
+
{messageLinkText}
|
|
19
|
+
</a>
|
|
20
|
+
</template>
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="actions" part="actions">
|
|
24
|
+
<template lwc:if={hasPrimaryButton}>
|
|
25
|
+
<dx-button
|
|
26
|
+
class="primary-btn"
|
|
27
|
+
href={buttonHref}
|
|
28
|
+
variant="primary"
|
|
29
|
+
size="small"
|
|
30
|
+
part="button"
|
|
31
|
+
>
|
|
32
|
+
{buttonLabel}
|
|
33
|
+
</dx-button>
|
|
34
|
+
</template>
|
|
35
|
+
<template lwc:if={hasSecondaryAction}>
|
|
36
|
+
<dx-button
|
|
37
|
+
class="secondary-btn"
|
|
38
|
+
variant="inline"
|
|
39
|
+
onclick={handleSecondaryClick}
|
|
40
|
+
part="secondary"
|
|
41
|
+
>
|
|
42
|
+
{secondaryLabel}
|
|
43
|
+
</dx-button>
|
|
44
|
+
</template>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<template lwc:if={showCloseButton}>
|
|
48
|
+
<div class="close-wrap" part="close-wrap">
|
|
49
|
+
<dx-button
|
|
50
|
+
class="close-btn"
|
|
51
|
+
variant="icon-only"
|
|
52
|
+
icon-symbol="close"
|
|
53
|
+
icon-color="#747474"
|
|
54
|
+
aria-label="Close"
|
|
55
|
+
onclick={handleCloseClick}
|
|
56
|
+
part="close"
|
|
57
|
+
></dx-button>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
3
|
+
|
|
4
|
+
const LOCALE_BANNER_STORAGE_PREFIX = "dsc-doc-locale-banner-dismissed-";
|
|
5
|
+
|
|
6
|
+
export default class Banner extends LightningElement {
|
|
7
|
+
@api messageText = "";
|
|
8
|
+
|
|
9
|
+
@api messageLinkUrl = "";
|
|
10
|
+
|
|
11
|
+
@api messageLinkText = "here";
|
|
12
|
+
|
|
13
|
+
@api buttonLabel = "";
|
|
14
|
+
|
|
15
|
+
@api buttonHref = "";
|
|
16
|
+
|
|
17
|
+
@api secondaryLabel = "";
|
|
18
|
+
|
|
19
|
+
@api dismissStorageKey = "";
|
|
20
|
+
|
|
21
|
+
_showCloseButton = false;
|
|
22
|
+
|
|
23
|
+
@api
|
|
24
|
+
get showCloseButton(): boolean {
|
|
25
|
+
return this._showCloseButton;
|
|
26
|
+
}
|
|
27
|
+
set showCloseButton(value: string | boolean) {
|
|
28
|
+
this._showCloseButton = normalizeBoolean(value);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@track private _dismissed = false;
|
|
32
|
+
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
if (
|
|
35
|
+
this.dismissStorageKey &&
|
|
36
|
+
typeof window !== "undefined" &&
|
|
37
|
+
window.localStorage
|
|
38
|
+
) {
|
|
39
|
+
this._dismissed =
|
|
40
|
+
window.localStorage.getItem(
|
|
41
|
+
`${LOCALE_BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`
|
|
42
|
+
) === "true";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get showBanner(): boolean {
|
|
47
|
+
if (!this.dismissStorageKey) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return !this._dismissed;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get hasMessageLink(): boolean {
|
|
54
|
+
return !!this.messageLinkUrl;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get hasPrimaryButton(): boolean {
|
|
58
|
+
return !!(this.buttonLabel && this.buttonHref);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get hasSecondaryAction(): boolean {
|
|
62
|
+
return !!this.secondaryLabel;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
persistDismissAndHide() {
|
|
66
|
+
if (
|
|
67
|
+
this.dismissStorageKey &&
|
|
68
|
+
typeof window !== "undefined" &&
|
|
69
|
+
window.localStorage
|
|
70
|
+
) {
|
|
71
|
+
window.localStorage.setItem(
|
|
72
|
+
`${LOCALE_BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`,
|
|
73
|
+
"true"
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
this._dismissed = true;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
handleSecondaryClick() {
|
|
80
|
+
this.persistDismissAndHide();
|
|
81
|
+
this.dispatchEvent(
|
|
82
|
+
new CustomEvent("dismiss", { bubbles: true, composed: true })
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
handleCloseClick() {
|
|
87
|
+
this.persistDismissAndHide();
|
|
88
|
+
this.dispatchEvent(
|
|
89
|
+
new CustomEvent("dismiss", { bubbles: true, composed: true })
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,76 +1,88 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class=
|
|
3
|
-
<
|
|
4
|
-
class="
|
|
5
|
-
|
|
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
|
-
empty-state-message={emptyStateMessage}
|
|
16
|
-
>
|
|
17
|
-
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
18
|
-
</dx-sidebar-old>
|
|
19
|
-
<div class="content-body-doc-phase-container">
|
|
20
|
-
<div class="doc-phase-wrapper">
|
|
21
|
-
<slot name="doc-phase"></slot>
|
|
2
|
+
<div class={contentClass}>
|
|
3
|
+
<template lwc:if={showLocaleBannerAbove}>
|
|
4
|
+
<div class="locale-notification-wrapper">
|
|
5
|
+
<slot name="locale-banner"></slot>
|
|
22
6
|
</div>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
</template>
|
|
8
|
+
<div class="content-columns">
|
|
9
|
+
<dx-sidebar-old
|
|
10
|
+
class="is-sticky left-nav-bar"
|
|
11
|
+
trees={sidebarContent}
|
|
12
|
+
value={sidebarValue}
|
|
13
|
+
header={sidebarHeader}
|
|
14
|
+
ontogglesidebar={onToggleSidebar}
|
|
15
|
+
languages={languages}
|
|
16
|
+
language={language}
|
|
17
|
+
bail-href={bailHref}
|
|
18
|
+
bail-label={bailLabel}
|
|
19
|
+
dev-center={devCenter}
|
|
20
|
+
brand={brand}
|
|
21
|
+
empty-state-message={emptyStateMessage}
|
|
22
|
+
>
|
|
23
|
+
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
24
|
+
</dx-sidebar-old>
|
|
25
|
+
<div class="content-body-doc-phase-container">
|
|
26
|
+
<template lwc:if={showLocaleBannerInColumn}>
|
|
27
|
+
<div class="locale-notification-wrapper">
|
|
28
|
+
<slot name="locale-banner"></slot>
|
|
32
29
|
</div>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
</template>
|
|
31
|
+
<div class="doc-phase-wrapper">
|
|
32
|
+
<slot name="doc-phase"></slot>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="version-wrapper">
|
|
35
|
+
<slot name="version-banner"></slot>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="content-body-container">
|
|
38
|
+
<div class="content-body">
|
|
39
|
+
<div class="breadcrumb-row" lwc:if={showBreadcrumbs}>
|
|
40
|
+
<doc-breadcrumbs
|
|
41
|
+
breadcrumbs={breadcrumbs}
|
|
42
|
+
></doc-breadcrumbs>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="read" lwc:if={showReadingTime}>
|
|
45
|
+
<svg
|
|
46
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
47
|
+
width="18"
|
|
48
|
+
height="18"
|
|
49
|
+
viewBox="0 0 52 52"
|
|
50
|
+
>
|
|
51
|
+
<g fill="#3e3e3c">
|
|
52
|
+
<path
|
|
53
|
+
d="m26 2c-13.2 0-24 10.8-24 24s10.8 24 24 24 24-10.8 24-24-10.8-24-24-24z m0 42c-9.9 0-18-8.1-18-18s8.1-18 18-18 18 8.1 18 18-8.1 18-18 18z m3.4-17.8c-0.3-0.3-0.4-0.7-0.4-1.1v-9.6c0-0.8-0.7-1.5-1.5-1.5h-3c-0.8 0-1.5 0.7-1.5 1.5v12.1c0 0.4 0.2 0.8 0.4 1.1l7.4 7.4c0.6 0.6 1.5 0.6 2.1 0l2.1-2.1c0.6-0.6 0.6-1.5 0-2.1l-5.6-5.7z"
|
|
54
|
+
></path>
|
|
55
|
+
</g>
|
|
56
|
+
</svg>
|
|
57
|
+
{readingTime} minute read
|
|
58
|
+
</div>
|
|
59
|
+
<div class="share-below-read" lwc:if={showSocialShare}>
|
|
60
|
+
<doc-social-share
|
|
61
|
+
title={shareTitle}
|
|
62
|
+
url={shareUrl}
|
|
63
|
+
twitter-via={shareTwitterVia}
|
|
64
|
+
></doc-social-share>
|
|
65
|
+
</div>
|
|
66
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
67
|
+
<doc-sprig-survey
|
|
68
|
+
lwc:if={shouldDisplayFeedback}
|
|
69
|
+
></doc-sprig-survey>
|
|
47
70
|
</div>
|
|
48
|
-
<div class="
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
></
|
|
71
|
+
<div lwc:if={showToc} class="right-nav-bar is-sticky">
|
|
72
|
+
<dx-toc
|
|
73
|
+
header={tocTitle}
|
|
74
|
+
options={tocOptions}
|
|
75
|
+
value={tocValue}
|
|
76
|
+
></dx-toc>
|
|
54
77
|
</div>
|
|
55
|
-
<slot onslotchange={onSlotChange}></slot>
|
|
56
|
-
<doc-sprig-survey
|
|
57
|
-
lwc:if={shouldDisplayFeedback}
|
|
58
|
-
></doc-sprig-survey>
|
|
59
78
|
</div>
|
|
60
|
-
<div lwc:if={
|
|
61
|
-
<dx-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
></dx-toc>
|
|
79
|
+
<div lwc:if={showFooter} class="footer-container">
|
|
80
|
+
<dx-footer
|
|
81
|
+
variant="no-signup"
|
|
82
|
+
mfe-config-origin={effectiveFooterOrigin}
|
|
83
|
+
></dx-footer>
|
|
66
84
|
</div>
|
|
67
85
|
</div>
|
|
68
|
-
<div lwc:if={showFooter} class="footer-container">
|
|
69
|
-
<dx-footer
|
|
70
|
-
variant="no-signup"
|
|
71
|
-
mfe-config-origin={effectiveFooterOrigin}
|
|
72
|
-
></dx-footer>
|
|
73
|
-
</div>
|
|
74
86
|
</div>
|
|
75
87
|
</div>
|
|
76
88
|
</template>
|
|
@@ -42,6 +42,8 @@ export default class ContentLayout extends LightningElement {
|
|
|
42
42
|
@api brand: any;
|
|
43
43
|
@api emptyStateMessage?: string;
|
|
44
44
|
|
|
45
|
+
@api showLocaleBannerAbove = false;
|
|
46
|
+
|
|
45
47
|
// This is needed for now to prevent failing snapshot tests due to links in the footer
|
|
46
48
|
@api
|
|
47
49
|
get showFooter() {
|
|
@@ -124,6 +126,16 @@ export default class ContentLayout extends LightningElement {
|
|
|
124
126
|
protected contentLoaded: boolean = false;
|
|
125
127
|
protected sidebarOpen: boolean = false;
|
|
126
128
|
|
|
129
|
+
get contentClass() {
|
|
130
|
+
return this.showLocaleBannerAbove
|
|
131
|
+
? "content content-banner-above"
|
|
132
|
+
: "content";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get showLocaleBannerInColumn() {
|
|
136
|
+
return !this.showLocaleBannerAbove;
|
|
137
|
+
}
|
|
138
|
+
|
|
127
139
|
get shouldDisplayFeedback() {
|
|
128
140
|
return this.contentLoaded && typeof Sprig !== "undefined";
|
|
129
141
|
}
|
|
@@ -268,6 +280,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
268
280
|
".sticky-doc-header"
|
|
269
281
|
) as HTMLElement;
|
|
270
282
|
|
|
283
|
+
const localeBannerWrapper = this.template.querySelector(
|
|
284
|
+
".locale-notification-wrapper"
|
|
285
|
+
) as HTMLElement;
|
|
271
286
|
const docPhaseWrapper = this.template.querySelector(
|
|
272
287
|
".doc-phase-wrapper"
|
|
273
288
|
) as HTMLElement;
|
|
@@ -275,6 +290,12 @@ export default class ContentLayout extends LightningElement {
|
|
|
275
290
|
".version-wrapper"
|
|
276
291
|
) as HTMLElement;
|
|
277
292
|
|
|
293
|
+
const localeBannerSlot = localeBannerWrapper?.querySelector(
|
|
294
|
+
"[name=locale-banner]"
|
|
295
|
+
) as HTMLSlotElement | null;
|
|
296
|
+
const localeBannerEl = localeBannerSlot?.assignedElements?.()[0] as
|
|
297
|
+
| HTMLElement
|
|
298
|
+
| undefined;
|
|
278
299
|
const docPhaseEl = (
|
|
279
300
|
docPhaseWrapper.querySelector("[name=doc-phase]")! as any
|
|
280
301
|
).assignedElements()[0] as HTMLSlotElement;
|
|
@@ -297,6 +318,12 @@ export default class ContentLayout extends LightningElement {
|
|
|
297
318
|
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
|
|
298
319
|
const totalHeaderHeight = globalNavHeight + docHeaderHeight;
|
|
299
320
|
|
|
321
|
+
const localeBannerHeight = localeBannerEl?.offsetHeight ?? 0;
|
|
322
|
+
const docPhaseElHeight =
|
|
323
|
+
(docPhaseEl?.getBoundingClientRect?.()?.height ?? 0) +
|
|
324
|
+
(verBannerEl?.getBoundingClientRect?.()?.height ?? 0);
|
|
325
|
+
const totalBannerHeight = localeBannerHeight + docPhaseElHeight;
|
|
326
|
+
|
|
300
327
|
// Selecting the doc section heading and RNB here.
|
|
301
328
|
const docHeadingEls = Array.from(
|
|
302
329
|
document.querySelectorAll("doc-heading")
|
|
@@ -313,15 +340,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
313
340
|
`${globalNavHeight}px`
|
|
314
341
|
);
|
|
315
342
|
|
|
316
|
-
const docPhaseElHeight =
|
|
317
|
-
docPhaseEl || verBannerEl
|
|
318
|
-
? (docPhaseEl || verBannerEl).getBoundingClientRect().height
|
|
319
|
-
: 0;
|
|
320
|
-
|
|
321
343
|
// Adjusting the doc section heading on scroll.
|
|
322
344
|
docHeadingEls.forEach((docHeadingEl) => {
|
|
323
345
|
(docHeadingEl as any).style.scrollMarginTop = `${
|
|
324
|
-
totalHeaderHeight +
|
|
346
|
+
totalHeaderHeight + totalBannerHeight + 40
|
|
325
347
|
}px`;
|
|
326
348
|
});
|
|
327
349
|
|
|
@@ -331,10 +353,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
331
353
|
const viewportHeight = window.innerHeight;
|
|
332
354
|
const maxHeight =
|
|
333
355
|
viewportHeight -
|
|
334
|
-
(
|
|
356
|
+
(totalBannerHeight + totalHeaderHeight + 24); //added some margin of dx-toc
|
|
335
357
|
|
|
336
358
|
rightNavBarEl.style.top = `${
|
|
337
|
-
totalHeaderHeight +
|
|
359
|
+
totalHeaderHeight + totalBannerHeight
|
|
338
360
|
}px`;
|
|
339
361
|
|
|
340
362
|
const toc = rightNavBarEl.querySelector("dx-toc");
|
|
@@ -512,13 +534,22 @@ export default class ContentLayout extends LightningElement {
|
|
|
512
534
|
globalNavEl?.offsetHeight +
|
|
513
535
|
contextNavEl?.offsetHeight;
|
|
514
536
|
|
|
537
|
+
const localeBannerWrapper = this.template.querySelector(
|
|
538
|
+
".locale-notification-wrapper"
|
|
539
|
+
) as HTMLElement;
|
|
540
|
+
const localeBannerSlot = localeBannerWrapper?.querySelector(
|
|
541
|
+
"[name=locale-banner]"
|
|
542
|
+
) as HTMLSlotElement | null;
|
|
543
|
+
const localeBannerEl = localeBannerSlot?.assignedElements?.()[0] as
|
|
544
|
+
| HTMLElement
|
|
545
|
+
| undefined;
|
|
515
546
|
const docPhaseEl = (
|
|
516
547
|
this.template.querySelector("[name=doc-phase]")! as any
|
|
517
548
|
).assignedElements()[0] as HTMLSlotElement;
|
|
518
549
|
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
550
|
+
const localeBannerHeight = localeBannerEl?.offsetHeight ?? 0;
|
|
551
|
+
const docPhaseHeight = docPhaseEl?.offsetHeight ?? 0;
|
|
552
|
+
const offset = headerHeight + localeBannerHeight + docPhaseHeight;
|
|
522
553
|
|
|
523
554
|
for (const headingElement of headingElements as any) {
|
|
524
555
|
if (headingElement.getAttribute("id") === hash) {
|
|
@@ -291,11 +291,7 @@ export default class RedocReference extends LightningElement {
|
|
|
291
291
|
this.insertDocPhase(apiContentDiv, docPhaseInfo);
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
|
|
295
|
-
this.insertSprigSurvey(apiContentDiv);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
this.insertFooter(apiContentDiv);
|
|
294
|
+
this.appendFooterItems(apiContentDiv);
|
|
299
295
|
|
|
300
296
|
// Wait for footer to be rendered before updating styles
|
|
301
297
|
requestAnimationFrame(() => {
|
|
@@ -358,6 +354,16 @@ export default class RedocReference extends LightningElement {
|
|
|
358
354
|
wrapper.appendChild(feedbackElement);
|
|
359
355
|
}
|
|
360
356
|
|
|
357
|
+
private appendFooterItems(parent: HTMLElement): void {
|
|
358
|
+
const container = document.createElement("div");
|
|
359
|
+
container.className = "appended-footer-container";
|
|
360
|
+
if (typeof Sprig !== "undefined") {
|
|
361
|
+
this.insertSprigSurvey(container);
|
|
362
|
+
}
|
|
363
|
+
this.insertFooter(container);
|
|
364
|
+
parent.appendChild(container);
|
|
365
|
+
}
|
|
366
|
+
|
|
361
367
|
// Adjusts third column bottom position to prevent footer overlap
|
|
362
368
|
private updateRedocThirdColumnStyle(redocContainer: HTMLElement): void {
|
|
363
369
|
const footer = redocContainer.querySelector(
|
|
@@ -14,7 +14,20 @@
|
|
|
14
14
|
show-footer={enableFooter}
|
|
15
15
|
reading-time={computedReadingTime}
|
|
16
16
|
origin={origin}
|
|
17
|
+
show-locale-banner-above={showLocaleBannerInSlot}
|
|
17
18
|
>
|
|
19
|
+
<doc-banner
|
|
20
|
+
slot="locale-banner"
|
|
21
|
+
lwc:if={showLocaleBannerInSlot}
|
|
22
|
+
message-text="This text was translated using Salesforce's machine translation system. More details can be found "
|
|
23
|
+
message-link-url="https://help.salesforce.com/s/articleView?id=sf.machine_translation.htm"
|
|
24
|
+
message-link-text="here"
|
|
25
|
+
button-label="Switch to English"
|
|
26
|
+
button-href={localeBannerEnUsHref}
|
|
27
|
+
secondary-label="Not Now"
|
|
28
|
+
show-close-button="true"
|
|
29
|
+
dismiss-storage-key={deliverable}
|
|
30
|
+
></doc-banner>
|
|
18
31
|
<doc-phase
|
|
19
32
|
slot="version-banner"
|
|
20
33
|
lwc:if={showVersionBanner}
|
|
@@ -48,6 +48,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
48
48
|
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer-mfe. */
|
|
49
49
|
@api origin: string | null = null;
|
|
50
50
|
|
|
51
|
+
/** Optional base URL for the canonical link (e.g. https://developer.salesforce.com). When set, used instead of window.location for the canonical href. */
|
|
52
|
+
@api baseUrl: string | null = null;
|
|
53
|
+
|
|
51
54
|
@api
|
|
52
55
|
get allLanguages(): Array<Language> {
|
|
53
56
|
return this._allLanguages;
|
|
@@ -251,6 +254,39 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
251
254
|
return this.pageReference.deliverable;
|
|
252
255
|
}
|
|
253
256
|
|
|
257
|
+
private get showLocaleBannerInSlot(): boolean {
|
|
258
|
+
return this.shouldShowLocaleBanner;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
private get shouldShowLocaleBanner(): boolean {
|
|
262
|
+
if (!this.pageReference?.deliverable) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
if (!this.language || this.language.id === "en-us") {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
const hasEnUs = this.availableLanguages?.some(
|
|
269
|
+
(lang: DocLanguage) => lang.id === "en-us"
|
|
270
|
+
);
|
|
271
|
+
return !!hasEnUs;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private get localeBannerEnUsHref(): string {
|
|
275
|
+
if (!this.pageReference) {
|
|
276
|
+
return "";
|
|
277
|
+
}
|
|
278
|
+
const enUsLanguage = this.availableLanguages?.find(
|
|
279
|
+
(lang: DocLanguage) => lang.id === "en-us"
|
|
280
|
+
);
|
|
281
|
+
if (!enUsLanguage) {
|
|
282
|
+
return "";
|
|
283
|
+
}
|
|
284
|
+
return this.pageReferenceToString({
|
|
285
|
+
...this.pageReference,
|
|
286
|
+
docId: enUsLanguage.url
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
254
290
|
private get useOldSidebar(): boolean {
|
|
255
291
|
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
256
292
|
// TODO: we need a better fix for version number check
|
|
@@ -766,21 +802,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
766
802
|
}
|
|
767
803
|
|
|
768
804
|
if (this.pageReference) {
|
|
769
|
-
const
|
|
805
|
+
const canonicalLink = document.querySelector(
|
|
770
806
|
'link[rel="canonical"]'
|
|
771
807
|
);
|
|
772
|
-
if (
|
|
808
|
+
if (canonicalLink) {
|
|
773
809
|
const copyPageReference = { ...this.pageReference };
|
|
774
810
|
copyPageReference.docId = copyPageReference.docId
|
|
775
811
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
776
812
|
: copyPageReference.docId;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
this.pageReferenceToString(copyPageReference)
|
|
783
|
-
);
|
|
813
|
+
const path = this.pageReferenceToString(copyPageReference);
|
|
814
|
+
const origin = this.baseUrl
|
|
815
|
+
? this.baseUrl.replace(/\/$/, "")
|
|
816
|
+
: `${window.location.protocol}//${window.location.host}`;
|
|
817
|
+
canonicalLink.setAttribute("href", `${origin}${path}`);
|
|
784
818
|
}
|
|
785
819
|
}
|
|
786
820
|
|
|
@@ -86,6 +86,21 @@ dx-toc {
|
|
|
86
86
|
position: relative;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
.content-banner-above {
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.locale-notification-wrapper {
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
width: 100%;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.content-columns {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex: 1;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
89
104
|
.content-body-doc-phase-container {
|
|
90
105
|
flex: 1;
|
|
91
106
|
border-left: 1px solid var(--dx-g-gray-90);
|
|
@@ -125,7 +140,7 @@ dx-toc {
|
|
|
125
140
|
max-width: 1000px;
|
|
126
141
|
flex: 1;
|
|
127
142
|
width: 0;
|
|
128
|
-
|
|
143
|
+
overflow-wrap: break-word;
|
|
129
144
|
}
|
|
130
145
|
|
|
131
146
|
.is-sticky {
|