@salesforcedevs/docs-components 0.74.3-alpha.3 → 0.75.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "0.74.3-alpha.3",
3
+ "version": "0.75.0",
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": "4629fdd9ca18a13480044ad43515b91945d16aad"
27
+ "gitHead": "daec9455e510a511d8818691837d23f7bd5f9bb0"
28
28
  }
@@ -1,16 +1,14 @@
1
1
  <template>
2
2
  <nav role="navigation" aria-label={ariaLabel}>
3
- <template if:true={hasBreadcrumbs}>
3
+ <template if:true={displayCrumbs}>
4
4
  <template if:false={renderSmallVariant}>
5
- <template if:true={renderFirstCrumb}>
6
- <doc-breadcrumb-item
7
- analytics-event={analyticsEventName}
8
- analytics-base-payload={analyticsBasePayload}
9
- href={firstCrumb.href}
10
- label={firstCrumb.label}
11
- ></doc-breadcrumb-item>
12
- <span class="breadcrumb-item_slash">/</span>
13
- </template>
5
+ <doc-breadcrumb-item
6
+ analytics-event={analyticsEventName}
7
+ analytics-base-payload={analyticsBasePayload}
8
+ href={firstCrumb.href}
9
+ label={firstCrumb.label}
10
+ ></doc-breadcrumb-item>
11
+ <span class="breadcrumb-item_slash">/</span>
14
12
  <template if:true={renderDropdown}>
15
13
  <dx-dropdown
16
14
  if:true={renderDropdown}
@@ -68,10 +68,6 @@ export default class Breadcrumbs extends LightningElement {
68
68
  return this.breadcrumbs[this.breadcrumbs.length - 2];
69
69
  }
70
70
 
71
- private get hasBreadcrumbs(): boolean {
72
- return this.breadcrumbs.length > 0;
73
- }
74
-
75
71
  private get hasInternalBreadcrumbs(): boolean {
76
72
  return this.breadcrumbs.length > 2;
77
73
  }
@@ -96,7 +92,7 @@ export default class Breadcrumbs extends LightningElement {
96
92
  );
97
93
  }
98
94
 
99
- private get renderFirstCrumb(): boolean {
95
+ private get displayCrumbs(): boolean {
100
96
  return this.breadcrumbs.length > 1;
101
97
  }
102
98
 
@@ -156,10 +152,6 @@ export default class Breadcrumbs extends LightningElement {
156
152
  }
157
153
 
158
154
  private calculateBreadcrumbsConfigs(): void {
159
- if (!this.hasBreadcrumbs) {
160
- return;
161
- }
162
-
163
155
  this.breadcrumbConfigs = [
164
156
  ...Array(this._breadcrumbs.length - 1).keys()
165
157
  ].map((optionsAmount) => {
@@ -29,10 +29,12 @@
29
29
  <div class="content-body-container">
30
30
  <div class="content-body">
31
31
  <doc-breadcrumbs
32
- if:true={breadcrumbs}
32
+ if:true={showBreadcrumbs}
33
33
  breadcrumbs={breadcrumbs}
34
34
  ></doc-breadcrumbs>
35
- <slot onslotchange={onSlotChange}></slot>
35
+ <div style={docContentStyle}>
36
+ <slot onslotchange={onSlotChange}></slot>
37
+ </div>
36
38
  </div>
37
39
  <div class="right-nav-bar is-sticky">
38
40
  <dx-toc
@@ -38,7 +38,7 @@ export default class ContentLayout extends LightningElement {
38
38
  return this._breadcrumbs;
39
39
  }
40
40
 
41
- set breadcrumbs(value) {
41
+ set breadcrumbs(value): [] {
42
42
  if (value) {
43
43
  this._breadcrumbs = toJson(value);
44
44
  }
@@ -111,6 +111,14 @@ export default class ContentLayout extends LightningElement {
111
111
  return window.location.pathname;
112
112
  }
113
113
 
114
+ get showBreadcrumbs(): boolean {
115
+ return this.breadcrumbs != null && (this.breadcrumbs as any[]).length > 1;
116
+ }
117
+
118
+ get docContentStyle(): string {
119
+ return this.showBreadcrumbs ? "" : "margin-top: 48px";
120
+ }
121
+
114
122
  connectedCallback(): void {
115
123
  const hasParentHighlightListener = closest(
116
124
  "doc-xml-content",
@@ -34,6 +34,7 @@
34
34
  docs-data={docContent}
35
35
  page-reference={pageReference}
36
36
  onnavclick={handleNavClick}
37
+ style={docContentStyle}
37
38
  ></doc-content>
38
39
  </doc-content-layout>
39
40
  </template>
@@ -577,7 +577,11 @@ export default class DocXmlContent extends LightningElementWithState<{
577
577
  }
578
578
 
579
579
  get showBreadcrumbs(): boolean {
580
- return this.breadcrumbs && this.breadcrumbs.length > 0;
580
+ return this.breadcrumbs && this.breadcrumbs.length > 1;
581
+ }
582
+
583
+ get docContentStyle(): string {
584
+ return this.showBreadcrumbs ? "" : "margin-top: 48px";
581
585
  }
582
586
 
583
587
  private buildBreadcrumbs(): void {