@salesforcedevs/docs-components 1.3.282 → 1.3.300-scroll-fix-alpha2

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.282",
3
+ "version": "1.3.300-scroll-fix-alpha2",
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": "21e8d824aabb661c500aade3a5d55f9721256f8c"
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
- this.observer = new ResizeObserver((entries) => {
116
- const [nav] = entries;
117
- if (this.navWidth === nav.contentRect.width) {
118
- return;
119
- }
120
- this.navWidth = nav.contentRect.width;
121
- this.updateDropdownOptionAmount();
122
- });
123
-
124
- this.observer.observe(this.template.querySelector("nav")!);
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,15 +231,38 @@ 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
+ const docHeadingEls = Array.from(
237
+ document.querySelectorAll("doc-heading")
238
+ );
239
+ const rightNavBarEl = this.template.querySelector(".right-nav-bar");
240
+
234
241
  sidebarEl.style.setProperty(
235
242
  "--dx-c-content-sidebar-sticky-top",
236
243
  `${globalNavHeight + docHeaderHeight}px`
237
244
  );
238
245
 
239
- docHeaderEl.style.setProperty(
240
- "--dx-g-global-header-height",
241
- `${globalNavHeight}px`
242
- );
246
+ docHeadingEls.forEach((docHeadingEl) => {
247
+ (docHeadingEl as any).style.scrollMarginTop = docPhaseEl
248
+ ? `${
249
+ totalHeaderHeight +
250
+ docPhaseEl.getBoundingClientRect().height
251
+ }px`
252
+ : `${totalHeaderHeight + 30}px`;
253
+ });
254
+
255
+ if (rightNavBarEl) {
256
+ rightNavBarEl.style.setProperty(
257
+ "--dx-c-content-sidebar-sticky-top",
258
+ docPhaseEl
259
+ ? `${
260
+ totalHeaderHeight +
261
+ docPhaseEl.getBoundingClientRect().height
262
+ }px`
263
+ : `${totalHeaderHeight}px`
264
+ );
265
+ }
243
266
 
244
267
  // 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
268
  if (docPhaseEl) {
@@ -253,30 +276,6 @@ export default class ContentLayout extends LightningElement {
253
276
  : globalNavHeight + docHeaderHeight
254
277
  }px`
255
278
  );
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
279
  }
281
280
  });
282
281
  };
@@ -707,7 +707,7 @@ export default class DocXmlContent extends LightningElementWithState<{
707
707
  const title = document.querySelector("title");
708
708
  const composedTitle = this.getComposedTitle(topicTitle, this.docTitle);
709
709
 
710
- if (title) {
710
+ if (title && title.textContent) {
711
711
  title.textContent = composedTitle;
712
712
  }
713
713
  const metatitle = document.querySelector('meta[name="title"]');
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.