@salesforcedevs/dx-components 1.3.83 → 1.3.84
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 +3 -6
- package/package.json +2 -3
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +10 -8
- package/src/modules/dx/cardContent/cardContent.html +1 -4
- package/src/modules/dx/cardDocs/cardDocs.html +1 -4
- package/src/modules/dx/codeBlock/codeBlock.css +7 -23
- package/src/modules/dx/codeBlock/codeBlock.html +19 -0
- package/src/modules/dx/codeBlock/codeBlock.ts +110 -70
- package/src/modules/dx/dropdown/dropdown.ts +3 -2
- package/src/modules/dx/filterMenu/filterMenu.html +2 -7
- package/src/modules/dx/filterMenu/filterMenu.ts +3 -4
- package/src/modules/dx/footer/links.ts +4 -2
- package/src/modules/dx/grid/grid.ts +1 -3
- package/src/modules/dx/popover/popover.ts +3 -3
- package/src/modules/dx/searchResults/searchResults.ts +3 -1
- package/src/modules/dx/select/select.ts +3 -2
- package/src/modules/dx/sidebar/sidebar.ts +5 -7
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +5 -2
- package/src/modules/dx/tabPanelList/tabPanelList.ts +2 -2
- package/src/modules/dxBaseElements/matchMediaElement/matchMediaElement.ts +4 -2
- package/src/modules/dxHelpers/code/code.css +296 -0
- package/src/modules/dxUtils/prismjs/prismjs.html +3 -0
- package/src/modules/dxUtils/prismjs/prismjs.ts +167 -287
- package/src/assets/shiki/languages/amp.tmLanguage.json +0 -205
- package/src/assets/shiki/themes/codey-highnoon.json +0 -650
- package/src/assets/shiki/themes/codey-midnight.json +0 -622
- package/src/modules/dxUtils/shiki/languages.ts +0 -18
- package/src/modules/dxUtils/shiki/shiki.ts +0 -75
package/lwc.config.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"modules": [
|
|
3
|
-
{
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"npm": "@salesforcedevs/dw-components"
|
|
8
|
-
}
|
|
3
|
+
{ "dir": "src/modules" },
|
|
4
|
+
{ "npm": "@salesforcedevs/dw-components" }
|
|
9
5
|
],
|
|
10
6
|
"expose": [
|
|
11
7
|
"dx/audio",
|
|
@@ -94,6 +90,7 @@
|
|
|
94
90
|
"dxHelpers/animations",
|
|
95
91
|
"dxHelpers/button",
|
|
96
92
|
"dxHelpers/card",
|
|
93
|
+
"dxHelpers/code",
|
|
97
94
|
"dxHelpers/commonHeader",
|
|
98
95
|
"dxHelpers/reset",
|
|
99
96
|
"dxHelpers/scrollbar",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.84",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"lodash.kebabcase": "^4.1.1",
|
|
25
25
|
"microtip": "0.2.2",
|
|
26
26
|
"salesforce-oauth2": "^0.2.0",
|
|
27
|
-
"shiki": "^0.11.1",
|
|
28
27
|
"throttle-debounce": "^5.0.0",
|
|
29
28
|
"uuid": "^9.0.0"
|
|
30
29
|
},
|
|
@@ -41,5 +40,5 @@
|
|
|
41
40
|
"eventsourcemock": "^2.0.0",
|
|
42
41
|
"luxon": "^3.1.0"
|
|
43
42
|
},
|
|
44
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "09b7aafdaf3a75bf49ecf7691fb51378e6a9c332"
|
|
45
44
|
}
|
|
@@ -85,14 +85,16 @@ export default class Breadcrumbs extends LightningElement {
|
|
|
85
85
|
breadcrumbs: Breadcrumb[]
|
|
86
86
|
): NormalizedBreadcrumb[] {
|
|
87
87
|
const { length } = breadcrumbs;
|
|
88
|
-
return breadcrumbs.map(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
return breadcrumbs.map(
|
|
89
|
+
(breadcrumb, i): NormalizedBreadcrumb => {
|
|
90
|
+
const last = i === length - 1;
|
|
91
|
+
return {
|
|
92
|
+
...breadcrumb,
|
|
93
|
+
asLink: this.hideCurrentLocation || !last,
|
|
94
|
+
last
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
private get breadcrumbDropdownOptions() {
|
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
/>
|
|
22
22
|
</a>
|
|
23
23
|
<div
|
|
24
|
-
class="
|
|
25
|
-
dx-card-base_section-vertical dx-card-base_column
|
|
26
|
-
card_section-text
|
|
27
|
-
"
|
|
24
|
+
class="dx-card-base_section-vertical dx-card-base_column card_section-text"
|
|
28
25
|
>
|
|
29
26
|
<span if:true={label} part="label" class="label dx-text-label-3">
|
|
30
27
|
{label}
|
|
@@ -7,10 +7,7 @@
|
|
|
7
7
|
class="image dx-card-base_image"
|
|
8
8
|
/>
|
|
9
9
|
<div
|
|
10
|
-
class="
|
|
11
|
-
dx-card-base_section-vertical dx-card-base_column
|
|
12
|
-
card_section-text
|
|
13
|
-
"
|
|
10
|
+
class="dx-card-base_section-vertical dx-card-base_column card_section-text"
|
|
14
11
|
>
|
|
15
12
|
<span class="dx-text-label-3">{label}</span>
|
|
16
13
|
<dx-card-title
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@import "dxHelpers/code";
|
|
1
2
|
@import "dxHelpers/text";
|
|
2
3
|
@import "./darkTheme.css";
|
|
3
4
|
@import "./lightTheme.css";
|
|
@@ -101,7 +102,7 @@ div.code-block-content {
|
|
|
101
102
|
background: var(--dx-g-gray-95);
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
code[class*="
|
|
105
|
+
code[class*="language-"] {
|
|
105
106
|
margin-left: -11px;
|
|
106
107
|
}
|
|
107
108
|
|
|
@@ -109,36 +110,19 @@ code[class*="shiki"] {
|
|
|
109
110
|
margin-right: var(--dx-g-spacing-xs);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
|
|
113
|
-
font-style: italic;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
pre[class*="shiki"] {
|
|
117
|
-
font-size: 14px;
|
|
113
|
+
pre[class*="language-"] {
|
|
118
114
|
border-radius: 0 0 0.3em 0.3em;
|
|
119
115
|
padding-bottom: var(--dx-g-spacing-smd);
|
|
120
116
|
background-color: unset;
|
|
121
117
|
padding-top: var(--dx-g-spacing-sm);
|
|
122
118
|
}
|
|
123
119
|
|
|
120
|
+
pre[class*="language-"].line-numbers {
|
|
121
|
+
padding-left: 56px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
124
|
@media screen and (max-width: 640px) {
|
|
125
125
|
.dx-code-block-heading {
|
|
126
126
|
display: none;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
/* Adding line numbers via CSS counters */
|
|
131
|
-
code {
|
|
132
|
-
counter-reset: step;
|
|
133
|
-
counter-increment: step 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
code .line::before {
|
|
137
|
-
content: counter(step);
|
|
138
|
-
counter-increment: step;
|
|
139
|
-
width: 1rem;
|
|
140
|
-
margin-right: 1.5rem;
|
|
141
|
-
display: inline-block;
|
|
142
|
-
text-align: right;
|
|
143
|
-
color: rgba(115, 138, 148, 0.4);
|
|
144
|
-
}
|
|
@@ -7,6 +7,25 @@
|
|
|
7
7
|
{ title }
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
|
+
<template if:true={showLanguageDropdown}>
|
|
11
|
+
<div class="toolbar-item">
|
|
12
|
+
<dx-dropdown
|
|
13
|
+
small="true"
|
|
14
|
+
options={allLanguages}
|
|
15
|
+
value={selectedLanguageId}
|
|
16
|
+
onchange={onLanguageChange}
|
|
17
|
+
>
|
|
18
|
+
<dx-button
|
|
19
|
+
icon-symbol="chevrondown"
|
|
20
|
+
class="btn language-btn"
|
|
21
|
+
variant="custom"
|
|
22
|
+
>
|
|
23
|
+
{ selectedLanguageLabel }
|
|
24
|
+
</dx-button>
|
|
25
|
+
</dx-dropdown>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="divider"></div>
|
|
28
|
+
</template>
|
|
10
29
|
<template if:true={showCodeSourceBtn}>
|
|
11
30
|
<div class="toolbar-item">
|
|
12
31
|
<dx-tooltip
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api, wire, track } from "lwc";
|
|
2
|
-
import { CodeBlockTheme } from "typings/custom";
|
|
2
|
+
import { CodeBlockTheme, CodeBlockLanguage } from "typings/custom";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import
|
|
4
|
+
import Prism from "dxUtils/prismjs";
|
|
5
5
|
import {
|
|
6
6
|
getLocalStorageData,
|
|
7
7
|
setLocalStorageData
|
|
@@ -24,6 +24,39 @@ export default class CodeBlock extends LightningElement {
|
|
|
24
24
|
// if it is true, it renders code as is coming instead of wrapping it into html/xml comments tags.
|
|
25
25
|
@api isEncoded = false;
|
|
26
26
|
|
|
27
|
+
private markupLangs = ["visualforce", "html", "xml"];
|
|
28
|
+
private _codeBlockRendered: boolean = false;
|
|
29
|
+
private componentLoaded: boolean = false;
|
|
30
|
+
private showLanguageDropdown: boolean = false;
|
|
31
|
+
private copyBtnText: string = "Click to copy";
|
|
32
|
+
private selectedLanguageLabel: string = "";
|
|
33
|
+
private selectedLanguageId: string = "";
|
|
34
|
+
private selectedLanguage: CodeBlockLanguage = { label: "Language", id: "" };
|
|
35
|
+
private allLanguages: CodeBlockLanguage[] = [
|
|
36
|
+
{ label: "Language", id: "" },
|
|
37
|
+
{ label: "Apex", id: "apex" },
|
|
38
|
+
{ label: "Java", id: "java" },
|
|
39
|
+
{ label: "Javascript", id: "javascript" },
|
|
40
|
+
{ label: "CSS", id: "css" },
|
|
41
|
+
{ label: "Visualforce", id: "visualforce" },
|
|
42
|
+
{ label: "Html", id: "html" },
|
|
43
|
+
{ label: "xml", id: "xml" },
|
|
44
|
+
{ label: "TypeScript", id: "typescript" },
|
|
45
|
+
{ label: "PHP", id: "php" },
|
|
46
|
+
{ label: "JSON", id: "json" },
|
|
47
|
+
{ label: "Swift", id: "swift" },
|
|
48
|
+
{ label: "Kotlin", id: "kotlin" },
|
|
49
|
+
{ label: "Python", id: "python" },
|
|
50
|
+
{ label: "Bash", id: "bash" },
|
|
51
|
+
{ label: "Shell", id: "shell" },
|
|
52
|
+
{ label: "Shell", id: "sh" },
|
|
53
|
+
{ label: "SQL", id: "sql" },
|
|
54
|
+
{ label: "YAML", id: "yaml" },
|
|
55
|
+
{ label: "Markdown", id: "markdown" },
|
|
56
|
+
{ label: "Markdown", id: "md" },
|
|
57
|
+
{ label: "JSX", id: "jsx" }
|
|
58
|
+
];
|
|
59
|
+
|
|
27
60
|
connectedCallback() {
|
|
28
61
|
if (!this.theme) {
|
|
29
62
|
this.theme = this.defaultTheme;
|
|
@@ -33,11 +66,11 @@ export default class CodeBlock extends LightningElement {
|
|
|
33
66
|
_codeBlock: string = "";
|
|
34
67
|
@api
|
|
35
68
|
set codeBlock(value: string) {
|
|
69
|
+
this._codeBlockRendered = false;
|
|
36
70
|
let match;
|
|
37
|
-
this._codeBlock = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
: match[1]
|
|
71
|
+
this._codeBlock = ((match = preTagRegexp.exec(value.trim())) === null
|
|
72
|
+
? value.trim()
|
|
73
|
+
: match[1]
|
|
41
74
|
).trim();
|
|
42
75
|
}
|
|
43
76
|
|
|
@@ -45,16 +78,12 @@ export default class CodeBlock extends LightningElement {
|
|
|
45
78
|
return this._codeBlock;
|
|
46
79
|
}
|
|
47
80
|
|
|
48
|
-
private copyBtnText = "Click to copy";
|
|
49
81
|
@track private theme: CodeBlockTheme | null = null;
|
|
50
82
|
|
|
51
83
|
@wire(getLocalStorageData, { key: "dx-codeblock-theme" })
|
|
52
84
|
updateThemeForCodeblock(value: any) {
|
|
53
85
|
if (themes.includes(value)) {
|
|
54
86
|
this.theme = value;
|
|
55
|
-
// As styles computation is static the code needs to be reformatted after a theme change
|
|
56
|
-
Shiki.setTheme(this.theme!);
|
|
57
|
-
this.formatCodeBlock();
|
|
58
87
|
} else {
|
|
59
88
|
setLocalStorageData(
|
|
60
89
|
LOCAL_STORAGE_KEY,
|
|
@@ -75,7 +104,7 @@ export default class CodeBlock extends LightningElement {
|
|
|
75
104
|
return cx(`dx-theme-${this.theme}`);
|
|
76
105
|
}
|
|
77
106
|
|
|
78
|
-
|
|
107
|
+
formatCodeBlock() {
|
|
79
108
|
const divEl = this.template.querySelector("div.code-block-content");
|
|
80
109
|
const templateEl = document.createElement("template");
|
|
81
110
|
|
|
@@ -88,13 +117,17 @@ export default class CodeBlock extends LightningElement {
|
|
|
88
117
|
"vvvvv$1vvvvv"
|
|
89
118
|
);
|
|
90
119
|
|
|
91
|
-
if (
|
|
92
|
-
|
|
120
|
+
if (
|
|
121
|
+
!this.isEncoded &&
|
|
122
|
+
this.markupLangs.includes(this.selectedLanguage.id || "")
|
|
123
|
+
) {
|
|
124
|
+
// Temporarily replace HTML comment characters, which Prism would also strip
|
|
125
|
+
cleanCodeBlock = `<!--${cleanCodeBlock.replace(
|
|
93
126
|
/<!--(.*?)-->/gs,
|
|
94
127
|
"@@$1##"
|
|
95
|
-
)}
|
|
128
|
+
)}-->`;
|
|
96
129
|
} else {
|
|
97
|
-
// If this is a non-encoded markup language, encode angle brackets
|
|
130
|
+
// If this is a non-encoded markup language, encode angle brackets that Prism would strip
|
|
98
131
|
cleanCodeBlock = this.isEncoded
|
|
99
132
|
? cleanCodeBlock
|
|
100
133
|
: cleanCodeBlock.replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -103,62 +136,42 @@ export default class CodeBlock extends LightningElement {
|
|
|
103
136
|
// eslint-disable-next-line
|
|
104
137
|
templateEl.innerHTML = `<pre class='codeblock'>${cleanCodeBlock}</pre>`;
|
|
105
138
|
|
|
106
|
-
const codeBlockEls =
|
|
107
|
-
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
// temporary hack to avoid prismjs tokens from showing up in markup languages
|
|
111
|
-
const isDocs = window.location.href.includes("/docs/");
|
|
112
|
-
|
|
113
|
-
const promisesForHighlighted = codeBlockEls.map((codeBlockEl) =>
|
|
139
|
+
const codeBlockEls = templateEl.content.querySelectorAll("pre");
|
|
140
|
+
codeBlockEls.forEach((codeBlockEl) => {
|
|
114
141
|
// eslint-disable-next-line
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
})
|
|
143
|
-
.catch((error) => {
|
|
144
|
-
console.error(error);
|
|
145
|
-
// Italicize anything marked as a "variable" by the docs team
|
|
146
|
-
// eslint-disable-next-line
|
|
147
|
-
codeBlockEl.innerHTML = codeBlockEl.innerHTML.replace(
|
|
148
|
-
/vvvvv(.+?)vvvvv/g,
|
|
149
|
-
"<span class='token italic'>$1</span>"
|
|
150
|
-
);
|
|
151
|
-
})
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
await Promise.all(promisesForHighlighted);
|
|
142
|
+
const codeHTML = codeBlockEl.innerHTML;
|
|
143
|
+
codeBlockEl.classList.add("line-numbers");
|
|
144
|
+
const codeEl = document.createElement("code");
|
|
145
|
+
codeEl.classList.add(
|
|
146
|
+
`language-${
|
|
147
|
+
this.markupLangs.includes(this.selectedLanguage.id || "")
|
|
148
|
+
? "markup"
|
|
149
|
+
: this.selectedLanguage.id
|
|
150
|
+
}`
|
|
151
|
+
);
|
|
152
|
+
// for custom markup content, it is a workaround to be refactored later.
|
|
153
|
+
// eslint-disable-next-line
|
|
154
|
+
this.language !== "text"
|
|
155
|
+
? // eslint-disable-next-line
|
|
156
|
+
(codeEl.innerHTML = codeHTML)
|
|
157
|
+
: (codeEl.textContent = this._codeBlock.trim());
|
|
158
|
+
// eslint-disable-next-line
|
|
159
|
+
codeBlockEl.innerHTML = "";
|
|
160
|
+
codeBlockEl.appendChild(codeEl);
|
|
161
|
+
Prism.highlightAllUnder(codeBlockEl);
|
|
162
|
+
// Italicize anything marked as a "variable" by the docs team
|
|
163
|
+
// eslint-disable-next-line
|
|
164
|
+
codeBlockEl.innerHTML = codeBlockEl.innerHTML.replace(
|
|
165
|
+
/vvvvv(.+?)vvvvv/g,
|
|
166
|
+
"<span class='token italic'>$1</span>"
|
|
167
|
+
);
|
|
168
|
+
});
|
|
155
169
|
|
|
156
170
|
if (divEl) {
|
|
157
171
|
// eslint-disable-next-line
|
|
158
172
|
divEl.innerHTML = "";
|
|
159
173
|
divEl.append(templateEl.content);
|
|
160
|
-
|
|
161
|
-
if (Shiki.isMarkupLanguage(this.language)) {
|
|
174
|
+
if (this.markupLangs.includes(this.selectedLanguage.id || "")) {
|
|
162
175
|
const res = this.template.querySelector(`code.language-markup`);
|
|
163
176
|
if (res) {
|
|
164
177
|
// Restore any temporarily replaced HTML comment characters
|
|
@@ -172,6 +185,25 @@ export default class CodeBlock extends LightningElement {
|
|
|
172
185
|
}
|
|
173
186
|
}
|
|
174
187
|
|
|
188
|
+
onLanguageChange(newLang: any) {
|
|
189
|
+
this.selectedLanguage =
|
|
190
|
+
this.allLanguages.find(
|
|
191
|
+
(lang: CodeBlockLanguage) => lang.id === newLang.detail
|
|
192
|
+
) || this.allLanguages[0];
|
|
193
|
+
this.selectedLanguageLabel = this.selectedLanguage.label;
|
|
194
|
+
this.selectedLanguageId = this.selectedLanguage.id;
|
|
195
|
+
this.formatCodeBlock();
|
|
196
|
+
|
|
197
|
+
gtmTrack(newLang, "custEv_ctaLinkClick", {
|
|
198
|
+
event: "custEv_ctaLinkClick",
|
|
199
|
+
click_text: newLang.detail,
|
|
200
|
+
element_title: "dx-dropdown",
|
|
201
|
+
click_url: this.selectedLanguageId,
|
|
202
|
+
element_type: "link",
|
|
203
|
+
content_category: "code block"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
175
207
|
/**
|
|
176
208
|
* Note: There is a known issue in storybook@6.1.13 where some apis are not available if you access Storybook through IP address.
|
|
177
209
|
* https://github.com/storybookjs/storybook/issues/13529
|
|
@@ -185,8 +217,9 @@ export default class CodeBlock extends LightningElement {
|
|
|
185
217
|
});
|
|
186
218
|
|
|
187
219
|
try {
|
|
188
|
-
const snippetContainer: HTMLElement | null =
|
|
189
|
-
|
|
220
|
+
const snippetContainer: HTMLElement | null = this.template.querySelector(
|
|
221
|
+
".code-block-content"
|
|
222
|
+
);
|
|
190
223
|
if (snippetContainer && snippetContainer.textContent) {
|
|
191
224
|
await navigator.clipboard.writeText(
|
|
192
225
|
snippetContainer.textContent
|
|
@@ -203,9 +236,6 @@ export default class CodeBlock extends LightningElement {
|
|
|
203
236
|
|
|
204
237
|
updateTheme(event: any) {
|
|
205
238
|
this.theme = this.theme === DARK ? LIGHT : DARK;
|
|
206
|
-
// As styles computation is static the code needs to be reformatted after a theme change
|
|
207
|
-
Shiki.setTheme(this.theme);
|
|
208
|
-
this.formatCodeBlock();
|
|
209
239
|
setLocalStorageData(LOCAL_STORAGE_KEY, this.theme);
|
|
210
240
|
|
|
211
241
|
gtmTrack(event.target, "custEv_iconClick", {
|
|
@@ -217,6 +247,16 @@ export default class CodeBlock extends LightningElement {
|
|
|
217
247
|
}
|
|
218
248
|
|
|
219
249
|
renderedCallback() {
|
|
250
|
+
if (this._codeBlockRendered) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this.selectedLanguage =
|
|
254
|
+
this.allLanguages.find(
|
|
255
|
+
(l: CodeBlockLanguage) => l.id === this.language
|
|
256
|
+
) || this.allLanguages[0];
|
|
257
|
+
this.selectedLanguageLabel = this.selectedLanguage.label;
|
|
258
|
+
this.selectedLanguageId = this.selectedLanguage.id;
|
|
220
259
|
this.formatCodeBlock();
|
|
260
|
+
this._codeBlockRendered = true;
|
|
221
261
|
}
|
|
222
262
|
}
|
|
@@ -172,8 +172,9 @@ export default class Dropdown extends LightningElement {
|
|
|
172
172
|
? this.findOptionElementIndex(this.value)
|
|
173
173
|
: 0;
|
|
174
174
|
|
|
175
|
-
const optionToFocus: any =
|
|
176
|
-
|
|
175
|
+
const optionToFocus: any = this.optionsElements[
|
|
176
|
+
defaultIndex < 0 ? 0 : defaultIndex
|
|
177
|
+
];
|
|
177
178
|
if (optionToFocus) {
|
|
178
179
|
optionToFocus.focus();
|
|
179
180
|
this._focusedValue = optionToFocus.option.id;
|
|
@@ -62,10 +62,7 @@
|
|
|
62
62
|
stroke-width="2"
|
|
63
63
|
stroke-linecap="round"
|
|
64
64
|
stroke-linejoin="round"
|
|
65
|
-
class="
|
|
66
|
-
feather feather-chevron-down
|
|
67
|
-
year-caret
|
|
68
|
-
"
|
|
65
|
+
class="feather feather-chevron-down year-caret"
|
|
69
66
|
>
|
|
70
67
|
<polyline
|
|
71
68
|
points="6 9 12 15 18 9"
|
|
@@ -88,9 +85,7 @@
|
|
|
88
85
|
{month.id}
|
|
89
86
|
<span
|
|
90
87
|
if:true={filtersDatesLoading}
|
|
91
|
-
class="
|
|
92
|
-
filters-dates-loading
|
|
93
|
-
"
|
|
88
|
+
class="filters-dates-loading"
|
|
94
89
|
></span>
|
|
95
90
|
<span
|
|
96
91
|
if:false={filtersDatesLoading}
|
|
@@ -80,10 +80,9 @@ export default class FilterMenu extends LightningElement {
|
|
|
80
80
|
|
|
81
81
|
private setIntedeterminateStatus(checkbox: any, value: boolean) {
|
|
82
82
|
if ("isYear" in checkbox.value && !checkbox.value.isYear) {
|
|
83
|
-
const yearCheckBox: any =
|
|
84
|
-
checkbox
|
|
85
|
-
|
|
86
|
-
);
|
|
83
|
+
const yearCheckBox: any = checkbox.parentElement.parentElement.parentElement.querySelector(
|
|
84
|
+
".checkbox-year"
|
|
85
|
+
);
|
|
87
86
|
yearCheckBox.indeterminate = value;
|
|
88
87
|
}
|
|
89
88
|
}
|
|
@@ -81,7 +81,8 @@ export const generalLinksRaw: OptionWithRequiredNested[] = [
|
|
|
81
81
|
options: [
|
|
82
82
|
{
|
|
83
83
|
link: {
|
|
84
|
-
href:
|
|
84
|
+
href:
|
|
85
|
+
"https://trailhead.salesforce.com/trailblazer-community/feed"
|
|
85
86
|
},
|
|
86
87
|
label: "Trailblazer Community",
|
|
87
88
|
id: "Trailblazer Community"
|
|
@@ -158,7 +159,8 @@ export const termsLinks = [
|
|
|
158
159
|
label: "Legal"
|
|
159
160
|
},
|
|
160
161
|
{
|
|
161
|
-
href:
|
|
162
|
+
href:
|
|
163
|
+
"https://www.salesforce.com/company/privacy/full_privacy/#nav_info",
|
|
162
164
|
label: "Use of Cookies"
|
|
163
165
|
},
|
|
164
166
|
{ href: "https://trust.salesforce.com/en/", label: "Trust" },
|
|
@@ -67,8 +67,6 @@ export default class Grid extends LightningElement {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
onSlotChange(e: Event) {
|
|
70
|
-
this._itemCount = (
|
|
71
|
-
e.target as LightningSlotElement
|
|
72
|
-
).assignedElements().length;
|
|
70
|
+
this._itemCount = (e.target as LightningSlotElement).assignedElements().length;
|
|
73
71
|
}
|
|
74
72
|
}
|
|
@@ -246,9 +246,9 @@ export default class Popover extends LightningElement {
|
|
|
246
246
|
const elements = slot.assignedElements();
|
|
247
247
|
const slotted = elements.length === 0 ? null : elements[0];
|
|
248
248
|
// allows dropdown/select to compose popover
|
|
249
|
-
const slotElement = (
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
const slotElement = (slotted?.tagName === "SLOT"
|
|
250
|
+
? slotted.firstChild
|
|
251
|
+
: slotted) as HTMLElement | null;
|
|
252
252
|
const isWorkToDo =
|
|
253
253
|
slotElement &&
|
|
254
254
|
(!this.control || !slotElement.isSameNode(this.control));
|
|
@@ -19,7 +19,9 @@ interface CoveoSearch {
|
|
|
19
19
|
|
|
20
20
|
declare const Coveo: CoveoSearch;
|
|
21
21
|
|
|
22
|
-
function getPaginationState(
|
|
22
|
+
function getPaginationState(
|
|
23
|
+
event: CoveoSDK.IQuerySuccessEventArgs
|
|
24
|
+
): {
|
|
23
25
|
numberOfPages: number;
|
|
24
26
|
currentPage: number;
|
|
25
27
|
} {
|
|
@@ -79,8 +79,9 @@ export default class Select extends LightningElement {
|
|
|
79
79
|
|
|
80
80
|
get selectElement() {
|
|
81
81
|
if (!this._selectElement) {
|
|
82
|
-
this._selectElement =
|
|
83
|
-
|
|
82
|
+
this._selectElement = this.template.querySelector<HTMLSelectElement>(
|
|
83
|
+
"select"
|
|
84
|
+
);
|
|
84
85
|
}
|
|
85
86
|
return this._selectElement;
|
|
86
87
|
}
|
|
@@ -51,11 +51,9 @@ export default class Sidebar extends SidebarBase {
|
|
|
51
51
|
|
|
52
52
|
@api
|
|
53
53
|
setInputValue(searchTerm: string) {
|
|
54
|
-
(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
) as unknown as SidebarSearch
|
|
58
|
-
)?.setInputValue(searchTerm);
|
|
54
|
+
((this.template.querySelector(
|
|
55
|
+
"dx-sidebar-search"
|
|
56
|
+
) as unknown) as SidebarSearch)?.setInputValue(searchTerm);
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
private expanded: boolean = true;
|
|
@@ -215,9 +213,9 @@ export default class Sidebar extends SidebarBase {
|
|
|
215
213
|
return;
|
|
216
214
|
}
|
|
217
215
|
|
|
218
|
-
const search = this.template.querySelector(
|
|
216
|
+
const search = (this.template.querySelector(
|
|
219
217
|
"dx-sidebar-search"
|
|
220
|
-
) as unknown as SidebarSearch;
|
|
218
|
+
) as unknown) as SidebarSearch;
|
|
221
219
|
|
|
222
220
|
if (
|
|
223
221
|
this.isNearBottomOfSearchResults &&
|
|
@@ -247,8 +247,11 @@ export default class SidebarSearch extends LightningElement {
|
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
const {
|
|
251
|
-
|
|
250
|
+
const {
|
|
251
|
+
isLoading,
|
|
252
|
+
firstSearchExecuted,
|
|
253
|
+
results
|
|
254
|
+
} = this.resultList.state;
|
|
252
255
|
|
|
253
256
|
if ((!firstSearchExecuted && !isLoading) || !this.value) {
|
|
254
257
|
// coveo search is firing off some unwanted payloads on startup
|
|
@@ -123,8 +123,8 @@ export default class TabPanelList extends LightningElement {
|
|
|
123
123
|
"dx-tab-panel-item:not(.more-btn-container)"
|
|
124
124
|
);
|
|
125
125
|
const moreBtn = this.template.querySelector(".more-btn-container")!;
|
|
126
|
-
const containerWidth =
|
|
127
|
-
|
|
126
|
+
const containerWidth = this.template.querySelector(".tablist")!
|
|
127
|
+
.offsetWidth;
|
|
128
128
|
let stopWidth = this.template.querySelector(
|
|
129
129
|
"dx-tab-panel-item.more-btn-container"
|
|
130
130
|
)!.offsetWidth;
|
|
@@ -19,8 +19,10 @@ const breakpointConfigs = [
|
|
|
19
19
|
];
|
|
20
20
|
|
|
21
21
|
export abstract class MatchMediaElement extends LightningElement {
|
|
22
|
-
private deviceType:
|
|
23
|
-
|
|
22
|
+
private deviceType:
|
|
23
|
+
| DEVICE_MOBILE
|
|
24
|
+
| DEVICE_TABLET
|
|
25
|
+
| DEVICE_DESKTOP = DEVICE_DESKTOP;
|
|
24
26
|
private matches: {
|
|
25
27
|
match: MediaQueryList;
|
|
26
28
|
callback: (e: MediaQueryListEvent | MediaQueryList) => void;
|