@salesforcedevs/docs-components 1.3.296 → 1.3.300-scroll-fix-alpha3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.300-scroll-fix-alpha3",
|
|
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.7",
|
|
25
25
|
"@types/lodash.uniqby": "^4.7.7"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
28
28
|
}
|
|
@@ -112,16 +112,23 @@ export default class Breadcrumbs extends LightningElement {
|
|
|
112
112
|
|
|
113
113
|
renderedCallback(): void {
|
|
114
114
|
if (!this.observer) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
try {
|
|
116
|
+
this.observer = new ResizeObserver((entries) => {
|
|
117
|
+
const [nav] = entries;
|
|
118
|
+
if (this.navWidth === nav.contentRect.width) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
this.navWidth = nav.contentRect.width;
|
|
122
|
+
this.updateDropdownOptionAmount();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
this.observer.observe(this.template.querySelector("nav")!);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.error(
|
|
128
|
+
"Error occured while setting up ResizeObserver on breadcrumbs",
|
|
129
|
+
error
|
|
130
|
+
);
|
|
131
|
+
}
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
134
|
|
|
@@ -231,6 +231,14 @@ export default class ContentLayout extends LightningElement {
|
|
|
231
231
|
(globalNavEl.getBoundingClientRect().height !== 72 ? 0 : 72) +
|
|
232
232
|
contextNavEl.getBoundingClientRect().height;
|
|
233
233
|
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
|
|
234
|
+
const totalHeaderHeight = globalNavHeight + docHeaderHeight;
|
|
235
|
+
|
|
236
|
+
// Selecting the doc section heading and RNB here.
|
|
237
|
+
const docHeadingEls = Array.from(
|
|
238
|
+
document.querySelectorAll("doc-heading")
|
|
239
|
+
);
|
|
240
|
+
const rightNavBarEl = this.template.querySelector(".right-nav-bar");
|
|
241
|
+
|
|
234
242
|
sidebarEl.style.setProperty(
|
|
235
243
|
"--dx-c-content-sidebar-sticky-top",
|
|
236
244
|
`${globalNavHeight + docHeaderHeight}px`
|
|
@@ -241,6 +249,26 @@ export default class ContentLayout extends LightningElement {
|
|
|
241
249
|
`${globalNavHeight}px`
|
|
242
250
|
);
|
|
243
251
|
|
|
252
|
+
// Adjusting the doc section heading on scroll.
|
|
253
|
+
docHeadingEls.forEach((docHeadingEl) => {
|
|
254
|
+
(docHeadingEl as any).style.scrollMarginTop = docPhaseEl
|
|
255
|
+
? `${
|
|
256
|
+
totalHeaderHeight +
|
|
257
|
+
docPhaseEl.getBoundingClientRect().height
|
|
258
|
+
}px`
|
|
259
|
+
: `${totalHeaderHeight + 30}px`;
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// Adjusting the right nav bar on scroll.
|
|
263
|
+
if (rightNavBarEl) {
|
|
264
|
+
rightNavBarEl.style.top = docPhaseEl
|
|
265
|
+
? `${
|
|
266
|
+
totalHeaderHeight +
|
|
267
|
+
docPhaseEl.getBoundingClientRect().height
|
|
268
|
+
}px`
|
|
269
|
+
: `${totalHeaderHeight}px`;
|
|
270
|
+
}
|
|
271
|
+
|
|
244
272
|
// 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
273
|
if (docPhaseEl) {
|
|
246
274
|
docPhaseEl.style.setProperty(
|
|
@@ -253,30 +281,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
253
281
|
: globalNavHeight + docHeaderHeight
|
|
254
282
|
}px`
|
|
255
283
|
);
|
|
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
284
|
}
|
|
281
285
|
});
|
|
282
286
|
};
|
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.
|