@salesforcedevs/docs-components 1.3.344 → 1.3.345-spPage-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 +1 -0
- package/package.json +2 -2
- package/src/modules/doc/contentLayout/contentLayout.ts +22 -6
- package/src/modules/doc/specificationContent/specificationContent.css +3 -0
- package/src/modules/doc/specificationContent/specificationContent.html +102 -0
- package/src/modules/doc/specificationContent/specificationContent.ts +64 -0
- package/LICENSE +0 -12
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.345-spPage-alpha",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@types/lodash.orderby": "4.6.9",
|
|
25
25
|
"@types/lodash.uniqby": "4.7.9"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
28
28
|
}
|
|
@@ -124,8 +124,14 @@ export default class ContentLayout extends LightningElement {
|
|
|
124
124
|
const headingElements = this.getHeadingElements();
|
|
125
125
|
headingElements.forEach((headingElement: any) => {
|
|
126
126
|
// Sometimes elements hash and header is not being set when slot content is wrapped with div
|
|
127
|
-
headingElement.hash
|
|
128
|
-
|
|
127
|
+
if (!headingElement.hash) {
|
|
128
|
+
headingElement.hash = headingElement.attributes.hash?.nodeValue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!headingElement.header) {
|
|
132
|
+
headingElement.header =
|
|
133
|
+
headingElement.attributes.header?.nodeValue;
|
|
134
|
+
}
|
|
129
135
|
});
|
|
130
136
|
this.updateTocItems(headingElements);
|
|
131
137
|
};
|
|
@@ -138,8 +144,19 @@ export default class ContentLayout extends LightningElement {
|
|
|
138
144
|
tabPanelListItem?.querySelectorAll("dx-tab-panel");
|
|
139
145
|
for (const tabPanelItem of tabPanels) {
|
|
140
146
|
if (tabPanelItem.active) {
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
// This is needed for Specification tab content
|
|
148
|
+
const specificationElement = tabPanelItem.querySelector(
|
|
149
|
+
"doc-specification-content"
|
|
150
|
+
);
|
|
151
|
+
if (specificationElement) {
|
|
152
|
+
headingElements =
|
|
153
|
+
specificationElement.shadowRoot.querySelectorAll(
|
|
154
|
+
TOC_HEADER_TAG
|
|
155
|
+
);
|
|
156
|
+
} else {
|
|
157
|
+
headingElements =
|
|
158
|
+
tabPanelItem.querySelectorAll(TOC_HEADER_TAG);
|
|
159
|
+
}
|
|
143
160
|
break;
|
|
144
161
|
}
|
|
145
162
|
}
|
|
@@ -456,8 +473,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
456
473
|
this.observer.observe(headingElement);
|
|
457
474
|
}
|
|
458
475
|
|
|
459
|
-
this.contentLoaded = true;
|
|
460
|
-
|
|
461
476
|
if (!this.didScrollToSelectedHash) {
|
|
462
477
|
this.didScrollToSelectedHash = true;
|
|
463
478
|
this.scrollToHash(headingElements);
|
|
@@ -466,6 +481,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
466
481
|
|
|
467
482
|
onSlotChange(): void {
|
|
468
483
|
this.updateRNB();
|
|
484
|
+
this.contentLoaded = true;
|
|
469
485
|
}
|
|
470
486
|
|
|
471
487
|
// eslint-disable-next-line no-undef
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="specification-properties">
|
|
3
|
+
<template if:true={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
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<template for:each={attributes} for:item="attribute">
|
|
19
|
+
<tr key={attribute.name}>
|
|
20
|
+
<td>{attribute.nameInKebabCase}</td>
|
|
21
|
+
<td>{attribute.description}</td>
|
|
22
|
+
</tr>
|
|
23
|
+
</template>
|
|
24
|
+
</tbody>
|
|
25
|
+
</table>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<template if:true={hasMethods}>
|
|
29
|
+
<doc-heading
|
|
30
|
+
header="Methods"
|
|
31
|
+
hash="methods"
|
|
32
|
+
aria-level="2"
|
|
33
|
+
id="methods"
|
|
34
|
+
></doc-heading>
|
|
35
|
+
<table>
|
|
36
|
+
<thead>
|
|
37
|
+
<tr>
|
|
38
|
+
<th>Name</th>
|
|
39
|
+
<th>Description</th>
|
|
40
|
+
</tr>
|
|
41
|
+
</thead>
|
|
42
|
+
<tbody>
|
|
43
|
+
<template for:each={methods} for:item="method">
|
|
44
|
+
<tr key={method.name}>
|
|
45
|
+
<td>{method.nameInKebabCase}</td>
|
|
46
|
+
<td>{method.description}</td>
|
|
47
|
+
</tr>
|
|
48
|
+
</template>
|
|
49
|
+
</tbody>
|
|
50
|
+
</table>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<template if:true={hasSlots}>
|
|
54
|
+
<doc-heading
|
|
55
|
+
header="Slots"
|
|
56
|
+
hash="slots"
|
|
57
|
+
aria-level="2"
|
|
58
|
+
id="slots"
|
|
59
|
+
></doc-heading>
|
|
60
|
+
<table>
|
|
61
|
+
<thead>
|
|
62
|
+
<tr>
|
|
63
|
+
<th>Name</th>
|
|
64
|
+
<th>Description</th>
|
|
65
|
+
</tr>
|
|
66
|
+
</thead>
|
|
67
|
+
<tbody>
|
|
68
|
+
<template for:each={slots} for:item="slot">
|
|
69
|
+
<tr key={slot.name}>
|
|
70
|
+
<td>{slot.nameInKebabCase}</td>
|
|
71
|
+
<td>{slot.description}</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</template>
|
|
74
|
+
</tbody>
|
|
75
|
+
</table>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<template if:true={hasEvents}>
|
|
79
|
+
<doc-heading
|
|
80
|
+
header="Events"
|
|
81
|
+
hash="events"
|
|
82
|
+
aria-level="2"
|
|
83
|
+
></doc-heading>
|
|
84
|
+
<table>
|
|
85
|
+
<thead>
|
|
86
|
+
<tr>
|
|
87
|
+
<th>Name</th>
|
|
88
|
+
<th>Description</th>
|
|
89
|
+
</tr>
|
|
90
|
+
</thead>
|
|
91
|
+
<tbody>
|
|
92
|
+
<template for:each={events} for:item="event">
|
|
93
|
+
<tr key={event.name}>
|
|
94
|
+
<td>{event.nameInKebabCase}</td>
|
|
95
|
+
<td>{event.description}</td>
|
|
96
|
+
</tr>
|
|
97
|
+
</template>
|
|
98
|
+
</tbody>
|
|
99
|
+
</table>
|
|
100
|
+
</template>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LightningElement, track, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
/* The actual URL is as follows:
|
|
4
|
+
* http://api.salesforce.com/doc-platform/developer/v1-alpha/components/{type}/{component-name}
|
|
5
|
+
* Until the API integration is ready, we will go ahead with localhost.
|
|
6
|
+
*/
|
|
7
|
+
const localURL: string = "https://cx-mock-router-f02597c1b3da.herokuapp.com";
|
|
8
|
+
const ROUTER_URL: string =
|
|
9
|
+
localURL || "https://api.salesforce.com/doc-platform/developer/v1";
|
|
10
|
+
|
|
11
|
+
export default class SpecificationContent extends LightningElement {
|
|
12
|
+
@track data: any;
|
|
13
|
+
@api component: string = "button";
|
|
14
|
+
@api type: string = "lightning";
|
|
15
|
+
|
|
16
|
+
private attributes = [];
|
|
17
|
+
private methods = [];
|
|
18
|
+
private slots = [];
|
|
19
|
+
private events = [];
|
|
20
|
+
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
this.fetchComponentMetadata();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async fetchComponentMetadata() {
|
|
26
|
+
const url = `${ROUTER_URL}/components/${this.type}/${this.component}`;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(url);
|
|
30
|
+
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const result = await response.json();
|
|
36
|
+
this.data = result;
|
|
37
|
+
({
|
|
38
|
+
attributes: this.attributes,
|
|
39
|
+
methods: this.methods,
|
|
40
|
+
slots: this.slots,
|
|
41
|
+
events: this.events
|
|
42
|
+
} = this.data);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
this.data = {};
|
|
45
|
+
console.error("fetchComponentMetadata() failed for:" + url);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get hasAttributes() {
|
|
50
|
+
return this.attributes?.length > 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get hasMethods() {
|
|
54
|
+
return this.methods?.length > 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get hasSlots() {
|
|
58
|
+
return this.slots?.length > 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get hasEvents() {
|
|
62
|
+
return this.events?.length > 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
-
|
|
10
|
-
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
-
|
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|