@salesforcedevs/docs-components 1.35.0-ver-picker-1 → 1.35.1-remediation.1

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 (25) hide show
  1. package/package.json +28 -29
  2. package/src/modules/doc/banner/banner.css +41 -2
  3. package/src/modules/doc/banner/banner.html +6 -5
  4. package/src/modules/doc/banner/banner.ts +28 -0
  5. package/src/modules/doc/content/content.css +0 -1
  6. package/src/modules/doc/contentActionToolbar/constants.ts +43 -0
  7. package/src/modules/doc/contentActionToolbar/contentActionToolbar.css +34 -6
  8. package/src/modules/doc/contentActionToolbar/contentActionToolbar.html +63 -28
  9. package/src/modules/doc/contentActionToolbar/contentActionToolbar.ts +372 -61
  10. package/src/modules/doc/contentActionToolbar/contentActionToolbarMocks.ts +1 -1
  11. package/src/modules/doc/contentLayout/contentLayout.html +35 -16
  12. package/src/modules/doc/contentLayout/contentLayout.ts +87 -8
  13. package/src/modules/doc/header/header.ts +14 -3
  14. package/src/modules/doc/heading/heading.css +15 -4
  15. package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +17 -0
  16. package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +9 -0
  17. package/src/modules/doc/unifiedContentLayout/unifiedContentLayout.ts +46 -8
  18. package/src/modules/doc/versionPicker/versionPicker.css +0 -114
  19. package/src/modules/doc/versionPicker/versionPicker.html +0 -37
  20. package/src/modules/doc/versionPicker/versionPicker.ts +0 -42
  21. package/src/modules/doc/xmlContent/xmlContent.html +1 -0
  22. package/src/modules/doc/xmlContent/xmlContent.ts +10 -14
  23. package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +5 -5
  24. package/src/modules/docHelpers/status/status.css +1 -0
  25. package/src/modules/docUtils/searchClient/searchClient.ts +16 -0
package/package.json CHANGED
@@ -1,30 +1,29 @@
1
1
  {
2
- "name": "@salesforcedevs/docs-components",
3
- "version": "1.35.0-ver-picker-1",
4
- "description": "Docs Lightning web components for DSC",
5
- "license": "MIT",
6
- "main": "index.js",
7
- "engines": {
8
- "node": "22.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.34.0"
30
- }
2
+ "name": "@salesforcedevs/docs-components",
3
+ "version": "1.35.1-remediation.1",
4
+ "description": "Docs Lightning web components for DSC",
5
+ "license": "MIT",
6
+ "main": "index.js",
7
+ "engines": {
8
+ "node": "22.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
+ }
@@ -16,8 +16,6 @@
16
16
  }
17
17
 
18
18
  .icon {
19
- --dx-c-icon-size: var(--dx-g-icon-size-lg);
20
-
21
19
  flex-shrink: 0;
22
20
  margin-top: var(--dx-g-spacing-smd);
23
21
  margin-right: var(--dx-g-spacing-sm);
@@ -73,6 +71,47 @@
73
71
  cursor: pointer;
74
72
  }
75
73
 
74
+ /* Centered variant: the message is centered in the banner and the icon hangs
75
+ to its left. The close button is taken out of the flow so it doesn't offset
76
+ the centering. */
77
+ .container_centered {
78
+ position: relative;
79
+ display: grid;
80
+ grid-template-columns: 1fr auto 1fr;
81
+ align-items: center;
82
+
83
+ /* Reserve the close button's width plus its right inset on both sides */
84
+ padding: 0
85
+ calc(
86
+ var(--dx-g-spacing-3xl) + var(--dx-g-spacing-xs) +
87
+ var(--doc-banner-padding-right)
88
+ );
89
+ }
90
+
91
+ .container_centered .icon {
92
+ grid-column: 1;
93
+ justify-self: end;
94
+ margin-top: 0;
95
+ }
96
+
97
+ .container_centered .main {
98
+ grid-column: 2;
99
+ align-items: center;
100
+ justify-content: center;
101
+ }
102
+
103
+ .container_centered .message {
104
+ text-align: center;
105
+ }
106
+
107
+ .container_centered .close {
108
+ position: absolute;
109
+ top: 50%;
110
+ right: var(--doc-banner-padding-right);
111
+ margin-left: 0;
112
+ transform: translateY(-50%);
113
+ }
114
+
76
115
  @media (max-width: 1279px) {
77
116
  :host {
78
117
  --doc-banner-padding-left: var(--dx-g-spacing-xl);
@@ -1,16 +1,17 @@
1
1
  <template>
2
2
  <template lwc:if={showBanner}>
3
- <div class="container" part="container">
3
+ <div class={containerClass} part="container">
4
4
  <dx-icon
5
5
  class="icon"
6
- symbol="info"
7
- size="override"
8
- color="gray-50"
6
+ sprite={iconSprite}
7
+ symbol={iconSymbol}
8
+ size={iconSize}
9
+ color={iconColor}
9
10
  part="icon"
10
11
  ></dx-icon>
11
12
  <div class="main">
12
13
  <div class="message" part="message" lwc:dom="manual"></div>
13
- <div class="actions" part="actions">
14
+ <div lwc:if={hasActions} class="actions" part="actions">
14
15
  <template lwc:if={hasPrimaryButton}>
15
16
  <dx-button
16
17
  href={buttonHref}
@@ -1,4 +1,6 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import { IconSize, IconSprite, IconSymbol } from "typings/custom";
3
+ import { normalizeBoolean } from "dxUtils/normalizers";
2
4
 
3
5
  const BANNER_STORAGE_PREFIX = "doc-banner-";
4
6
 
@@ -13,6 +15,24 @@ export default class Banner extends LightningElement {
13
15
 
14
16
  @api dismissStorageKey = "";
15
17
 
18
+ @api
19
+ get centered(): boolean {
20
+ return this._centered;
21
+ }
22
+ set centered(value: boolean | string) {
23
+ this._centered = normalizeBoolean(value);
24
+ }
25
+
26
+ @api iconSprite: IconSprite = "utility";
27
+
28
+ @api iconSymbol: IconSymbol = "info";
29
+
30
+ @api iconColor = "gray-50";
31
+
32
+ @api iconSize: IconSize = "large";
33
+
34
+ private _centered = false;
35
+
16
36
  private _dismissed = false;
17
37
 
18
38
  connectedCallback() {
@@ -33,10 +53,18 @@ export default class Banner extends LightningElement {
33
53
  }
34
54
  }
35
55
 
56
+ get containerClass(): string {
57
+ return this._centered ? "container container_centered" : "container";
58
+ }
59
+
36
60
  get showBanner(): boolean {
37
61
  return !this._dismissed;
38
62
  }
39
63
 
64
+ get hasActions(): boolean {
65
+ return this.hasPrimaryButton || this.hasSecondaryAction;
66
+ }
67
+
40
68
  get hasPrimaryButton(): boolean {
41
69
  return !!(this.buttonLabel && this.buttonHref);
42
70
  }
@@ -149,7 +149,6 @@ a,
149
149
  border-width: 0;
150
150
  border-style: solid;
151
151
  border-color: #e2e8f0;
152
- font-size: var(--dx-g-text-md);
153
152
  color: var(--dx-g-blue-vibrant-50);
154
153
  }
155
154
 
@@ -0,0 +1,43 @@
1
+ export const DEFAULT_TOOLTIP_LABEL = "Click to copy";
2
+ export const COPIED_TOOLTIP_LABEL = "Copied!";
3
+ export const COPIED_RESET_MS = 1000;
4
+
5
+ export const ANALYTICS_CONTENT_CATEGORY = "content action toolbar";
6
+ export const MORE_ACTIONS_LABEL = "More actions";
7
+
8
+ export const COPY_MARKDOWN_LABEL = "Copy as Markdown";
9
+ export const VIEW_MARKDOWN_LABEL = "View as Markdown";
10
+ export const COPY_MARKDOWN_URL_LABEL = "Copy URL to Markdown";
11
+ export const VIEW_LLMS_LABEL = "View llms.txt";
12
+ export const COPY_LLMS_URL_LABEL = "Copy URL to llms.txt";
13
+ export const OPEN_CHATGPT_LABEL = "Open in ChatGPT";
14
+ export const OPEN_CLAUDE_LABEL = "Open in Claude";
15
+ export const OPEN_PERPLEXITY_LABEL = "Open in Perplexity";
16
+
17
+ export const LLMS_TXT_PATH = "/docs/llms.txt";
18
+ export const CHATGPT_URL = "https://chatgpt.com/";
19
+ export const CLAUDE_URL = "https://claude.ai/new";
20
+ export const PERPLEXITY_URL = "https://www.perplexity.ai/search";
21
+
22
+ export const ACTION_COPY_MARKDOWN = "copy-markdown";
23
+ export const ACTION_VIEW_MARKDOWN = "view-markdown";
24
+ export const ACTION_COPY_MARKDOWN_URL = "copy-markdown-url";
25
+ export const ACTION_VIEW_LLMS = "view-llms";
26
+ export const ACTION_COPY_LLMS_URL = "copy-llms-url";
27
+ export const ACTION_OPEN_CHATGPT = "open-chatgpt";
28
+ export const ACTION_OPEN_CLAUDE = "open-claude";
29
+ export const ACTION_OPEN_PERPLEXITY = "open-perplexity";
30
+
31
+ export const AI_ASSISTANTS = [
32
+ {
33
+ action: ACTION_OPEN_CHATGPT,
34
+ base: CHATGPT_URL,
35
+ label: OPEN_CHATGPT_LABEL
36
+ },
37
+ { action: ACTION_OPEN_CLAUDE, base: CLAUDE_URL, label: OPEN_CLAUDE_LABEL },
38
+ {
39
+ action: ACTION_OPEN_PERPLEXITY,
40
+ base: PERPLEXITY_URL,
41
+ label: OPEN_PERPLEXITY_LABEL
42
+ }
43
+ ] as const;
@@ -2,16 +2,27 @@
2
2
 
3
3
  :host {
4
4
  display: block;
5
+
6
+ /* 4px gap below the trigger, and the same 4px gap above when the menu
7
+ flips */
8
+ --popover-container-open-transform: translateY(var(--dx-g-spacing-xs));
9
+ --popover-container-open-transform-up: translateY(
10
+ calc(-1 * var(--dx-g-spacing-xs))
11
+ );
5
12
  }
6
13
 
7
14
  .toolbar {
8
15
  display: flex;
9
16
  align-items: center;
10
- flex-wrap: wrap;
17
+ flex-wrap: nowrap;
11
18
  gap: var(--dx-g-spacing-smd);
12
19
  margin-bottom: var(--dx-g-spacing-lg);
13
20
  }
14
21
 
22
+ .toolbar > * {
23
+ flex-shrink: 0;
24
+ }
25
+
15
26
  .toolbar-button {
16
27
  --dx-c-button-font-weight: var(--dx-g-font-demi);
17
28
  --dx-c-button-line-height: var(--dx-g-spacing-mlg);
@@ -24,9 +35,26 @@
24
35
  background-color: var(--dx-g-gray-70);
25
36
  }
26
37
 
27
- @media screen and (max-width: 480px) {
28
- .toolbar-button_copy-url,
29
- .divider_copy-url {
30
- display: none;
31
- }
38
+ .toolbar_no-markdown .divider_view-llms {
39
+ display: none;
40
+ }
41
+
42
+ .toolbar-menu {
43
+ --dx-c-popover-z-index: calc(var(--dx-g-z-index-100) + 6);
44
+
45
+ flex: 0 0 auto;
46
+ }
47
+
48
+ .menu-trigger {
49
+ white-space: nowrap;
50
+ flex-shrink: 0;
51
+ }
52
+
53
+ .toolbar > [data-overflow="true"] {
54
+ display: none;
55
+ }
56
+
57
+ .toolbar > .divider_view-markdown[data-overflow="true"] ~ .divider_menu,
58
+ .toolbar_no-markdown .divider_menu {
59
+ display: none;
32
60
  }
@@ -1,53 +1,88 @@
1
1
  <template>
2
- <div class="toolbar" lwc:if={markdownUrl}>
3
- <dx-tooltip placement="top-right" label={copyMarkdownLabel}>
2
+ <div class={toolbarClass}>
3
+ <template lwc:if={hasMarkdown}>
4
+ <dx-tooltip
5
+ placement="top-right"
6
+ label={copyMarkdownTooltipLabel}
7
+ visible={copyMarkdownTooltipVisible}
8
+ >
9
+ <dx-button
10
+ class="toolbar-button"
11
+ variant="inline"
12
+ size="small"
13
+ icon-sprite="utility"
14
+ icon-symbol="copy"
15
+ icon-size="medium"
16
+ icon-position="right"
17
+ aria-label={copyMarkdownButtonText}
18
+ onclick={handleCopyMarkdown}
19
+ >
20
+ {copyMarkdownButtonText}
21
+ </dx-button>
22
+ </dx-tooltip>
23
+
24
+ <div class="divider divider_view-markdown"></div>
25
+
4
26
  <dx-button
5
- class="toolbar-button"
27
+ class="toolbar-button toolbar-button_view-markdown"
6
28
  variant="inline"
7
29
  size="small"
8
30
  icon-sprite="utility"
9
- icon-symbol="copy"
31
+ icon-symbol="new_window"
10
32
  icon-size="medium"
11
33
  icon-position="right"
12
- aria-label={copyMarkdownButtonText}
13
- onclick={handleCopyMarkdown}
34
+ aria-label={viewMarkdownButtonText}
35
+ onclick={handleViewMarkdown}
14
36
  >
15
- {copyMarkdownButtonText}
37
+ {viewMarkdownButtonText}
16
38
  </dx-button>
17
- </dx-tooltip>
39
+ </template>
18
40
 
19
- <div class="divider"></div>
41
+ <div class="divider divider_view-llms"></div>
20
42
 
21
43
  <dx-button
22
- class="toolbar-button"
44
+ class="toolbar-button toolbar-button_view-llms"
23
45
  variant="inline"
24
46
  size="small"
25
47
  icon-sprite="utility"
26
48
  icon-symbol="new_window"
27
49
  icon-size="medium"
28
50
  icon-position="right"
29
- aria-label={viewMarkdownButtonText}
30
- onclick={handleViewMarkdown}
51
+ aria-label={viewLlmsButtonText}
52
+ onclick={handleViewLlms}
31
53
  >
32
- {viewMarkdownButtonText}
54
+ {viewLlmsButtonText}
33
55
  </dx-button>
34
56
 
35
- <div class="divider divider_copy-url"></div>
57
+ <div class="divider divider_menu"></div>
36
58
 
37
- <dx-tooltip placement="top-right" label={copyUrlLabel}>
38
- <dx-button
39
- class="toolbar-button toolbar-button_copy-url"
40
- variant="inline"
41
- size="small"
42
- icon-sprite="utility"
43
- icon-symbol="link"
44
- icon-size="medium"
45
- icon-position="right"
46
- aria-label={copyUrlButtonText}
47
- onclick={handleCopyUrl}
59
+ <dx-dropdown
60
+ class="toolbar-menu"
61
+ options={menuOptions}
62
+ placement="bottom-end"
63
+ width-mode="fit-content"
64
+ onchange={handleMenuSelect}
65
+ onopen={handleMenuOpen}
66
+ onclose={handleMenuClose}
67
+ >
68
+ <dx-tooltip
69
+ placement="top-right"
70
+ label={menuTooltipLabel}
71
+ visible={menuTooltipVisible}
72
+ suppressed={menuOpen}
48
73
  >
49
- {copyUrlButtonText}
50
- </dx-button>
51
- </dx-tooltip>
74
+ <dx-button
75
+ class="menu-trigger"
76
+ variant="secondary"
77
+ size="small"
78
+ icon-sprite="utility"
79
+ icon-symbol="threedots"
80
+ icon-size="medium"
81
+ icon-only
82
+ >
83
+ {moreActionsLabel}
84
+ </dx-button>
85
+ </dx-tooltip>
86
+ </dx-dropdown>
52
87
  </div>
53
88
  </template>