@salesforcedevs/docs-components 0.0.0 → 0.0.1-edit

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.
Files changed (84) hide show
  1. package/lwc.config.json +11 -2
  2. package/package.json +14 -13
  3. package/src/modules/doc/{amfReference/utils.ts → amfModelParser/amfModelParser.ts} +10 -5
  4. package/src/modules/doc/amfReference/amfReference.css +23 -3
  5. package/src/modules/doc/amfReference/amfReference.html +34 -21
  6. package/src/modules/doc/amfReference/amfReference.ts +225 -92
  7. package/src/modules/doc/amfReference/types.ts +3 -11
  8. package/src/modules/doc/amfTopic/amfTopic.css +20 -0
  9. package/src/modules/doc/amfTopic/amfTopic.ts +35 -18
  10. package/src/modules/doc/amfTopic/types.ts +15 -13
  11. package/src/modules/doc/amfTopic/utils.ts +12 -6
  12. package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +17 -10
  13. package/src/modules/doc/breadcrumbs/breadcrumbs.html +7 -9
  14. package/src/modules/doc/breadcrumbs/breadcrumbs.ts +30 -34
  15. package/src/modules/doc/chat/README.md +179 -0
  16. package/src/modules/doc/chat/chat.css +818 -0
  17. package/src/modules/doc/chat/chat.html +241 -0
  18. package/src/modules/doc/chat/chat.ts +586 -0
  19. package/src/modules/doc/componentPlayground/componentPlayground.css +22 -0
  20. package/src/modules/doc/componentPlayground/componentPlayground.html +20 -0
  21. package/src/modules/doc/componentPlayground/componentPlayground.ts +29 -0
  22. package/src/modules/doc/content/content.css +70 -76
  23. package/src/modules/doc/content/content.html +1 -0
  24. package/src/modules/doc/content/content.ts +24 -45
  25. package/src/modules/doc/contentCallout/contentCallout.css +10 -7
  26. package/src/modules/doc/contentCallout/contentCallout.html +11 -4
  27. package/src/modules/doc/contentCallout/contentCallout.ts +8 -1
  28. package/src/modules/doc/contentLayout/contentLayout.css +1 -98
  29. package/src/modules/doc/contentLayout/contentLayout.html +37 -19
  30. package/src/modules/doc/contentLayout/contentLayout.ts +298 -89
  31. package/src/modules/doc/doDont/doDont.css +47 -0
  32. package/src/modules/doc/doDont/doDont.html +27 -0
  33. package/src/modules/doc/doDont/doDont.ts +17 -0
  34. package/src/modules/doc/editFile/editFile.css +514 -0
  35. package/src/modules/doc/editFile/editFile.html +164 -0
  36. package/src/modules/doc/editFile/editFile.ts +213 -0
  37. package/src/modules/doc/header/header.css +65 -36
  38. package/src/modules/doc/header/header.html +41 -139
  39. package/src/modules/doc/header/header.ts +54 -76
  40. package/src/modules/doc/heading/heading.css +16 -37
  41. package/src/modules/doc/heading/heading.html +4 -4
  42. package/src/modules/doc/heading/heading.ts +12 -10
  43. package/src/modules/doc/headingAnchor/headingAnchor.css +2 -2
  44. package/src/modules/doc/headingAnchor/headingAnchor.ts +2 -2
  45. package/src/modules/doc/headingContent/headingContent.css +1 -1
  46. package/src/modules/doc/headingContent/headingContent.html +2 -2
  47. package/src/modules/doc/headingContent/headingContent.ts +2 -2
  48. package/src/modules/doc/lwcContentLayout/lwcContentLayout.css +1 -0
  49. package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +68 -0
  50. package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +168 -0
  51. package/src/modules/doc/overview/overview.css +40 -0
  52. package/src/modules/doc/overview/overview.html +34 -0
  53. package/src/modules/doc/overview/overview.ts +12 -0
  54. package/src/modules/doc/phase/phase.css +18 -3
  55. package/src/modules/doc/phase/phase.html +12 -2
  56. package/src/modules/doc/phase/phase.ts +44 -8
  57. package/src/modules/doc/specificationContent/specificationContent.css +36 -0
  58. package/src/modules/doc/specificationContent/specificationContent.html +171 -0
  59. package/src/modules/doc/specificationContent/specificationContent.ts +127 -0
  60. package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
  61. package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
  62. package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
  63. package/src/modules/doc/toc/toc.html +1 -3
  64. package/src/modules/doc/toc/toc.ts +1 -1
  65. package/src/modules/doc/toolbar/toolbar.ts +6 -6
  66. package/src/modules/doc/versionPicker/versionPicker.css +64 -0
  67. package/src/modules/doc/versionPicker/versionPicker.html +38 -0
  68. package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
  69. package/src/modules/doc/xmlContent/types.ts +9 -3
  70. package/src/modules/doc/xmlContent/utils.ts +3 -1
  71. package/src/modules/doc/xmlContent/xmlContent.css +26 -4
  72. package/src/modules/doc/xmlContent/xmlContent.html +29 -17
  73. package/src/modules/doc/xmlContent/xmlContent.ts +212 -79
  74. package/src/modules/docHelpers/amfStyle/amfStyle.css +6 -6
  75. package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +131 -0
  76. package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
  77. package/src/modules/docHelpers/status/status.css +1 -1
  78. package/src/modules/docUtils/{SearchSyncer/SearchSyncer.ts → searchSyncer/searchSyncer.ts} +1 -0
  79. package/src/modules/docUtils/utils/__mocks__/coveo.analytics.ts +16 -0
  80. package/src/modules/docUtils/utils/coveo.analytics.d.ts +10 -0
  81. package/src/modules/docUtils/utils/utils.ts +32 -0
  82. package/LICENSE +0 -12
  83. package/src/modules/docBaseElements/lightningElementWithState/lightningElementWithState.ts +0 -93
  84. package/src/modules/docHelpers/phaseContentLayout/phaseContentLayout.css +0 -39
@@ -0,0 +1,64 @@
1
+ @import "dxHelpers/reset";
2
+
3
+ /* NOTE: doc-version-picker-width width variable is used by both dx-button and dx-dropdown to maintain a consistent width. */
4
+ :host {
5
+ --dx-c-dropdown-option-font-weight: normal;
6
+ --dx-c-dropdown-option-label-color: var(--dx-g-gray-10);
7
+ --popover-container-open-transform: translateY(4px);
8
+ }
9
+
10
+ .version-picker-container {
11
+ padding: 8px var(--dx-g-spacing-lg) 8px
12
+ var(--dx-g-global-header-padding-horizontal);
13
+ border-top: 1px solid var(--dx-g-gray-90);
14
+ border-bottom: 1px solid var(--dx-g-gray-90);
15
+ }
16
+
17
+ .version-picker-button {
18
+ display: flex;
19
+ width: var(--doc-version-picker-width, 296px);
20
+ }
21
+
22
+ .version-picker-button:hover,
23
+ .version-picker-button:active,
24
+ .version-picker-button:focus {
25
+ --dx-c-button-secondary-color-hover: var(--dx-g-cloud-blue-vibrant-95);
26
+ --dx-c-button-primary-color: var(--dx-g-blue-vibrant-40);
27
+ }
28
+
29
+ /**
30
+ * NOTE: This CSS ensures the span inside the button stays within the parent's width, avoiding overflow.
31
+ * Not keeping this in common component to ensure that existing functionality works as it is.
32
+ */
33
+ dx-button::part(content) {
34
+ width: inherit;
35
+ overflow: hidden;
36
+ }
37
+
38
+ .selected-version {
39
+ display: flex;
40
+ flex-direction: row;
41
+ align-items: center;
42
+ }
43
+
44
+ .selected-version-label {
45
+ flex: 1;
46
+ overflow: hidden;
47
+ text-align: left;
48
+ text-overflow: ellipsis;
49
+ white-space: nowrap;
50
+ }
51
+
52
+ dx-type-badge.latest-badge {
53
+ --dx-c-type-badge-color: var(--dx-g-green-vibrant-40);
54
+ --dx-c-type-badge-background: var(--dx-g-green-vibrant-95);
55
+
56
+ margin-left: var(--dx-g-spacing-sm);
57
+ }
58
+
59
+ dx-type-badge.not-latest-badge {
60
+ --dx-c-type-badge-color: var(--dx-g-red-vibrant-40);
61
+ --dx-c-type-badge-background: var(--dx-g-red-vibrant-95);
62
+
63
+ margin-left: var(--dx-g-spacing-sm);
64
+ }
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div lwc:if={showVersionPicker} class="version-picker-container">
3
+ <dx-dropdown
4
+ options={versions}
5
+ value={selectedVersion.id}
6
+ width="var(--doc-version-picker-width)"
7
+ onchange={onVersionChange}
8
+ >
9
+ <dx-button
10
+ class="version-picker-button"
11
+ variant="tertiary"
12
+ size="small"
13
+ icon-symbol="chevrondown"
14
+ icon-size="medium"
15
+ >
16
+ <div class="selected-version">
17
+ <p class="selected-version-label">
18
+ {selectedVersion.label}
19
+ </p>
20
+ <template lwc:if={showLatestTag}>
21
+ <dx-type-badge
22
+ class="latest-badge"
23
+ lwc:if={latestVersion}
24
+ value="Latest"
25
+ size="small"
26
+ ></dx-type-badge>
27
+ <dx-type-badge
28
+ class="not-latest-badge"
29
+ lwc:else
30
+ value="Not Latest"
31
+ size="small"
32
+ ></dx-type-badge>
33
+ </template>
34
+ </div>
35
+ </dx-button>
36
+ </dx-dropdown>
37
+ </div>
38
+ </template>
@@ -0,0 +1,65 @@
1
+ import { LightningElement, api, track } from "lwc";
2
+
3
+ import { AnalyticsPayload, OptionWithNested } from "typings/custom";
4
+
5
+ import { toJson, normalizeBoolean } from "dxUtils/normalizers";
6
+
7
+ export default class VersionPicker extends LightningElement {
8
+ @api analyticsEvent?: string;
9
+ @api analyticsPayload?: AnalyticsPayload;
10
+
11
+ @track private _versions!: OptionWithNested[];
12
+ private _selectedVersion?: OptionWithNested;
13
+ private _latestVersion: boolean = false;
14
+ private _hideBadge: boolean = false;
15
+
16
+ @api
17
+ get versions() {
18
+ return this._versions;
19
+ }
20
+
21
+ set versions(value: OptionWithNested[]) {
22
+ this._versions = toJson(value);
23
+ }
24
+
25
+ @api
26
+ get selectedVersion(): OptionWithNested | undefined {
27
+ return this._selectedVersion || this.versions[0];
28
+ }
29
+
30
+ set selectedVersion(value: OptionWithNested) {
31
+ if (value) {
32
+ this._selectedVersion = toJson(value);
33
+ }
34
+ }
35
+
36
+ @api
37
+ get latestVersion() {
38
+ return this._latestVersion;
39
+ }
40
+
41
+ set latestVersion(value) {
42
+ this._latestVersion = normalizeBoolean(value);
43
+ }
44
+
45
+ @api
46
+ get hideBadge() {
47
+ return this._hideBadge;
48
+ }
49
+
50
+ set hideBadge(value) {
51
+ this._hideBadge = normalizeBoolean(value);
52
+ }
53
+
54
+ private get showVersionPicker() {
55
+ return this._versions && this._versions.length !== 0;
56
+ }
57
+
58
+ private get showLatestTag(): boolean {
59
+ return !this.hideBadge;
60
+ }
61
+
62
+ private onVersionChange(e: CustomEvent) {
63
+ this.dispatchEvent(new CustomEvent("change", { detail: e.detail }));
64
+ }
65
+ }
@@ -35,6 +35,9 @@ type DropdownOption = {
35
35
  export type DocVersion = DropdownOption & {
36
36
  releaseVersion: string;
37
37
  url: string;
38
+ link?: {
39
+ href: string;
40
+ };
38
41
  };
39
42
 
40
43
  export type DocLanguage = DropdownOption & {
@@ -58,12 +61,15 @@ export type ApiDocLanguage = {
58
61
 
59
62
  export interface Header extends Element {
60
63
  subtitle: string;
64
+ headerHref: string;
65
+ }
66
+
67
+ export type SiderbarFooter = {
61
68
  bailHref: string;
62
69
  bailLabel: string;
63
70
  languages: Array<DocLanguage>;
64
- language: string;
65
- headerHref: string;
66
- }
71
+ language?: string;
72
+ };
67
73
 
68
74
  export type ApiNavItem = {
69
75
  children: Array<ApiNavItem>;
@@ -87,7 +87,9 @@ export class FetchContent {
87
87
  return json;
88
88
  }
89
89
 
90
- private normalizeToc(apiToc: Array<ApiNavItem>): {
90
+ private normalizeToc(
91
+ apiToc: Array<ApiNavItem>
92
+ ): {
91
93
  tocMap: { [key: string]: TreeNode };
92
94
  normalizedToc: Array<TreeNode>;
93
95
  } {
@@ -3,11 +3,16 @@
3
3
  --button-primary-color-hover: var(--dx-g-blue-vibrant-40);
4
4
  }
5
5
 
6
+ doc-content-layout {
7
+ --dx-c-content-sidebar-sticky-top: var(--dx-g-global-header-height);
8
+ --dx-c-sidebar-height: calc(100vh - var(--dx-g-global-header-height));
9
+ }
10
+
6
11
  doc-breadcrumbs {
7
12
  --dx-c-popover-z-index: 5;
8
13
 
9
14
  display: block;
10
- margin-bottom: var(--dx-g-spacing-2xl);
15
+ margin-bottom: var(--dx-g-spacing-md);
11
16
  }
12
17
 
13
18
  dx-dropdown {
@@ -26,7 +31,24 @@ dx-dropdown > dx-button:hover {
26
31
  --border-color: var(--button-primary-color-hover);
27
32
  }
28
33
 
29
- .document-pickers {
30
- margin-left: auto;
31
- margin-right: var(--dx-g-spacing-sm);
34
+ doc-phase {
35
+ --doc-c-phase-top: var(--dx-g-global-header-height);
36
+ }
37
+
38
+ @media screen and (max-width: 768px) {
39
+ doc-content-layout {
40
+ --dx-g-doc-header-main-nav-height: 41px;
41
+ --dx-g-doc-header-height: calc(
42
+ var(--dx-g-doc-header-main-nav-height) + 40px
43
+ );
44
+ --dx-c-content-sidebar-sticky-top: calc(
45
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
46
+ );
47
+ }
48
+
49
+ doc-phase {
50
+ --doc-c-phase-top: calc(
51
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
52
+ );
53
+ }
32
54
  }
@@ -1,32 +1,45 @@
1
1
  <template>
2
2
  <doc-content-layout
3
- if:true={loaded}
3
+ lwc:if={loaded}
4
+ lwc:ref="docContentLayout"
4
5
  coveo-organization-id={coveoOrganizationId}
5
6
  coveo-public-access-token={coveoPublicAccessToken}
6
- coveo-search-hub="Developer_Docs_SS"
7
+ coveo-analytics-token={coveoAnalyticsToken}
8
+ coveo-search-hub={coveoSearchHub}
7
9
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
8
- sidebar-header="Pages"
10
+ sidebar-header={docTitle}
9
11
  sidebar-content={sidebarContent}
10
12
  sidebar-value={sidebarValue}
11
13
  onselect={handleSelect}
12
14
  use-old-sidebar={useOldSidebar}
15
+ onlangchange={handleLanguageChange}
16
+ languages={sidebarFooterContent.languages}
17
+ language={sidebarFooterContent.language}
18
+ bail-href={sidebarFooterContent.bailHref}
19
+ bail-label={sidebarFooterContent.bailLabel}
20
+ show-footer={enableFooter}
13
21
  >
14
- <div slot="sidebar-header" class="document-pickers">
15
- <dx-dropdown
22
+ <doc-phase
23
+ slot="version-banner"
24
+ lwc:if={showVersionBanner}
25
+ doc-phase-info={oldVersionInfo}
26
+ icon-name="warning"
27
+ dismissible="true"
28
+ ondismissphase={handleDismissVersionBanner}
29
+ ></doc-phase>
30
+ <div lwc:if={showVersionPicker} slot="sidebar-header">
31
+ <doc-version-picker
16
32
  data-type="version"
17
- suppress-gtm-nav-headings
18
- analytics-event={analyticsEvent}
19
- options={versionOptions}
20
- value={version.id}
21
- width="290px"
22
- >
23
- <dx-button variant="inline" disabled={disableVersion}>
24
- {version.releaseVersion}
25
- </dx-button>
26
- </dx-dropdown>
33
+ analytics-event="custEv_ctaLinkClick"
34
+ analytics-payload={ANALYTICS_PAYLOAD}
35
+ versions={versionOptions}
36
+ selected-version={version}
37
+ latest-version={latestVersion}
38
+ hide-badge={previewVersion}
39
+ ></doc-version-picker>
27
40
  </div>
28
41
  <doc-breadcrumbs
29
- if:true={showBreadcrumbs}
42
+ lwc:if={showBreadcrumbs}
30
43
  breadcrumbs={breadcrumbs}
31
44
  pixel-per-character={breadcrumbPixelPerCharacter}
32
45
  ></doc-breadcrumbs>
@@ -34,7 +47,6 @@
34
47
  docs-data={docContent}
35
48
  page-reference={pageReference}
36
49
  onnavclick={handleNavClick}
37
- style={docContentStyle}
38
50
  ></doc-content>
39
51
  </doc-content-layout>
40
52
  </template>