@salesforcedevs/docs-components 1.3.304-ww-fix-alpha1 → 1.3.319-do-dont
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 +1 -0
- package/package.json +1 -1
- package/src/modules/doc/amfReference/amfReference.ts +9 -1
- package/src/modules/doc/amfReference/types.ts +1 -1
- package/src/modules/doc/amfTopic/amfTopic.ts +6 -19
- package/src/modules/doc/amfTopic/types.ts +1 -1
- package/src/modules/doc/doDont/doDont.css +47 -0
- package/src/modules/doc/doDont/doDont.html +27 -0
- package/src/modules/doc/doDont/doDont.ts +17 -0
- package/src/modules/doc/amfTopic/worker.ts +0 -3
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1475,10 +1475,18 @@ export default class AmfReference extends LightningElement {
|
|
|
1475
1475
|
// update topic view
|
|
1476
1476
|
const { referenceId, amfId, type } = this.selectedTopic!;
|
|
1477
1477
|
|
|
1478
|
+
// Adding stringify inside try/catch
|
|
1479
|
+
let amfModelString = "";
|
|
1480
|
+
try {
|
|
1481
|
+
amfModelString = JSON.stringify(this.amfMap[referenceId].model);
|
|
1482
|
+
} catch (error) {
|
|
1483
|
+
console.error(`Error stringifying amf model: ${error}`);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1478
1486
|
// This updates the component in the content section.
|
|
1479
1487
|
this.topicModel = {
|
|
1480
1488
|
type,
|
|
1481
|
-
amf:
|
|
1489
|
+
amf: amfModelString,
|
|
1482
1490
|
parser: this.amfMap[referenceId].parser,
|
|
1483
1491
|
id: amfId
|
|
1484
1492
|
};
|
|
@@ -27,13 +27,17 @@ export default class AmfTopic extends LightningElement {
|
|
|
27
27
|
!this.amf ||
|
|
28
28
|
(value && this._model && value.amf !== this._model?.amf)
|
|
29
29
|
) {
|
|
30
|
-
|
|
30
|
+
try {
|
|
31
|
+
this.amf = value && JSON.parse(value.amf);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(`Error parsing amf model: ${error}`);
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
if (
|
|
33
37
|
!this.type ||
|
|
34
38
|
(value && this._model && value.type !== this._model?.type)
|
|
35
39
|
) {
|
|
36
|
-
this.type = value &&
|
|
40
|
+
this.type = value && value.type;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
this._model = value;
|
|
@@ -105,20 +109,3 @@ export default class AmfTopic extends LightningElement {
|
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The underlying web components we use from api-console mutate their models we pass in.
|
|
111
|
-
* Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
|
|
112
|
-
* @param value JSON Serializable object to clone.
|
|
113
|
-
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
|
|
114
|
-
*/
|
|
115
|
-
function clone(value: any): any {
|
|
116
|
-
const worker = new Worker("./worker.js");
|
|
117
|
-
worker.postMessage(value);
|
|
118
|
-
return new Promise((resolve) => {
|
|
119
|
-
worker.addEventListener("message", (event) => {
|
|
120
|
-
resolve(event.data);
|
|
121
|
-
worker.terminate();
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
.container {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--dx-g-spacing-md);
|
|
8
|
+
flex: 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.doc-do-dont-header {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--dx-g-spacing-sm);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.doc-do-dont-label {
|
|
18
|
+
font-family: var(--dx-g-font-display);
|
|
19
|
+
font-size: var(--dx-g-spacing-md);
|
|
20
|
+
font-weight: var(--dx-g-font-demi);
|
|
21
|
+
line-height: var(--dx-g-spacing-lg);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.doc-do-color {
|
|
25
|
+
color: var(--dx-g-green-vibrant-50);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.doc-dont-color {
|
|
29
|
+
color: var(--dx-g-red-vibrant-30);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.do-dont-image-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
max-height: 480px;
|
|
35
|
+
min-height: 140px;
|
|
36
|
+
padding: var(--dx-g-spacing-3xl) var(--dx-g-spacing-2xl);
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex: 1;
|
|
41
|
+
border-radius: var(--dx-g-spacing-sm);
|
|
42
|
+
border: 1px solid var(--dx-g-brand-default-color-border-2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.doc-do-dont-img {
|
|
46
|
+
object-fit: contain;
|
|
47
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="doc-do-dont-header">
|
|
4
|
+
<template lwc:if={isDo}>
|
|
5
|
+
<dx-icon
|
|
6
|
+
symbol="success"
|
|
7
|
+
size="large"
|
|
8
|
+
color="green-vibrant-50"
|
|
9
|
+
></dx-icon>
|
|
10
|
+
<div class="doc-do-dont-label doc-do-color">Do</div>
|
|
11
|
+
</template>
|
|
12
|
+
<template lwc:else>
|
|
13
|
+
<dx-icon
|
|
14
|
+
symbol="clear"
|
|
15
|
+
size="large"
|
|
16
|
+
color="red-vibrant-30"
|
|
17
|
+
class="doc-do-dont-icon"
|
|
18
|
+
></dx-icon>
|
|
19
|
+
<div class="doc-do-dont-label doc-dont-color">Don't</div>
|
|
20
|
+
</template>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="do-dont-image-container">
|
|
23
|
+
<img class="doc-do-dont-img" src={src} alt={caption} />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="dx-text-body-4">{caption}</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
3
|
+
|
|
4
|
+
export default class DoDont extends LightningElement {
|
|
5
|
+
@api caption: string = "";
|
|
6
|
+
@api src!: string;
|
|
7
|
+
_isDo: boolean = false;
|
|
8
|
+
|
|
9
|
+
@api
|
|
10
|
+
get isDo(): boolean {
|
|
11
|
+
return this._isDo;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
set isDo(value) {
|
|
15
|
+
this._isDo = normalizeBoolean(value);
|
|
16
|
+
}
|
|
17
|
+
}
|