@salesforcedevs/dx-components 1.27.16 → 1.27.22-banner

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 CHANGED
@@ -56,6 +56,7 @@
56
56
  "dx/featuresListHeader",
57
57
  "dx/filterMenu",
58
58
  "dx/footer",
59
+ "dx/footerMfe",
59
60
  "dx/formattedDateTime",
60
61
  "dx/formattedRichText",
61
62
  "dx/grid",
@@ -93,7 +94,6 @@
93
94
  "dx/sidebarOld",
94
95
  "dx/sidebarFooterNav",
95
96
  "dx/skipNavLink",
96
- "dx/socials",
97
97
  "dx/spinner",
98
98
  "dx/stepSequence",
99
99
  "dx/stepSequenceStep",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.27.16",
3
+ "version": "1.27.22-banner",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,5 +44,5 @@
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
46
  },
47
- "gitHead": "92787faed8b31ef7128f8cee6421a06857def418"
47
+ "gitHead": "c75e59bd77c2c61b628eb54068cd366f486bd6da"
48
48
  }
@@ -34,6 +34,7 @@ export default class CodeBlock extends LightningElement {
34
34
  private _codeBlockRendered: boolean = false;
35
35
  private _showLoadingIndicator: boolean = false;
36
36
  private _isCbHeightCalculated: boolean = false;
37
+ private _plainCodeForCopy: string = "";
37
38
  private markupLangs = ["visualforce", "html", "xml"];
38
39
  private componentLoaded: boolean = false;
39
40
  private showLanguageDropdown: boolean = false;
@@ -290,6 +291,9 @@ export default class CodeBlock extends LightningElement {
290
291
  );
291
292
  }
292
293
  }
294
+ // Get the plain code for copy functionality
295
+ const codeElement = this.template.querySelector("code");
296
+ this._plainCodeForCopy = codeElement?.textContent?.trim() ?? "";
293
297
  // Add line numbers to each line
294
298
  this.addLineNumbers();
295
299
  }
@@ -328,12 +332,8 @@ export default class CodeBlock extends LightningElement {
328
332
  });
329
333
 
330
334
  try {
331
- const snippetContainer: HTMLElement | null =
332
- this.template.querySelector(".code-block-content");
333
- if (snippetContainer && snippetContainer.textContent) {
334
- await navigator.clipboard.writeText(
335
- snippetContainer.textContent
336
- );
335
+ if (this._plainCodeForCopy) {
336
+ await navigator.clipboard.writeText(this._plainCodeForCopy);
337
337
  this.copyBtnText = "Copied!";
338
338
  setTimeout(() => {
339
339
  this.copyBtnText = "Click to copy";
@@ -45,6 +45,7 @@
45
45
  <dx-footer-mfe
46
46
  legal-only={showLegalOnly}
47
47
  origin={mfeConfigOrigin}
48
+ home-href={mfeHomeHref}
48
49
  ></dx-footer-mfe>
49
50
  </footer>
50
51
  </template>
@@ -10,6 +10,9 @@ export default class Footer extends LightningElement {
10
10
  private signupUrl =
11
11
  "https://www.salesforce.com/form/other/role-based-newsletter/?Developer=true";
12
12
 
13
+ @api
14
+ mfeHomeHref: string = `/${window.location.host}`; // ugly hack: ideally this wouldn't be necessary, but the only way to remove the "See all ways to contact us" link from the footer MFE is to set this to a non-empty value other than "us"; and given the way that the footer works, the non-empty value needs to be something that can be appended to `/` and work correctly
15
+
13
16
  @api
14
17
  mfeConfigOrigin: string = `${window.location.origin}/developer/en-us/wp-json`;
15
18
 
@@ -4,6 +4,7 @@ export default class FooterMfe extends LightningElement {
4
4
  private footerElement: HTMLElement | null = null;
5
5
 
6
6
  @api legalOnly = false;
7
+ @api homeHref: string = `/${window.location.host}`; // ugly hack by default: ideally this wouldn't be necessary, but the only way to remove the "See all ways to contact us" link from the footer MFE is to set this to a non-empty value other than "us"; and given the way that the footer works, the non-empty value needs to be something that can be appended to `/` and work correctly
7
8
  @api origin: string = `${window.location.origin}/developer/en-us/wp-json`;
8
9
 
9
10
  renderedCallback() {
@@ -69,6 +69,27 @@
69
69
  transition: var(--dx-g-transition-hue-1x);
70
70
  }
71
71
 
72
+ /* Indent TOC items by heading level: H2 base, H3+ progressively indented */
73
+ .toc-level-2 {
74
+ padding-left: 11px;
75
+ }
76
+
77
+ .toc-level-3 {
78
+ padding-left: calc(11px + var(--dx-g-spacing-md, 16px));
79
+ }
80
+
81
+ .toc-level-4 {
82
+ padding-left: calc(11px + 2 * var(--dx-g-spacing-md, 16px));
83
+ }
84
+
85
+ .toc-level-5 {
86
+ padding-left: calc(11px + 3 * var(--dx-g-spacing-md, 16px));
87
+ }
88
+
89
+ .toc-level-6 {
90
+ padding-left: calc(11px + 4 * var(--dx-g-spacing-md, 16px));
91
+ }
92
+
72
93
  .content-button.selected {
73
94
  border-color: var(--dx-g-blue-vibrant-50);
74
95
  color: var(--dx-g-blue-vibrant-50);
@@ -32,10 +32,12 @@ export default class Toc extends LightningElement {
32
32
  this.value ||
33
33
  (this._options && this._options.length > 0 && this._options[0].id);
34
34
  return this._options.map((option) => {
35
+ const level = option.level ?? 2;
35
36
  return {
36
37
  ...option,
37
38
  className: cx(
38
39
  "content-button",
40
+ `toc-level-${level}`,
39
41
  option.id === actualValue && "selected"
40
42
  )
41
43
  };
@@ -1,36 +0,0 @@
1
- :host {
2
- display: inline-block;
3
- }
4
-
5
- .details-section {
6
- color: var(--dx-g-text-label-color);
7
- font-family: var(--dx-g-font-display);
8
- font-size: var(--dx-g-text-xs);
9
- letter-spacing: 0.7px;
10
- margin-bottom: var(--dx-g-spacing-sm);
11
- text-transform: uppercase;
12
- }
13
-
14
- .details-section span {
15
- display: block;
16
- line-height: var(--dx-g-spacing-md);
17
- }
18
-
19
- .socials-group {
20
- display: flex;
21
- }
22
-
23
- .socials-group a:not(:last-child) {
24
- margin-right: var(--dx-g-spacing-md);
25
- }
26
-
27
- dx-icon-badge {
28
- --dx-c-icon-badge-background-color: var(--dx-g-social-svg-background-color);
29
- --dx-c-icon-badge-color: var(--dx-g-social-svg-icon-color);
30
- --dx-c-icon-badge-size: 34px;
31
- --dx-c-icon-badge-icon-size: 18px;
32
- }
33
-
34
- dx-icon-badge:hover {
35
- --dx-c-icon-badge-background-color: var(--dx-g-social-svg-hover-color);
36
- }
@@ -1,22 +0,0 @@
1
- <template>
2
- <div class="details-section" if:true={hasDetails}>
3
- <template for:each={details} for:item="detail">
4
- <span key={detail}>{detail}</span>
5
- </template>
6
- </div>
7
- <div class="socials-group">
8
- <template for:each={socials} for:item="social">
9
- <a
10
- href={social.href}
11
- key={social.name}
12
- target={linksTarget}
13
- title={social.name}
14
- >
15
- <dx-icon-badge
16
- sprite={spriteName}
17
- symbol={social.symbol}
18
- ></dx-icon-badge>
19
- </a>
20
- </template>
21
- </div>
22
- </template>
@@ -1,76 +0,0 @@
1
- import { LightningElement, api } from "lwc";
2
- import { normalizeToArray } from "dxUtils/normalizers";
3
-
4
- type Icon = { name: string; symbol: string; baseShareUrl: string };
5
-
6
- const URL_TOKEN = "{url}";
7
- const TEXT_TOKEN = "{text}";
8
-
9
- const SOCIAL_ICONS: Array<Icon> = [
10
- {
11
- name: "Twitter",
12
- symbol: "twitter",
13
- baseShareUrl: `https://twitter.com/intent/tweet?url=${URL_TOKEN}&text=${TEXT_TOKEN}`
14
- },
15
- {
16
- name: "Linkedin",
17
- symbol: "linkedin-in",
18
- baseShareUrl: `http://www.linkedin.com/sharing/share-offsite/?url=${URL_TOKEN}`
19
- }
20
- ];
21
-
22
- const SPRITE_NAME = "brand";
23
-
24
- const VALID_TARGETS = ["_self", "_blank", "_parent", "_top", "framename"];
25
-
26
- export default class Socials extends LightningElement {
27
- private _linksTarget: string = "_blank";
28
- private _details: Array<string> = [];
29
-
30
- @api
31
- get details() {
32
- return this._details;
33
- }
34
-
35
- set details(value) {
36
- this._details = normalizeToArray(value, "|") as Array<string>;
37
- }
38
-
39
- @api
40
- get linksTarget(): string {
41
- return this._linksTarget;
42
- }
43
-
44
- set linksTarget(value: string) {
45
- if (value && !VALID_TARGETS.includes(value)) {
46
- console.error(
47
- `Invalid links target, valid options are: ${VALID_TARGETS.join(
48
- ", "
49
- )}`
50
- );
51
- return;
52
- }
53
- this._linksTarget = value;
54
- }
55
-
56
- get socials() {
57
- const url = encodeURIComponent(document.location.href);
58
- const text = encodeURIComponent(document.title);
59
- return SOCIAL_ICONS.map(({ baseShareUrl, ...value }: Icon) => {
60
- return {
61
- ...value,
62
- href: baseShareUrl
63
- .replace(URL_TOKEN, url)
64
- .replace(TEXT_TOKEN, text)
65
- };
66
- });
67
- }
68
-
69
- get spriteName() {
70
- return SPRITE_NAME;
71
- }
72
-
73
- get hasDetails() {
74
- return this.details && this.details.length > 0;
75
- }
76
- }