@salesforcedevs/docs-components 1.20.0-rnb-scroll-3 → 1.20.2

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/LICENSE ADDED
@@ -0,0 +1,12 @@
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.
package/package.json CHANGED
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.20.0-rnb-scroll-3",
3
+ "version": "1.20.2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "engines": {
8
- "node": "20.x",
9
- "yarn": "1.22.19"
10
- },
11
- "volta": {
12
- "node": "20.18.2",
13
- "yarn": "1.22.19"
8
+ "node": "20.x"
14
9
  },
15
10
  "publishConfig": {
16
11
  "access": "public"
@@ -30,5 +25,5 @@
30
25
  "@types/lodash.orderby": "4.6.9",
31
26
  "@types/lodash.uniqby": "4.7.9"
32
27
  },
33
- "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
+ "gitHead": "10311f28b3791b85639bde33ade200feb8ccd06d"
34
29
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  .dx-callout {
6
6
  border-radius: 4px;
7
+ margin: var(--dx-g-spacing-md) 0;
7
8
  }
8
9
 
9
10
  .dx-callout-base,
@@ -269,28 +269,13 @@ export default class ContentLayout extends LightningElement {
269
269
  });
270
270
 
271
271
  // Adjusting the right nav bar on scroll.
272
- // setting maxheight to make the RNB scrollable based on different parent elements
273
272
  if (rightNavBarEl) {
274
- const docPhaseElHeight = docPhaseEl
275
- ? docPhaseEl.getBoundingClientRect().height
276
- : 0;
277
- const viewportHeight = window.innerHeight;
278
- const maxHeight =
279
- viewportHeight -
280
- (docPhaseElHeight + totalHeaderHeight + 24); //added some margin of dx-toc
281
-
282
- rightNavBarEl.style.top = `${
283
- totalHeaderHeight + docPhaseElHeight
284
- }px`;
285
-
286
- const toc = rightNavBarEl.querySelector("dx-toc");
287
- const listContainer = toc?.shadowRoot?.querySelector(
288
- ".toc"
289
- ) as HTMLElement;
290
-
291
- if (listContainer) {
292
- listContainer.style.maxHeight = `${maxHeight}px`;
293
- }
273
+ rightNavBarEl.style.top = docPhaseEl
274
+ ? `${
275
+ totalHeaderHeight +
276
+ docPhaseEl.getBoundingClientRect().height
277
+ }px`
278
+ : `${totalHeaderHeight}px`;
294
279
  }
295
280
 
296
281
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
@@ -160,11 +160,11 @@
160
160
  </tr>
161
161
  </thead>
162
162
  <tbody>
163
- <template for:each={events} for:item="event">
163
+ <template for:each={processedEvents} for:item="event">
164
164
  <tr key={event.name}>
165
165
  <td>
166
166
  <span class="code">
167
- {event.nameInKebabCase}
167
+ {event.nameCapitalized}
168
168
  </span>
169
169
  </td>
170
170
  <td>{event.description}</td>
@@ -17,6 +17,7 @@ export default class SpecificationContent extends LightningElement {
17
17
  private methods: Method[] = [];
18
18
  private slots: Specification[] = [];
19
19
  private events: Specification[] = [];
20
+ private _processedEvents: Specification[] = [];
20
21
 
21
22
  /* TODO: For now setting the timeout to 300ms,
22
23
  * post integration with CX-Router API will test and change if required.
@@ -60,6 +61,20 @@ export default class SpecificationContent extends LightningElement {
60
61
  slots: this.slots,
61
62
  events: this.events
62
63
  } = this.data);
64
+
65
+ // Process events once when data is set
66
+ this._processedEvents = this.events
67
+ ? this.events.map((event) => {
68
+ const capitalizedName = event.name
69
+ ? event.name.charAt(0).toUpperCase() +
70
+ event.name.slice(1)
71
+ : "";
72
+ return {
73
+ ...event,
74
+ nameCapitalized: capitalizedName
75
+ };
76
+ })
77
+ : [];
63
78
  }
64
79
  } catch (error) {
65
80
  this.data = {};
@@ -92,6 +107,15 @@ export default class SpecificationContent extends LightningElement {
92
107
  });
93
108
  }
94
109
 
110
+ /**
111
+ * Returns the preprocessed events for easier rendering in the template.
112
+ * Each event is augmented with a capitalized name property that capitalizes the first letter
113
+ * while maintaining camelCase format.
114
+ */
115
+ get processedEvents(): Specification[] {
116
+ return this._processedEvents;
117
+ }
118
+
95
119
  get hasAttributes() {
96
120
  return this.attributes?.length > 0;
97
121
  }