@salesforcedevs/docs-components 1.14.9-playground-404-1 → 1.16.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": "1.14.9-playground-404-1",
3
+ "version": "1.16.0",
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": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
+ "gitHead": "977c82c3a242a1476eee4eee5c70b03472a7492e"
29
29
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="container" if:true={playgroundAvailable}>
2
+ <div class="container" lwc:if={playgroundAvailable}>
3
3
  <dx-spinner
4
4
  size="large"
5
5
  variant="brand"
@@ -13,7 +13,7 @@
13
13
  ></iframe>
14
14
  </div>
15
15
  <dx-error-fallback
16
- if:false={playgroundAvailable}
16
+ lwc:else
17
17
  title="Playground Unavailable"
18
18
  description="This component's playground is currently unavailable. Please check again later."
19
19
  ></dx-error-fallback>
@@ -11,6 +11,8 @@
11
11
  language={language}
12
12
  bail-href={bailHref}
13
13
  bail-label={bailLabel}
14
+ dev-center={devCenter}
15
+ brand={brand}
14
16
  >
15
17
  <slot name="sidebar-header" slot="version-picker"></slot>
16
18
  </dx-sidebar-old>
@@ -30,6 +32,8 @@
30
32
  language={language}
31
33
  bail-href={bailHref}
32
34
  bail-label={bailLabel}
35
+ dev-center={devCenter}
36
+ brand={brand}
33
37
  >
34
38
  <slot name="sidebar-header" slot="version-picker"></slot>
35
39
  </dx-sidebar>
@@ -42,6 +42,8 @@ export default class ContentLayout extends LightningElement {
42
42
  @api language!: string;
43
43
  @api bailHref!: string;
44
44
  @api bailLabel!: string;
45
+ @api devCenter: any;
46
+ @api brand: any;
45
47
 
46
48
  // This is needed for now to prevent failing snapshot tests due to links in the footer
47
49
  @api showFooter = false;
@@ -6,6 +6,7 @@
6
6
  lwc:if={showBanner}
7
7
  banner-markup={bannerMarkup}
8
8
  ></dx-banner>
9
+ <!-- To-Do: Move the devCenter as a new component and use it here, as devCenter is also used in Sidebar now -->
9
10
  <div lwc:if={devCenter} class="dev-center-link">
10
11
  <a href={devCenter.link} class="dev-center-content">
11
12
  <dx-icon symbol="back"></dx-icon>
@@ -30,7 +31,7 @@
30
31
  </a>
31
32
  </div>
32
33
  <div
33
- lwc:if={hasScopedNavItems}
34
+ lwc:if={showScopedNavItems}
34
35
  class="header_l2_group header_l2_group-nav"
35
36
  >
36
37
  <div
@@ -48,7 +49,7 @@
48
49
  </header>
49
50
  </dx-brand-theme-provider>
50
51
  </template>
51
- <template lwc:if={showDocDivider}>
52
+ <template lwc:if={shouldHideHeader}>
52
53
  <div class="no-header-content"></div>
53
54
  </template>
54
55
  </template>
@@ -1,8 +1,8 @@
1
1
  import { api } from "lwc";
2
2
  import cx from "classnames";
3
- import type { OptionWithNested } from "typings/custom";
3
+ import type { OptionWithNested, DevCenterConfig } from "typings/custom";
4
4
  import { HeaderBase } from "dxBaseElements/headerBase";
5
- import { toJson } from "dxUtils/normalizers";
5
+ import { toJson, normalizeBoolean } from "dxUtils/normalizers";
6
6
 
7
7
  const TABLET_MATCH = "980px";
8
8
  const MOBILE_MATCH = "768px";
@@ -18,6 +18,15 @@ export default class Header extends HeaderBase {
18
18
  @api langValuePath: string = "id"; // allows to override how language property is interpreted, follows valuePath dropdown api.
19
19
  @api headerHref: string = "/";
20
20
 
21
+ @api
22
+ get hideDocHeader() {
23
+ return this._hideDocHeader;
24
+ }
25
+
26
+ set hideDocHeader(value) {
27
+ this._hideDocHeader = normalizeBoolean(value);
28
+ }
29
+
21
30
  @api
22
31
  get scopedNavItems() {
23
32
  return this._scopedNavItems;
@@ -28,7 +37,7 @@ export default class Header extends HeaderBase {
28
37
  }
29
38
 
30
39
  @api
31
- get devCenter() {
40
+ get devCenter(): DevCenterConfig {
32
41
  return this._devCenter;
33
42
  }
34
43
 
@@ -41,14 +50,27 @@ export default class Header extends HeaderBase {
41
50
  private tabletMatchMedia!: MediaQueryList;
42
51
  private shouldRender: boolean = false;
43
52
  private showDocDivider: boolean = false;
44
- private _devCenter: any;
53
+ private _devCenter!: DevCenterConfig;
54
+ private _hideDocHeader: boolean = false;
45
55
 
46
56
  protected mobileBreakpoint(): string {
47
57
  return MOBILE_MATCH;
48
58
  }
49
59
 
50
- private get hasScopedNavItems(): boolean {
51
- return this.scopedNavItems && this.scopedNavItems.length > 0;
60
+ private get showScopedNavItems(): boolean {
61
+ return (
62
+ this.scopedNavItems &&
63
+ this.scopedNavItems.length > 0 &&
64
+ !this.hideDocHeader
65
+ );
66
+ }
67
+
68
+ /**
69
+ * This function returns true if the hideDocHeader is true and the view is not mobile.
70
+ * Also we need to show the header border in case the doc is hidden or if the brand information doesn't exists.
71
+ */
72
+ private get shouldHideHeader(): boolean {
73
+ return (this.hideDocHeader && !this.mobile) || this.showDocDivider;
52
74
  }
53
75
 
54
76
  connectedCallback(): void {
@@ -60,7 +82,8 @@ export default class Header extends HeaderBase {
60
82
  this.tabletMatchMedia.addEventListener("change", this.onTabletChange);
61
83
 
62
84
  if (
63
- (window.location.pathname.includes("/docs/") &&
85
+ (!this.shouldHideHeader &&
86
+ window.location.pathname.includes("/docs/") &&
64
87
  window.location.pathname !== "/docs/apis") ||
65
88
  window.location.pathname ===
66
89
  "/tableau/embedding-playground/overview" ||
@@ -91,7 +114,7 @@ export default class Header extends HeaderBase {
91
114
  protected additionalClasses(): string {
92
115
  return cx(
93
116
  this.brand && "has-brand",
94
- this.hasScopedNavItems && "has-scoped-nav-items"
117
+ this.showScopedNavItems && "has-scoped-nav-items"
95
118
  );
96
119
  }
97
120
  }
@@ -11,6 +11,8 @@
11
11
  language={language}
12
12
  bail-href={bailHref}
13
13
  bail-label={bailLabel}
14
+ dev-center={devCenter}
15
+ brand={brand}
14
16
  >
15
17
  <slot name="sidebar-header" slot="version-picker"></slot>
16
18
  </dx-sidebar-old>
@@ -30,6 +32,8 @@
30
32
  language={language}
31
33
  bail-href={bailHref}
32
34
  bail-label={bailLabel}
35
+ dev-center={devCenter}
36
+ brand={brand}
33
37
  >
34
38
  <slot name="sidebar-header" slot="version-picker"></slot>
35
39
  </dx-sidebar>