@salesforcedevs/docs-components 0.0.2-edit → 0.0.2-superscript
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/lwc.config.json +2 -1
- package/package.json +29 -28
- package/src/modules/doc/amfReference/amfReference.css +0 -12
- package/src/modules/doc/amfReference/amfReference.html +2 -6
- package/src/modules/doc/amfReference/amfReference.ts +48 -37
- package/src/modules/doc/amfTopic/amfTopic.ts +24 -0
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +0 -1
- package/src/modules/doc/componentPlayground/componentPlayground.css +11 -3
- package/src/modules/doc/componentPlayground/componentPlayground.html +4 -4
- package/src/modules/doc/componentPlayground/componentPlayground.ts +69 -1
- package/src/modules/doc/content/content.ts +0 -1
- package/src/modules/doc/contentCallout/contentCallout.css +1 -0
- package/src/modules/doc/contentLayout/contentLayout.html +53 -60
- package/src/modules/doc/contentLayout/contentLayout.ts +82 -43
- package/src/modules/doc/contentMedia/contentMedia.css +1 -1
- package/src/modules/doc/header/header.html +5 -1
- package/src/modules/doc/header/header.ts +10 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +8 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +38 -42
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +116 -15
- package/src/modules/doc/phase/phase.css +0 -7
- package/src/modules/doc/redocReference/redocReference.css +7 -0
- package/src/modules/doc/redocReference/redocReference.html +13 -0
- package/src/modules/doc/redocReference/redocReference.ts +425 -0
- package/src/modules/doc/specificationContent/specificationContent.html +15 -9
- package/src/modules/doc/specificationContent/specificationContent.ts +39 -0
- package/src/modules/doc/superscriptSubscript/superscriptSubscript.html +8 -0
- package/src/modules/doc/superscriptSubscript/superscriptSubscript.ts +16 -0
- package/src/modules/doc/versionPicker/versionPicker.html +2 -0
- package/src/modules/doc/xmlContent/xmlContent.css +0 -10
- package/src/modules/doc/xmlContent/xmlContent.html +11 -8
- package/src/modules/doc/xmlContent/xmlContent.ts +95 -53
- package/src/modules/docHelpers/amfStyle/amfStyle.css +0 -2
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +32 -1
- package/src/modules/doc/chat/README.md +0 -179
- package/src/modules/doc/chat/chat.css +0 -818
- package/src/modules/doc/chat/chat.html +0 -241
- package/src/modules/doc/chat/chat.ts +0 -586
- package/src/modules/doc/editFile/editFile.css +0 -514
- package/src/modules/doc/editFile/editFile.html +0 -164
- package/src/modules/doc/editFile/editFile.ts +0 -213
package/lwc.config.json
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"doc/componentPlayground",
|
|
11
11
|
"doc/content",
|
|
12
12
|
"doc/contentCallout",
|
|
13
|
-
"doc/chat",
|
|
14
13
|
"doc/doDont",
|
|
15
14
|
"doc/contentLayout",
|
|
16
15
|
"doc/contentMedia",
|
|
@@ -21,7 +20,9 @@
|
|
|
21
20
|
"doc/headingAnchor",
|
|
22
21
|
"doc/overview",
|
|
23
22
|
"doc/phase",
|
|
23
|
+
"doc/redocReference",
|
|
24
24
|
"doc/specificationContent",
|
|
25
|
+
"doc/superscriptSubscript",
|
|
25
26
|
"doc/versionPicker",
|
|
26
27
|
"doc/xmlContent",
|
|
27
28
|
"docUtils/utils"
|
package/package.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
"name": "@salesforcedevs/docs-components",
|
|
3
|
+
"version": "0.0.2-superscript",
|
|
4
|
+
"description": "Docs Lightning web components for DSC",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "20.x"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@api-components/amf-helper-mixin": "4.5.29",
|
|
15
|
+
"classnames": "2.5.1",
|
|
16
|
+
"dompurify": "3.2.4",
|
|
17
|
+
"kagekiri": "1.4.2",
|
|
18
|
+
"lodash.orderby": "4.6.0",
|
|
19
|
+
"lodash.uniqby": "4.7.0",
|
|
20
|
+
"query-string": "7.1.3",
|
|
21
|
+
"sentence-case": "3.0.4"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/classnames": "2.3.1",
|
|
25
|
+
"@types/lodash.orderby": "4.6.9",
|
|
26
|
+
"@types/lodash.uniqby": "4.7.9"
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad",
|
|
29
|
+
"stableVersion": "1.27.18"
|
|
30
|
+
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
doc-phase {
|
|
2
|
-
--doc-c-phase-top: calc(
|
|
3
|
-
var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
|
|
4
|
-
var(--dx-g-spacing-xl)
|
|
5
|
-
);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
1
|
/* We need to apply some borders when there are two doc phases */
|
|
9
2
|
doc-phase:not(:only-of-type)::part(container) {
|
|
10
3
|
border-top: 1px solid var(--dx-g-yellow-vibrant-90);
|
|
@@ -15,11 +8,6 @@ doc-phase:nth-child(2)::part(container) {
|
|
|
15
8
|
border-bottom: 1px solid var(--dx-g-yellow-vibrant-90);
|
|
16
9
|
}
|
|
17
10
|
|
|
18
|
-
/* We don't want second component to sticky as we need to handle different cases like position */
|
|
19
|
-
doc-phase:nth-child(2) {
|
|
20
|
-
position: static;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
11
|
.api-documentation {
|
|
24
12
|
margin-top: 48px;
|
|
25
13
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<doc-content-layout
|
|
3
3
|
lwc:if={isVersionFetched}
|
|
4
|
-
use-old-sidebar={useOldSidebar}
|
|
5
4
|
class="content-type content-type-reference"
|
|
6
|
-
coveo-organization-id={coveoOrganizationId}
|
|
7
|
-
coveo-public-access-token={coveoPublicAccessToken}
|
|
8
|
-
coveo-analytics-token={coveoAnalyticsToken}
|
|
9
|
-
coveo-search-hub={coveoSearchHub}
|
|
10
|
-
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
11
5
|
breadcrumbs={breadcrumbs}
|
|
12
6
|
sidebar-header={sidebarHeader}
|
|
13
7
|
sidebar-value={selectedSidebarValue}
|
|
@@ -16,10 +10,12 @@
|
|
|
16
10
|
onexpandcollapse={onExpandCollapse}
|
|
17
11
|
toc-title={tocTitle}
|
|
18
12
|
toc-options={tocOptions}
|
|
13
|
+
toc-aria-level={tocAriaLevel}
|
|
19
14
|
enable-slot-change="true"
|
|
20
15
|
languages={languages}
|
|
21
16
|
language={language}
|
|
22
17
|
show-footer={enableFooter}
|
|
18
|
+
empty-state-message={emptyStateMessage}
|
|
23
19
|
>
|
|
24
20
|
<doc-phase
|
|
25
21
|
slot="doc-phase"
|
|
@@ -4,7 +4,7 @@ import { sentenceCase } from "sentence-case";
|
|
|
4
4
|
import qs from "query-string";
|
|
5
5
|
import { AmfModelParser } from "doc/amfModelParser";
|
|
6
6
|
import { normalizeBoolean, toJson } from "dxUtils/normalizers";
|
|
7
|
-
import type { OptionWithLink } from "typings/custom";
|
|
7
|
+
import type { OptionWithLink, Breadcrumb } from "typings/custom";
|
|
8
8
|
import type {
|
|
9
9
|
AmfConfig,
|
|
10
10
|
AmfMetadataTopic,
|
|
@@ -28,7 +28,8 @@ import {
|
|
|
28
28
|
} from "./constants";
|
|
29
29
|
import { restoreScroll } from "dx/scrollManager";
|
|
30
30
|
import { DocPhaseInfo } from "typings/custom";
|
|
31
|
-
import {
|
|
31
|
+
import { oldVersionDocInfo } from "docUtils/utils";
|
|
32
|
+
import { track as trackEvent } from "dxUtils/analytics";
|
|
32
33
|
|
|
33
34
|
type NavigationItem = {
|
|
34
35
|
label: string;
|
|
@@ -41,20 +42,15 @@ type NavigationItem = {
|
|
|
41
42
|
export default class AmfReference extends LightningElement {
|
|
42
43
|
@api breadcrumbs: string | null = null;
|
|
43
44
|
@api sidebarHeader!: string;
|
|
44
|
-
@api coveoOrganizationId!: string;
|
|
45
|
-
@api coveoPublicAccessToken!: string;
|
|
46
|
-
@api coveoAnalyticsToken!: string;
|
|
47
|
-
@api coveoSearchHub!: string;
|
|
48
|
-
@api useOldSidebar: boolean = false;
|
|
49
45
|
@api tocTitle?: string;
|
|
50
46
|
@api tocOptions?: string;
|
|
47
|
+
@api tocAriaLevel?: string;
|
|
51
48
|
@api languages!: OptionWithLink[];
|
|
52
49
|
@api language!: string;
|
|
53
50
|
@api hideFooter = false;
|
|
54
51
|
@track navigation = [] as NavigationItem[];
|
|
55
52
|
@track versions: Array<ReferenceVersion> = [];
|
|
56
53
|
@track showVersionBanner = false;
|
|
57
|
-
@track _coveoAdvancedQueryConfig!: { [key: string]: any };
|
|
58
54
|
|
|
59
55
|
// Update this to update what component gets rendered in the content block
|
|
60
56
|
@track
|
|
@@ -160,35 +156,18 @@ export default class AmfReference extends LightningElement {
|
|
|
160
156
|
this._expandChildren = normalizeBoolean(value);
|
|
161
157
|
}
|
|
162
158
|
|
|
163
|
-
/*
|
|
164
|
-
* The get coveoAdvancedQueryConfig() method returns this._coveoAdvancedQueryConfig,
|
|
165
|
-
* but before returning it, it checks if there are multiple versions (this.versions.length > 1)
|
|
166
|
-
* and if a version is selected (this.selectedVersion). If both conditions are met,
|
|
167
|
-
* it updates the version property of this._coveoAdvancedQueryConfig with the selected version.
|
|
168
|
-
*/
|
|
169
|
-
@api
|
|
170
|
-
get coveoAdvancedQueryConfig(): { [key: string]: any } {
|
|
171
|
-
const coveoConfig = this._coveoAdvancedQueryConfig;
|
|
172
|
-
if (this.versions.length > 1 && this.selectedVersion) {
|
|
173
|
-
const currentGAVersionRef = this.versions[0];
|
|
174
|
-
if (this.selectedVersion.id !== currentGAVersionRef.id) {
|
|
175
|
-
// Currently Coveo only supports query without "v"
|
|
176
|
-
const version = this.selectedVersion.id.replace("v", "");
|
|
177
|
-
coveoConfig.version = version;
|
|
178
|
-
this._coveoAdvancedQueryConfig = coveoConfig;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return this._coveoAdvancedQueryConfig;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
set coveoAdvancedQueryConfig(config) {
|
|
185
|
-
this._coveoAdvancedQueryConfig = toJson(config);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
159
|
private get enableFooter(): boolean {
|
|
189
160
|
return !this.hideFooter;
|
|
190
161
|
}
|
|
191
162
|
|
|
163
|
+
private get emptyStateMessage(): string {
|
|
164
|
+
return JSON.stringify([
|
|
165
|
+
"Select a relevant API specification",
|
|
166
|
+
"Please consider misspellings",
|
|
167
|
+
"Try different search keywords"
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
|
|
192
171
|
// model
|
|
193
172
|
protected _amfConfigList: AmfConfig[] = [];
|
|
194
173
|
protected _amfConfigMap: Map<string, AmfConfig> = new Map();
|
|
@@ -967,6 +946,16 @@ export default class AmfReference extends LightningElement {
|
|
|
967
946
|
this.handleSelectedItem();
|
|
968
947
|
|
|
969
948
|
this.updateDocPhase();
|
|
949
|
+
|
|
950
|
+
// Track page view when a new spec reference page is loaded
|
|
951
|
+
trackEvent(this.template.host, "doc_page_view", {
|
|
952
|
+
page_path: window.location.pathname + window.location.search,
|
|
953
|
+
reference_id: referenceId,
|
|
954
|
+
reference_type: "spec",
|
|
955
|
+
meta: meta,
|
|
956
|
+
topic_type: type,
|
|
957
|
+
article_name: this.getArticleName()
|
|
958
|
+
});
|
|
970
959
|
}
|
|
971
960
|
|
|
972
961
|
/**
|
|
@@ -1328,6 +1317,15 @@ export default class AmfReference extends LightningElement {
|
|
|
1328
1317
|
this.isVersionFetched = true;
|
|
1329
1318
|
this.updateDocPhase();
|
|
1330
1319
|
this.selectedSidebarValue = window.location.pathname;
|
|
1320
|
+
|
|
1321
|
+
// Track page view when a new markdown reference page is loaded
|
|
1322
|
+
trackEvent(this.template.host, "doc_page_view", {
|
|
1323
|
+
page_path: window.location.pathname + window.location.search,
|
|
1324
|
+
reference_id: selectedItemRefId,
|
|
1325
|
+
reference_type: "markdown",
|
|
1326
|
+
topic_meta: referenceMeta,
|
|
1327
|
+
article_name: this.getArticleName()
|
|
1328
|
+
});
|
|
1331
1329
|
}
|
|
1332
1330
|
}
|
|
1333
1331
|
|
|
@@ -1436,10 +1434,6 @@ export default class AmfReference extends LightningElement {
|
|
|
1436
1434
|
metaVal
|
|
1437
1435
|
);
|
|
1438
1436
|
|
|
1439
|
-
logCoveoPageView(
|
|
1440
|
-
this.coveoOrganizationId,
|
|
1441
|
-
this.coveoAnalyticsToken
|
|
1442
|
-
);
|
|
1443
1437
|
this.updateUrlWithSelected(parentReferencePath, metaVal);
|
|
1444
1438
|
this.updateTags(metadata.navTitle);
|
|
1445
1439
|
} else {
|
|
@@ -1471,6 +1465,23 @@ export default class AmfReference extends LightningElement {
|
|
|
1471
1465
|
}
|
|
1472
1466
|
}
|
|
1473
1467
|
|
|
1468
|
+
private getArticleName(): string | undefined {
|
|
1469
|
+
if (!this.breadcrumbs) {
|
|
1470
|
+
return undefined;
|
|
1471
|
+
}
|
|
1472
|
+
try {
|
|
1473
|
+
const breadcrumbArray = toJson(this.breadcrumbs) as Breadcrumb[];
|
|
1474
|
+
if (Array.isArray(breadcrumbArray) && breadcrumbArray.length > 0) {
|
|
1475
|
+
// Join all breadcrumb labels with "/" to create article name
|
|
1476
|
+
// e.g., "Tooling API Objects/FieldDefinition"
|
|
1477
|
+
return breadcrumbArray.map((crumb) => crumb.label).join("/");
|
|
1478
|
+
}
|
|
1479
|
+
} catch (e) {
|
|
1480
|
+
// If parsing fails, return undefined
|
|
1481
|
+
}
|
|
1482
|
+
return undefined;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1474
1485
|
handleSelectedItem(): void {
|
|
1475
1486
|
// update topic view
|
|
1476
1487
|
const { referenceId, amfId, type } = this.selectedTopic!;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "./utils";
|
|
10
10
|
import type { TopicModel } from "./types";
|
|
11
11
|
import { Json } from "typings/custom";
|
|
12
|
+
import { buildDocLinkClickHandler } from "dxUtils/analytics";
|
|
12
13
|
|
|
13
14
|
const TABLE_SIZE_MATCH = "769px";
|
|
14
15
|
|
|
@@ -16,6 +17,15 @@ export default class AmfTopic extends LightningElement {
|
|
|
16
17
|
private _model: TopicModel | undefined;
|
|
17
18
|
private amf: Json;
|
|
18
19
|
private type: string | undefined;
|
|
20
|
+
private handleLinkClick = buildDocLinkClickHandler();
|
|
21
|
+
|
|
22
|
+
disconnectedCallback(): void {
|
|
23
|
+
// Remove link click handler
|
|
24
|
+
const container = this.template.querySelector(".topic-container");
|
|
25
|
+
if (container) {
|
|
26
|
+
container.removeEventListener("click", this.handleLinkClick);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
19
29
|
|
|
20
30
|
@api
|
|
21
31
|
get model(): TopicModel | undefined {
|
|
@@ -92,6 +102,15 @@ export default class AmfTopic extends LightningElement {
|
|
|
92
102
|
}
|
|
93
103
|
container?.appendChild(element as Node);
|
|
94
104
|
|
|
105
|
+
// Add click handler for all links in the dynamically loaded content
|
|
106
|
+
if (container) {
|
|
107
|
+
if (this.isLinkTrackingHandledByAncestor()) {
|
|
108
|
+
container.removeEventListener("click", this.handleLinkClick);
|
|
109
|
+
} else {
|
|
110
|
+
container.addEventListener("click", this.handleLinkClick);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
95
114
|
const isTabletOrDesktop = window.matchMedia(
|
|
96
115
|
`(min-width: ${TABLE_SIZE_MATCH})`
|
|
97
116
|
).matches;
|
|
@@ -108,4 +127,9 @@ export default class AmfTopic extends LightningElement {
|
|
|
108
127
|
console.error(error);
|
|
109
128
|
}
|
|
110
129
|
}
|
|
130
|
+
|
|
131
|
+
private isLinkTrackingHandledByAncestor(): boolean {
|
|
132
|
+
const host = this.template.host as HTMLElement | undefined;
|
|
133
|
+
return !!host?.closest?.("doc-content-layout");
|
|
134
|
+
}
|
|
111
135
|
}
|
|
@@ -10,13 +10,21 @@
|
|
|
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
|
-
|
|
17
|
-
|
|
24
|
+
min-height: var(--playground-iframe-min-height);
|
|
25
|
+
max-height: var(--playground-iframe-max-height);
|
|
18
26
|
}
|
|
19
27
|
|
|
20
|
-
.container {
|
|
28
|
+
.playground-container {
|
|
21
29
|
position: relative;
|
|
22
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="container" lwc:if={playgroundAvailable}>
|
|
2
|
+
<div class="playground-container" lwc:if={playgroundAvailable}>
|
|
3
3
|
<dx-spinner
|
|
4
4
|
size="large"
|
|
5
5
|
variant="brand"
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
<iframe
|
|
9
9
|
src={playgroundSrc}
|
|
10
10
|
onload={handleIframeLoad}
|
|
11
|
-
title=
|
|
11
|
+
title={playgroundTitle}
|
|
12
12
|
allow="clipboard-write"
|
|
13
13
|
></iframe>
|
|
14
14
|
</div>
|
|
15
15
|
<dx-error-fallback
|
|
16
16
|
lwc:else
|
|
17
|
-
title="
|
|
18
|
-
description="This component's
|
|
17
|
+
title="Code Examples Unavailable"
|
|
18
|
+
description="This component's code examples are currently unavailable. Please check again later."
|
|
19
19
|
></dx-error-fallback>
|
|
20
20
|
</template>
|
|
@@ -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;
|
|
@@ -8,6 +11,19 @@ export default class ComponentPlayground extends LightningElement {
|
|
|
8
11
|
|
|
9
12
|
isLoading = true;
|
|
10
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Returns a formatted title for the component playground
|
|
16
|
+
* Maps 'aura' model to 'Aura' and 'lwc' model to 'Lightning'
|
|
17
|
+
* Capitalizes the first letter of the component name
|
|
18
|
+
* @returns {string} Formatted playground title
|
|
19
|
+
*/
|
|
20
|
+
get playgroundTitle() {
|
|
21
|
+
const modelName = this.model === "aura" ? "Aura" : "Lightning";
|
|
22
|
+
const componentName =
|
|
23
|
+
this.component.charAt(0).toUpperCase() + this.component.slice(1);
|
|
24
|
+
return `Example previews and code for ${modelName} ${componentName} component`;
|
|
25
|
+
}
|
|
26
|
+
|
|
11
27
|
get playgroundAvailable() {
|
|
12
28
|
return (
|
|
13
29
|
this.playgroundAppUrl &&
|
|
@@ -23,7 +39,59 @@ export default class ComponentPlayground extends LightningElement {
|
|
|
23
39
|
}/${this.component.toLowerCase()}.html`;
|
|
24
40
|
}
|
|
25
41
|
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
window.addEventListener("message", this.handleIframeMessage);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
window.removeEventListener("message", this.handleIframeMessage);
|
|
48
|
+
}
|
|
49
|
+
|
|
26
50
|
handleIframeLoad() {
|
|
27
|
-
|
|
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
|
+
}
|
|
28
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
|
+
};
|
|
29
97
|
}
|
|
@@ -1,68 +1,61 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="content">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</template>
|
|
20
|
-
<template lwc:else>
|
|
21
|
-
<dx-sidebar
|
|
22
|
-
class="is-sticky left-nav-bar"
|
|
23
|
-
trees={sidebarContent}
|
|
24
|
-
value={sidebarValue}
|
|
25
|
-
header={sidebarHeader}
|
|
26
|
-
coveo-organization-id={coveoOrganizationId}
|
|
27
|
-
coveo-public-access-token={coveoPublicAccessToken}
|
|
28
|
-
coveo-search-hub={coveoSearchHub}
|
|
29
|
-
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
30
|
-
ontogglesidebar={onToggleSidebar}
|
|
31
|
-
languages={languages}
|
|
32
|
-
language={language}
|
|
33
|
-
bail-href={bailHref}
|
|
34
|
-
bail-label={bailLabel}
|
|
35
|
-
dev-center={devCenter}
|
|
36
|
-
brand={brand}
|
|
37
|
-
>
|
|
38
|
-
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
39
|
-
</dx-sidebar>
|
|
40
|
-
</template>
|
|
3
|
+
<dx-sidebar-old
|
|
4
|
+
class="is-sticky left-nav-bar"
|
|
5
|
+
trees={sidebarContent}
|
|
6
|
+
value={sidebarValue}
|
|
7
|
+
header={sidebarHeader}
|
|
8
|
+
ontogglesidebar={onToggleSidebar}
|
|
9
|
+
languages={languages}
|
|
10
|
+
language={language}
|
|
11
|
+
bail-href={bailHref}
|
|
12
|
+
bail-label={bailLabel}
|
|
13
|
+
dev-center={devCenter}
|
|
14
|
+
brand={brand}
|
|
15
|
+
empty-state-message={emptyStateMessage}
|
|
16
|
+
>
|
|
17
|
+
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
18
|
+
</dx-sidebar-old>
|
|
41
19
|
<div class="content-body-doc-phase-container">
|
|
42
|
-
<
|
|
43
|
-
|
|
20
|
+
<div class="doc-phase-wrapper">
|
|
21
|
+
<slot name="doc-phase"></slot>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="version-wrapper">
|
|
24
|
+
<slot name="version-banner"></slot>
|
|
25
|
+
</div>
|
|
44
26
|
<div class="content-body-container">
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
></dx-toc>
|
|
27
|
+
<div class="content-body">
|
|
28
|
+
<doc-breadcrumbs
|
|
29
|
+
lwc:if={showBreadcrumbs}
|
|
30
|
+
breadcrumbs={breadcrumbs}
|
|
31
|
+
></doc-breadcrumbs>
|
|
32
|
+
<div class="read" lwc:if={showReadingTime}>
|
|
33
|
+
<svg
|
|
34
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
35
|
+
width="18"
|
|
36
|
+
height="18"
|
|
37
|
+
viewBox="0 0 52 52"
|
|
38
|
+
>
|
|
39
|
+
<g fill="#3e3e3c">
|
|
40
|
+
<path
|
|
41
|
+
d="m26 2c-13.2 0-24 10.8-24 24s10.8 24 24 24 24-10.8 24-24-10.8-24-24-24z m0 42c-9.9 0-18-8.1-18-18s8.1-18 18-18 18 8.1 18 18-8.1 18-18 18z m3.4-17.8c-0.3-0.3-0.4-0.7-0.4-1.1v-9.6c0-0.8-0.7-1.5-1.5-1.5h-3c-0.8 0-1.5 0.7-1.5 1.5v12.1c0 0.4 0.2 0.8 0.4 1.1l7.4 7.4c0.6 0.6 1.5 0.6 2.1 0l2.1-2.1c0.6-0.6 0.6-1.5 0-2.1l-5.6-5.7z"
|
|
42
|
+
></path>
|
|
43
|
+
</g>
|
|
44
|
+
</svg>
|
|
45
|
+
{readingTime} minute read
|
|
65
46
|
</div>
|
|
47
|
+
<slot onslotchange={onSlotChange}></slot>
|
|
48
|
+
<doc-sprig-survey
|
|
49
|
+
lwc:if={shouldDisplayFeedback}
|
|
50
|
+
></doc-sprig-survey>
|
|
51
|
+
</div>
|
|
52
|
+
<div lwc:if={showToc} class="right-nav-bar is-sticky">
|
|
53
|
+
<dx-toc
|
|
54
|
+
header={tocTitle}
|
|
55
|
+
options={tocOptions}
|
|
56
|
+
value={tocValue}
|
|
57
|
+
></dx-toc>
|
|
58
|
+
</div>
|
|
66
59
|
</div>
|
|
67
60
|
<div lwc:if={showFooter} class="footer-container">
|
|
68
61
|
<dx-footer variant="no-signup"></dx-footer>
|