@salesforcedevs/docs-components 1.18.5-specification → 1.18.6-dynamic-pg1

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,16 +1,11 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.18.5-specification",
3
+ "version": "1.18.6-dynamic-pg1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "engines": {
8
- "node": "20.x",
9
- "yarn": "1.22.19"
10
- },
11
- "volta": {
12
- "node": "20.18.2",
13
- "yarn": "1.22.19"
8
+ "node": "20.x"
14
9
  },
15
10
  "publishConfig": {
16
11
  "access": "public"
@@ -10,13 +10,27 @@
10
10
  * Total: 606px
11
11
  **/
12
12
 
13
+ :host {
14
+ --playground-iframe-min-height: 500px;
15
+ --playground-iframe-max-height: 5000px;
16
+ }
17
+
13
18
  iframe {
14
19
  width: 100%;
15
20
  height: 606px;
21
+ min-height: var(--playground-iframe-min-height);
22
+ max-height: var(--playground-iframe-max-height);
23
+ transition: height 0.3s ease, min-height 0.3s ease;
16
24
  border-radius: var(--dx-g-spacing-sm);
17
25
  border: 1px solid var(--dx-g-gray-90);
18
26
  }
19
27
 
28
+ @media (prefers-reduced-motion: reduce) {
29
+ iframe {
30
+ transition: none;
31
+ }
32
+ }
33
+
20
34
  .playground-container {
21
35
  position: relative;
22
36
  }
@@ -1,5 +1,7 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
 
3
+ const PLAYGROUND_HEIGHT_MESSAGE = "PLAYGROUND_HEIGHT_CHANGE";
4
+
3
5
  export default class ComponentPlayground extends LightningElement {
4
6
  @api model!: string;
5
7
  @api namespace!: string;
@@ -36,7 +38,49 @@ export default class ComponentPlayground extends LightningElement {
36
38
  }/${this.component.toLowerCase()}.html`;
37
39
  }
38
40
 
41
+ connectedCallback() {
42
+ window.addEventListener("message", this.handleIframeMessage);
43
+ }
44
+
45
+ disconnectedCallback() {
46
+ window.removeEventListener("message", this.handleIframeMessage);
47
+ }
48
+
39
49
  handleIframeLoad() {
40
50
  this.isLoading = false;
41
51
  }
52
+
53
+ handleIframeMessage = (event: MessageEvent) => {
54
+ // Only handle height change messages from our iframe
55
+ if (event.data?.type !== PLAYGROUND_HEIGHT_MESSAGE) {
56
+ return;
57
+ }
58
+
59
+ const iframe = this.template.querySelector(
60
+ "iframe"
61
+ ) as HTMLIFrameElement;
62
+ if (!iframe || event.source !== iframe.contentWindow) {
63
+ return;
64
+ }
65
+
66
+ const height = event.data.height;
67
+ if (typeof height === "number" && height > 0) {
68
+ const minHeight = parseInt(
69
+ getComputedStyle(this.template.host).getPropertyValue(
70
+ "--playground-iframe-min-height"
71
+ ),
72
+ 10
73
+ );
74
+ const maxHeight = parseInt(
75
+ getComputedStyle(this.template.host).getPropertyValue(
76
+ "--playground-iframe-max-height"
77
+ ),
78
+ 10
79
+ );
80
+
81
+ const newHeight = Math.min(Math.max(height, minHeight), maxHeight);
82
+ iframe.style.height = `${newHeight}px`;
83
+ iframe.style.minHeight = `${newHeight}px`;
84
+ }
85
+ };
42
86
  }
@@ -7,11 +7,6 @@
7
7
  if:true={isLoading}
8
8
  ></dx-spinner>
9
9
  <dx-error-fallback lwc:if={showError}></dx-error-fallback>
10
- <dx-error-fallback
11
- lwc:if={showNoSpecifications}
12
- title="No specifications to show"
13
- description="No specifications are available for this component or API module. When specifications are defined, they'll appear here."
14
- ></dx-error-fallback>
15
10
  <template lwc:if={hasAttributes}>
16
11
  <doc-heading
17
12
  header="Attributes"
@@ -108,17 +108,6 @@ export default class SpecificationContent extends LightningElement {
108
108
  return this.events?.length > 0;
109
109
  }
110
110
 
111
- get showNoSpecifications() {
112
- return (
113
- !this.showError &&
114
- !this.isLoading &&
115
- !this.hasAttributes &&
116
- !this.hasMethods &&
117
- !this.hasSlots &&
118
- !this.hasEvents
119
- );
120
- }
121
-
122
111
  renderedCallback(): void {
123
112
  if (this.data) {
124
113
  this.debouncedNotifyDataRendered();