@salesforcedevs/docs-components 1.16.0 → 1.17.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
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": "1ffac16d66295e04f390e3240328e7f7a9541268"
|
|
29
29
|
}
|
|
@@ -43,26 +43,10 @@ export default class Content extends LightningElement {
|
|
|
43
43
|
return this.docContent;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
@api
|
|
47
|
-
set codeBlockTheme(value) {
|
|
48
|
-
this._codeBlockTheme = value;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get codeBlockTheme() {
|
|
52
|
-
return this._codeBlockTheme;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
46
|
@track docContent: DocContent = "";
|
|
56
|
-
_codeBlockTheme: string = "dark";
|
|
57
47
|
_docRendered: boolean = false;
|
|
58
|
-
originalCodeBlockThemeValue: String = "";
|
|
59
48
|
|
|
60
49
|
connectedCallback() {
|
|
61
|
-
this.template.addEventListener(
|
|
62
|
-
"themechange",
|
|
63
|
-
this.updateTheme.bind(this) // eslint-disableline no-use-before-define
|
|
64
|
-
);
|
|
65
|
-
|
|
66
50
|
window.addEventListener(
|
|
67
51
|
"highlightedtermchange",
|
|
68
52
|
this.updateHighlighted
|
|
@@ -76,15 +60,6 @@ export default class Content extends LightningElement {
|
|
|
76
60
|
);
|
|
77
61
|
}
|
|
78
62
|
|
|
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
63
|
renderPaginationButton(anchorEl: HTMLElement) {
|
|
89
64
|
const isNext = anchorEl.textContent!.includes("Next →");
|
|
90
65
|
anchorEl.innerHTML = "";
|
|
@@ -116,11 +91,11 @@ export default class Content extends LightningElement {
|
|
|
116
91
|
const codeBlockEls = divEl.querySelectorAll(".codeSection");
|
|
117
92
|
codeBlockEls.forEach((codeBlockEl) => {
|
|
118
93
|
codeBlockEl.setAttribute("lwc:dom", "manual");
|
|
119
|
-
const classList =
|
|
94
|
+
const classList = codeBlockEl.firstElementChild?.classList;
|
|
120
95
|
let language = "";
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const className = classList[
|
|
96
|
+
if (classList) {
|
|
97
|
+
for (let i = 0; i < classList.length; i++) {
|
|
98
|
+
const className = classList[i];
|
|
124
99
|
if (className.startsWith("brush:")) {
|
|
125
100
|
language = className.split(":")[1];
|
|
126
101
|
}
|
|
@@ -133,7 +108,6 @@ export default class Content extends LightningElement {
|
|
|
133
108
|
codeBlock: codeBlockEl.innerHTML,
|
|
134
109
|
// ! Hot fix for incoming html tags from couchdb for xml blocks, fix me soon please
|
|
135
110
|
language: LANGUAGE_MAP[language] || language,
|
|
136
|
-
theme: this.codeBlockTheme,
|
|
137
111
|
header: "", // Default no title.
|
|
138
112
|
variant: this.codeBlockType,
|
|
139
113
|
isEncoded: true
|
|
@@ -158,6 +132,7 @@ export default class Content extends LightningElement {
|
|
|
158
132
|
}
|
|
159
133
|
});
|
|
160
134
|
|
|
135
|
+
// Set a flag to 1 (true) if and only if all detailEls have no content.
|
|
161
136
|
let flag = 1;
|
|
162
137
|
for (let i: number = 0; i < detailEls.length; i++) {
|
|
163
138
|
flag &= (detailEls[i].innerHTML.trim() === "") as any; // Dark Magic TM
|
|
@@ -359,7 +334,7 @@ export default class Content extends LightningElement {
|
|
|
359
334
|
);
|
|
360
335
|
|
|
361
336
|
@api
|
|
362
|
-
public navigateToHash(hash: String) {
|
|
337
|
+
public navigateToHash = (hash: String) => {
|
|
363
338
|
const splitHash = hash.split("#");
|
|
364
339
|
if (splitHash.length === 2) {
|
|
365
340
|
hash = splitHash[1];
|
|
@@ -370,7 +345,7 @@ export default class Content extends LightningElement {
|
|
|
370
345
|
} else {
|
|
371
346
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
372
347
|
}
|
|
373
|
-
}
|
|
348
|
+
};
|
|
374
349
|
|
|
375
350
|
renderedCallback() {
|
|
376
351
|
if (this._docRendered) {
|