@salesforcedevs/docs-components 0.0.0
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/LICENSE +12 -0
- package/lwc.config.json +20 -0
- package/package.json +28 -0
- package/src/modules/README.md +41 -0
- package/src/modules/doc/amfReference/amfReference.css +5 -0
- package/src/modules/doc/amfReference/amfReference.html +47 -0
- package/src/modules/doc/amfReference/amfReference.ts +1361 -0
- package/src/modules/doc/amfReference/constants.ts +76 -0
- package/src/modules/doc/amfReference/types.ts +133 -0
- package/src/modules/doc/amfReference/utils.ts +669 -0
- package/src/modules/doc/amfTopic/amfTopic.css +1 -0
- package/src/modules/doc/amfTopic/amfTopic.html +3 -0
- package/src/modules/doc/amfTopic/amfTopic.ts +94 -0
- package/src/modules/doc/amfTopic/types.ts +54 -0
- package/src/modules/doc/amfTopic/utils.ts +130 -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 +64 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +60 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +187 -0
- package/src/modules/doc/content/content.css +399 -0
- package/src/modules/doc/content/content.html +6 -0
- package/src/modules/doc/content/content.ts +378 -0
- package/src/modules/doc/contentCallout/contentCallout.css +56 -0
- package/src/modules/doc/contentCallout/contentCallout.html +15 -0
- package/src/modules/doc/contentCallout/contentCallout.ts +58 -0
- package/src/modules/doc/contentLayout/contentLayout.css +98 -0
- package/src/modules/doc/contentLayout/contentLayout.html +50 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +322 -0
- package/src/modules/doc/contentMedia/contentMedia.css +49 -0
- package/src/modules/doc/contentMedia/contentMedia.html +23 -0
- package/src/modules/doc/contentMedia/contentMedia.ts +34 -0
- package/src/modules/doc/header/header.css +103 -0
- package/src/modules/doc/header/header.html +153 -0
- package/src/modules/doc/header/header.ts +142 -0
- package/src/modules/doc/heading/heading.css +54 -0
- package/src/modules/doc/heading/heading.html +14 -0
- package/src/modules/doc/heading/heading.ts +65 -0
- package/src/modules/doc/headingAnchor/headingAnchor.css +33 -0
- package/src/modules/doc/headingAnchor/headingAnchor.html +19 -0
- package/src/modules/doc/headingAnchor/headingAnchor.ts +43 -0
- 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/nav/nav.css +14 -0
- package/src/modules/doc/nav/nav.html +12 -0
- package/src/modules/doc/nav/nav.ts +39 -0
- package/src/modules/doc/phase/phase.css +55 -0
- package/src/modules/doc/phase/phase.html +28 -0
- package/src/modules/doc/phase/phase.ts +57 -0
- package/src/modules/doc/toc/toc.css +31 -0
- package/src/modules/doc/toc/toc.html +127 -0
- package/src/modules/doc/toc/toc.ts +27 -0
- package/src/modules/doc/toolbar/toolbar.css +8 -0
- package/src/modules/doc/toolbar/toolbar.html +34 -0
- package/src/modules/doc/toolbar/toolbar.ts +79 -0
- package/src/modules/doc/xmlContent/types.ts +114 -0
- package/src/modules/doc/xmlContent/utils.ts +161 -0
- package/src/modules/doc/xmlContent/xmlContent.css +32 -0
- package/src/modules/doc/xmlContent/xmlContent.html +40 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +659 -0
- package/src/modules/docBaseElements/lightningElementWithState/lightningElementWithState.ts +93 -0
- package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
- package/src/modules/docHelpers/phaseContentLayout/phaseContentLayout.css +39 -0
- package/src/modules/docHelpers/status/status.css +22 -0
- package/src/modules/docUtils/SearchSyncer/SearchSyncer.ts +85 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
import { closest } from "kagekiri";
|
|
3
|
+
import { toJson } from "dxUtils/normalizers";
|
|
4
|
+
import { highlightTerms } from "dxUtils/highlight";
|
|
5
|
+
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
6
|
+
|
|
7
|
+
type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
|
|
8
|
+
|
|
9
|
+
const TOC_HEADER_TAG = "DOC-HEADING";
|
|
10
|
+
const HIGHLIGHTABLE_SELECTOR = [
|
|
11
|
+
"p",
|
|
12
|
+
"h1",
|
|
13
|
+
"h2",
|
|
14
|
+
"h3",
|
|
15
|
+
"h4",
|
|
16
|
+
"h5",
|
|
17
|
+
"h6",
|
|
18
|
+
"li",
|
|
19
|
+
"dl",
|
|
20
|
+
"th",
|
|
21
|
+
"td"
|
|
22
|
+
].join(",");
|
|
23
|
+
const OBSERVER_ATTACH_WAIT_TIME = 500;
|
|
24
|
+
|
|
25
|
+
export default class ContentLayout extends LightningElement {
|
|
26
|
+
@api sidebarValue: string;
|
|
27
|
+
@api sidebarHeader: string;
|
|
28
|
+
@api tocTitle: string;
|
|
29
|
+
@api enableSlotChange = false;
|
|
30
|
+
@api coveoOrganizationId!: string;
|
|
31
|
+
@api coveoPublicAccessToken!: string;
|
|
32
|
+
@api coveoSearchHub!: string;
|
|
33
|
+
@api coveoAdvancedQueryConfig!: string;
|
|
34
|
+
@api useOldSidebar?: boolean = false;
|
|
35
|
+
|
|
36
|
+
@api
|
|
37
|
+
get breadcrumbs() {
|
|
38
|
+
return this._breadcrumbs;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set breadcrumbs(value): [] {
|
|
42
|
+
if (value) {
|
|
43
|
+
this._breadcrumbs = toJson(value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@api
|
|
48
|
+
get sidebarContent() {
|
|
49
|
+
return this._sidebarContent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
set sidebarContent(value) {
|
|
53
|
+
this._sidebarContent = toJson(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@api
|
|
57
|
+
get tocOptions() {
|
|
58
|
+
return this._tocOptions;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set tocOptions(value) {
|
|
62
|
+
this._tocOptions = toJson(value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@api
|
|
66
|
+
setSidebarInputValue(searchTerm: string): void {
|
|
67
|
+
this.template.querySelector("dx-sidebar")?.setInputValue(searchTerm);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@track
|
|
71
|
+
private _sidebarContent: unknown;
|
|
72
|
+
|
|
73
|
+
private _breadcrumbs = null;
|
|
74
|
+
|
|
75
|
+
@track
|
|
76
|
+
private _tocOptions: Array<unknown>;
|
|
77
|
+
|
|
78
|
+
private anchoredElements: AnchorMap = {};
|
|
79
|
+
private lastScrollPosition: number;
|
|
80
|
+
private observer?: IntersectionObserver;
|
|
81
|
+
private hasRendered: boolean = false;
|
|
82
|
+
|
|
83
|
+
private searchSyncer = new SearchSyncer({
|
|
84
|
+
callbacks: {
|
|
85
|
+
onUrlChange: (nextSearchString: string): void => {
|
|
86
|
+
this.updateHighlightsAndSearch(nextSearchString);
|
|
87
|
+
},
|
|
88
|
+
onSearchChange: (nextSearchString: string): void => {
|
|
89
|
+
this.dispatchHighlightChange(
|
|
90
|
+
new URLSearchParams(nextSearchString).get("q") || ""
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
eventName: "sidebarsearchchange",
|
|
95
|
+
historyMethod: window.history.pushState,
|
|
96
|
+
searchParam: "q",
|
|
97
|
+
shouldStopPropagation: true,
|
|
98
|
+
target: window
|
|
99
|
+
});
|
|
100
|
+
private tocValue?: string = undefined;
|
|
101
|
+
private observerTimerId = null;
|
|
102
|
+
private didScrollToSelectedHash = false;
|
|
103
|
+
private _scrollInterval = 0;
|
|
104
|
+
|
|
105
|
+
get showToc(): boolean {
|
|
106
|
+
return this.tocOptions && this.tocOptions.length > 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ? This could be a good default for pathname in dx-breadcrumbs. Using this getter for now as a workaround.
|
|
110
|
+
get pathname(): string {
|
|
111
|
+
return window.location.pathname;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
get showBreadcrumbs(): boolean {
|
|
115
|
+
return (
|
|
116
|
+
this.breadcrumbs != null && (this.breadcrumbs as any[]).length > 1
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get docContentStyle(): string {
|
|
121
|
+
return this.showBreadcrumbs ? "" : "margin-top: 48px";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
connectedCallback(): void {
|
|
125
|
+
const hasParentHighlightListener = closest(
|
|
126
|
+
"doc-xml-content",
|
|
127
|
+
this.template.host
|
|
128
|
+
);
|
|
129
|
+
if (!hasParentHighlightListener) {
|
|
130
|
+
window.addEventListener(
|
|
131
|
+
"highlightedtermchange",
|
|
132
|
+
this.updateHighlighted
|
|
133
|
+
);
|
|
134
|
+
this.searchSyncer.init();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this._scrollInterval = window.setInterval(() => {
|
|
138
|
+
this.saveScroll();
|
|
139
|
+
}, 1000);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
renderedCallback(): void {
|
|
143
|
+
/**
|
|
144
|
+
* Note: We are adding timeout because chrome is optimizing and not triggering recent renderedCallback though elements reference is changed
|
|
145
|
+
* Also we are considering recent renderedCallback
|
|
146
|
+
*/
|
|
147
|
+
this.clearRenderObserverTimer();
|
|
148
|
+
this.observerTimerId = setTimeout(
|
|
149
|
+
this.attachInteractionObserver,
|
|
150
|
+
OBSERVER_ATTACH_WAIT_TIME
|
|
151
|
+
);
|
|
152
|
+
if (!this.hasRendered) {
|
|
153
|
+
this.hasRendered = true;
|
|
154
|
+
this.restoreScroll();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
disconnectedCallback(): void {
|
|
159
|
+
this.disconnectObserver();
|
|
160
|
+
window.removeEventListener(
|
|
161
|
+
"highlightedtermchange",
|
|
162
|
+
this.updateHighlighted
|
|
163
|
+
);
|
|
164
|
+
this.searchSyncer.dispose();
|
|
165
|
+
this.clearRenderObserverTimer();
|
|
166
|
+
|
|
167
|
+
window.clearInterval(this._scrollInterval);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
saveScroll() {
|
|
171
|
+
window.history.replaceState(
|
|
172
|
+
{ scrollValue: document.body.scrollTop },
|
|
173
|
+
"",
|
|
174
|
+
window.location.href
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
restoreScroll() {
|
|
179
|
+
document.body.scrollTop = document.documentElement.scrollTop =
|
|
180
|
+
window.history.state?.scrollValue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
clearRenderObserverTimer = () => {
|
|
184
|
+
if (this.observerTimerId) {
|
|
185
|
+
clearTimeout(this.observerTimerId);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
updateHighlighted = (event: Event): void =>
|
|
190
|
+
highlightTerms(
|
|
191
|
+
this.querySelectorAll(HIGHLIGHTABLE_SELECTOR),
|
|
192
|
+
(event as CustomEvent<string>).detail
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
attachInteractionObserver = (): void => {
|
|
196
|
+
if (!this.enableSlotChange) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.disconnectObserver();
|
|
200
|
+
this.observer = new IntersectionObserver((entries) => {
|
|
201
|
+
entries.forEach(
|
|
202
|
+
(entry) =>
|
|
203
|
+
(this.anchoredElements[
|
|
204
|
+
entry.target.getAttribute("id")
|
|
205
|
+
].intersect = entry.isIntersecting)
|
|
206
|
+
);
|
|
207
|
+
this.calculateActualSection();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// Note: We are doing document.querySelectorAll as a quick fix as we are not getting heading elements reference this.querySelectorAll
|
|
211
|
+
const headingElements = document.querySelectorAll(TOC_HEADER_TAG);
|
|
212
|
+
for (const headingElement of headingElements) {
|
|
213
|
+
// Add headingElements to intersectionObserver for highlighting respective RNB item when user scroll
|
|
214
|
+
const id = headingElement.getAttribute("id");
|
|
215
|
+
this.anchoredElements[id] = {
|
|
216
|
+
id,
|
|
217
|
+
intersect: false
|
|
218
|
+
};
|
|
219
|
+
this.observer.observe(headingElement);
|
|
220
|
+
}
|
|
221
|
+
if (!this.didScrollToSelectedHash) {
|
|
222
|
+
this.didScrollToSelectedHash = true;
|
|
223
|
+
this.scrollToHash(headingElements);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
onSlotChange(event: Event): void {
|
|
228
|
+
const slotElements = (
|
|
229
|
+
event.target as HTMLSlotElement
|
|
230
|
+
).assignedElements();
|
|
231
|
+
|
|
232
|
+
if (slotElements.length) {
|
|
233
|
+
const slotContentElement = slotElements[0];
|
|
234
|
+
const headingElements =
|
|
235
|
+
slotContentElement.ownerDocument?.getElementsByTagName(
|
|
236
|
+
TOC_HEADER_TAG
|
|
237
|
+
);
|
|
238
|
+
for (const headingElement of headingElements) {
|
|
239
|
+
// Sometimes elements hash is not being set when slot content is wrapped with div
|
|
240
|
+
headingElement.hash = headingElement.attributes.hash?.nodeValue;
|
|
241
|
+
}
|
|
242
|
+
const tocOptions = [];
|
|
243
|
+
for (const headingElement of headingElements) {
|
|
244
|
+
headingElement.id = headingElement.hash;
|
|
245
|
+
|
|
246
|
+
// Update tocOptions from anchorTags
|
|
247
|
+
const tocItem = {
|
|
248
|
+
anchor: `#${headingElement.hash}`,
|
|
249
|
+
id: headingElement.id,
|
|
250
|
+
label: headingElement.title
|
|
251
|
+
};
|
|
252
|
+
tocOptions.push(tocItem);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
this._tocOptions = tocOptions;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
private disconnectObserver(): void {
|
|
260
|
+
if (this.observer) {
|
|
261
|
+
this.observer.disconnect();
|
|
262
|
+
this.observer = null;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// eslint-disable-next-line no-undef
|
|
267
|
+
private scrollToHash(headingElements: NodeListOf<Element>): void {
|
|
268
|
+
let { hash } = window.location;
|
|
269
|
+
if (hash) {
|
|
270
|
+
hash = hash.substr(1);
|
|
271
|
+
for (const headingElement of headingElements) {
|
|
272
|
+
if (headingElement.getAttribute("id") === hash) {
|
|
273
|
+
headingElement.scrollIntoView({ behavior: "auto" });
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
private calculateActualSection(): void {
|
|
281
|
+
const currentScrollPosition = document.documentElement.scrollTop;
|
|
282
|
+
const id = Object.keys(this.anchoredElements).find(
|
|
283
|
+
(_id) => this.anchoredElements[_id].intersect
|
|
284
|
+
);
|
|
285
|
+
if (id) {
|
|
286
|
+
this.assignElementId(id);
|
|
287
|
+
} else if (currentScrollPosition < this.lastScrollPosition) {
|
|
288
|
+
// The user has scroll up since last update
|
|
289
|
+
this.assignElementId(this.calculatePreviousElementId());
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
this.lastScrollPosition = currentScrollPosition;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private calculatePreviousElementId(): string {
|
|
296
|
+
const keys = Object.keys(this.anchoredElements);
|
|
297
|
+
const currentIndex = keys.findIndex((id) => this.tocValue === id);
|
|
298
|
+
|
|
299
|
+
return currentIndex > 0 ? keys[currentIndex - 1] : undefined;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
private assignElementId(id: string): void {
|
|
303
|
+
this.tocValue = id;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
private dispatchHighlightChange(term: string): void {
|
|
307
|
+
this.dispatchEvent(
|
|
308
|
+
new CustomEvent("highlightedtermchange", {
|
|
309
|
+
detail: term,
|
|
310
|
+
bubbles: true,
|
|
311
|
+
composed: true
|
|
312
|
+
})
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
private updateHighlightsAndSearch(nextSearchString: string): void {
|
|
317
|
+
const nextSearchParam =
|
|
318
|
+
new URLSearchParams(nextSearchString).get("q") || "";
|
|
319
|
+
this.setSidebarInputValue(nextSearchParam);
|
|
320
|
+
this.dispatchHighlightChange(nextSearchParam);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--aspect-ratio: 9 / 16; /* the vertical axis is the first number */
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.content-media-wrapper {
|
|
6
|
+
margin: 36px 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.content-media-title {
|
|
10
|
+
color: var(--dx-g-blue-vibrant-20);
|
|
11
|
+
font-size: var(--dx-g-text-base);
|
|
12
|
+
font-family: var(--dx-g-font-display);
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
background-color: var(--sds-g-gray-4);
|
|
15
|
+
padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-smd);
|
|
16
|
+
border-top-left-radius: 4px;
|
|
17
|
+
border-top-right-radius: 4px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.content-media-image,
|
|
21
|
+
.content-media-iframe {
|
|
22
|
+
border: 1px solid var(--dx-g-gray-90);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.content-media-image img {
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.content-media-iframe {
|
|
31
|
+
position: relative;
|
|
32
|
+
padding-bottom: calc(var(--aspect-ratio, 0.5625) * 100%);
|
|
33
|
+
height: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.content-media-iframe iframe {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.content-media-caption {
|
|
45
|
+
font-family: var(--dx-g-font-sans);
|
|
46
|
+
font-size: var(--dx-g-text-xs);
|
|
47
|
+
margin-top: var(--dx-g-spacing-sm);
|
|
48
|
+
margin-left: var(--dx-g-spacing-smd);
|
|
49
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="content-media-wrapper">
|
|
3
|
+
<div class="content-media-container">
|
|
4
|
+
<div if:true={mediaTitle} class="content-media-title">
|
|
5
|
+
{mediaTitle}
|
|
6
|
+
</div>
|
|
7
|
+
<div class={mediaWrapperClass}>
|
|
8
|
+
<img if:true={isImage} src={contentSrc} alt={mediaTitle} />
|
|
9
|
+
<iframe
|
|
10
|
+
if:true={isIframe}
|
|
11
|
+
title={frameTitle}
|
|
12
|
+
width="560"
|
|
13
|
+
height="315"
|
|
14
|
+
src={contentSrc}
|
|
15
|
+
frameborder="0"
|
|
16
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
17
|
+
allowfullscreen
|
|
18
|
+
></iframe>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div if:true={caption} class="content-media-caption">{caption}</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
export default class ContentMedia extends LightningElement {
|
|
4
|
+
@api mediaTitle?: string = undefined;
|
|
5
|
+
@api contentSrc?: string = undefined;
|
|
6
|
+
@api contentType?: "image" | "iframe" = undefined;
|
|
7
|
+
@api iframeSrc?: string = undefined;
|
|
8
|
+
@api caption?: string = undefined;
|
|
9
|
+
|
|
10
|
+
get mediaWrapperClass(): string {
|
|
11
|
+
return this.contentType === "image"
|
|
12
|
+
? "content-media-image"
|
|
13
|
+
: "content-media-iframe";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get frameTitle(): string {
|
|
17
|
+
if (!this.mediaTitle) {
|
|
18
|
+
console.error(
|
|
19
|
+
"media-title must be specified when using iframe-src attribute."
|
|
20
|
+
);
|
|
21
|
+
return "Embedded iframe";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return this.mediaTitle;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get isImage(): boolean {
|
|
28
|
+
return this.contentType === "image";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get isIframe(): boolean {
|
|
32
|
+
return this.contentType === "iframe";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
@import "dxHelpers/commonHeader";
|
|
2
|
+
|
|
3
|
+
dx-logo {
|
|
4
|
+
min-width: fit-content;
|
|
5
|
+
min-width: -moz-fit-content;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.header_l2 {
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.nav_menu-button {
|
|
13
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-20);
|
|
14
|
+
--dx-c-button-secondary-color-hover: var(
|
|
15
|
+
--dx-g-brand-default-button-color-background-inactive
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nav_menu-ctas {
|
|
20
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
header:not(.has-brand) > .header_l1 {
|
|
24
|
+
background: var(--dx-g-brand-current-color-background);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
header:not(.has-brand) > .header_l2 {
|
|
28
|
+
background: var(--dx-g-brand-current-color-background-2);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.header_l2_group.header_l2_group-right-ctas {
|
|
32
|
+
align-items: baseline;
|
|
33
|
+
}
|
|
34
|
+
|
|
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);
|
|
44
|
+
}
|
|
45
|
+
|
|
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);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (max-width: 740px) {
|
|
60
|
+
.header_l2 {
|
|
61
|
+
padding: 0;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.has-nav-items .header_l2 {
|
|
66
|
+
height: initial;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.header_l2_group {
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.header_l2_group-nav {
|
|
74
|
+
height: var(--dx-g-spacing-3xl);
|
|
75
|
+
padding: 0;
|
|
76
|
+
padding-left: var(--dx-g-spacing-sm);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.header_l2_group-nav_overflow {
|
|
80
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.header_l2_group-title {
|
|
84
|
+
margin-right: 0;
|
|
85
|
+
padding: var(--dx-g-spacing-smd) var(--dx-g-page-padding-horizontal);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.header_l2_group-title .header_lang-dropdown {
|
|
89
|
+
margin-left: auto;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.header_lang-dropdown > dx-button {
|
|
93
|
+
padding: var(--dx-g-spacing-2xs) 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.has-scoped-nav-items > .header_l2 {
|
|
97
|
+
height: unset;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.has-scoped-nav-items .header_l2_group-title {
|
|
101
|
+
border-bottom: 1px solid var(--dx-g-brand-current-color-border-2);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<dx-brand-theme-provider brand={brand}>
|
|
3
|
+
<header class={className}>
|
|
4
|
+
<dx-skip-nav-link></dx-skip-nav-link>
|
|
5
|
+
<dx-banner
|
|
6
|
+
if:true={bannerMarkup}
|
|
7
|
+
banner-markup={bannerMarkup}
|
|
8
|
+
></dx-banner>
|
|
9
|
+
<div class="header_l1">
|
|
10
|
+
<div if:true={showMenuButton} class="nav_menu-ctas">
|
|
11
|
+
<dx-button
|
|
12
|
+
aria-label="Menu Button"
|
|
13
|
+
class="nav_menu-button"
|
|
14
|
+
icon-size="large"
|
|
15
|
+
icon-symbol={mobileMenuIconSymbol}
|
|
16
|
+
variant="tertiary"
|
|
17
|
+
onclick={toggleMobileNavMenu}
|
|
18
|
+
></dx-button>
|
|
19
|
+
</div>
|
|
20
|
+
<dx-logo label={title}></dx-logo>
|
|
21
|
+
<dx-header-nav
|
|
22
|
+
if:true={showDesktopNavItems}
|
|
23
|
+
aria-label="Global Navigation Bar"
|
|
24
|
+
nav-items={navItems}
|
|
25
|
+
onrequestopennavmenu={onRequestOpenNavMenu}
|
|
26
|
+
pathname={pathname}
|
|
27
|
+
variant="small"
|
|
28
|
+
></dx-header-nav>
|
|
29
|
+
<div class="header-cta-container">
|
|
30
|
+
<dx-header-search
|
|
31
|
+
if:true={hasSearch}
|
|
32
|
+
coveo-organization-id={coveoOrganizationId}
|
|
33
|
+
coveo-public-access-token={coveoPublicAccessToken}
|
|
34
|
+
coveo-search-pipeline={coveoSearchPipeline}
|
|
35
|
+
coveo-search-hub={coveoSearchHub}
|
|
36
|
+
mobile={tablet}
|
|
37
|
+
onstatechange={handleStateChange}
|
|
38
|
+
></dx-header-search>
|
|
39
|
+
</div>
|
|
40
|
+
<div if:true={showSignup} class="header-login-signup">
|
|
41
|
+
<dx-button
|
|
42
|
+
aria-label="Sign Up For Salesforce Developer Edition"
|
|
43
|
+
size="small"
|
|
44
|
+
href={signupLink}
|
|
45
|
+
onclick={handleSignUpClick}
|
|
46
|
+
>
|
|
47
|
+
Sign Up
|
|
48
|
+
</dx-button>
|
|
49
|
+
</div>
|
|
50
|
+
<dx-header-mobile-nav-menu
|
|
51
|
+
if:true={hasNavItems}
|
|
52
|
+
nav-items={navItems}
|
|
53
|
+
open={showMobileNavMenu}
|
|
54
|
+
pathname={pathname}
|
|
55
|
+
value={mobileNavMenuValue}
|
|
56
|
+
onchange={onMobileNavMenuChange}
|
|
57
|
+
onrequestclose={closeMobileNavMenu}
|
|
58
|
+
>
|
|
59
|
+
<dx-button
|
|
60
|
+
aria-label={bailLabel}
|
|
61
|
+
if:true={hasBailLink}
|
|
62
|
+
href={bailHref}
|
|
63
|
+
variant="tertiary"
|
|
64
|
+
icon-symbol="new_window"
|
|
65
|
+
>
|
|
66
|
+
{bailLabel}
|
|
67
|
+
</dx-button>
|
|
68
|
+
</dx-header-mobile-nav-menu>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="header_l2">
|
|
71
|
+
<div class="header_l2_group header_l2_group-title">
|
|
72
|
+
<a href={headerHref} class="home-link">
|
|
73
|
+
<dx-icon
|
|
74
|
+
class="brand-icon"
|
|
75
|
+
if:true={isValidBrand}
|
|
76
|
+
sprite="salesforcebrand"
|
|
77
|
+
symbol={brand}
|
|
78
|
+
size="xlarge"
|
|
79
|
+
></dx-icon>
|
|
80
|
+
<span class="subtitle dx-text-heading-4">
|
|
81
|
+
{subtitle}
|
|
82
|
+
</span>
|
|
83
|
+
</a>
|
|
84
|
+
<dx-dropdown
|
|
85
|
+
if:true={showMobileLanguages}
|
|
86
|
+
class="header_lang-dropdown"
|
|
87
|
+
options={languages}
|
|
88
|
+
small
|
|
89
|
+
value={language}
|
|
90
|
+
value-path={langValuePath}
|
|
91
|
+
onchange={onLangChange}
|
|
92
|
+
>
|
|
93
|
+
<dx-button
|
|
94
|
+
aria-label="Select Language"
|
|
95
|
+
variant="inline"
|
|
96
|
+
icon-size="large"
|
|
97
|
+
icon-symbol="world"
|
|
98
|
+
></dx-button>
|
|
99
|
+
</dx-dropdown>
|
|
100
|
+
</div>
|
|
101
|
+
<div
|
|
102
|
+
if:true={hasScopedNavItems}
|
|
103
|
+
class="header_l2_group header_l2_group-nav"
|
|
104
|
+
>
|
|
105
|
+
<div
|
|
106
|
+
class="header_l2_group-nav_overflow"
|
|
107
|
+
onscroll={onNavScroll}
|
|
108
|
+
>
|
|
109
|
+
<dx-header-nav
|
|
110
|
+
aria-label="Scoped Navigation Bar"
|
|
111
|
+
nav-items={scopedNavItems}
|
|
112
|
+
pathname={pathname}
|
|
113
|
+
></dx-header-nav>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div
|
|
117
|
+
if:false={smallMobile}
|
|
118
|
+
class="header_l2_group header_l2_group-right-ctas"
|
|
119
|
+
>
|
|
120
|
+
<dx-dropdown
|
|
121
|
+
if:true={hasLanguages}
|
|
122
|
+
class="header_lang-dropdown"
|
|
123
|
+
options={languages}
|
|
124
|
+
small
|
|
125
|
+
value-path={langValuePath}
|
|
126
|
+
value={language}
|
|
127
|
+
onchange={onLangChange}
|
|
128
|
+
>
|
|
129
|
+
<dx-button
|
|
130
|
+
aria-label="Select Language"
|
|
131
|
+
variant="inline"
|
|
132
|
+
icon-size="small"
|
|
133
|
+
icon-symbol="world"
|
|
134
|
+
>
|
|
135
|
+
{languageLabel}
|
|
136
|
+
</dx-button>
|
|
137
|
+
</dx-dropdown>
|
|
138
|
+
<dx-button
|
|
139
|
+
if:true={hasBailLink}
|
|
140
|
+
aria-label={bailLabel}
|
|
141
|
+
class="header_bail-link"
|
|
142
|
+
href={bailHref}
|
|
143
|
+
variant="tertiary"
|
|
144
|
+
icon-symbol="new_window"
|
|
145
|
+
target="_blank"
|
|
146
|
+
>
|
|
147
|
+
{bailLabel}
|
|
148
|
+
</dx-button>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
</header>
|
|
152
|
+
</dx-brand-theme-provider>
|
|
153
|
+
</template>
|