@salesforcedevs/dx-components 1.20.17-cb-plain-loading-1 → 1.20.18-redocly3

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/dx-components",
3
- "version": "1.20.17-cb-plain-loading-1",
3
+ "version": "1.20.18-redocly3",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -30,13 +30,11 @@ pre {
30
30
  }
31
31
 
32
32
  div.dx-theme-dark {
33
- position: relative;
34
33
  border: var(--dx-g-dark-mode-toggle-button-border);
35
34
  border-radius: var(--dx-code-block-toolbar-border-radius, 0.3em);
36
35
  }
37
36
 
38
37
  div.dx-theme-light {
39
- position: relative;
40
38
  border: var(--dx-g-light-mode-code-block-border);
41
39
  border-radius: var(--dx-code-block-toolbar-border-radius, 0.3em);
42
40
  }
@@ -132,21 +130,3 @@ pre[class*="shiki"] {
132
130
  dx-button {
133
131
  --dx-g-button-icon-color: var(--dx-g-cloud-blue-vibrant-50);
134
132
  }
135
-
136
- .code-block-loader {
137
- position: absolute;
138
- top: 0;
139
- left: 0;
140
- right: 0;
141
- bottom: 0;
142
- display: flex;
143
- align-items: center;
144
- justify-content: center;
145
- background-color: rgb(255 255 255 / 90%);
146
- border-radius: 0 0 0.3em 0.3em;
147
- z-index: 10;
148
- }
149
-
150
- .dx-theme-dark .code-block-loader {
151
- background-color: rgb(0 0 0 / 90%);
152
- }
@@ -73,9 +73,6 @@
73
73
  </div>
74
74
  </div>
75
75
  <div class="code-block-content" lwc:dom="manual"></div>
76
- <div class="code-block-loader" if:true={showLoaderUI}>
77
- <dx-spinner size="medium" variant="brand"></dx-spinner>
78
- </div>
79
76
  </div>
80
77
  </template>
81
78
  <template if:false={codeBlock}>No content provided</template>
@@ -3,7 +3,6 @@ import { CodeBlockTheme, CodeBlockLanguage } from "typings/custom";
3
3
  import cx from "classnames";
4
4
  import { track as gtmTrack } from "dxUtils/analytics";
5
5
  import { highlightCode } from "dxUtils/shiki";
6
- import { normalizeBoolean } from "dxUtils/normalizers";
7
6
 
8
7
  /*
9
8
  Custom language support is handled by the Shiki wrapper module
@@ -32,8 +31,6 @@ export default class CodeBlock extends LightningElement {
32
31
  @api isEncoded = false;
33
32
 
34
33
  private _codeBlockRendered: boolean = false;
35
- private _showLoadingIndicator: boolean = false;
36
- private _isCbHeightCalculated: boolean = false;
37
34
  private markupLangs = ["visualforce", "html", "xml"];
38
35
  private componentLoaded: boolean = false;
39
36
  private showLanguageDropdown: boolean = false;
@@ -85,7 +82,6 @@ export default class CodeBlock extends LightningElement {
85
82
  }
86
83
  set codeBlock(value: string) {
87
84
  this._codeBlockRendered = false;
88
- this._isCbHeightCalculated = false;
89
85
  let match;
90
86
  this._codeBlock = (
91
87
  (match = preTagRegexp.exec(value.trim())) === null
@@ -94,15 +90,6 @@ export default class CodeBlock extends LightningElement {
94
90
  ).trim();
95
91
  }
96
92
 
97
- @api
98
- get showLoadingIndicator() {
99
- return this._showLoadingIndicator;
100
- }
101
-
102
- set showLoadingIndicator(value) {
103
- this._showLoadingIndicator = normalizeBoolean(value);
104
- }
105
-
106
93
  get updateThemeBtnText(): string {
107
94
  return `Switch to ${this.theme === DARK ? "Light" : "Dark"} mode`;
108
95
  }
@@ -115,66 +102,6 @@ export default class CodeBlock extends LightningElement {
115
102
  return cx(`dx-theme-${this.theme}`);
116
103
  }
117
104
 
118
- get showLoaderUI(): boolean {
119
- return (
120
- this.showLoadingIndicator &&
121
- this._isCbHeightCalculated &&
122
- !this._codeBlockRendered
123
- );
124
- }
125
-
126
- private calculateContainerHeight(): number | null {
127
- const computedStyle = window.getComputedStyle(this.template.host);
128
- const customHeight = computedStyle.getPropertyValue(
129
- "--dx-code-block-height"
130
- );
131
-
132
- // If custom height is set, use it
133
- if (
134
- customHeight &&
135
- customHeight !== "unset" &&
136
- !customHeight.includes("auto")
137
- ) {
138
- return parseFloat(customHeight);
139
- }
140
-
141
- // If no custom height, calculate from number of lines + padding
142
- if (this.codeBlock) {
143
- const lines = this.codeBlock.split("\n").length;
144
-
145
- const textSmValue =
146
- parseFloat(computedStyle.getPropertyValue("--dx-g-text-sm")) ||
147
- 14;
148
- const spacingMlgValue =
149
- parseFloat(
150
- computedStyle.getPropertyValue("--dx-g-spacing-mlg")
151
- ) || 20;
152
-
153
- const codeLineHeight = spacingMlgValue;
154
- const codeVerticalPadding = textSmValue * 2;
155
-
156
- return lines * codeLineHeight + codeVerticalPadding;
157
- }
158
-
159
- return null;
160
- }
161
-
162
- private setupLoadingIndicator(): void {
163
- if (!this.showLoadingIndicator) {
164
- return;
165
- }
166
- const containerHeight = this.calculateContainerHeight();
167
- if (containerHeight) {
168
- const contentContainer = this.template.querySelector(
169
- ".code-block-content"
170
- ) as HTMLElement;
171
- if (contentContainer) {
172
- contentContainer.style.height = `${containerHeight}px`;
173
- }
174
- this._isCbHeightCalculated = true;
175
- }
176
- }
177
-
178
105
  private initializeTheme() {
179
106
  window.addEventListener(EVENT_NAME, this.toggleTheme);
180
107
  const darkModeSetting = localStorage.getItem(
@@ -192,9 +119,6 @@ export default class CodeBlock extends LightningElement {
192
119
  }
193
120
 
194
121
  async formatCodeBlock() {
195
- // Show loading indicator immediately
196
- this.setupLoadingIndicator();
197
-
198
122
  const divEl = this.template.querySelector("div.code-block-content");
199
123
  const templateEl = document.createElement("template");
200
124
 
@@ -293,7 +217,6 @@ export default class CodeBlock extends LightningElement {
293
217
  }
294
218
  }
295
219
  }
296
- this._codeBlockRendered = true;
297
220
  }
298
221
 
299
222
  onLanguageChange(newLang: any) {
@@ -381,6 +304,7 @@ export default class CodeBlock extends LightningElement {
381
304
  this.selectedLanguageLabel = this.selectedLanguage.label;
382
305
  this.selectedLanguageId = this.selectedLanguage.id;
383
306
  this.formatCodeBlock();
307
+ this._codeBlockRendered = true;
384
308
  }
385
309
 
386
310
  disconnectedCallback(): void {
@@ -9,7 +9,6 @@
9
9
  language={codeBlockItem.language}
10
10
  source-link={codeBlockItem.sourceLink}
11
11
  is-encoded={codeBlockItem.isEncoded}
12
- show-loading-indicator={showLoadingIndicator}
13
12
  ></dx-code-block>
14
13
  </dx-tab-panel>
15
14
  </template>
@@ -1,24 +1,14 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import { CodeBlockItem } from "typings/custom";
3
- import { safeDecodeURI, toJson, normalizeBoolean } from "dxUtils/normalizers";
3
+ import { safeDecodeURI, toJson } from "dxUtils/normalizers";
4
4
  import { DARK } from "dx/codeBlock";
5
5
 
6
6
  export default class TabbedCodeBlock extends LightningElement {
7
7
  _codeBlocks: CodeBlockItem[] = [];
8
- private _showLoadingIndicator: boolean = false;
9
8
 
10
9
  // By default, we want a dark theme for the tabbed code block; however, if the user changes the theme of any code block, it updates the same across the entire website.
11
10
  @api defaultTheme = DARK;
12
11
 
13
- @api
14
- get showLoadingIndicator() {
15
- return this._showLoadingIndicator;
16
- }
17
-
18
- set showLoadingIndicator(value) {
19
- this._showLoadingIndicator = normalizeBoolean(value);
20
- }
21
-
22
12
  get tabs(): string {
23
13
  // Use the code block headers to create a tabs array as a JSON string
24
14
  return JSON.stringify(