@salesforcedevs/docs-components 0.56.2-seo-test16 → 0.56.2-snyk
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 +10 -2
- package/package.json +13 -12
- package/src/modules/doc/{amfReference/utils.ts → amfModelParser/amfModelParser.ts} +10 -5
- package/src/modules/doc/amfReference/amfReference.css +23 -3
- package/src/modules/doc/amfReference/amfReference.html +34 -21
- package/src/modules/doc/amfReference/amfReference.ts +264 -73
- package/src/modules/doc/amfReference/types.ts +4 -12
- package/src/modules/doc/amfTopic/amfTopic.css +20 -0
- package/src/modules/doc/amfTopic/amfTopic.ts +35 -18
- package/src/modules/doc/amfTopic/types.ts +15 -13
- package/src/modules/doc/amfTopic/utils.ts +12 -6
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +2 -1
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +1 -1
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +22 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.css +9 -1
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +44 -34
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +62 -23
- package/src/modules/doc/componentPlayground/componentPlayground.css +22 -0
- package/src/modules/doc/componentPlayground/componentPlayground.html +15 -0
- package/src/modules/doc/componentPlayground/componentPlayground.ts +20 -0
- package/src/modules/doc/content/content.css +70 -76
- package/src/modules/doc/content/content.ts +20 -16
- package/src/modules/doc/contentCallout/contentCallout.css +15 -7
- package/src/modules/doc/contentCallout/contentCallout.html +13 -4
- package/src/modules/doc/contentCallout/contentCallout.ts +14 -2
- package/src/modules/doc/contentLayout/contentLayout.css +1 -100
- package/src/modules/doc/contentLayout/contentLayout.html +26 -17
- package/src/modules/doc/contentLayout/contentLayout.ts +312 -70
- 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/header/header.css +65 -36
- package/src/modules/doc/header/header.html +40 -139
- package/src/modules/doc/header/header.ts +32 -77
- package/src/modules/doc/heading/heading.css +16 -37
- package/src/modules/doc/heading/heading.html +4 -4
- package/src/modules/doc/heading/heading.ts +12 -10
- package/src/modules/doc/headingAnchor/headingAnchor.css +2 -2
- package/src/modules/doc/headingAnchor/headingAnchor.ts +2 -2
- package/src/modules/doc/headingContent/headingContent.css +6 -8
- package/src/modules/doc/headingContent/headingContent.html +9 -15
- package/src/modules/doc/headingContent/headingContent.ts +2 -14
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +1 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +64 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +168 -0
- package/src/modules/doc/overview/overview.css +40 -0
- package/src/modules/doc/overview/overview.html +34 -0
- package/src/modules/doc/overview/overview.ts +12 -0
- package/src/modules/doc/phase/phase.css +18 -3
- package/src/modules/doc/phase/phase.html +15 -3
- package/src/modules/doc/phase/phase.ts +44 -8
- package/src/modules/doc/specificationContent/specificationContent.css +31 -0
- package/src/modules/doc/specificationContent/specificationContent.html +164 -0
- package/src/modules/doc/specificationContent/specificationContent.ts +121 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
- package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
- package/src/modules/doc/toc/toc.ts +1 -1
- package/src/modules/doc/versionPicker/versionPicker.css +64 -0
- package/src/modules/doc/versionPicker/versionPicker.html +38 -0
- package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
- package/src/modules/doc/xmlContent/types.ts +12 -3
- package/src/modules/doc/xmlContent/utils.ts +17 -12
- package/src/modules/doc/xmlContent/xmlContent.css +32 -3
- package/src/modules/doc/xmlContent/xmlContent.html +33 -15
- package/src/modules/doc/xmlContent/xmlContent.ts +278 -88
- package/src/modules/docHelpers/amfStyle/amfStyle.css +10 -45
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +131 -0
- package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
- package/src/modules/docHelpers/status/status.css +1 -1
- package/src/modules/docUtils/{SearchSyncer/SearchSyncer.ts → searchSyncer/searchSyncer.ts} +1 -0
- package/src/modules/docUtils/utils/__mocks__/coveo.analytics.ts +16 -0
- package/src/modules/docUtils/utils/coveo.analytics.d.ts +10 -0
- package/src/modules/docUtils/utils/utils.ts +32 -0
- package/src/modules/docBaseElements/lightningElementWithState/lightningElementWithState.ts +0 -93
- package/src/modules/docHelpers/phaseContentLayout/phaseContentLayout.css +0 -39
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="specification-properties">
|
|
3
|
+
<template lwc:if={hasAttributes}>
|
|
4
|
+
<doc-heading
|
|
5
|
+
header="Attributes"
|
|
6
|
+
hash="attributes"
|
|
7
|
+
aria-level="2"
|
|
8
|
+
id="attributes"
|
|
9
|
+
></doc-heading>
|
|
10
|
+
<table>
|
|
11
|
+
<thead>
|
|
12
|
+
<tr>
|
|
13
|
+
<th>Name</th>
|
|
14
|
+
<th>Description</th>
|
|
15
|
+
<th>Type</th>
|
|
16
|
+
<th>Default</th>
|
|
17
|
+
<th>Required</th>
|
|
18
|
+
</tr>
|
|
19
|
+
</thead>
|
|
20
|
+
<tbody>
|
|
21
|
+
<template for:each={attributes} for:item="attribute">
|
|
22
|
+
<tr key={attribute.name}>
|
|
23
|
+
<td>
|
|
24
|
+
<span class="code">
|
|
25
|
+
{attribute.nameInKebabCase}
|
|
26
|
+
</span>
|
|
27
|
+
</td>
|
|
28
|
+
<td>{attribute.description}</td>
|
|
29
|
+
<td>{attribute.type}</td>
|
|
30
|
+
<td>{attribute.default}</td>
|
|
31
|
+
<td class="icon-cell">
|
|
32
|
+
<template lwc:if={attribute.required}>
|
|
33
|
+
<dx-icon
|
|
34
|
+
symbol="success"
|
|
35
|
+
size="large"
|
|
36
|
+
color="green-vibrant-65"
|
|
37
|
+
class="icon"
|
|
38
|
+
></dx-icon>
|
|
39
|
+
</template>
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
42
|
+
</template>
|
|
43
|
+
</tbody>
|
|
44
|
+
</table>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<template lwc:if={hasMethods}>
|
|
48
|
+
<doc-heading
|
|
49
|
+
header="Methods"
|
|
50
|
+
hash="methods"
|
|
51
|
+
aria-level="2"
|
|
52
|
+
id="methods"
|
|
53
|
+
></doc-heading>
|
|
54
|
+
<table>
|
|
55
|
+
<thead>
|
|
56
|
+
<tr>
|
|
57
|
+
<th>Name</th>
|
|
58
|
+
<th>Description</th>
|
|
59
|
+
<th>Argument Name</th>
|
|
60
|
+
<th>Argument Type</th>
|
|
61
|
+
<th>Argument Description</th>
|
|
62
|
+
</tr>
|
|
63
|
+
</thead>
|
|
64
|
+
<tbody>
|
|
65
|
+
<template for:each={processedMethods} for:item="method">
|
|
66
|
+
<template lwc:if={method.firstArgument}>
|
|
67
|
+
<tr key={method.name}>
|
|
68
|
+
<td rowspan={method.arguments.length}>
|
|
69
|
+
<span class="code">
|
|
70
|
+
{method.nameInKebabCase}
|
|
71
|
+
</span>
|
|
72
|
+
</td>
|
|
73
|
+
<td rowspan={method.arguments.length}>
|
|
74
|
+
{method.description}
|
|
75
|
+
</td>
|
|
76
|
+
<td class={method.cssForMultipleArguments}>
|
|
77
|
+
{method.firstArgument.name}
|
|
78
|
+
</td>
|
|
79
|
+
<td>{method.firstArgument.type}</td>
|
|
80
|
+
<td>{method.firstArgument.description}</td>
|
|
81
|
+
</tr>
|
|
82
|
+
<template
|
|
83
|
+
for:each={method.remainingArguments}
|
|
84
|
+
for:item="arg"
|
|
85
|
+
>
|
|
86
|
+
<tr key={arg.name}>
|
|
87
|
+
<td>{arg.name}</td>
|
|
88
|
+
<td>{arg.type}</td>
|
|
89
|
+
<td>{arg.description}</td>
|
|
90
|
+
</tr>
|
|
91
|
+
</template>
|
|
92
|
+
</template>
|
|
93
|
+
<template lwc:else>
|
|
94
|
+
<tr key={method.name}>
|
|
95
|
+
<td>
|
|
96
|
+
<span class="code">
|
|
97
|
+
{method.nameInKebabCase}
|
|
98
|
+
</span>
|
|
99
|
+
</td>
|
|
100
|
+
<td>{method.description}</td>
|
|
101
|
+
<td colspan="3"></td>
|
|
102
|
+
</tr>
|
|
103
|
+
</template>
|
|
104
|
+
</template>
|
|
105
|
+
</tbody>
|
|
106
|
+
</table>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<template lwc:if={hasSlots}>
|
|
110
|
+
<doc-heading
|
|
111
|
+
header="Slots"
|
|
112
|
+
hash="slots"
|
|
113
|
+
aria-level="2"
|
|
114
|
+
id="slots"
|
|
115
|
+
></doc-heading>
|
|
116
|
+
<table>
|
|
117
|
+
<thead>
|
|
118
|
+
<tr>
|
|
119
|
+
<th>Name</th>
|
|
120
|
+
<th>Description</th>
|
|
121
|
+
</tr>
|
|
122
|
+
</thead>
|
|
123
|
+
<tbody>
|
|
124
|
+
<template for:each={slots} for:item="slot">
|
|
125
|
+
<tr key={slot.name}>
|
|
126
|
+
<td>
|
|
127
|
+
<span class="code">{slot.nameInKebabCase}</span>
|
|
128
|
+
</td>
|
|
129
|
+
<td>{slot.description}</td>
|
|
130
|
+
</tr>
|
|
131
|
+
</template>
|
|
132
|
+
</tbody>
|
|
133
|
+
</table>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<template lwc:if={hasEvents}>
|
|
137
|
+
<doc-heading
|
|
138
|
+
header="Events"
|
|
139
|
+
hash="events"
|
|
140
|
+
aria-level="2"
|
|
141
|
+
></doc-heading>
|
|
142
|
+
<table>
|
|
143
|
+
<thead>
|
|
144
|
+
<tr>
|
|
145
|
+
<th>Name</th>
|
|
146
|
+
<th>Description</th>
|
|
147
|
+
</tr>
|
|
148
|
+
</thead>
|
|
149
|
+
<tbody>
|
|
150
|
+
<template for:each={events} for:item="event">
|
|
151
|
+
<tr key={event.name}>
|
|
152
|
+
<td>
|
|
153
|
+
<span class="code">
|
|
154
|
+
{event.nameInKebabCase}
|
|
155
|
+
</span>
|
|
156
|
+
</td>
|
|
157
|
+
<td>{event.description}</td>
|
|
158
|
+
</tr>
|
|
159
|
+
</template>
|
|
160
|
+
</tbody>
|
|
161
|
+
</table>
|
|
162
|
+
</template>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { LightningElement, track, api } from "lwc";
|
|
2
|
+
import { Method, Specification } from "typings/custom";
|
|
3
|
+
import debounce from "debounce";
|
|
4
|
+
|
|
5
|
+
const CX_ROUTER_API: string = "/cx-router/components";
|
|
6
|
+
export default class SpecificationContent extends LightningElement {
|
|
7
|
+
@track data: any;
|
|
8
|
+
|
|
9
|
+
@api component!: string;
|
|
10
|
+
@api model!: string;
|
|
11
|
+
@api namespace!: string;
|
|
12
|
+
|
|
13
|
+
private attributes: Specification[] = [];
|
|
14
|
+
private methods: Method[] = [];
|
|
15
|
+
private slots: Specification[] = [];
|
|
16
|
+
private events: Specification[] = [];
|
|
17
|
+
|
|
18
|
+
/* TODO: For now setting the timeout to 300ms,
|
|
19
|
+
* post integration with CX-Router API will test and change if required.
|
|
20
|
+
*/
|
|
21
|
+
private debouncedNotifyDataRendered = debounce(() => {
|
|
22
|
+
this.notifySpecificationDataRendered();
|
|
23
|
+
}, 300);
|
|
24
|
+
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
this.fetchComponentMetadata();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async fetchComponentMetadata() {
|
|
30
|
+
const componentQueryParams = {
|
|
31
|
+
model: this.model,
|
|
32
|
+
namespace: this.namespace,
|
|
33
|
+
component: this.component
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const queryString = new URLSearchParams(
|
|
37
|
+
componentQueryParams
|
|
38
|
+
).toString();
|
|
39
|
+
const url = `${CX_ROUTER_API}?${queryString}`;
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const response = await fetch(url);
|
|
43
|
+
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
// TODO: Will add loader and show error as follow-up
|
|
46
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const result = await response.json();
|
|
50
|
+
|
|
51
|
+
// Due to middleware the data is sent as part of response now.
|
|
52
|
+
this.data = result?.response;
|
|
53
|
+
if (this.data) {
|
|
54
|
+
({
|
|
55
|
+
attributes: this.attributes,
|
|
56
|
+
methods: this.methods,
|
|
57
|
+
slots: this.slots,
|
|
58
|
+
events: this.events
|
|
59
|
+
} = this.data);
|
|
60
|
+
}
|
|
61
|
+
} catch (error) {
|
|
62
|
+
this.data = {};
|
|
63
|
+
console.error("fetchComponentMetadata() failed:", error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* This getter is to preprocess the methods for easier rendering in the template.
|
|
69
|
+
* Each method is augmented with additional properties:
|
|
70
|
+
* - `firstArgument`: The first argument (if any).
|
|
71
|
+
* - `remainingArguments`: All other arguments (if any).
|
|
72
|
+
* - `hasArguments`: A boolean indicating whether the method has arguments or not.
|
|
73
|
+
*/
|
|
74
|
+
get processedMethods(): Method[] {
|
|
75
|
+
return this.methods.map((method) => {
|
|
76
|
+
const [firstArgument, ...remainingArguments] =
|
|
77
|
+
method.arguments || [];
|
|
78
|
+
return {
|
|
79
|
+
...method,
|
|
80
|
+
firstArgument,
|
|
81
|
+
remainingArguments,
|
|
82
|
+
hasArguments: method.arguments && method.arguments.length > 0,
|
|
83
|
+
cssForMultipleArguments:
|
|
84
|
+
remainingArguments.length > 0 ? "left-border" : ""
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
get hasAttributes() {
|
|
90
|
+
return this.attributes?.length > 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
get hasMethods() {
|
|
94
|
+
return this.methods?.length > 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
get hasSlots() {
|
|
98
|
+
return this.slots?.length > 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
get hasEvents() {
|
|
102
|
+
return this.events?.length > 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
renderedCallback(): void {
|
|
106
|
+
if (this.data) {
|
|
107
|
+
this.debouncedNotifyDataRendered();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
notifySpecificationDataRendered() {
|
|
112
|
+
// Dispatch a custom event to notify the specification tab has rendered.
|
|
113
|
+
this.dispatchEvent(
|
|
114
|
+
new CustomEvent("specificationdatarendered", {
|
|
115
|
+
detail: { name: "doc-specification-content" },
|
|
116
|
+
bubbles: true,
|
|
117
|
+
composed: true
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template lwc:render-mode="light">
|
|
2
|
+
<dx-hr no-padding spacing="md"></dx-hr>
|
|
3
|
+
<div class="survey-container">
|
|
4
|
+
<div class="text-container">
|
|
5
|
+
<b>DID THIS ARTICLE SOLVE YOUR ISSUE?</b>
|
|
6
|
+
<br />
|
|
7
|
+
Let us know so we can improve!
|
|
8
|
+
</div>
|
|
9
|
+
<div class="btn-container">
|
|
10
|
+
<dx-button
|
|
11
|
+
variant="secondary"
|
|
12
|
+
aria-label="Share Your Feedback"
|
|
13
|
+
onclick={openSurvey}
|
|
14
|
+
>
|
|
15
|
+
Share your feedback
|
|
16
|
+
</dx-button>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<dx-hr no-padding spacing="md"></dx-hr>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:host .survey-container {
|
|
2
|
+
align-items: center;
|
|
3
|
+
align-content: center;
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
margin: 20px 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dx-hr:first-of-type::part(hr) {
|
|
11
|
+
margin-top: var(--dx-g-spacing-2xl);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.text-container {
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LightningElement } from "lwc";
|
|
2
|
+
import cx from "classnames";
|
|
3
|
+
|
|
4
|
+
declare const Sprig: (eventType: string, eventNme: string) => void;
|
|
5
|
+
|
|
6
|
+
export default class Phase extends LightningElement {
|
|
7
|
+
static renderMode = "light";
|
|
8
|
+
|
|
9
|
+
get className() {
|
|
10
|
+
return cx("container");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
openSurvey() {
|
|
14
|
+
Sprig("track", "ProvideFeedback");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -11,7 +11,7 @@ export default class Toc extends LightningElement {
|
|
|
11
11
|
const newPageReference = { ...this.pageReference };
|
|
12
12
|
// When moving to the new navigation component
|
|
13
13
|
//const target = event.detail.name.split('-')
|
|
14
|
-
const target = event.currentTarget.dataset.id.split("-");
|
|
14
|
+
const target = (event.currentTarget as any).dataset.id.split("-");
|
|
15
15
|
newPageReference.contentDocumentId = target[0] + ".htm";
|
|
16
16
|
newPageReference.hash = target[1];
|
|
17
17
|
this.dispatchEvent(
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
/* NOTE: doc-version-picker-width width variable is used by both dx-button and dx-dropdown to maintain a consistent width. */
|
|
4
|
+
:host {
|
|
5
|
+
--dx-c-dropdown-option-font-weight: normal;
|
|
6
|
+
--dx-c-dropdown-option-label-color: var(--dx-g-gray-10);
|
|
7
|
+
--popover-container-open-transform: translateY(4px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.version-picker-container {
|
|
11
|
+
padding: 8px var(--dx-g-spacing-lg) 8px
|
|
12
|
+
var(--dx-g-global-header-padding-horizontal);
|
|
13
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
14
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.version-picker-button {
|
|
18
|
+
display: flex;
|
|
19
|
+
width: var(--doc-version-picker-width, 296px);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.version-picker-button:hover,
|
|
23
|
+
.version-picker-button:active,
|
|
24
|
+
.version-picker-button:focus {
|
|
25
|
+
--dx-c-button-secondary-color-hover: var(--dx-g-cloud-blue-vibrant-95);
|
|
26
|
+
--dx-c-button-primary-color: var(--dx-g-blue-vibrant-40);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* NOTE: This CSS ensures the span inside the button stays within the parent's width, avoiding overflow.
|
|
31
|
+
* Not keeping this in common component to ensure that existing functionality works as it is.
|
|
32
|
+
*/
|
|
33
|
+
dx-button::part(content) {
|
|
34
|
+
width: inherit;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.selected-version {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
align-items: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.selected-version-label {
|
|
45
|
+
flex: 1;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
text-align: left;
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
dx-type-badge.latest-badge {
|
|
53
|
+
--dx-c-type-badge-color: var(--dx-g-green-vibrant-40);
|
|
54
|
+
--dx-c-type-badge-background: var(--dx-g-green-vibrant-95);
|
|
55
|
+
|
|
56
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
dx-type-badge.not-latest-badge {
|
|
60
|
+
--dx-c-type-badge-color: var(--dx-g-red-vibrant-40);
|
|
61
|
+
--dx-c-type-badge-background: var(--dx-g-red-vibrant-95);
|
|
62
|
+
|
|
63
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
64
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div lwc:if={showVersionPicker} class="version-picker-container">
|
|
3
|
+
<dx-dropdown
|
|
4
|
+
options={versions}
|
|
5
|
+
value={selectedVersion.id}
|
|
6
|
+
width="var(--doc-version-picker-width)"
|
|
7
|
+
onchange={onVersionChange}
|
|
8
|
+
>
|
|
9
|
+
<dx-button
|
|
10
|
+
class="version-picker-button"
|
|
11
|
+
variant="tertiary"
|
|
12
|
+
size="small"
|
|
13
|
+
icon-symbol="chevrondown"
|
|
14
|
+
icon-size="medium"
|
|
15
|
+
>
|
|
16
|
+
<div class="selected-version">
|
|
17
|
+
<p class="selected-version-label">
|
|
18
|
+
{selectedVersion.label}
|
|
19
|
+
</p>
|
|
20
|
+
<template lwc:if={showLatestTag}>
|
|
21
|
+
<dx-type-badge
|
|
22
|
+
class="latest-badge"
|
|
23
|
+
lwc:if={latestVersion}
|
|
24
|
+
value="Latest"
|
|
25
|
+
size="small"
|
|
26
|
+
></dx-type-badge>
|
|
27
|
+
<dx-type-badge
|
|
28
|
+
class="not-latest-badge"
|
|
29
|
+
lwc:else
|
|
30
|
+
value="Not Latest"
|
|
31
|
+
size="small"
|
|
32
|
+
></dx-type-badge>
|
|
33
|
+
</template>
|
|
34
|
+
</div>
|
|
35
|
+
</dx-button>
|
|
36
|
+
</dx-dropdown>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
|
|
3
|
+
import { AnalyticsPayload, OptionWithNested } from "typings/custom";
|
|
4
|
+
|
|
5
|
+
import { toJson, normalizeBoolean } from "dxUtils/normalizers";
|
|
6
|
+
|
|
7
|
+
export default class VersionPicker extends LightningElement {
|
|
8
|
+
@api analyticsEvent?: string;
|
|
9
|
+
@api analyticsPayload?: AnalyticsPayload;
|
|
10
|
+
|
|
11
|
+
@track private _versions!: OptionWithNested[];
|
|
12
|
+
private _selectedVersion?: OptionWithNested;
|
|
13
|
+
private _latestVersion: boolean = false;
|
|
14
|
+
private _hideBadge: boolean = false;
|
|
15
|
+
|
|
16
|
+
@api
|
|
17
|
+
get versions() {
|
|
18
|
+
return this._versions;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
set versions(value: OptionWithNested[]) {
|
|
22
|
+
this._versions = toJson(value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@api
|
|
26
|
+
get selectedVersion(): OptionWithNested | undefined {
|
|
27
|
+
return this._selectedVersion || this.versions[0];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
set selectedVersion(value: OptionWithNested) {
|
|
31
|
+
if (value) {
|
|
32
|
+
this._selectedVersion = toJson(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@api
|
|
37
|
+
get latestVersion() {
|
|
38
|
+
return this._latestVersion;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set latestVersion(value) {
|
|
42
|
+
this._latestVersion = normalizeBoolean(value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@api
|
|
46
|
+
get hideBadge() {
|
|
47
|
+
return this._hideBadge;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
set hideBadge(value) {
|
|
51
|
+
this._hideBadge = normalizeBoolean(value);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private get showVersionPicker() {
|
|
55
|
+
return this._versions && this._versions.length !== 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private get showLatestTag(): boolean {
|
|
59
|
+
return !this.hideBadge;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private onVersionChange(e: CustomEvent) {
|
|
63
|
+
this.dispatchEvent(new CustomEvent("change", { detail: e.detail }));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -24,6 +24,7 @@ export type TreeNode = {
|
|
|
24
24
|
name: string;
|
|
25
25
|
children?: Array<TreeNode>;
|
|
26
26
|
isExpanded?: boolean;
|
|
27
|
+
parent?: TreeNode;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
type DropdownOption = {
|
|
@@ -34,6 +35,9 @@ type DropdownOption = {
|
|
|
34
35
|
export type DocVersion = DropdownOption & {
|
|
35
36
|
releaseVersion: string;
|
|
36
37
|
url: string;
|
|
38
|
+
link?: {
|
|
39
|
+
href: string;
|
|
40
|
+
};
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
export type DocLanguage = DropdownOption & {
|
|
@@ -57,12 +61,15 @@ export type ApiDocLanguage = {
|
|
|
57
61
|
|
|
58
62
|
export interface Header extends Element {
|
|
59
63
|
subtitle: string;
|
|
64
|
+
headerHref: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type SiderbarFooter = {
|
|
60
68
|
bailHref: string;
|
|
61
69
|
bailLabel: string;
|
|
62
70
|
languages: Array<DocLanguage>;
|
|
63
|
-
language
|
|
64
|
-
|
|
65
|
-
}
|
|
71
|
+
language?: string;
|
|
72
|
+
};
|
|
66
73
|
|
|
67
74
|
export type ApiNavItem = {
|
|
68
75
|
children: Array<ApiNavItem>;
|
|
@@ -109,3 +116,5 @@ export type ContentApiOptions = {
|
|
|
109
116
|
version: string;
|
|
110
117
|
language: string;
|
|
111
118
|
};
|
|
119
|
+
|
|
120
|
+
export type TocMap = { [key: string]: TreeNode };
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
DocumentData,
|
|
9
9
|
DocLanguage,
|
|
10
10
|
DocVersion,
|
|
11
|
-
TreeNode
|
|
11
|
+
TreeNode,
|
|
12
|
+
TocMap
|
|
12
13
|
} from "./types";
|
|
13
14
|
import { Language } from "typings/custom";
|
|
14
15
|
import { getLanguageDisplayTextById } from "dxUtils/language";
|
|
@@ -86,7 +87,9 @@ export class FetchContent {
|
|
|
86
87
|
return json;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
private normalizeToc(
|
|
90
|
+
private normalizeToc(
|
|
91
|
+
apiToc: Array<ApiNavItem>
|
|
92
|
+
): {
|
|
90
93
|
tocMap: { [key: string]: TreeNode };
|
|
91
94
|
normalizedToc: Array<TreeNode>;
|
|
92
95
|
} {
|
|
@@ -100,26 +103,26 @@ export class FetchContent {
|
|
|
100
103
|
|
|
101
104
|
private normalizeNavItem(
|
|
102
105
|
navItem: ApiNavItem,
|
|
103
|
-
tocMap:
|
|
106
|
+
tocMap: TocMap,
|
|
107
|
+
parentNavItem?: TreeNode
|
|
104
108
|
): TreeNode {
|
|
105
109
|
const name = this.calculateNavItemName(navItem, tocMap);
|
|
106
110
|
const node: TreeNode = {
|
|
107
111
|
label: navItem.text,
|
|
108
|
-
name
|
|
112
|
+
name,
|
|
113
|
+
parent: parentNavItem
|
|
109
114
|
};
|
|
115
|
+
|
|
110
116
|
if (name) {
|
|
111
117
|
tocMap[name] = node;
|
|
112
118
|
}
|
|
113
119
|
node.children = navItem.children?.map((child) =>
|
|
114
|
-
this.normalizeNavItem(child, tocMap)
|
|
120
|
+
this.normalizeNavItem(child, tocMap, node)
|
|
115
121
|
);
|
|
116
122
|
return node;
|
|
117
123
|
}
|
|
118
124
|
|
|
119
|
-
private calculateNavItemName(
|
|
120
|
-
navItem: ApiNavItem,
|
|
121
|
-
tocMap: { [key: string]: TreeNode }
|
|
122
|
-
): string {
|
|
125
|
+
private calculateNavItemName(navItem: ApiNavItem, tocMap: TocMap): string {
|
|
123
126
|
let href = navItem.a_attr?.href || "";
|
|
124
127
|
if (href.includes("#")) {
|
|
125
128
|
const [pathUrl] = href.split("#");
|
|
@@ -144,11 +147,13 @@ export class FetchContent {
|
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
private normalizeLanguage(language: ApiDocLanguage): DocLanguage {
|
|
147
|
-
|
|
148
150
|
return (
|
|
149
151
|
language && {
|
|
150
|
-
label:
|
|
151
|
-
|
|
152
|
+
label:
|
|
153
|
+
getLanguageDisplayTextById(
|
|
154
|
+
this.languages,
|
|
155
|
+
language.locale
|
|
156
|
+
) || language.label,
|
|
152
157
|
id: language.locale,
|
|
153
158
|
code: language.code,
|
|
154
159
|
url: language.url
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
--button-primary-color-hover: var(--dx-g-blue-vibrant-40);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
doc-content-layout {
|
|
7
|
+
--dx-c-content-sidebar-sticky-top: var(--dx-g-global-header-height);
|
|
8
|
+
--dx-c-sidebar-height: calc(100vh - var(--dx-g-global-header-height));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
doc-breadcrumbs {
|
|
12
|
+
--dx-c-popover-z-index: 5;
|
|
13
|
+
|
|
14
|
+
display: block;
|
|
15
|
+
margin-bottom: var(--dx-g-spacing-md);
|
|
16
|
+
}
|
|
17
|
+
|
|
6
18
|
dx-dropdown {
|
|
7
19
|
--dx-c-dropdown-option-font-size: var(--dx-g-text-sm);
|
|
8
20
|
}
|
|
@@ -19,7 +31,24 @@ dx-dropdown > dx-button:hover {
|
|
|
19
31
|
--border-color: var(--button-primary-color-hover);
|
|
20
32
|
}
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
doc-phase {
|
|
35
|
+
--doc-c-phase-top: var(--dx-g-global-header-height);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media screen and (max-width: 768px) {
|
|
39
|
+
doc-content-layout {
|
|
40
|
+
--dx-g-doc-header-main-nav-height: 41px;
|
|
41
|
+
--dx-g-doc-header-height: calc(
|
|
42
|
+
var(--dx-g-doc-header-main-nav-height) + 40px
|
|
43
|
+
);
|
|
44
|
+
--dx-c-content-sidebar-sticky-top: calc(
|
|
45
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
doc-phase {
|
|
50
|
+
--doc-c-phase-top: calc(
|
|
51
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
25
54
|
}
|