@salesforcedevs/docs-components 1.28.7-alpha.9 → 1.29.0-aitoolbar-alpha
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 -0
- package/package.json +28 -28
- package/src/modules/doc/aiToolbar/aiToolbar.css +40 -0
- package/src/modules/doc/aiToolbar/aiToolbar.html +53 -0
- package/src/modules/doc/aiToolbar/aiToolbar.ts +138 -0
- package/src/modules/doc/aiToolbar/aiToolbarMocks.ts +48 -0
- package/src/modules/doc/amfReference/amfReference.html +1 -0
- package/src/modules/doc/amfReference/amfReference.ts +62 -10
- package/src/modules/doc/amfReference/types.ts +5 -0
- package/src/modules/doc/banner/banner.css +88 -0
- package/src/modules/doc/banner/banner.html +47 -0
- package/src/modules/doc/banner/banner.ts +73 -0
- package/src/modules/doc/contentLayout/contentLayout.html +17 -30
- package/src/modules/doc/contentLayout/contentLayout.ts +105 -26
- package/src/modules/doc/header/header.html +0 -1
- package/src/modules/doc/localeBanner/localeBanner.css +3 -0
- package/src/modules/doc/localeBanner/localeBanner.html +9 -0
- package/src/modules/doc/localeBanner/localeBanner.ts +195 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +5 -13
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +11 -0
- package/src/modules/doc/redocReference/redocReference.ts +167 -2
- package/src/modules/doc/xmlContent/xmlContent.html +1 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +49 -10
- package/LICENSE +0 -12
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
2
|
+
"name": "@salesforcedevs/docs-components",
|
|
3
|
+
"version": "1.29.0-aitoolbar-alpha",
|
|
4
|
+
"description": "Docs Lightning web components for DSC",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "22.x"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@api-components/amf-helper-mixin": "4.5.29",
|
|
15
|
+
"classnames": "2.5.1",
|
|
16
|
+
"dompurify": "3.2.4",
|
|
17
|
+
"kagekiri": "1.4.2",
|
|
18
|
+
"lodash.orderby": "4.6.0",
|
|
19
|
+
"lodash.uniqby": "4.7.0",
|
|
20
|
+
"query-string": "7.1.3",
|
|
21
|
+
"sentence-case": "3.0.4"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/classnames": "2.3.1",
|
|
25
|
+
"@types/lodash.orderby": "4.6.9",
|
|
26
|
+
"@types/lodash.uniqby": "4.7.9"
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
29
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ai-toolbar {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--dx-g-spacing-smd);
|
|
11
|
+
padding-bottom: var(--dx-g-spacing-sm);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.toolbar-button {
|
|
15
|
+
--dx-g-button-inline-color: var(--dx-g-blue-vibrant-50);
|
|
16
|
+
--dx-g-button-inline-color-hover: var(--dx-g-blue-vibrant-30);
|
|
17
|
+
--dx-c-button-font-size: var(--dx-g-text-sm);
|
|
18
|
+
--dx-c-button-horizontal-spacing: 0;
|
|
19
|
+
--dx-c-button-icon-vertical-align: middle;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.toolbar-button::part(content) {
|
|
23
|
+
font-family: var(--dx-g-font-display);
|
|
24
|
+
font-weight: var(--dx-g-font-demi);
|
|
25
|
+
line-height: var(--dx-g-spacing-mlg);
|
|
26
|
+
letter-spacing: 0.07px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.divider {
|
|
30
|
+
width: 1px;
|
|
31
|
+
height: var(--dx-g-spacing-md);
|
|
32
|
+
background-color: var(--dx-g-gray-70);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media screen and (max-width: 480px) {
|
|
36
|
+
.toolbar-button_copy-url,
|
|
37
|
+
.divider_copy-url {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ai-toolbar">
|
|
3
|
+
<dx-tooltip placement="top-right" label={copyMarkdownLabel}>
|
|
4
|
+
<dx-button
|
|
5
|
+
class="toolbar-button"
|
|
6
|
+
variant="inline"
|
|
7
|
+
size="small"
|
|
8
|
+
icon-sprite="utility"
|
|
9
|
+
icon-symbol="copy"
|
|
10
|
+
icon-size="medium"
|
|
11
|
+
icon-position="right"
|
|
12
|
+
aria-label={copyMarkdownButtonText}
|
|
13
|
+
onclick={handleCopyMarkdown}
|
|
14
|
+
>
|
|
15
|
+
{copyMarkdownButtonText}
|
|
16
|
+
</dx-button>
|
|
17
|
+
</dx-tooltip>
|
|
18
|
+
|
|
19
|
+
<div class="divider"></div>
|
|
20
|
+
|
|
21
|
+
<dx-button
|
|
22
|
+
class="toolbar-button"
|
|
23
|
+
variant="inline"
|
|
24
|
+
size="small"
|
|
25
|
+
icon-sprite="utility"
|
|
26
|
+
icon-symbol="new_window"
|
|
27
|
+
icon-size="medium"
|
|
28
|
+
icon-position="right"
|
|
29
|
+
aria-label={viewMarkdownButtonText}
|
|
30
|
+
onclick={handleViewMarkdown}
|
|
31
|
+
>
|
|
32
|
+
{viewMarkdownButtonText}
|
|
33
|
+
</dx-button>
|
|
34
|
+
|
|
35
|
+
<div class="divider divider_copy-url"></div>
|
|
36
|
+
|
|
37
|
+
<dx-tooltip placement="top-right" label={copyUrlLabel}>
|
|
38
|
+
<dx-button
|
|
39
|
+
class="toolbar-button toolbar-button_copy-url"
|
|
40
|
+
variant="inline"
|
|
41
|
+
size="small"
|
|
42
|
+
icon-sprite="utility"
|
|
43
|
+
icon-symbol="link"
|
|
44
|
+
icon-size="medium"
|
|
45
|
+
icon-position="right"
|
|
46
|
+
aria-label={copyUrlButtonText}
|
|
47
|
+
onclick={handleCopyUrl}
|
|
48
|
+
>
|
|
49
|
+
{copyUrlButtonText}
|
|
50
|
+
</dx-button>
|
|
51
|
+
</dx-tooltip>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { LightningElement } from "lwc";
|
|
2
|
+
import { track } from "dxUtils/analytics";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_COPY_TOOLTIP_LABEL = "Click to copy";
|
|
5
|
+
const COPIED_TOOLTIP_LABEL = "Copied!";
|
|
6
|
+
const COPIED_TOOLTIP_RESET_MS = 2000;
|
|
7
|
+
|
|
8
|
+
const ANALYTICS_CONTENT_CATEGORY = "ai toolbar";
|
|
9
|
+
const COPY_MARKDOWN_LABEL = "Copy as Markdown";
|
|
10
|
+
const VIEW_MARKDOWN_LABEL = "View as Markdown";
|
|
11
|
+
const COPY_URL_LABEL = "Copy URL to Markdown";
|
|
12
|
+
|
|
13
|
+
export default class AiToolbar extends LightningElement {
|
|
14
|
+
copyMarkdownLabel: string = DEFAULT_COPY_TOOLTIP_LABEL;
|
|
15
|
+
copyUrlLabel: string = DEFAULT_COPY_TOOLTIP_LABEL;
|
|
16
|
+
|
|
17
|
+
private copyTooltipResetTimeout: number | null = null;
|
|
18
|
+
|
|
19
|
+
get copyMarkdownButtonText(): string {
|
|
20
|
+
return COPY_MARKDOWN_LABEL;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get viewMarkdownButtonText(): string {
|
|
24
|
+
return VIEW_MARKDOWN_LABEL;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get copyUrlButtonText(): string {
|
|
28
|
+
return COPY_URL_LABEL;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async handleCopyMarkdown(event: Event) {
|
|
32
|
+
const markdownUrl = this.getMarkdownUrl();
|
|
33
|
+
if (!markdownUrl) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.trackToolbarEvent(
|
|
38
|
+
event,
|
|
39
|
+
"custEv_linkClick",
|
|
40
|
+
COPY_MARKDOWN_LABEL,
|
|
41
|
+
markdownUrl
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch(markdownUrl);
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const markdown = await response.text();
|
|
50
|
+
await navigator.clipboard.writeText(markdown);
|
|
51
|
+
this.flashCopied("copyMarkdownLabel");
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
handleViewMarkdown(event: Event) {
|
|
58
|
+
const markdownUrl = this.getMarkdownUrl();
|
|
59
|
+
if (!markdownUrl) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.trackToolbarEvent(
|
|
64
|
+
event,
|
|
65
|
+
"custEv_linkClick",
|
|
66
|
+
VIEW_MARKDOWN_LABEL,
|
|
67
|
+
markdownUrl
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
window.open(markdownUrl, "_blank", "noopener,noreferrer");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async handleCopyUrl(event: Event) {
|
|
74
|
+
const markdownUrl = this.getMarkdownUrl();
|
|
75
|
+
if (!markdownUrl) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.trackToolbarEvent(
|
|
80
|
+
event,
|
|
81
|
+
"custEv_linkClick",
|
|
82
|
+
COPY_URL_LABEL,
|
|
83
|
+
markdownUrl
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
await navigator.clipboard.writeText(markdownUrl);
|
|
88
|
+
this.flashCopied("copyUrlLabel");
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error(error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private trackToolbarEvent(
|
|
95
|
+
event: Event,
|
|
96
|
+
eventName: "custEv_linkClick",
|
|
97
|
+
label: string,
|
|
98
|
+
url: string
|
|
99
|
+
): void {
|
|
100
|
+
track(event.currentTarget!, eventName, {
|
|
101
|
+
click_text: label,
|
|
102
|
+
click_url: url,
|
|
103
|
+
element_type: "button_link",
|
|
104
|
+
element_title: label,
|
|
105
|
+
content_category: ANALYTICS_CONTENT_CATEGORY
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the `.md` equivalent of the current page URL with any hash and
|
|
111
|
+
* query string stripped, or `null` when the current page does not end
|
|
112
|
+
* with `.html`.
|
|
113
|
+
*/
|
|
114
|
+
private getMarkdownUrl(): string | null {
|
|
115
|
+
const url = new URL(window.location.href);
|
|
116
|
+
url.hash = "";
|
|
117
|
+
url.search = "";
|
|
118
|
+
|
|
119
|
+
if (!url.pathname.endsWith(".html")) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
url.pathname = url.pathname.replace(/\.html$/, ".md");
|
|
124
|
+
return url.toString();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private flashCopied(labelKey: "copyMarkdownLabel" | "copyUrlLabel") {
|
|
128
|
+
if (this.copyTooltipResetTimeout !== null) {
|
|
129
|
+
window.clearTimeout(this.copyTooltipResetTimeout);
|
|
130
|
+
}
|
|
131
|
+
this[labelKey] = COPIED_TOOLTIP_LABEL;
|
|
132
|
+
this.copyTooltipResetTimeout = window.setTimeout(() => {
|
|
133
|
+
this.copyMarkdownLabel = DEFAULT_COPY_TOOLTIP_LABEL;
|
|
134
|
+
this.copyUrlLabel = DEFAULT_COPY_TOOLTIP_LABEL;
|
|
135
|
+
this.copyTooltipResetTimeout = null;
|
|
136
|
+
}, COPIED_TOOLTIP_RESET_MS);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Mocks for the AI toolbar so stories never hit the real
|
|
5
|
+
* docs backend. Any story rendering `doc-ai-toolbar` (directly or via
|
|
6
|
+
* `doc-content-layout`) must register `aiToolbarMswHandlers` and call
|
|
7
|
+
* `interceptWindowOpenForAiToolbar()`.
|
|
8
|
+
*/
|
|
9
|
+
export const DUMMY_MARKDOWN_CONTENT = `# Dummy Markdown
|
|
10
|
+
|
|
11
|
+
Storybook serves this placeholder content in place of the real markdown
|
|
12
|
+
that the docs backend would return for the current page. It exists so
|
|
13
|
+
the "Copied" tooltip, the "View as Markdown" new tab, and the
|
|
14
|
+
"Copy URL to Markdown" clipboard behavior are all exercisable in
|
|
15
|
+
storybook without hitting the live backend.
|
|
16
|
+
|
|
17
|
+
- Item 1
|
|
18
|
+
- Item 2
|
|
19
|
+
- Item 3
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const DUMMY_MARKDOWN_DATA_URL = `data:text/markdown;charset=utf-8,${encodeURIComponent(
|
|
23
|
+
DUMMY_MARKDOWN_CONTENT
|
|
24
|
+
)}`;
|
|
25
|
+
|
|
26
|
+
/** Intercepts any `.md` GET request and returns the dummy markdown. */
|
|
27
|
+
export const aiToolbarMswHandlers = [
|
|
28
|
+
http.get(/\.md(\?.*)?$/, () => HttpResponse.text(DUMMY_MARKDOWN_CONTENT))
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
let windowOpenIntercepted = false;
|
|
32
|
+
|
|
33
|
+
/** Redirects `window.open` calls for `.md` URLs to the dummy markdown data URL (MSW does not cover new tabs). */
|
|
34
|
+
export function interceptWindowOpenForAiToolbar() {
|
|
35
|
+
if (windowOpenIntercepted) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
windowOpenIntercepted = true;
|
|
39
|
+
|
|
40
|
+
const originalOpen = window.open.bind(window);
|
|
41
|
+
window.open = ((url?: string | URL, target?: string, features?: string) => {
|
|
42
|
+
const stringUrl = url?.toString() ?? "";
|
|
43
|
+
if (stringUrl.endsWith(".md")) {
|
|
44
|
+
return originalOpen(DUMMY_MARKDOWN_DATA_URL, target, features);
|
|
45
|
+
}
|
|
46
|
+
return originalOpen(url ?? "", target, features);
|
|
47
|
+
}) as typeof window.open;
|
|
48
|
+
}
|
|
@@ -37,6 +37,7 @@ type NavigationItem = {
|
|
|
37
37
|
isExpanded: boolean;
|
|
38
38
|
children: ParsedMarkdownTopic[];
|
|
39
39
|
isChildrenLoading: boolean;
|
|
40
|
+
showForwardArrow?: boolean;
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
export default class AmfReference extends LightningElement {
|
|
@@ -72,6 +73,16 @@ export default class AmfReference extends LightningElement {
|
|
|
72
73
|
return this.isSpecBasedReference(this._currentReferenceId);
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
/**
|
|
77
|
+
* AI toolbar is only enabled for markdown-based references in the en-us locale.
|
|
78
|
+
*/
|
|
79
|
+
get showAiToolbar(): boolean {
|
|
80
|
+
return (
|
|
81
|
+
!this.showSpecBasedReference &&
|
|
82
|
+
this.language?.toLowerCase() === "en-us"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
75
86
|
@api
|
|
76
87
|
get referenceSetConfig(): ReferenceSetConfig {
|
|
77
88
|
return this._referenceSetConfig;
|
|
@@ -204,6 +215,7 @@ export default class AmfReference extends LightningElement {
|
|
|
204
215
|
|
|
205
216
|
_boundOnApiNavigationChanged;
|
|
206
217
|
_boundUpdateSelectedItemFromUrlQuery;
|
|
218
|
+
_boundOnPageShow;
|
|
207
219
|
|
|
208
220
|
constructor() {
|
|
209
221
|
super();
|
|
@@ -212,6 +224,7 @@ export default class AmfReference extends LightningElement {
|
|
|
212
224
|
this.onApiNavigationChanged.bind(this);
|
|
213
225
|
this._boundUpdateSelectedItemFromUrlQuery =
|
|
214
226
|
this.updateSelectedItemFromUrlQuery.bind(this);
|
|
227
|
+
this._boundOnPageShow = this.onPageShow.bind(this);
|
|
215
228
|
}
|
|
216
229
|
|
|
217
230
|
connectedCallback(): void {
|
|
@@ -223,6 +236,7 @@ export default class AmfReference extends LightningElement {
|
|
|
223
236
|
"popstate",
|
|
224
237
|
this._boundUpdateSelectedItemFromUrlQuery
|
|
225
238
|
);
|
|
239
|
+
window.addEventListener("pageshow", this._boundOnPageShow);
|
|
226
240
|
}
|
|
227
241
|
|
|
228
242
|
disconnectedCallback(): void {
|
|
@@ -234,6 +248,22 @@ export default class AmfReference extends LightningElement {
|
|
|
234
248
|
"popstate",
|
|
235
249
|
this._boundUpdateSelectedItemFromUrlQuery
|
|
236
250
|
);
|
|
251
|
+
window.removeEventListener("pageshow", this._boundOnPageShow);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* On bfcache restore, reset the sidebar selection so the tree re-syncs
|
|
256
|
+
* its highlighted tile with the current URL.
|
|
257
|
+
*/
|
|
258
|
+
protected onPageShow(event: PageTransitionEvent): void {
|
|
259
|
+
if (!event.persisted) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const currentPath = window.location.pathname;
|
|
263
|
+
this.selectedSidebarValue = "";
|
|
264
|
+
Promise.resolve().then(() => {
|
|
265
|
+
this.selectedSidebarValue = currentPath;
|
|
266
|
+
});
|
|
237
267
|
}
|
|
238
268
|
|
|
239
269
|
renderedCallback(): void {
|
|
@@ -443,16 +473,21 @@ export default class AmfReference extends LightningElement {
|
|
|
443
473
|
let navItemChildren = [] as ParsedMarkdownTopic[];
|
|
444
474
|
let isChildrenLoading = false;
|
|
445
475
|
if (amfConfig.referenceType !== REFERENCE_TYPES.markdown) {
|
|
446
|
-
if (amfConfig.
|
|
447
|
-
|
|
448
|
-
(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
476
|
+
if (amfConfig.amf) {
|
|
477
|
+
if (amfConfig.isSelected) {
|
|
478
|
+
const amfPromise = this.fetchAmf(amfConfig).then(
|
|
479
|
+
(amfJson) => {
|
|
480
|
+
this.updateModel(amfConfig.id, amfJson);
|
|
481
|
+
this.assignNavigationItemsFromAmf(
|
|
482
|
+
amfConfig,
|
|
483
|
+
index
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
this.amfFetchPromiseMap[amfConfig.id] = amfPromise;
|
|
488
|
+
}
|
|
489
|
+
isChildrenLoading = true;
|
|
454
490
|
}
|
|
455
|
-
isChildrenLoading = true;
|
|
456
491
|
} else {
|
|
457
492
|
const isExpandChildrenEnabled = this.isExpandChildrenEnabled(
|
|
458
493
|
amfConfig.id
|
|
@@ -473,13 +508,30 @@ export default class AmfReference extends LightningElement {
|
|
|
473
508
|
amfConfig.isSelected ||
|
|
474
509
|
this.isExpandChildrenEnabled(amfConfig.id),
|
|
475
510
|
children: navItemChildren,
|
|
476
|
-
isChildrenLoading
|
|
511
|
+
isChildrenLoading,
|
|
512
|
+
showForwardArrow: this.resolveNavRenderWith(amfConfig)
|
|
477
513
|
};
|
|
478
514
|
this.parentReferenceUrls.push(amfConfig.href);
|
|
479
515
|
}
|
|
480
516
|
this.navigation = navAmfOrder;
|
|
481
517
|
}
|
|
482
518
|
|
|
519
|
+
/**
|
|
520
|
+
* Determines whether the sidebar tile should render a forward arrow for
|
|
521
|
+
* this reference. Honors `redoc` set on the config, and also infers it
|
|
522
|
+
* for non-markdown references that have no AMF URL (i.e. those rendered
|
|
523
|
+
* by Redoc).
|
|
524
|
+
*/
|
|
525
|
+
private resolveNavRenderWith(amfConfig: AmfConfig): boolean {
|
|
526
|
+
if (amfConfig.renderWith) {
|
|
527
|
+
return amfConfig.renderWith === "redoc";
|
|
528
|
+
}
|
|
529
|
+
return (
|
|
530
|
+
amfConfig.referenceType !== REFERENCE_TYPES.markdown &&
|
|
531
|
+
!amfConfig.amf
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
|
|
483
535
|
/**
|
|
484
536
|
* Returns a boolean indicating whether the children should be expanded or not.
|
|
485
537
|
*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
|
|
7
|
+
--doc-banner-padding-left: var(--dx-g-spacing-2xl);
|
|
8
|
+
--doc-banner-padding-right: var(--dx-g-spacing-lg);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.container {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
background: var(--dx-g-gray-90);
|
|
15
|
+
padding: 0 var(--doc-banner-padding-right) 0 var(--doc-banner-padding-left);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon {
|
|
19
|
+
--dx-c-icon-size: var(--dx-g-icon-size-lg);
|
|
20
|
+
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
margin-top: var(--dx-g-spacing-smd);
|
|
23
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.main {
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-width: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
align-items: flex-start;
|
|
32
|
+
column-gap: var(--dx-g-spacing-md);
|
|
33
|
+
padding: calc((var(--dx-g-spacing-xs) + var(--dx-g-spacing-sm)) / 2) 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.message {
|
|
37
|
+
flex: 0 1 auto;
|
|
38
|
+
font-size: var(--dx-g-text-sm);
|
|
39
|
+
color: var(--dx-g-gray-10);
|
|
40
|
+
padding: calc((var(--dx-g-spacing-xs) + var(--dx-g-spacing-sm)) / 2) 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.message a {
|
|
44
|
+
color: var(--dx-g-cloud-blue-vibrant-50);
|
|
45
|
+
text-decoration: underline;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.actions {
|
|
49
|
+
flex: 0 0 auto;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--dx-g-spacing-smd);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.actions dx-button {
|
|
56
|
+
--dx-c-button-font-size: var(--dx-g-text-sm);
|
|
57
|
+
--dx-c-button-font-weight: var(--dx-g-font-normal);
|
|
58
|
+
|
|
59
|
+
flex: 0 0 auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.close {
|
|
63
|
+
--dx-c-icon-size: var(--dx-g-icon-size-lg);
|
|
64
|
+
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
align-self: flex-start;
|
|
67
|
+
width: calc(var(--dx-g-spacing-3xl) + var(--dx-g-spacing-xs));
|
|
68
|
+
height: calc(var(--dx-g-spacing-2xl) + var(--dx-g-spacing-xs));
|
|
69
|
+
margin-left: auto;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media (max-width: 1279px) {
|
|
77
|
+
:host {
|
|
78
|
+
--doc-banner-padding-left: var(--dx-g-spacing-xl);
|
|
79
|
+
--doc-banner-padding-right: var(--dx-g-spacing-md);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (max-width: 768px) {
|
|
84
|
+
:host {
|
|
85
|
+
--doc-banner-padding-left: var(--dx-g-spacing-lg);
|
|
86
|
+
--doc-banner-padding-right: var(--dx-g-spacing-sm);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template lwc:if={showBanner}>
|
|
3
|
+
<div class="container" part="container">
|
|
4
|
+
<dx-icon
|
|
5
|
+
class="icon"
|
|
6
|
+
symbol="info"
|
|
7
|
+
size="override"
|
|
8
|
+
color="gray-50"
|
|
9
|
+
part="icon"
|
|
10
|
+
></dx-icon>
|
|
11
|
+
<div class="main">
|
|
12
|
+
<div class="message" part="message" lwc:dom="manual"></div>
|
|
13
|
+
<div class="actions" part="actions">
|
|
14
|
+
<template lwc:if={hasPrimaryButton}>
|
|
15
|
+
<dx-button
|
|
16
|
+
href={buttonHref}
|
|
17
|
+
variant="primary"
|
|
18
|
+
size="small"
|
|
19
|
+
part="button"
|
|
20
|
+
>
|
|
21
|
+
{buttonLabel}
|
|
22
|
+
</dx-button>
|
|
23
|
+
</template>
|
|
24
|
+
<template lwc:if={hasSecondaryAction}>
|
|
25
|
+
<dx-button
|
|
26
|
+
variant="inline"
|
|
27
|
+
onclick={handleSecondaryClick}
|
|
28
|
+
part="secondary"
|
|
29
|
+
>
|
|
30
|
+
{secondaryLabel}
|
|
31
|
+
</dx-button>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<dx-button
|
|
36
|
+
class="close"
|
|
37
|
+
variant="icon-only"
|
|
38
|
+
icon-symbol="close"
|
|
39
|
+
icon-size="override"
|
|
40
|
+
icon-color="gray-50"
|
|
41
|
+
aria-label="Close"
|
|
42
|
+
onclick={handleCloseClick}
|
|
43
|
+
part="close"
|
|
44
|
+
></dx-button>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
</template>
|