@salesforcedevs/docs-components 0.54.0 → 0.54.1-a01
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 +6 -2
- package/package.json +12 -4
- package/src/modules/README.md +41 -0
- package/src/modules/doc/amfReference/amfReference.css +5 -0
- package/src/modules/doc/amfReference/amfReference.html +47 -0
- package/src/modules/doc/amfReference/amfReference.ts +1309 -0
- package/src/modules/doc/amfReference/constants.ts +76 -0
- package/src/modules/doc/amfReference/types.ts +133 -0
- package/src/modules/doc/amfReference/utils.ts +669 -0
- package/src/modules/doc/amfTopic/amfTopic.css +1 -0
- package/src/modules/doc/amfTopic/amfTopic.html +3 -0
- package/src/modules/doc/amfTopic/amfTopic.ts +94 -0
- package/src/modules/doc/amfTopic/types.ts +54 -0
- package/src/modules/doc/amfTopic/utils.ts +130 -0
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +4 -3
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +1 -1
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +17 -1
- package/src/modules/doc/breadcrumbs/breadcrumbs.css +11 -3
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +12 -2
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +50 -9
- package/src/modules/doc/content/content.css +35 -11
- package/src/modules/doc/content/content.ts +18 -3
- package/src/modules/doc/contentCallout/contentCallout.css +4 -4
- package/src/modules/doc/contentCallout/contentCallout.ts +5 -0
- package/src/modules/doc/contentLayout/contentLayout.css +98 -0
- package/src/modules/doc/contentLayout/contentLayout.html +48 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +287 -0
- package/src/modules/doc/header/header.css +1 -1
- package/src/modules/doc/header/header.ts +5 -5
- package/src/modules/doc/headingAnchor/headingAnchor.css +1 -1
- package/src/modules/doc/headingContent/headingContent.css +5 -1
- package/src/modules/doc/phase/phase.css +3 -3
- package/src/modules/doc/phase/phase.ts +1 -1
- package/src/modules/doc/xmlContent/types.ts +114 -0
- package/src/modules/doc/xmlContent/utils.ts +161 -0
- package/src/modules/doc/xmlContent/xmlContent.css +32 -0
- package/src/modules/doc/xmlContent/xmlContent.html +39 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +651 -0
- package/src/modules/docBaseElements/lightningElementWithState/lightningElementWithState.ts +93 -0
- package/src/modules/docHelpers/amfStyle/amfStyle.css +390 -0
- package/src/modules/docHelpers/phaseContentLayout/phaseContentLayout.css +39 -0
- package/src/modules/{helpers → docHelpers}/status/status.css +0 -0
- package/src/modules/docUtils/SearchSyncer/SearchSyncer.ts +85 -0
- package/LICENSE +0 -12
|
@@ -26,6 +26,11 @@ export default class ContentCallout extends LightningElement {
|
|
|
26
26
|
this.iconColor = "red-vibrant-50";
|
|
27
27
|
this.iconName = "alert";
|
|
28
28
|
break;
|
|
29
|
+
case "important":
|
|
30
|
+
this.cardVariant = "doc-status-container dx-callout-important";
|
|
31
|
+
this.iconColor = "gray-10";
|
|
32
|
+
this.iconName = "announcement";
|
|
33
|
+
break;
|
|
29
34
|
case "note":
|
|
30
35
|
default:
|
|
31
36
|
this.cardVariant = "dx-callout-note";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--dx-c-content-vertical-spacing: var(--dx-g-spacing-lg);
|
|
3
|
+
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
doc-breadcrumbs {
|
|
8
|
+
--dx-c-popover-z-index: 5;
|
|
9
|
+
|
|
10
|
+
display: block;
|
|
11
|
+
margin-bottom: var(--dx-g-spacing-2xl);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
dx-sidebar,
|
|
15
|
+
dx-sidebar-old {
|
|
16
|
+
--dx-c-sidebar-height: 100%;
|
|
17
|
+
--dx-c-sidebar-vertical-padding: var(--dx-c-content-vertical-spacing);
|
|
18
|
+
|
|
19
|
+
z-index: 6;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dx-toc {
|
|
23
|
+
--dx-c-toc-width: unset;
|
|
24
|
+
|
|
25
|
+
height: calc(100% - var(--dx-c-content-vertical-spacing) * 2);
|
|
26
|
+
margin: var(--dx-c-content-vertical-spacing) 0;
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
dx-sidebar,
|
|
31
|
+
dx-toc {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.content {
|
|
36
|
+
display: flex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.content-body-doc-phase-container {
|
|
40
|
+
flex: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.content-body-container {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
padding-right: var(--dx-g-page-padding-horizontal);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.content-body {
|
|
50
|
+
margin: var(--dx-g-spacing-sm) var(--dx-c-content-vertical-spacing)
|
|
51
|
+
var(--dx-g-spacing-xl);
|
|
52
|
+
flex: 1;
|
|
53
|
+
width: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.is-sticky {
|
|
57
|
+
height: 100vh;
|
|
58
|
+
position: sticky;
|
|
59
|
+
top: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.right-nav-bar {
|
|
63
|
+
max-width: 275px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media screen and (max-width: 1024px) {
|
|
67
|
+
.right-nav-bar {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media screen and (max-width: 800px) {
|
|
73
|
+
.content-body {
|
|
74
|
+
margin-top: var(--dx-c-content-vertical-spacing);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media screen and (max-width: 768px) {
|
|
79
|
+
.content {
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.content-body-container {
|
|
84
|
+
padding-right: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.left-nav-bar {
|
|
88
|
+
--dx-c-sidebar-height: 80vh;
|
|
89
|
+
|
|
90
|
+
height: unset;
|
|
91
|
+
z-index: 10;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.content-body {
|
|
95
|
+
margin-left: var(--dx-g-spacing-mlg, 20px);
|
|
96
|
+
margin-right: var(--dx-g-spacing-mlg, 20px);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="content">
|
|
3
|
+
<template if:true={useOldSidebar}>
|
|
4
|
+
<dx-sidebar-old
|
|
5
|
+
class="is-sticky left-nav-bar"
|
|
6
|
+
trees={sidebarContent}
|
|
7
|
+
value={sidebarValue}
|
|
8
|
+
header={sidebarHeader}
|
|
9
|
+
>
|
|
10
|
+
<slot name="sidebar-header" slot="header"></slot>
|
|
11
|
+
</dx-sidebar-old>
|
|
12
|
+
</template>
|
|
13
|
+
<template if:false={useOldSidebar}>
|
|
14
|
+
<dx-sidebar
|
|
15
|
+
class="is-sticky left-nav-bar"
|
|
16
|
+
trees={sidebarContent}
|
|
17
|
+
value={sidebarValue}
|
|
18
|
+
header={sidebarHeader}
|
|
19
|
+
coveo-organization-id={coveoOrganizationId}
|
|
20
|
+
coveo-public-access-token={coveoPublicAccessToken}
|
|
21
|
+
coveo-search-hub={coveoSearchHub}
|
|
22
|
+
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
23
|
+
>
|
|
24
|
+
<slot name="sidebar-header" slot="header"></slot>
|
|
25
|
+
</dx-sidebar>
|
|
26
|
+
</template>
|
|
27
|
+
<div class="content-body-doc-phase-container">
|
|
28
|
+
<slot name="doc-phase"></slot>
|
|
29
|
+
<div class="content-body-container">
|
|
30
|
+
<div class="content-body">
|
|
31
|
+
<doc-breadcrumbs
|
|
32
|
+
if:true={breadcrumbs}
|
|
33
|
+
breadcrumbs={breadcrumbs}
|
|
34
|
+
></doc-breadcrumbs>
|
|
35
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="right-nav-bar is-sticky">
|
|
38
|
+
<dx-toc
|
|
39
|
+
if:true={showToc}
|
|
40
|
+
title={tocTitle}
|
|
41
|
+
options={tocOptions}
|
|
42
|
+
value={tocValue}
|
|
43
|
+
></dx-toc>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
import { closest } from "kagekiri";
|
|
3
|
+
import { toJson } from "dxUtils/normalizers";
|
|
4
|
+
import { highlightTerms } from "dxUtils/highlight";
|
|
5
|
+
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
6
|
+
|
|
7
|
+
type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
|
|
8
|
+
|
|
9
|
+
const TOC_HEADER_TAG = "DOC-HEADING";
|
|
10
|
+
const HIGHLIGHTABLE_SELECTOR = [
|
|
11
|
+
"p",
|
|
12
|
+
"h1",
|
|
13
|
+
"h2",
|
|
14
|
+
"h3",
|
|
15
|
+
"h4",
|
|
16
|
+
"h5",
|
|
17
|
+
"h6",
|
|
18
|
+
"li",
|
|
19
|
+
"dl",
|
|
20
|
+
"th",
|
|
21
|
+
"td"
|
|
22
|
+
].join(",");
|
|
23
|
+
const OBSERVER_ATTACH_WAIT_TIME = 500;
|
|
24
|
+
|
|
25
|
+
export default class ContentLayout extends LightningElement {
|
|
26
|
+
@api sidebarValue: string;
|
|
27
|
+
@api sidebarHeader: string;
|
|
28
|
+
@api tocTitle: string;
|
|
29
|
+
@api enableSlotChange = false;
|
|
30
|
+
@api coveoOrganizationId!: string;
|
|
31
|
+
@api coveoPublicAccessToken!: string;
|
|
32
|
+
@api coveoSearchHub!: string;
|
|
33
|
+
@api coveoAdvancedQueryConfig!: string;
|
|
34
|
+
@api useOldSidebar?: boolean = false;
|
|
35
|
+
|
|
36
|
+
@api
|
|
37
|
+
get breadcrumbs() {
|
|
38
|
+
return this._breadcrumbs;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set breadcrumbs(value) {
|
|
42
|
+
if (value) {
|
|
43
|
+
this._breadcrumbs = toJson(value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@api
|
|
48
|
+
get sidebarContent() {
|
|
49
|
+
return this._sidebarContent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
set sidebarContent(value) {
|
|
53
|
+
this._sidebarContent = toJson(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@api
|
|
57
|
+
get tocOptions() {
|
|
58
|
+
return this._tocOptions;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
set tocOptions(value) {
|
|
62
|
+
this._tocOptions = toJson(value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@api
|
|
66
|
+
setSidebarInputValue(searchTerm: string): void {
|
|
67
|
+
this.template.querySelector("dx-sidebar")?.setInputValue(searchTerm);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@track
|
|
71
|
+
private _sidebarContent: unknown;
|
|
72
|
+
|
|
73
|
+
private _breadcrumbs = null;
|
|
74
|
+
|
|
75
|
+
@track
|
|
76
|
+
private _tocOptions: Array<unknown>;
|
|
77
|
+
|
|
78
|
+
private anchoredElements: AnchorMap = {};
|
|
79
|
+
private lastScrollPosition: number;
|
|
80
|
+
private observer?: IntersectionObserver;
|
|
81
|
+
private searchSyncer = new SearchSyncer({
|
|
82
|
+
callbacks: {
|
|
83
|
+
onUrlChange: (nextSearchString: string): void => {
|
|
84
|
+
this.updateHighlightsAndSearch(nextSearchString);
|
|
85
|
+
},
|
|
86
|
+
onSearchChange: (nextSearchString: string): void => {
|
|
87
|
+
this.dispatchHighlightChange(
|
|
88
|
+
new URLSearchParams(nextSearchString).get("q") || ""
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
eventName: "sidebarsearchchange",
|
|
93
|
+
historyMethod: window.history.pushState,
|
|
94
|
+
searchParam: "q",
|
|
95
|
+
shouldStopPropagation: true,
|
|
96
|
+
target: window
|
|
97
|
+
});
|
|
98
|
+
private tocValue?: string = undefined;
|
|
99
|
+
private observerTimerId = null;
|
|
100
|
+
private didScrollToSelectedHash = false;
|
|
101
|
+
|
|
102
|
+
get showToc(): boolean {
|
|
103
|
+
return this.tocOptions && this.tocOptions.length > 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ? This could be a good default for pathname in dx-breadcrumbs. Using this getter for now as a workaround.
|
|
107
|
+
get pathname(): string {
|
|
108
|
+
return window.location.pathname;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
connectedCallback(): void {
|
|
112
|
+
const hasParentHighlightListener = closest(
|
|
113
|
+
"doc-xml-content",
|
|
114
|
+
this.template.host
|
|
115
|
+
);
|
|
116
|
+
if (!hasParentHighlightListener) {
|
|
117
|
+
window.addEventListener(
|
|
118
|
+
"highlightedtermchange",
|
|
119
|
+
this.updateHighlighted
|
|
120
|
+
);
|
|
121
|
+
this.searchSyncer.init();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
renderedCallback(): void {
|
|
126
|
+
/**
|
|
127
|
+
* Note: We are adding timeout because chrome is optimizing and not triggering recent renderedCallback though elements reference is changed
|
|
128
|
+
* Also we are considering recent renderedCallback
|
|
129
|
+
*/
|
|
130
|
+
this.clearRenderObserverTimer();
|
|
131
|
+
this.observerTimerId = setTimeout(
|
|
132
|
+
this.attachInteractionObserver,
|
|
133
|
+
OBSERVER_ATTACH_WAIT_TIME
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
disconnectedCallback(): void {
|
|
138
|
+
this.disconnectObserver();
|
|
139
|
+
window.removeEventListener(
|
|
140
|
+
"highlightedtermchange",
|
|
141
|
+
this.updateHighlighted
|
|
142
|
+
);
|
|
143
|
+
this.searchSyncer.dispose();
|
|
144
|
+
this.clearRenderObserverTimer();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
clearRenderObserverTimer = () => {
|
|
148
|
+
if (this.observerTimerId) {
|
|
149
|
+
clearTimeout(this.observerTimerId);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
updateHighlighted = (event: Event): void =>
|
|
154
|
+
highlightTerms(
|
|
155
|
+
this.querySelectorAll(HIGHLIGHTABLE_SELECTOR),
|
|
156
|
+
(event as CustomEvent<string>).detail
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
attachInteractionObserver = (): void => {
|
|
160
|
+
if (!this.enableSlotChange) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.disconnectObserver();
|
|
164
|
+
this.observer = new IntersectionObserver((entries) => {
|
|
165
|
+
entries.forEach(
|
|
166
|
+
(entry) =>
|
|
167
|
+
(this.anchoredElements[
|
|
168
|
+
entry.target.getAttribute("id")
|
|
169
|
+
].intersect = entry.isIntersecting)
|
|
170
|
+
);
|
|
171
|
+
this.calculateActualSection();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Note: We are doing document.querySelectorAll as a quick fix as we are not getting heading elements reference this.querySelectorAll
|
|
175
|
+
const headingElements = document.querySelectorAll(TOC_HEADER_TAG);
|
|
176
|
+
for (const headingElement of headingElements) {
|
|
177
|
+
// Add headingElements to intersectionObserver for highlighting respective RNB item when user scroll
|
|
178
|
+
const id = headingElement.getAttribute("id");
|
|
179
|
+
this.anchoredElements[id] = {
|
|
180
|
+
id,
|
|
181
|
+
intersect: false
|
|
182
|
+
};
|
|
183
|
+
this.observer.observe(headingElement);
|
|
184
|
+
}
|
|
185
|
+
if (!this.didScrollToSelectedHash) {
|
|
186
|
+
this.didScrollToSelectedHash = true;
|
|
187
|
+
this.scrollToHash(headingElements);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
onSlotChange(event: Event): void {
|
|
192
|
+
const slotElements = (
|
|
193
|
+
event.target as HTMLSlotElement
|
|
194
|
+
).assignedElements();
|
|
195
|
+
|
|
196
|
+
if (slotElements.length) {
|
|
197
|
+
const slotContentElement = slotElements[0];
|
|
198
|
+
const headingElements =
|
|
199
|
+
slotContentElement.ownerDocument?.getElementsByTagName(
|
|
200
|
+
TOC_HEADER_TAG
|
|
201
|
+
);
|
|
202
|
+
for (const headingElement of headingElements) {
|
|
203
|
+
// Sometimes elements hash is not being set when slot content is wrapped with div
|
|
204
|
+
headingElement.hash =
|
|
205
|
+
headingElement.attributes.hash?.nodeValue;
|
|
206
|
+
}
|
|
207
|
+
const tocOptions = [];
|
|
208
|
+
for (const headingElement of headingElements) {
|
|
209
|
+
headingElement.id = headingElement.hash;
|
|
210
|
+
|
|
211
|
+
// Update tocOptions from anchorTags
|
|
212
|
+
const tocItem = {
|
|
213
|
+
anchor: `#${headingElement.hash}`,
|
|
214
|
+
id: headingElement.id,
|
|
215
|
+
label: headingElement.title
|
|
216
|
+
};
|
|
217
|
+
tocOptions.push(tocItem);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
this._tocOptions = tocOptions;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private disconnectObserver(): void {
|
|
225
|
+
if (this.observer) {
|
|
226
|
+
this.observer.disconnect();
|
|
227
|
+
this.observer = null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// eslint-disable-next-line no-undef
|
|
232
|
+
private scrollToHash(headingElements: NodeListOf<Element>): void {
|
|
233
|
+
let { hash } = window.location;
|
|
234
|
+
if (hash) {
|
|
235
|
+
hash = hash.substr(1);
|
|
236
|
+
for (const headingElement of headingElements) {
|
|
237
|
+
if (headingElement.getAttribute("id") === hash) {
|
|
238
|
+
headingElement.scrollIntoView({ behavior: "auto" });
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private calculateActualSection(): void {
|
|
246
|
+
const currentScrollPosition = document.documentElement.scrollTop;
|
|
247
|
+
const id = Object.keys(this.anchoredElements).find(
|
|
248
|
+
(_id) => this.anchoredElements[_id].intersect
|
|
249
|
+
);
|
|
250
|
+
if (id) {
|
|
251
|
+
this.assignElementId(id);
|
|
252
|
+
} else if (currentScrollPosition < this.lastScrollPosition) {
|
|
253
|
+
// The user has scroll up since last update
|
|
254
|
+
this.assignElementId(this.calculatePreviousElementId());
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.lastScrollPosition = currentScrollPosition;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private calculatePreviousElementId(): string {
|
|
261
|
+
const keys = Object.keys(this.anchoredElements);
|
|
262
|
+
const currentIndex = keys.findIndex((id) => this.tocValue === id);
|
|
263
|
+
|
|
264
|
+
return currentIndex > 0 ? keys[currentIndex - 1] : undefined;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private assignElementId(id: string): void {
|
|
268
|
+
this.tocValue = id;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
private dispatchHighlightChange(term: string): void {
|
|
272
|
+
this.dispatchEvent(
|
|
273
|
+
new CustomEvent("highlightedtermchange", {
|
|
274
|
+
detail: term,
|
|
275
|
+
bubbles: true,
|
|
276
|
+
composed: true
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private updateHighlightsAndSearch(nextSearchString: string): void {
|
|
282
|
+
const nextSearchParam =
|
|
283
|
+
new URLSearchParams(nextSearchString).get("q") || "";
|
|
284
|
+
this.setSidebarInputValue(nextSearchParam);
|
|
285
|
+
this.dispatchHighlightChange(nextSearchParam);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import type {
|
|
4
|
-
import { HeaderBase } from "
|
|
5
|
-
import { toJson } from "
|
|
3
|
+
import type { OptionWithNested, OptionWithLink } from "typings/custom";
|
|
4
|
+
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
5
|
+
import { toJson } from "dxUtils/normalizers";
|
|
6
6
|
import get from "lodash.get";
|
|
7
7
|
|
|
8
8
|
const TABLET_MATCH = "980px";
|
|
@@ -43,8 +43,8 @@ export default class Header extends HeaderBase {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
private _language: string | null = null;
|
|
46
|
-
private _languages!:
|
|
47
|
-
private _scopedNavItems!:
|
|
46
|
+
private _languages!: OptionWithLink[];
|
|
47
|
+
private _scopedNavItems!: OptionWithNested[];
|
|
48
48
|
private smallMobile = false;
|
|
49
49
|
private smallMobileMatchMedia!: MediaQueryList;
|
|
50
50
|
private tablet = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
2
|
|
|
3
3
|
:host {
|
|
4
4
|
--doc-c-heading-anchor-button-bottom: 0;
|
|
@@ -34,6 +34,10 @@ dx-icon {
|
|
|
34
34
|
--dx-c-icon-size: var(--doc-c-heading-anchor-icon-size);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
span {
|
|
38
|
+
word-break: break-word;
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
span:last-of-type {
|
|
38
42
|
padding-right: var(--dx-g-spacing-xs);
|
|
39
43
|
}
|
|
@@ -2,7 +2,7 @@ import { LightningElement, api } from "lwc";
|
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
|
|
4
4
|
import { DocPhaseInfo } from "typings/custom";
|
|
5
|
-
import { toJson } from "
|
|
5
|
+
import { toJson } from "dxUtils/normalizers";
|
|
6
6
|
|
|
7
7
|
export default class Phase extends LightningElement {
|
|
8
8
|
_docPhaseInfo: DocPhaseInfo | null = null;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export type CoveoAdvancedQueryXMLConfig = {
|
|
2
|
+
locale?: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
topicid?: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type PageReference = {
|
|
8
|
+
domain?: string;
|
|
9
|
+
page?: string;
|
|
10
|
+
docId?: string;
|
|
11
|
+
deliverable?: string;
|
|
12
|
+
contentDocumentId?: string;
|
|
13
|
+
hash?: string;
|
|
14
|
+
search?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export enum HistoryState {
|
|
18
|
+
PUSH_STATE = "pushState",
|
|
19
|
+
REPLACE_STATE = "replaceState"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type TreeNode = {
|
|
23
|
+
label: string;
|
|
24
|
+
name: string;
|
|
25
|
+
children?: Array<TreeNode>;
|
|
26
|
+
isExpanded?: boolean;
|
|
27
|
+
parent?: TreeNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type DropdownOption = {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type DocVersion = DropdownOption & {
|
|
36
|
+
releaseVersion: string;
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type DocLanguage = DropdownOption & {
|
|
41
|
+
code: string;
|
|
42
|
+
url: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type ApiDocVersion = {
|
|
46
|
+
version_text: string;
|
|
47
|
+
release_version: string;
|
|
48
|
+
doc_version: string;
|
|
49
|
+
version_url: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type ApiDocLanguage = {
|
|
53
|
+
code: string;
|
|
54
|
+
label: string;
|
|
55
|
+
locale: string;
|
|
56
|
+
url: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export interface Header extends Element {
|
|
60
|
+
subtitle: string;
|
|
61
|
+
bailHref: string;
|
|
62
|
+
bailLabel: string;
|
|
63
|
+
languages: Array<DocLanguage>;
|
|
64
|
+
language: string;
|
|
65
|
+
headerHref: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type ApiNavItem = {
|
|
69
|
+
children: Array<ApiNavItem>;
|
|
70
|
+
text: string;
|
|
71
|
+
a_attr: {
|
|
72
|
+
href: string;
|
|
73
|
+
};
|
|
74
|
+
id: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type ApiDocData = {
|
|
78
|
+
available_languages: Array<ApiDocLanguage>;
|
|
79
|
+
available_versions: Array<ApiDocVersion>;
|
|
80
|
+
content: string;
|
|
81
|
+
content_document_id: string;
|
|
82
|
+
deliverable: string;
|
|
83
|
+
doc_title: string;
|
|
84
|
+
language: ApiDocLanguage;
|
|
85
|
+
title: string;
|
|
86
|
+
toc: Array<ApiNavItem>;
|
|
87
|
+
version: ApiDocVersion;
|
|
88
|
+
pdf_url: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type ContentData = {
|
|
92
|
+
content: string;
|
|
93
|
+
id: string;
|
|
94
|
+
title: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type DocumentData = ContentData & {
|
|
98
|
+
availableLanguages: Array<DocLanguage>;
|
|
99
|
+
availableVersions: Array<DocVersion>;
|
|
100
|
+
deliverable: string;
|
|
101
|
+
docTitle: string;
|
|
102
|
+
language: DocLanguage;
|
|
103
|
+
toc: Array<TreeNode>;
|
|
104
|
+
tocMap: { [key: string]: TreeNode };
|
|
105
|
+
version: DocVersion;
|
|
106
|
+
pdfUrl: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type ContentApiOptions = {
|
|
110
|
+
version: string;
|
|
111
|
+
language: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type TocMap = { [key: string]: TreeNode };
|