@salesforcedevs/docs-components 0.0.1
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 +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 +134 -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,378 @@
|
|
|
1
|
+
/* eslint-disable @lwc/lwc/no-inner-html */
|
|
2
|
+
import { createElement, LightningElement, api, track } from "lwc";
|
|
3
|
+
import { DocContent, PageReference } from "typings/custom";
|
|
4
|
+
import ContentCallout from "doc/contentCallout";
|
|
5
|
+
import CodeBlock from "dx/codeBlock";
|
|
6
|
+
import ContentMedia from "doc/contentMedia";
|
|
7
|
+
import Button from "dx/button";
|
|
8
|
+
import { highlightTerms } from "dxUtils/highlight";
|
|
9
|
+
|
|
10
|
+
const HIGHLIGHTABLE_SELECTOR = [
|
|
11
|
+
"p",
|
|
12
|
+
".p",
|
|
13
|
+
".shortdesc",
|
|
14
|
+
"h1",
|
|
15
|
+
"h2",
|
|
16
|
+
"h3",
|
|
17
|
+
"h4",
|
|
18
|
+
"h5",
|
|
19
|
+
"h6",
|
|
20
|
+
"li",
|
|
21
|
+
"dl",
|
|
22
|
+
"th",
|
|
23
|
+
"td"
|
|
24
|
+
].join(",");
|
|
25
|
+
|
|
26
|
+
const LANGUAGE_MAP: { [key: string]: string } = {
|
|
27
|
+
js: "javascript"
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default class Content extends LightningElement {
|
|
31
|
+
@api isStorybook: boolean = false;
|
|
32
|
+
@api pageReference!: PageReference;
|
|
33
|
+
@api codeBlockType: string = "card";
|
|
34
|
+
@api showPaginationButtons: boolean = false;
|
|
35
|
+
|
|
36
|
+
@api
|
|
37
|
+
set docsData(value) {
|
|
38
|
+
this._docRendered = false;
|
|
39
|
+
this.docContent = (value && value.trim()) || "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get docsData() {
|
|
43
|
+
return this.docContent;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@api
|
|
47
|
+
set codeBlockTheme(value) {
|
|
48
|
+
this._codeBlockTheme = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get codeBlockTheme() {
|
|
52
|
+
return this._codeBlockTheme;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@track docContent: DocContent = "";
|
|
56
|
+
_codeBlockTheme: string = "dark";
|
|
57
|
+
_docRendered: boolean = false;
|
|
58
|
+
originalCodeBlockThemeValue: String = "";
|
|
59
|
+
|
|
60
|
+
connectedCallback() {
|
|
61
|
+
this.template.addEventListener(
|
|
62
|
+
"themechange",
|
|
63
|
+
this.updateTheme.bind(this) // eslint-disableline no-use-before-define
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
window.addEventListener(
|
|
67
|
+
"highlightedtermchange",
|
|
68
|
+
this.updateHighlighted
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
disconnectedCallback(): void {
|
|
73
|
+
window.removeEventListener(
|
|
74
|
+
"highlightedtermchange",
|
|
75
|
+
this.updateHighlighted
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
updateTheme() {
|
|
80
|
+
this._codeBlockTheme =
|
|
81
|
+
this._codeBlockTheme === "dark" ? "light" : "dark";
|
|
82
|
+
const codeBlockEls = this.template.querySelectorAll("dx-code-block");
|
|
83
|
+
codeBlockEls.forEach((codeBlockEl) => {
|
|
84
|
+
codeBlockEl.setAttribute("theme", this._codeBlockTheme);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
renderPaginationButton(anchorEl: HTMLElement) {
|
|
89
|
+
const isNext = anchorEl.textContent.includes("Next →");
|
|
90
|
+
anchorEl.innerHTML = "";
|
|
91
|
+
const buttonEl = createElement("dx-button", { is: Button });
|
|
92
|
+
const params = isNext
|
|
93
|
+
? { iconSymbol: "chevronright" }
|
|
94
|
+
: {
|
|
95
|
+
iconPosition: "left",
|
|
96
|
+
iconSymbol: "chevronleft",
|
|
97
|
+
variant: "secondary"
|
|
98
|
+
};
|
|
99
|
+
Object.assign(buttonEl, params);
|
|
100
|
+
const textEl = document.createDocumentFragment();
|
|
101
|
+
textEl.textContent = isNext ? "Next" : "Previous";
|
|
102
|
+
buttonEl.appendChild(textEl);
|
|
103
|
+
anchorEl.appendChild(buttonEl);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// We don't use any tracked field here. The challenge is that
|
|
107
|
+
// for security reasons you can't pass pure HTML via a class
|
|
108
|
+
// field to the template. Hence we manipulate the DOM manually.
|
|
109
|
+
insertDocHtml(docContent?: string) {
|
|
110
|
+
const divEl = this.getCleanContainer();
|
|
111
|
+
|
|
112
|
+
if (divEl) {
|
|
113
|
+
divEl.innerHTML = docContent || this.docContent;
|
|
114
|
+
|
|
115
|
+
// Query the code blocks and create a dx-code-block component that contains the code
|
|
116
|
+
const codeBlockEls = divEl.querySelectorAll(".codeSection");
|
|
117
|
+
codeBlockEls.forEach((codeBlockEl) => {
|
|
118
|
+
codeBlockEl.setAttribute("lwc:dom", "manual");
|
|
119
|
+
const classList = codeBlockEl.firstChild.classList;
|
|
120
|
+
let language = "";
|
|
121
|
+
for (const key in classList) {
|
|
122
|
+
if (typeof classList[key] === "string") {
|
|
123
|
+
const className = classList[key];
|
|
124
|
+
if (className.startsWith("brush:")) {
|
|
125
|
+
language = className.split(":")[1];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const blockCmp = createElement("dx-code-block", {
|
|
130
|
+
is: CodeBlock
|
|
131
|
+
});
|
|
132
|
+
Object.assign(blockCmp, {
|
|
133
|
+
codeBlock: codeBlockEl.innerHTML,
|
|
134
|
+
// ! Hot fix for incoming html tags from couchdb for xml blocks, fix me soon please
|
|
135
|
+
language: LANGUAGE_MAP[language] || language,
|
|
136
|
+
theme: this.codeBlockTheme,
|
|
137
|
+
title: "", // Default no title.
|
|
138
|
+
variant: this.codeBlockType,
|
|
139
|
+
isEncoded: true
|
|
140
|
+
});
|
|
141
|
+
// eslint-disable-next-line no-use-before-define
|
|
142
|
+
codeBlockEl.innerHTML = "";
|
|
143
|
+
codeBlockEl.appendChild(blockCmp);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Query the callouts and create a doc-content-callout component that contains the code
|
|
147
|
+
const calloutEls = divEl.querySelectorAll(".message");
|
|
148
|
+
calloutEls.forEach((calloutEl) => {
|
|
149
|
+
const calloutCompEl = createElement("doc-content-callout", {
|
|
150
|
+
is: ContentCallout
|
|
151
|
+
});
|
|
152
|
+
const detailEls = calloutEl.querySelectorAll(
|
|
153
|
+
"p, .p, div.data, ol, ul, p+.codeSection, p~.codeSection, div >.codeSection, .mediaBd > span.ph"
|
|
154
|
+
);
|
|
155
|
+
detailEls.forEach((detailEl) => {
|
|
156
|
+
if (detailEl.innerHTML.trim() !== "") {
|
|
157
|
+
calloutCompEl.appendChild(detailEl);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
let flag = 1;
|
|
162
|
+
for (let i: number = 0; i < detailEls.length; i++) {
|
|
163
|
+
flag &= detailEls[i].innerHTML.trim() === "";
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (flag) {
|
|
167
|
+
const codeEls = calloutEl.querySelectorAll(".codeSection");
|
|
168
|
+
codeEls.forEach((codeEl) => {
|
|
169
|
+
calloutCompEl.appendChild(codeEl);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const type = calloutEl.querySelector("h4").textContent;
|
|
174
|
+
const typeLower = type.toLowerCase();
|
|
175
|
+
Object.assign(calloutCompEl, {
|
|
176
|
+
title: type,
|
|
177
|
+
variant: typeLower
|
|
178
|
+
});
|
|
179
|
+
// eslint-disable-next-line no-use-before-define
|
|
180
|
+
calloutEl.innerHTML = "";
|
|
181
|
+
calloutEl.appendChild(calloutCompEl);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Modify links to work with any domain, links that start with "#" are excluded
|
|
185
|
+
const anchorEls = divEl.querySelectorAll("a:not([href^='#'])");
|
|
186
|
+
|
|
187
|
+
anchorEls.forEach((anchorEl) => {
|
|
188
|
+
if (
|
|
189
|
+
anchorEl.textContent.includes("Next →") ||
|
|
190
|
+
anchorEl.textContent.includes("← Previous")
|
|
191
|
+
) {
|
|
192
|
+
if (this.showPaginationButtons) {
|
|
193
|
+
this.renderPaginationButton(anchorEl);
|
|
194
|
+
} else {
|
|
195
|
+
anchorEl.remove();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ! This is a hack
|
|
200
|
+
// Normalize urls in case it doesn't come complete.
|
|
201
|
+
if (anchorEl.href.startsWith("atlas.")) {
|
|
202
|
+
anchorEl.href = "/docs/" + anchorEl.href;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const href = anchorEl.href.split("/");
|
|
206
|
+
if (
|
|
207
|
+
(href[3] === this.pageReference.docId &&
|
|
208
|
+
this.isStorybook) ||
|
|
209
|
+
href[4] === this.pageReference.docId ||
|
|
210
|
+
href[6] === this.pageReference.docId
|
|
211
|
+
) {
|
|
212
|
+
let updatedURL;
|
|
213
|
+
switch (href.length) {
|
|
214
|
+
case 8:
|
|
215
|
+
updatedURL = href.splice(5).join("/");
|
|
216
|
+
break;
|
|
217
|
+
case 7:
|
|
218
|
+
updatedURL = href.splice(4).join("/");
|
|
219
|
+
break;
|
|
220
|
+
case 6:
|
|
221
|
+
updatedURL = href.splice(3).join("/");
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
updatedURL = href.splice(6).join("/");
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
anchorEl.addEventListener(
|
|
228
|
+
"click",
|
|
229
|
+
// eslint-disable-next-line no-use-before-define
|
|
230
|
+
this.handleNavClick.bind(this)
|
|
231
|
+
);
|
|
232
|
+
// anchor href event is not propagated here as we want SPA nature.
|
|
233
|
+
// But in prerender.io - as javascript is not executed, we want the anchor links are proper (absolute urls).
|
|
234
|
+
anchorEl.setAttribute("href", "/docs/" + updatedURL);
|
|
235
|
+
anchorEl.setAttribute("data-id", "docs/" + updatedURL);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
anchorEl.setAttribute("data-id", anchorEl.href);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// Modify image src to work with any domain and replace images/iframes with doc-content-media
|
|
243
|
+
const imgEls = divEl.querySelectorAll("img, iframe");
|
|
244
|
+
|
|
245
|
+
imgEls.forEach((mediaEl) => {
|
|
246
|
+
const isImage = mediaEl.nodeName === "IMG";
|
|
247
|
+
let src = mediaEl.getAttribute("src");
|
|
248
|
+
if (!src) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const alt = mediaEl.getAttribute("alt");
|
|
252
|
+
const title = mediaEl.getAttribute("title");
|
|
253
|
+
const label = mediaEl.getAttribute("label");
|
|
254
|
+
const width = mediaEl.getAttribute("width");
|
|
255
|
+
const height = mediaEl.getAttribute("height");
|
|
256
|
+
|
|
257
|
+
if (isImage) {
|
|
258
|
+
src = src.startsWith("/")
|
|
259
|
+
? `https://developer.salesforce.com${src}`
|
|
260
|
+
: src.replace(
|
|
261
|
+
window.location.origin,
|
|
262
|
+
"https://developer.salesforce.com"
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
const img: HTMLImageElement = document.createElement("img");
|
|
266
|
+
img.src = src;
|
|
267
|
+
if (alt) {
|
|
268
|
+
img.alt = alt;
|
|
269
|
+
}
|
|
270
|
+
if (title) {
|
|
271
|
+
img.title = title;
|
|
272
|
+
}
|
|
273
|
+
if (height) {
|
|
274
|
+
img.height = parseFloat(height);
|
|
275
|
+
}
|
|
276
|
+
if (width) {
|
|
277
|
+
img.width = parseFloat(width);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
img.className = "content-image";
|
|
281
|
+
mediaEl.parentNode!.insertBefore(img, mediaEl);
|
|
282
|
+
} else {
|
|
283
|
+
const contentMediaEl = createElement("doc-content-media", {
|
|
284
|
+
is: ContentMedia
|
|
285
|
+
});
|
|
286
|
+
Object.assign(contentMediaEl, {
|
|
287
|
+
contentType: "iframe",
|
|
288
|
+
contentSrc: src,
|
|
289
|
+
mediaTitle: alt || title || label
|
|
290
|
+
});
|
|
291
|
+
mediaEl.parentNode!.insertBefore(contentMediaEl, mediaEl);
|
|
292
|
+
}
|
|
293
|
+
mediaEl.remove();
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Once the html has been corectly modified, naviage to the page reference on the page
|
|
298
|
+
if (this.pageReference.hash) {
|
|
299
|
+
this.navigateToHash(this.pageReference.hash);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
private getCleanContainer(): HTMLElement | null {
|
|
304
|
+
const divEl = this.template.querySelector("div");
|
|
305
|
+
if (divEl?.hasChildNodes()) {
|
|
306
|
+
divEl.removeChild(divEl.firstChild!);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return divEl;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
isSamePage(reference: PageReference): boolean {
|
|
313
|
+
return (
|
|
314
|
+
this.pageReference.contentDocumentId ===
|
|
315
|
+
reference.contentDocumentId &&
|
|
316
|
+
this.pageReference.docId === reference.docId &&
|
|
317
|
+
this.pageReference.page === reference.page &&
|
|
318
|
+
this.pageReference.deliverable === reference.deliverable
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
handleNavClick(event: InputEvent) {
|
|
323
|
+
event.preventDefault();
|
|
324
|
+
// eslint-disable-next-line no-use-before-define
|
|
325
|
+
const target = event.currentTarget.dataset.id;
|
|
326
|
+
const [page, docId, deliverable, tempContentDocumentId] =
|
|
327
|
+
target.split("/");
|
|
328
|
+
const [contentDocumentId, hash] = tempContentDocumentId.split("#");
|
|
329
|
+
const newPageReference = {
|
|
330
|
+
page: page,
|
|
331
|
+
docId: docId,
|
|
332
|
+
deliverable: deliverable,
|
|
333
|
+
contentDocumentId: contentDocumentId,
|
|
334
|
+
hash: hash
|
|
335
|
+
};
|
|
336
|
+
this.dispatchEvent(
|
|
337
|
+
new CustomEvent("navclick", {
|
|
338
|
+
detail: {
|
|
339
|
+
pageReference: newPageReference
|
|
340
|
+
},
|
|
341
|
+
bubbles: true,
|
|
342
|
+
composed: true
|
|
343
|
+
})
|
|
344
|
+
);
|
|
345
|
+
|
|
346
|
+
if (this.isSamePage({ ...newPageReference, domain: "" })) {
|
|
347
|
+
this.navigateToHash(window.location.hash);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
updateHighlighted = (event: any) =>
|
|
352
|
+
highlightTerms(
|
|
353
|
+
this.template.querySelectorAll(HIGHLIGHTABLE_SELECTOR),
|
|
354
|
+
event.detail
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
@api
|
|
358
|
+
public navigateToHash(hash: String) {
|
|
359
|
+
const splitHash = hash.split("#");
|
|
360
|
+
if (splitHash.length === 2) {
|
|
361
|
+
hash = splitHash[1];
|
|
362
|
+
}
|
|
363
|
+
const anchorEl = this.template.querySelector(`[id='${hash}']`);
|
|
364
|
+
if (anchorEl) {
|
|
365
|
+
anchorEl.scrollIntoView();
|
|
366
|
+
} else {
|
|
367
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
renderedCallback() {
|
|
372
|
+
if (this._docRendered) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.insertDocHtml();
|
|
376
|
+
this._docRendered = true;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
@import "docHelpers/status";
|
|
4
|
+
|
|
5
|
+
.dx-callout {
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dx-callout-base {
|
|
10
|
+
background-color: var(--dx-g-gray-95);
|
|
11
|
+
border-color: var(--dx-g-gray-50);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dx-callout-note {
|
|
15
|
+
background-color: var(--dx-g-blue-vibrant-95);
|
|
16
|
+
border-color: var(--dx-g-blue-vibrant-50);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dx-callout-tip {
|
|
20
|
+
background-color: var(--dx-g-green-natural-95);
|
|
21
|
+
border-color: var(--dx-g-green-vibrant-60);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dx-callout-caution {
|
|
25
|
+
background-color: var(--dx-g-red-natural-95);
|
|
26
|
+
border-color: var(--dx-g-red-vibrant-50);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dx-callout-warning {
|
|
30
|
+
background-color: var(--dx-g-red-natural-95);
|
|
31
|
+
border-color: var(--dx-g-red-vibrant-50);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.dx-callout-base_section {
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dx-callout-base_section-large {
|
|
39
|
+
width: 100%;
|
|
40
|
+
padding: var(--dx-g-spacing-xl);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* callout column */
|
|
44
|
+
|
|
45
|
+
.dx-callout-base_column {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dx-callout-base_column > *:not(:last-child):not(dx-type-badge-group) {
|
|
51
|
+
margin-bottom: var(--dx-g-spacing-sm);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dx-callout-base_column > dx-type-badge-group {
|
|
55
|
+
margin-bottom: var(--dx-g-spacing-sm);
|
|
56
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class={className}>
|
|
3
|
+
<div class="doc-status-icon dx-callout-icon">
|
|
4
|
+
<dx-icon symbol={iconName} size="large" color={iconColor}></dx-icon>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="dx-callout-content">
|
|
7
|
+
<p class="doc-status-title dx-callout-title dx-text-body-3">
|
|
8
|
+
{title}
|
|
9
|
+
</p>
|
|
10
|
+
<span class="dx-callout-body dx-text-body-3">
|
|
11
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
import { CalloutVariant, LightningSlotElement } from "typings/custom";
|
|
4
|
+
|
|
5
|
+
export default class ContentCallout extends LightningElement {
|
|
6
|
+
@api title!: string;
|
|
7
|
+
@api variant!: CalloutVariant;
|
|
8
|
+
cardVariant?: string;
|
|
9
|
+
iconName?: string;
|
|
10
|
+
iconColor?: string;
|
|
11
|
+
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
switch (this.variant) {
|
|
14
|
+
case "tip":
|
|
15
|
+
this.cardVariant = "dx-callout-tip";
|
|
16
|
+
this.iconColor = "green-vibrant-60";
|
|
17
|
+
this.iconName = "success";
|
|
18
|
+
break;
|
|
19
|
+
case "warning":
|
|
20
|
+
this.cardVariant = "doc-status-container dx-callout-warning";
|
|
21
|
+
this.iconColor = "red-vibrant-50";
|
|
22
|
+
this.iconName = "warning";
|
|
23
|
+
break;
|
|
24
|
+
case "caution":
|
|
25
|
+
this.cardVariant = "dx-callout-caution";
|
|
26
|
+
this.iconColor = "red-vibrant-50";
|
|
27
|
+
this.iconName = "alert";
|
|
28
|
+
break;
|
|
29
|
+
case "important":
|
|
30
|
+
this.cardVariant = "doc-status-container dx-callout-important";
|
|
31
|
+
this.iconColor = "gray-10";
|
|
32
|
+
this.iconName = "announcement";
|
|
33
|
+
break;
|
|
34
|
+
case "note":
|
|
35
|
+
default:
|
|
36
|
+
this.cardVariant = "dx-callout-note";
|
|
37
|
+
this.iconColor = "blue-vibrant-50";
|
|
38
|
+
this.iconName = "info";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get className() {
|
|
43
|
+
return cx(
|
|
44
|
+
"dx-callout",
|
|
45
|
+
"doc-status-base",
|
|
46
|
+
"dx-callout-base_section",
|
|
47
|
+
"dx-callout-base_column",
|
|
48
|
+
this.cardVariant
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private isSlotEmpty: boolean = true;
|
|
53
|
+
private onSlotChange(e: LightningSlotElement) {
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
const slot = e.target;
|
|
56
|
+
this.isSlotEmpty = slot.assignedElements().length === 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--dx-c-content-vertical-spacing: var(--dx-g-spacing-lg);
|
|
3
|
+
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
doc-breadcrumbs {
|
|
8
|
+
--dx-c-popover-z-index: 5;
|
|
9
|
+
|
|
10
|
+
display: block;
|
|
11
|
+
margin-bottom: var(--dx-g-spacing-2xl);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
dx-sidebar,
|
|
15
|
+
dx-sidebar-old {
|
|
16
|
+
--dx-c-sidebar-height: 100%;
|
|
17
|
+
--dx-c-sidebar-vertical-padding: var(--dx-c-content-vertical-spacing);
|
|
18
|
+
|
|
19
|
+
z-index: 6;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dx-toc {
|
|
23
|
+
--dx-c-toc-width: unset;
|
|
24
|
+
|
|
25
|
+
height: calc(100% - var(--dx-c-content-vertical-spacing) * 2);
|
|
26
|
+
margin: var(--dx-c-content-vertical-spacing) 0;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
dx-sidebar,
|
|
31
|
+
dx-toc {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.content {
|
|
36
|
+
display: flex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.content-body-doc-phase-container {
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.content-body-container {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
padding-right: var(--dx-g-page-padding-horizontal);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.content-body {
|
|
50
|
+
margin: var(--dx-g-spacing-sm) var(--dx-c-content-vertical-spacing)
|
|
51
|
+
var(--dx-g-spacing-xl);
|
|
52
|
+
flex: 1;
|
|
53
|
+
width: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.is-sticky {
|
|
57
|
+
height: 100vh;
|
|
58
|
+
position: sticky;
|
|
59
|
+
top: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.right-nav-bar {
|
|
63
|
+
max-width: 275px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media screen and (max-width: 1024px) {
|
|
67
|
+
.right-nav-bar {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media screen and (max-width: 800px) {
|
|
73
|
+
.content-body {
|
|
74
|
+
margin-top: var(--dx-c-content-vertical-spacing);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media screen and (max-width: 768px) {
|
|
79
|
+
.content {
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.content-body-container {
|
|
84
|
+
padding-right: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.left-nav-bar {
|
|
88
|
+
--dx-c-sidebar-height: 80vh;
|
|
89
|
+
|
|
90
|
+
height: unset;
|
|
91
|
+
z-index: 10;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.content-body {
|
|
95
|
+
margin-left: var(--dx-g-spacing-mlg, 20px);
|
|
96
|
+
margin-right: var(--dx-g-spacing-mlg, 20px);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="content">
|
|
3
|
+
<template if:true={useOldSidebar}>
|
|
4
|
+
<dx-sidebar-old
|
|
5
|
+
class="is-sticky left-nav-bar"
|
|
6
|
+
trees={sidebarContent}
|
|
7
|
+
value={sidebarValue}
|
|
8
|
+
header={sidebarHeader}
|
|
9
|
+
>
|
|
10
|
+
<slot name="sidebar-header" slot="header"></slot>
|
|
11
|
+
</dx-sidebar-old>
|
|
12
|
+
</template>
|
|
13
|
+
<template if:false={useOldSidebar}>
|
|
14
|
+
<dx-sidebar
|
|
15
|
+
class="is-sticky left-nav-bar"
|
|
16
|
+
trees={sidebarContent}
|
|
17
|
+
value={sidebarValue}
|
|
18
|
+
header={sidebarHeader}
|
|
19
|
+
coveo-organization-id={coveoOrganizationId}
|
|
20
|
+
coveo-public-access-token={coveoPublicAccessToken}
|
|
21
|
+
coveo-search-hub={coveoSearchHub}
|
|
22
|
+
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
23
|
+
>
|
|
24
|
+
<slot name="sidebar-header" slot="header"></slot>
|
|
25
|
+
</dx-sidebar>
|
|
26
|
+
</template>
|
|
27
|
+
<div class="content-body-doc-phase-container">
|
|
28
|
+
<slot name="doc-phase"></slot>
|
|
29
|
+
<div class="content-body-container">
|
|
30
|
+
<div class="content-body">
|
|
31
|
+
<doc-breadcrumbs
|
|
32
|
+
if:true={showBreadcrumbs}
|
|
33
|
+
breadcrumbs={breadcrumbs}
|
|
34
|
+
></doc-breadcrumbs>
|
|
35
|
+
<div style={docContentStyle}>
|
|
36
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="right-nav-bar is-sticky">
|
|
40
|
+
<dx-toc
|
|
41
|
+
if:true={showToc}
|
|
42
|
+
title={tocTitle}
|
|
43
|
+
options={tocOptions}
|
|
44
|
+
value={tocValue}
|
|
45
|
+
></dx-toc>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|