@salesforcedevs/docs-components 0.56.2 → 0.56.3-example
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 +19 -13
- 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 +42 -21
- package/src/modules/doc/amfReference/amfReference.ts +1022 -341
- package/src/modules/doc/amfReference/constants.ts +76 -0
- package/src/modules/doc/amfReference/types.ts +45 -13
- 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 +20 -0
- package/src/modules/doc/componentPlayground/componentPlayground.ts +42 -0
- package/src/modules/doc/content/content.css +70 -76
- package/src/modules/doc/content/content.html +1 -0
- package/src/modules/doc/content/content.ts +26 -47
- 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 +30 -17
- package/src/modules/doc/contentLayout/contentLayout.ts +354 -65
- 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 +41 -139
- package/src/modules/doc/header/header.ts +54 -76
- 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 +68 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +256 -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 +36 -0
- package/src/modules/doc/specificationContent/specificationContent.html +167 -0
- package/src/modules/doc/specificationContent/specificationContent.ts +127 -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 +41 -15
- package/src/modules/doc/xmlContent/xmlContent.ts +295 -95
- 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/LICENSE +0 -12
- package/src/modules/doc/amfReference/route-meta.ts +0 -22
- package/src/modules/docBaseElements/lightningElementWithState/lightningElementWithState.ts +0 -93
- package/src/modules/docHelpers/phaseContentLayout/phaseContentLayout.css +0 -39
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const NAVIGATION_ITEMS = [
|
|
2
|
+
{
|
|
3
|
+
label: "Summary",
|
|
4
|
+
name: "summary",
|
|
5
|
+
childrenPropertyName: undefined,
|
|
6
|
+
type: "summary"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
label: "Endpoints",
|
|
10
|
+
name: "endpoints",
|
|
11
|
+
childrenPropertyName: "endpoints",
|
|
12
|
+
type: "endpoint"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Documentation",
|
|
16
|
+
name: "documentation",
|
|
17
|
+
childrenPropertyName: "docs",
|
|
18
|
+
type: "documentation"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Types",
|
|
22
|
+
name: "types",
|
|
23
|
+
childrenPropertyName: "types",
|
|
24
|
+
type: "type"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Security",
|
|
28
|
+
name: "security",
|
|
29
|
+
childrenPropertyName: "security",
|
|
30
|
+
type: "security"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const URL_CONFIG = {
|
|
35
|
+
summary: {
|
|
36
|
+
urlIdentifer: "label"
|
|
37
|
+
},
|
|
38
|
+
endpoint: {
|
|
39
|
+
urlIdentifer: "path"
|
|
40
|
+
},
|
|
41
|
+
method: {
|
|
42
|
+
urlIdentifer: "label"
|
|
43
|
+
},
|
|
44
|
+
documentation: {
|
|
45
|
+
urlIdentifer: "label"
|
|
46
|
+
},
|
|
47
|
+
type: {
|
|
48
|
+
urlIdentifer: "label",
|
|
49
|
+
prefix: "type:"
|
|
50
|
+
},
|
|
51
|
+
security: {
|
|
52
|
+
urlIdentifer: "label",
|
|
53
|
+
prefix: "security:"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const REFERENCE_TYPES = {
|
|
58
|
+
markdown: "markdown",
|
|
59
|
+
raml: "rest-raml",
|
|
60
|
+
oa2: "rest-oa2",
|
|
61
|
+
oa3: "rest-oa3"
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const oldReferenceIdNewReferenceIdMap: Record<string, string> = {
|
|
65
|
+
"commerce-api-assignments": "assignments",
|
|
66
|
+
"commerce-api-campaigns": "campaigns",
|
|
67
|
+
"commerce-api-catalogs": "catalogs",
|
|
68
|
+
"cdn-zones": "cdn-api-process-apis",
|
|
69
|
+
"inventory-impex": "impex",
|
|
70
|
+
"inventory-reservations": "inventory-reservation-service",
|
|
71
|
+
"shopper-login-and-api-access-service": "shopper-login",
|
|
72
|
+
"shopper-login-and-api-access-service-admin": "slas-admin",
|
|
73
|
+
"einstein-recommendations": "einstein-api-quick-start-guide"
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { NAVIGATION_ITEMS, URL_CONFIG, oldReferenceIdNewReferenceIdMap };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Json } from "typings/custom";
|
|
1
|
+
import { Json, DocPhaseInfo } from "typings/custom";
|
|
2
2
|
|
|
3
3
|
export interface AmfTopicType {
|
|
4
4
|
referenceId: string;
|
|
5
|
+
parentReferencePath: string;
|
|
5
6
|
amfId: string;
|
|
6
7
|
elementId: string;
|
|
7
8
|
type: string;
|
|
@@ -10,6 +11,7 @@ export interface AmfTopicType {
|
|
|
10
11
|
export interface AmfMetadataTopic extends AmfTopicType {
|
|
11
12
|
meta: string;
|
|
12
13
|
identifier: string;
|
|
14
|
+
navTitle?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export interface AmfMetaTopicType extends AmfTopicType {
|
|
@@ -19,7 +21,6 @@ export interface AmfMetaTopicType extends AmfTopicType {
|
|
|
19
21
|
export interface NavItem {
|
|
20
22
|
name: string;
|
|
21
23
|
label: string;
|
|
22
|
-
// TODO: Better type here
|
|
23
24
|
children?: ({
|
|
24
25
|
id: string;
|
|
25
26
|
label?: string;
|
|
@@ -45,19 +46,38 @@ export interface AmfModelRecord {
|
|
|
45
46
|
parsedModel: Json;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
export type
|
|
49
|
+
export type ReferenceType = "markdown" | "rest-raml" | "rest-oa2" | "rest-oa3";
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Represents parsed topic for the sidebar.
|
|
53
|
+
*/
|
|
54
|
+
export interface ParsedMarkdownTopic {
|
|
55
|
+
label: string;
|
|
56
|
+
name: string;
|
|
57
|
+
children: ParsedMarkdownTopic[];
|
|
58
|
+
link?: {
|
|
59
|
+
href: string;
|
|
60
|
+
target?: string;
|
|
61
|
+
};
|
|
62
|
+
isExpanded?: boolean;
|
|
63
|
+
}
|
|
55
64
|
|
|
56
|
-
export interface AmfConfig
|
|
65
|
+
export interface AmfConfig {
|
|
57
66
|
id: string;
|
|
58
|
-
amf: string;
|
|
59
67
|
version?: string;
|
|
60
|
-
docPhase?:
|
|
68
|
+
docPhase?: DocPhaseInfo;
|
|
69
|
+
title: string;
|
|
70
|
+
href: string;
|
|
71
|
+
referenceType: ReferenceType;
|
|
72
|
+
|
|
73
|
+
// determines if a reference config is the current active and selected one.
|
|
74
|
+
isSelected: boolean;
|
|
75
|
+
|
|
76
|
+
// required for spec based references
|
|
77
|
+
amf?: string;
|
|
78
|
+
|
|
79
|
+
// required for markdown based references
|
|
80
|
+
topic?: ParsedMarkdownTopic;
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
export interface ParsedTopicModel {
|
|
@@ -75,7 +95,7 @@ export interface ParsedTopicModel {
|
|
|
75
95
|
export interface TopicModel {
|
|
76
96
|
id: string;
|
|
77
97
|
type: string;
|
|
78
|
-
amf:
|
|
98
|
+
amf: string;
|
|
79
99
|
parser: AmfParser;
|
|
80
100
|
}
|
|
81
101
|
|
|
@@ -84,10 +104,22 @@ export interface ReferenceVersion {
|
|
|
84
104
|
label: string;
|
|
85
105
|
deprecated?: boolean;
|
|
86
106
|
selected?: boolean;
|
|
107
|
+
link: {
|
|
108
|
+
href: string;
|
|
109
|
+
};
|
|
87
110
|
}
|
|
88
111
|
|
|
89
112
|
export interface ReferenceSetConfig {
|
|
113
|
+
refId?: string;
|
|
90
114
|
versionToRefMap?: Map<string, Array<AmfConfig>>;
|
|
91
115
|
refList: Array<AmfConfig>;
|
|
92
|
-
versions
|
|
116
|
+
versions: Array<ReferenceVersion>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface RouteMeta {
|
|
120
|
+
meta: string;
|
|
121
|
+
referenceId: string;
|
|
122
|
+
topicId: string;
|
|
123
|
+
//type is only for spec based references
|
|
124
|
+
type?: string;
|
|
93
125
|
}
|
|
@@ -1 +1,21 @@
|
|
|
1
1
|
@import "docHelpers/amfStyle";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--reference-container-margin-top: var(--dx-g-spacing-sm);
|
|
5
|
+
--api-documentation-margin-top: var(--dx-g-spacing-3xl);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 1. We need to scroll to top from the tablet size as side nav bar and content in side by side from tablet size
|
|
10
|
+
* 2. Consider global nav height, doc header height and content margins to scroll to the right position
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
@media screen and (min-width: 769px) {
|
|
14
|
+
.topic-container {
|
|
15
|
+
scroll-margin-top: calc(
|
|
16
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
|
|
17
|
+
var(--reference-container-margin-top) +
|
|
18
|
+
var(--api-documentation-margin-top)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -8,14 +8,17 @@ import {
|
|
|
8
8
|
createTypeElement
|
|
9
9
|
} from "./utils";
|
|
10
10
|
import type { TopicModel } from "./types";
|
|
11
|
+
import { Json } from "typings/custom";
|
|
12
|
+
|
|
13
|
+
const TABLE_SIZE_MATCH = "769px";
|
|
11
14
|
|
|
12
15
|
export default class AmfTopic extends LightningElement {
|
|
13
|
-
private _model;
|
|
14
|
-
private amf;
|
|
15
|
-
private type;
|
|
16
|
+
private _model: TopicModel | undefined;
|
|
17
|
+
private amf: Json;
|
|
18
|
+
private type: string | undefined;
|
|
16
19
|
|
|
17
20
|
@api
|
|
18
|
-
get model(): TopicModel {
|
|
21
|
+
get model(): TopicModel | undefined {
|
|
19
22
|
return this._model;
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -24,13 +27,17 @@ export default class AmfTopic extends LightningElement {
|
|
|
24
27
|
!this.amf ||
|
|
25
28
|
(value && this._model && value.amf !== this._model?.amf)
|
|
26
29
|
) {
|
|
27
|
-
|
|
30
|
+
try {
|
|
31
|
+
this.amf = value && JSON.parse(value.amf);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(`Error parsing amf model: ${error}`);
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
36
|
if (
|
|
30
37
|
!this.type ||
|
|
31
38
|
(value && this._model && value.type !== this._model?.type)
|
|
32
39
|
) {
|
|
33
|
-
this.type = value &&
|
|
40
|
+
this.type = value && value.type;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
this._model = value;
|
|
@@ -41,7 +48,11 @@ export default class AmfTopic extends LightningElement {
|
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
update(): void {
|
|
44
|
-
|
|
51
|
+
if (!this.model) {
|
|
52
|
+
throw new Error("Amf TopicModel undefined when trying to update");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const container = this.template.querySelector(".topic-container")!;
|
|
45
56
|
const { id } = this.model;
|
|
46
57
|
const type = this.type;
|
|
47
58
|
const amf = this.amf;
|
|
@@ -76,19 +87,25 @@ export default class AmfTopic extends LightningElement {
|
|
|
76
87
|
element = createDocumentationElement(amf, docsModel);
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
if (container
|
|
90
|
+
if (container?.firstChild) {
|
|
80
91
|
container.firstChild.remove();
|
|
81
92
|
}
|
|
82
|
-
container
|
|
93
|
+
container?.appendChild(element as Node);
|
|
94
|
+
|
|
95
|
+
const isTabletOrDesktop = window.matchMedia(
|
|
96
|
+
`(min-width: ${TABLE_SIZE_MATCH})`
|
|
97
|
+
).matches;
|
|
98
|
+
|
|
99
|
+
if (isTabletOrDesktop) {
|
|
100
|
+
window.scrollTo(0, 0);
|
|
101
|
+
}
|
|
83
102
|
}
|
|
84
|
-
}
|
|
85
103
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return JSON.parse(JSON.stringify(value));
|
|
104
|
+
renderedCallback(): void {
|
|
105
|
+
try {
|
|
106
|
+
this.update();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
94
111
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Json } from "typings/custom";
|
|
2
|
+
import { AmfModelParser } from "doc/amfModelParser";
|
|
3
|
+
import {
|
|
4
|
+
DomainElement,
|
|
5
|
+
EndPoint,
|
|
6
|
+
Operation,
|
|
7
|
+
Shape
|
|
8
|
+
} from "@api-components/amf-helper-mixin";
|
|
2
9
|
|
|
3
10
|
export type ApiSummaryElement = HTMLElement & {
|
|
4
11
|
amf: Json;
|
|
@@ -11,44 +18,39 @@ export type ApiEndpointElement = HTMLElement & {
|
|
|
11
18
|
inlineMethods: boolean;
|
|
12
19
|
noNavigation: boolean;
|
|
13
20
|
selected: string;
|
|
14
|
-
endpoint:
|
|
21
|
+
endpoint: EndPoint;
|
|
15
22
|
noTryIt: boolean;
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
export type ApiMethodElement = HTMLElement & {
|
|
19
26
|
amf: Json;
|
|
20
27
|
noNavigation: boolean;
|
|
21
|
-
endpoint:
|
|
22
|
-
method:
|
|
28
|
+
endpoint: EndPoint | undefined;
|
|
29
|
+
method: Operation | undefined;
|
|
23
30
|
noTryIt: boolean;
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
export type ApiSecurityElement = HTMLElement & {
|
|
27
34
|
amf: Json;
|
|
28
|
-
security:
|
|
35
|
+
security: DomainElement | undefined;
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
export type ApiTypeElement = HTMLElement & {
|
|
32
39
|
amf: Json;
|
|
33
|
-
type
|
|
40
|
+
type?: Shape;
|
|
34
41
|
mediaTypes: Json;
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
export type ApiDocElement = HTMLElement & {
|
|
38
45
|
amf: Json;
|
|
39
|
-
shape:
|
|
46
|
+
shape: DomainElement | undefined;
|
|
40
47
|
};
|
|
41
48
|
|
|
42
49
|
export type AmfModel = Json;
|
|
43
50
|
|
|
44
|
-
export interface AmfParser {
|
|
45
|
-
parse(): void;
|
|
46
|
-
parsedModel: any;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
51
|
export interface TopicModel {
|
|
50
52
|
id: string;
|
|
51
53
|
type: string;
|
|
52
|
-
amf:
|
|
53
|
-
parser:
|
|
54
|
+
amf: string;
|
|
55
|
+
parser: AmfModelParser;
|
|
54
56
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DomainElement,
|
|
3
|
+
EndPoint,
|
|
4
|
+
Operation,
|
|
5
|
+
Shape
|
|
6
|
+
} from "@api-components/amf-helper-mixin";
|
|
1
7
|
import type {
|
|
2
8
|
ApiDocElement,
|
|
3
9
|
ApiEndpointElement,
|
|
@@ -37,7 +43,7 @@ export function createSummaryElement(amf: Json): HTMLElement {
|
|
|
37
43
|
*/
|
|
38
44
|
export function createEndpointElement(
|
|
39
45
|
amf: Json,
|
|
40
|
-
endpointModel:
|
|
46
|
+
endpointModel: EndPoint,
|
|
41
47
|
selected: string
|
|
42
48
|
): HTMLElement {
|
|
43
49
|
const el: ApiEndpointElement = document.createElement(
|
|
@@ -57,8 +63,8 @@ export function createEndpointElement(
|
|
|
57
63
|
*/
|
|
58
64
|
export function createMethodElement(
|
|
59
65
|
amf: Json,
|
|
60
|
-
endpointMethodModel:
|
|
61
|
-
methodModel:
|
|
66
|
+
endpointMethodModel: EndPoint | undefined,
|
|
67
|
+
methodModel: Operation | undefined
|
|
62
68
|
): HTMLElement {
|
|
63
69
|
const el: ApiMethodElement = document.createElement(
|
|
64
70
|
"api-method-documentation"
|
|
@@ -79,7 +85,7 @@ export function createMethodElement(
|
|
|
79
85
|
*/
|
|
80
86
|
export function createSecurityElement(
|
|
81
87
|
amf: Json,
|
|
82
|
-
securityModel:
|
|
88
|
+
securityModel: DomainElement | undefined
|
|
83
89
|
): HTMLElement {
|
|
84
90
|
const el: ApiSecurityElement = document.createElement(
|
|
85
91
|
"api-security-documentation"
|
|
@@ -98,7 +104,7 @@ export function createSecurityElement(
|
|
|
98
104
|
*/
|
|
99
105
|
export function createTypeElement(
|
|
100
106
|
amf: Json,
|
|
101
|
-
typeModel:
|
|
107
|
+
typeModel: Shape | undefined,
|
|
102
108
|
mediaTypes: Json
|
|
103
109
|
): HTMLElement {
|
|
104
110
|
const el: ApiTypeElement = document.createElement(
|
|
@@ -119,7 +125,7 @@ export function createTypeElement(
|
|
|
119
125
|
*/
|
|
120
126
|
export function createDocumentationElement(
|
|
121
127
|
amf: Json,
|
|
122
|
-
docsModel:
|
|
128
|
+
docsModel: DomainElement | undefined
|
|
123
129
|
): HTMLElement {
|
|
124
130
|
const el: ApiDocElement = document.createElement(
|
|
125
131
|
"api-documentation-document"
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
:host {
|
|
5
5
|
display: flex;
|
|
6
6
|
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
7
8
|
width: fit-content;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
:host(.breadcrumb_long) {
|
|
11
12
|
/* ensure 30 character min-width */
|
|
12
|
-
min-width:
|
|
13
|
+
min-width: 200px;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
:host(.breadcrumb_back-arrow) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { track } from "dxUtils/analytics";
|
|
1
2
|
import { LightningElement, api } from "lwc";
|
|
2
3
|
import { BreadcrumbItemVariant } from "typings/custom";
|
|
3
4
|
|
|
@@ -7,6 +8,8 @@ const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
|
|
|
7
8
|
const LONG_LABEL_NUMBER = 30;
|
|
8
9
|
export default class BreadcrumbItem extends LightningElement {
|
|
9
10
|
@api href?: string;
|
|
11
|
+
@api level?: string;
|
|
12
|
+
@api breadcrumbLabels?: string;
|
|
10
13
|
|
|
11
14
|
@api
|
|
12
15
|
get label() {
|
|
@@ -46,4 +49,23 @@ export default class BreadcrumbItem extends LightningElement {
|
|
|
46
49
|
private get isBackArrowVariant(): boolean {
|
|
47
50
|
return this._variant === "back-arrow";
|
|
48
51
|
}
|
|
52
|
+
|
|
53
|
+
private onLinkClick(event: Event): void {
|
|
54
|
+
track(event.target!, "custEv_breadcrumbClick", {
|
|
55
|
+
click_text: this.label,
|
|
56
|
+
click_url: `${window.location.origin}${this.href}`,
|
|
57
|
+
element_type: "link",
|
|
58
|
+
nav_type: "breadcrumb",
|
|
59
|
+
nav_level: this.level ? this.level + 1 : 1,
|
|
60
|
+
nav_item: this.breadcrumbLabels
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
track(event.target!, "custEv_linkClick", {
|
|
64
|
+
click_text: this.label,
|
|
65
|
+
click_url: `${window.location.origin}${this.href}`,
|
|
66
|
+
element_title: this.label,
|
|
67
|
+
element_type: "link",
|
|
68
|
+
content_category: "cta"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
49
71
|
}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
:host {
|
|
5
5
|
--dx-c-breadcrumbs-title-color: var(--dx-g-blue-vibrant-20);
|
|
6
6
|
--dx-c-breadcrumbs-breadcrumb-color: var(--dx-g-blue-vibrant-20);
|
|
7
|
+
|
|
8
|
+
font-family: var(--dx-g-font-sans);
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
nav {
|
|
10
12
|
display: flex;
|
|
11
13
|
align-items: center;
|
|
12
|
-
height: 100%;
|
|
13
14
|
position: relative;
|
|
14
15
|
gap: var(--dx-g-spacing-sm);
|
|
15
16
|
}
|
|
@@ -17,3 +18,10 @@ nav {
|
|
|
17
18
|
.breadcrumb-item_slash {
|
|
18
19
|
min-width: fit-content;
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
dx-dropdown {
|
|
23
|
+
--dx-c-dropdown-option-font-size: var(--dx-g-text-sm);
|
|
24
|
+
--dx-c-dropdown-option-label-color: var(
|
|
25
|
+
--dx-c-breadcrumbs-breadcrumb-color
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -1,48 +1,58 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<nav role="navigation" aria-label={ariaLabel}>
|
|
3
|
-
<template if:
|
|
4
|
-
<template if:
|
|
3
|
+
<template if:true={displayCrumbs}>
|
|
4
|
+
<template if:false={renderSmallVariant}>
|
|
5
5
|
<doc-breadcrumb-item
|
|
6
6
|
href={firstCrumb.href}
|
|
7
7
|
label={firstCrumb.label}
|
|
8
|
+
breadcrumb-labels={breadcrumbLabels}
|
|
8
9
|
></doc-breadcrumb-item>
|
|
9
10
|
<span class="breadcrumb-item_slash">/</span>
|
|
11
|
+
<template if:true={renderDropdown}>
|
|
12
|
+
<dx-dropdown
|
|
13
|
+
analytics-event="custEv_breadcrumbClick"
|
|
14
|
+
analytics-payload={ANALYTICS_PAYLOAD}
|
|
15
|
+
if:true={renderDropdown}
|
|
16
|
+
options={dropdownOptions}
|
|
17
|
+
open-on-hover
|
|
18
|
+
placement="bottom"
|
|
19
|
+
variant="indented"
|
|
20
|
+
width="fit-content"
|
|
21
|
+
>
|
|
22
|
+
<dx-button
|
|
23
|
+
aria-label="Open Breadcrumbs Dropdown"
|
|
24
|
+
icon-size="large"
|
|
25
|
+
icon-symbol="threedots"
|
|
26
|
+
variant="tertiary"
|
|
27
|
+
></dx-button>
|
|
28
|
+
</dx-dropdown>
|
|
29
|
+
<span class="breadcrumb-item_slash">/</span>
|
|
30
|
+
</template>
|
|
31
|
+
<template for:each={breadcrumbItems} for:item="breadcrumb">
|
|
32
|
+
<doc-breadcrumb-item
|
|
33
|
+
href={breadcrumb.href}
|
|
34
|
+
key={breadcrumb.id}
|
|
35
|
+
label={breadcrumb.label}
|
|
36
|
+
level={breadcrumb.level}
|
|
37
|
+
breadcrumb-labels={breadcrumbLabels}
|
|
38
|
+
></doc-breadcrumb-item>
|
|
39
|
+
<span class="breadcrumb-item_slash" key={breadcrumb.label}>
|
|
40
|
+
/
|
|
41
|
+
</span>
|
|
42
|
+
</template>
|
|
43
|
+
<doc-breadcrumb-item
|
|
44
|
+
label={lastCrumb.label}
|
|
45
|
+
breadcrumb-labels={breadcrumbLabels}
|
|
46
|
+
></doc-breadcrumb-item>
|
|
10
47
|
</template>
|
|
11
|
-
<template if:true={
|
|
12
|
-
<dx-dropdown
|
|
13
|
-
if:true={renderDropdown}
|
|
14
|
-
options={dropdownOptions}
|
|
15
|
-
open-on-hover
|
|
16
|
-
placement="bottom"
|
|
17
|
-
width="200px"
|
|
18
|
-
>
|
|
19
|
-
<dx-button
|
|
20
|
-
aria-label="Open Breadcrumbs Dropdown"
|
|
21
|
-
icon-size="large"
|
|
22
|
-
icon-symbol="threedots"
|
|
23
|
-
variant="tertiary"
|
|
24
|
-
></dx-button>
|
|
25
|
-
</dx-dropdown>
|
|
26
|
-
<span class="breadcrumb-item_slash">/</span>
|
|
27
|
-
</template>
|
|
28
|
-
<template for:each={breadcrumbItems} for:item="breadcrumb">
|
|
48
|
+
<template if:true={renderSmallVariant}>
|
|
29
49
|
<doc-breadcrumb-item
|
|
30
|
-
href={
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
href={lastLinkCrump.href}
|
|
51
|
+
label={lastLinkCrump.label}
|
|
52
|
+
breadcrumb-labels={breadcrumbLabels}
|
|
53
|
+
variant="back-arrow"
|
|
33
54
|
></doc-breadcrumb-item>
|
|
34
|
-
<span class="breadcrumb-item_slash" key={breadcrumb.label}>
|
|
35
|
-
/
|
|
36
|
-
</span>
|
|
37
55
|
</template>
|
|
38
|
-
<doc-breadcrumb-item label={lastCrumb.label}></doc-breadcrumb-item>
|
|
39
|
-
</template>
|
|
40
|
-
<template if:true={renderSmallVariant}>
|
|
41
|
-
<doc-breadcrumb-item
|
|
42
|
-
href={lastLinkCrump.href}
|
|
43
|
-
label={lastLinkCrump.label}
|
|
44
|
-
variant="back-arrow"
|
|
45
|
-
></doc-breadcrumb-item>
|
|
46
56
|
</template>
|
|
47
57
|
</nav>
|
|
48
58
|
</template>
|