@salesforcedevs/docs-components 1.19.2-specfix-alpha → 1.19.6-alpha1

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.19.2-specfix-alpha",
3
+ "version": "1.19.6-alpha1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -10,11 +10,26 @@
10
10
  * Total: 606px
11
11
  **/
12
12
 
13
+ :host {
14
+ --playground-iframe-min-height: 500px;
15
+ --playground-iframe-max-height: 5000px;
16
+
17
+ margin-top: var(--dx-g-spacing-md) !important;
18
+ display: block !important;
19
+ }
20
+
13
21
  iframe {
14
22
  width: 100%;
15
23
  height: 606px;
16
- border-radius: var(--dx-g-spacing-sm);
17
- border: 1px solid var(--dx-g-gray-90);
24
+ min-height: var(--playground-iframe-min-height);
25
+ max-height: var(--playground-iframe-max-height);
26
+ transition: height 0.3s ease, min-height 0.3s ease;
27
+ }
28
+
29
+ @media (prefers-reduced-motion: reduce) {
30
+ iframe {
31
+ transition: none;
32
+ }
18
33
  }
19
34
 
20
35
  .playground-container {
@@ -1,5 +1,8 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
 
3
+ const PLAYGROUND_HEIGHT_MESSAGE = "PLAYGROUND_HEIGHT_CHANGE";
4
+ const LOADER_TIMEOUT_MS = 2000;
5
+
3
6
  export default class ComponentPlayground extends LightningElement {
4
7
  @api model!: string;
5
8
  @api namespace!: string;
@@ -36,7 +39,59 @@ export default class ComponentPlayground extends LightningElement {
36
39
  }/${this.component.toLowerCase()}.html`;
37
40
  }
38
41
 
42
+ connectedCallback() {
43
+ window.addEventListener("message", this.handleIframeMessage);
44
+ }
45
+
46
+ disconnectedCallback() {
47
+ window.removeEventListener("message", this.handleIframeMessage);
48
+ }
49
+
39
50
  handleIframeLoad() {
40
- this.isLoading = false;
51
+ if (!window.ResizeObserver) {
52
+ // If ResizeObserver not supported, hide loader immediately (no height messages will come)
53
+ this.isLoading = false;
54
+ } else {
55
+ // Hide loader after 2 seconds if no height messages received
56
+ // This handles cases where iframe fails to load, crashes, or height reporting fails
57
+ setTimeout(() => {
58
+ this.isLoading = false;
59
+ }, LOADER_TIMEOUT_MS);
60
+ }
41
61
  }
62
+
63
+ handleIframeMessage = (event: MessageEvent) => {
64
+ // Only handle height change messages from our iframe
65
+ if (event.data?.type !== PLAYGROUND_HEIGHT_MESSAGE) {
66
+ return;
67
+ }
68
+
69
+ const iframe = this.template.querySelector(
70
+ "iframe"
71
+ ) as HTMLIFrameElement;
72
+ if (!iframe || event.source !== iframe.contentWindow) {
73
+ return;
74
+ }
75
+
76
+ const height = event.data?.height;
77
+ if (typeof height === "number" && height > 0) {
78
+ const minHeight = parseInt(
79
+ getComputedStyle(this.template.host).getPropertyValue(
80
+ "--playground-iframe-min-height"
81
+ ),
82
+ 10
83
+ );
84
+ const maxHeight = parseInt(
85
+ getComputedStyle(this.template.host).getPropertyValue(
86
+ "--playground-iframe-max-height"
87
+ ),
88
+ 10
89
+ );
90
+
91
+ const newHeight = Math.min(Math.max(height, minHeight), maxHeight);
92
+ iframe.style.height = `${newHeight}px`;
93
+ iframe.style.minHeight = `${newHeight}px`;
94
+ this.isLoading = false;
95
+ }
96
+ };
42
97
  }
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="content">
3
3
  <dx-sidebar-old
4
+ lwc:if={showSidebar}
4
5
  class="is-sticky left-nav-bar"
5
6
  trees={sidebarContent}
6
7
  value={sidebarValue}
@@ -40,6 +40,7 @@ export default class ContentLayout extends LightningElement {
40
40
  @api devCenter: any;
41
41
  @api brand: any;
42
42
  @api emptyStateMessage?: string;
43
+ @api showSidebar?: boolean = false;
43
44
 
44
45
  // This is needed for now to prevent failing snapshot tests due to links in the footer
45
46
  @api showFooter = false;
@@ -1 +1,9 @@
1
1
  @import "docHelpers/contentLayoutStyle";
2
+
3
+ .fixed-right-nav-bar {
4
+ width: 180px;
5
+ }
6
+
7
+ .content-body-no-rnb {
8
+ max-width: 1220px;
9
+ }
@@ -19,7 +19,7 @@
19
19
  <slot name="doc-phase"></slot>
20
20
  <slot name="version-banner"></slot>
21
21
  <div class="content-body-container">
22
- <div class="content-body">
22
+ <div class={contentBodyClasses}>
23
23
  <doc-breadcrumbs
24
24
  lwc:if={showBreadcrumbs}
25
25
  breadcrumbs={breadcrumbs}
@@ -29,7 +29,7 @@
29
29
  lwc:if={shouldDisplayFeedback}
30
30
  ></doc-sprig-survey>
31
31
  </div>
32
- <div lwc:if={showToc} class="right-nav-bar is-sticky">
32
+ <div lwc:if={showToc} class={rightNavBarClasses}>
33
33
  <dx-toc
34
34
  header={tocTitle}
35
35
  options={tocOptions}
@@ -1,4 +1,5 @@
1
1
  import ContentLayout from "doc/contentLayout";
2
+ import cx from "classnames";
2
3
 
3
4
  const TOC_HEADER_TAG = "doc-heading";
4
5
  const RNB_BY_TAB = "docs-tab";
@@ -23,6 +24,18 @@ export default class LwcContentLayout extends ContentLayout {
23
24
  return this.rnbByTab;
24
25
  }
25
26
 
27
+ get rightNavBarClasses() {
28
+ return cx(
29
+ "right-nav-bar",
30
+ "is-sticky",
31
+ this.showTabBasedRNB && "fixed-right-nav-bar"
32
+ );
33
+ }
34
+
35
+ get contentBodyClasses() {
36
+ return cx("content-body", !this.showToc && "content-body-no-rnb");
37
+ }
38
+
26
39
  /**
27
40
  * Check if the main slot contains doc-specification-content
28
41
  * Uses caching to avoid repeated DOM queries
@@ -74,7 +74,7 @@ dx-toc {
74
74
 
75
75
  .content-body {
76
76
  margin: var(--dx-g-spacing-md) 0 0;
77
- max-width: 900px;
77
+ max-width: 1000px;
78
78
  flex: 1;
79
79
  width: 0;
80
80
  }