@salesforcedevs/docs-components 1.3.304-async-fix-alpha1 → 1.3.319-scroll-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/package.json +2 -3
- package/src/modules/doc/amfReference/amfReference.ts +9 -1
- package/src/modules/doc/amfReference/types.ts +1 -1
- package/src/modules/doc/amfTopic/amfTopic.ts +6 -14
- package/src/modules/doc/amfTopic/types.ts +1 -1
- package/src/modules/doc/content/content.css +2 -1
- package/src/modules/doc/contentLayout/contentLayout.css +2 -1
- package/src/modules/doc/contentLayout/contentLayout.ts +36 -25
- package/src/modules/doc/amfTopic/worker.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.319-scroll-alpha",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"lodash.orderby": "^4.6.0",
|
|
18
18
|
"lodash.uniqby": "^4.7.0",
|
|
19
19
|
"query-string": "^7.1.3",
|
|
20
|
-
"sentence-case": "^3.0.4"
|
|
21
|
-
"yieldable-json": "^2.0.1"
|
|
20
|
+
"sentence-case": "^3.0.4"
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
23
|
"@types/classnames": "^2.2.10",
|
|
@@ -1475,10 +1475,18 @@ export default class AmfReference extends LightningElement {
|
|
|
1475
1475
|
// update topic view
|
|
1476
1476
|
const { referenceId, amfId, type } = this.selectedTopic!;
|
|
1477
1477
|
|
|
1478
|
+
// Adding stringify inside try/catch
|
|
1479
|
+
let amfModelString = "";
|
|
1480
|
+
try {
|
|
1481
|
+
amfModelString = JSON.stringify(this.amfMap[referenceId].model);
|
|
1482
|
+
} catch (error) {
|
|
1483
|
+
console.error(`Error stringifying amf model: ${error}`);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1478
1486
|
// This updates the component in the content section.
|
|
1479
1487
|
this.topicModel = {
|
|
1480
1488
|
type,
|
|
1481
|
-
amf:
|
|
1489
|
+
amf: amfModelString,
|
|
1482
1490
|
parser: this.amfMap[referenceId].parser,
|
|
1483
1491
|
id: amfId
|
|
1484
1492
|
};
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from "./utils";
|
|
10
10
|
import type { TopicModel } from "./types";
|
|
11
11
|
import { Json } from "typings/custom";
|
|
12
|
-
import { parse, stringify } from "yieldable-json";
|
|
13
12
|
|
|
14
13
|
const TABLE_SIZE_MATCH = "769px";
|
|
15
14
|
|
|
@@ -28,13 +27,17 @@ export default class AmfTopic extends LightningElement {
|
|
|
28
27
|
!this.amf ||
|
|
29
28
|
(value && this._model && value.amf !== this._model?.amf)
|
|
30
29
|
) {
|
|
31
|
-
|
|
30
|
+
try {
|
|
31
|
+
this.amf = value && JSON.parse(value.amf);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(`Error parsing amf model: ${error}`);
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
if (
|
|
34
37
|
!this.type ||
|
|
35
38
|
(value && this._model && value.type !== this._model?.type)
|
|
36
39
|
) {
|
|
37
|
-
this.type = value &&
|
|
40
|
+
this.type = value && value.type;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
this._model = value;
|
|
@@ -106,14 +109,3 @@ export default class AmfTopic extends LightningElement {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* The underlying web components we use from api-console mutate their models we pass in.
|
|
112
|
-
* Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
|
|
113
|
-
* @param value JSON Serializable object to clone.
|
|
114
|
-
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
|
|
115
|
-
*/
|
|
116
|
-
async function clone(value: any): any {
|
|
117
|
-
const parsedValue = await parse(stringify(value));
|
|
118
|
-
return parsedValue;
|
|
119
|
-
}
|
|
@@ -385,6 +385,7 @@ mark {
|
|
|
385
385
|
/* offset page jump link due to fixed header */
|
|
386
386
|
[id] {
|
|
387
387
|
scroll-margin-top: calc(
|
|
388
|
-
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
388
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
|
|
389
|
+
var(--dx-g-spacing-2xl)
|
|
389
390
|
);
|
|
390
391
|
}
|
|
@@ -43,7 +43,8 @@ dx-toc {
|
|
|
43
43
|
/* offset page jump link due to fixed header */
|
|
44
44
|
::slotted(doc-heading) {
|
|
45
45
|
scroll-margin-top: calc(
|
|
46
|
-
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
|
|
46
|
+
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
|
|
47
|
+
var(--dx-g-spacing-2xl)
|
|
47
48
|
);
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -215,10 +215,16 @@ export default class ContentLayout extends LightningElement {
|
|
|
215
215
|
".sticky-doc-header"
|
|
216
216
|
) as HTMLElement;
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
let docPhaseEl = (
|
|
219
219
|
this.template.querySelector("[name=doc-phase]")! as any
|
|
220
220
|
).assignedElements()[0] as HTMLSlotElement;
|
|
221
221
|
|
|
222
|
+
if (!docPhaseEl) {
|
|
223
|
+
docPhaseEl = (
|
|
224
|
+
this.template.querySelector("[name=version-banner]")! as any
|
|
225
|
+
).assignedElements()[0] as HTMLSlotElement;
|
|
226
|
+
}
|
|
227
|
+
|
|
222
228
|
if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
|
|
223
229
|
console.warn("One or more required elements are missing.");
|
|
224
230
|
return;
|
|
@@ -231,6 +237,14 @@ export default class ContentLayout extends LightningElement {
|
|
|
231
237
|
(globalNavEl.getBoundingClientRect().height !== 72 ? 0 : 72) +
|
|
232
238
|
contextNavEl.getBoundingClientRect().height;
|
|
233
239
|
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
|
|
240
|
+
const totalHeaderHeight = globalNavHeight + docHeaderHeight;
|
|
241
|
+
|
|
242
|
+
// Selecting the doc section heading and RNB here.
|
|
243
|
+
const docHeadingEls = Array.from(
|
|
244
|
+
document.querySelectorAll("doc-heading")
|
|
245
|
+
);
|
|
246
|
+
const rightNavBarEl = this.template.querySelector(".right-nav-bar");
|
|
247
|
+
|
|
234
248
|
sidebarEl.style.setProperty(
|
|
235
249
|
"--dx-c-content-sidebar-sticky-top",
|
|
236
250
|
`${globalNavHeight + docHeaderHeight}px`
|
|
@@ -241,6 +255,27 @@ export default class ContentLayout extends LightningElement {
|
|
|
241
255
|
`${globalNavHeight}px`
|
|
242
256
|
);
|
|
243
257
|
|
|
258
|
+
// Adjusting the doc section heading on scroll.
|
|
259
|
+
docHeadingEls.forEach((docHeadingEl) => {
|
|
260
|
+
(docHeadingEl as any).style.scrollMarginTop = docPhaseEl
|
|
261
|
+
? `${
|
|
262
|
+
totalHeaderHeight +
|
|
263
|
+
docPhaseEl.getBoundingClientRect().height +
|
|
264
|
+
40
|
|
265
|
+
}px`
|
|
266
|
+
: `${totalHeaderHeight + 40}px`;
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
// Adjusting the right nav bar on scroll.
|
|
270
|
+
if (rightNavBarEl) {
|
|
271
|
+
rightNavBarEl.style.top = docPhaseEl
|
|
272
|
+
? `${
|
|
273
|
+
totalHeaderHeight +
|
|
274
|
+
docPhaseEl.getBoundingClientRect().height
|
|
275
|
+
}px`
|
|
276
|
+
: `${totalHeaderHeight}px`;
|
|
277
|
+
}
|
|
278
|
+
|
|
244
279
|
// If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
|
|
245
280
|
if (docPhaseEl) {
|
|
246
281
|
docPhaseEl.style.setProperty(
|
|
@@ -253,30 +288,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
253
288
|
: globalNavHeight + docHeaderHeight
|
|
254
289
|
}px`
|
|
255
290
|
);
|
|
256
|
-
|
|
257
|
-
// Adjust scroll margin for doc headings when doc phase is present
|
|
258
|
-
const docHeadingEls = Array.from(
|
|
259
|
-
document.querySelectorAll("doc-heading")
|
|
260
|
-
);
|
|
261
|
-
docHeadingEls.forEach((docHeadingEl) => {
|
|
262
|
-
(docHeadingEl as any).style.scrollMarginTop = `${
|
|
263
|
-
globalNavHeight +
|
|
264
|
-
docHeaderHeight +
|
|
265
|
-
docPhaseEl.getBoundingClientRect().height
|
|
266
|
-
}px`;
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
// Adjust right nav bar position when doc phase is present
|
|
270
|
-
const rightNavBarEl =
|
|
271
|
-
this.template.querySelector(".right-nav-bar");
|
|
272
|
-
|
|
273
|
-
if (rightNavBarEl) {
|
|
274
|
-
rightNavBarEl.style.top = `${
|
|
275
|
-
globalNavHeight +
|
|
276
|
-
docHeaderHeight +
|
|
277
|
-
docPhaseEl.getBoundingClientRect().height
|
|
278
|
-
}px`;
|
|
279
|
-
}
|
|
280
291
|
}
|
|
281
292
|
});
|
|
282
293
|
};
|