@salesforcedevs/docs-components 1.17.11 → 1.17.12-banner
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 -2
- package/src/modules/doc/contentLayout/contentLayout.ts +39 -15
- package/LICENSE +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.12-banner",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
29
29
|
}
|
|
@@ -248,41 +248,65 @@ export default class ContentLayout extends LightningElement {
|
|
|
248
248
|
const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
|
|
249
249
|
const totalHeaderHeight = globalNavHeight + docHeaderHeight;
|
|
250
250
|
|
|
251
|
+
// Collect any banners rendered via the doc-phase and version-banner slots
|
|
252
|
+
const versionBannerSlot = this.template.querySelector(
|
|
253
|
+
"[name=version-banner]"
|
|
254
|
+
) as any;
|
|
255
|
+
const docPhaseSlot = this.template.querySelector(
|
|
256
|
+
"[name=doc-phase]"
|
|
257
|
+
) as any;
|
|
258
|
+
const versionBannerEls = (
|
|
259
|
+
versionBannerSlot
|
|
260
|
+
? (versionBannerSlot.assignedElements() as HTMLElement[])
|
|
261
|
+
: []
|
|
262
|
+
) as HTMLElement[];
|
|
263
|
+
const docPhaseEls = (
|
|
264
|
+
docPhaseSlot
|
|
265
|
+
? (docPhaseSlot.assignedElements() as HTMLElement[])
|
|
266
|
+
: []
|
|
267
|
+
) as HTMLElement[];
|
|
268
|
+
const bannersTotalHeight = [
|
|
269
|
+
...versionBannerEls,
|
|
270
|
+
...docPhaseEls
|
|
271
|
+
].reduce(
|
|
272
|
+
(sum, el) => sum + (el?.getBoundingClientRect()?.height || 0),
|
|
273
|
+
0
|
|
274
|
+
);
|
|
275
|
+
|
|
251
276
|
// Selecting the doc section heading and RNB here.
|
|
252
277
|
const docHeadingEls = Array.from(
|
|
253
278
|
document.querySelectorAll("doc-heading")
|
|
254
279
|
);
|
|
255
280
|
const rightNavBarEl = this.template.querySelector(".right-nav-bar");
|
|
256
281
|
|
|
257
|
-
sidebarEl.style.setProperty(
|
|
282
|
+
(sidebarEl as HTMLElement).style.setProperty(
|
|
258
283
|
"--dx-c-content-sidebar-sticky-top",
|
|
259
|
-
`${
|
|
284
|
+
`${totalHeaderHeight}px`
|
|
260
285
|
);
|
|
261
286
|
|
|
262
287
|
docHeaderEl.style.setProperty(
|
|
263
288
|
"--dx-g-global-header-height",
|
|
264
289
|
`${globalNavHeight}px`
|
|
265
290
|
);
|
|
291
|
+
// Expose heights as CSS variables for sticky offsets used by page content
|
|
292
|
+
const rootStyle = document.documentElement.style;
|
|
293
|
+
rootStyle.setProperty(
|
|
294
|
+
"--dx-g-doc-header-banner-height",
|
|
295
|
+
`${docHeaderHeight + bannersTotalHeight}px`
|
|
296
|
+
);
|
|
266
297
|
|
|
267
298
|
// Adjusting the doc section heading on scroll.
|
|
268
299
|
docHeadingEls.forEach((docHeadingEl) => {
|
|
269
|
-
(docHeadingEl as any).style.scrollMarginTop =
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
docPhaseEl.getBoundingClientRect().height +
|
|
273
|
-
40
|
|
274
|
-
}px`
|
|
275
|
-
: `${totalHeaderHeight + 40}px`;
|
|
300
|
+
(docHeadingEl as any).style.scrollMarginTop = `${
|
|
301
|
+
totalHeaderHeight + bannersTotalHeight + 40
|
|
302
|
+
}px`;
|
|
276
303
|
});
|
|
277
304
|
|
|
278
305
|
// Adjusting the right nav bar on scroll.
|
|
279
306
|
if (rightNavBarEl) {
|
|
280
|
-
rightNavBarEl.style.top =
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
docPhaseEl.getBoundingClientRect().height
|
|
284
|
-
}px`
|
|
285
|
-
: `${totalHeaderHeight}px`;
|
|
307
|
+
(rightNavBarEl as HTMLElement).style.top = `${
|
|
308
|
+
totalHeaderHeight + bannersTotalHeight
|
|
309
|
+
}px`;
|
|
286
310
|
}
|
|
287
311
|
|
|
288
312
|
// If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
|
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.
|