@salesforcedevs/docs-components 1.29.0-toolbar-alpha3 → 1.30.0

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2020, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
- "name": "@salesforcedevs/docs-components",
3
- "version": "1.29.0-toolbar-alpha3",
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
- }
2
+ "name": "@salesforcedevs/docs-components",
3
+ "version": "1.30.0",
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": "f3e8e2c6ae6c8792b316e41021344648d4a07bec"
29
+ }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="toolbar">
2
+ <div class="toolbar" lwc:if={markdownUrl}>
3
3
  <dx-tooltip placement="top-right" label={copyMarkdownLabel}>
4
4
  <dx-button
5
5
  class="toolbar-button"
@@ -3,7 +3,7 @@ import { track } from "dxUtils/analytics";
3
3
 
4
4
  const DEFAULT_COPY_TOOLTIP_LABEL = "Click to copy";
5
5
  const COPIED_TOOLTIP_LABEL = "Copied!";
6
- const COPIED_TOOLTIP_RESET_MS = 2000;
6
+ const COPIED_TOOLTIP_RESET_MS = 1000;
7
7
 
8
8
  const ANALYTICS_CONTENT_CATEGORY = "content action toolbar";
9
9
  const COPY_MARKDOWN_LABEL = "Copy as Markdown";
@@ -20,7 +20,6 @@ export default class ContentActionToolbar extends LightningElement {
20
20
  return;
21
21
  }
22
22
  this._pageUrl = value;
23
- this.markdownUrl = this.deriveMarkdownUrl();
24
23
  }
25
24
  private _pageUrl?: string;
26
25
 
@@ -29,7 +28,27 @@ export default class ContentActionToolbar extends LightningElement {
29
28
 
30
29
  private copyTooltipResetTimeout: number | null = null;
31
30
 
32
- private markdownUrl: string | null = this.deriveMarkdownUrl();
31
+ /**
32
+ * Returns the `.md` equivalent of `pageUrl` with any hash and query
33
+ * string stripped, or `null` when `pageUrl` is not set or does not end
34
+ * with `.html`.
35
+ */
36
+ get markdownUrl(): string | null {
37
+ if (!this.pageUrl) {
38
+ return null;
39
+ }
40
+
41
+ const url = new URL(this.pageUrl, window.location.href);
42
+ url.hash = "";
43
+ url.search = "";
44
+
45
+ if (!url.pathname.endsWith(".html")) {
46
+ return null;
47
+ }
48
+
49
+ url.pathname = url.pathname.replace(/\.html$/, ".md");
50
+ return url.toString();
51
+ }
33
52
 
34
53
  get copyMarkdownButtonText(): string {
35
54
  return COPY_MARKDOWN_LABEL;
@@ -118,25 +137,6 @@ export default class ContentActionToolbar extends LightningElement {
118
137
  });
119
138
  }
120
139
 
121
- /**
122
- * Returns the `.md` equivalent of the current page URL with any hash and
123
- * query string stripped, or `null` when the current page does not end
124
- * with `.html`.
125
- */
126
- private deriveMarkdownUrl(): string | null {
127
- const sourceHref = this._pageUrl || window.location.href;
128
- const url = new URL(sourceHref, window.location.href);
129
- url.hash = "";
130
- url.search = "";
131
-
132
- if (!url.pathname.endsWith(".html")) {
133
- return null;
134
- }
135
-
136
- url.pathname = url.pathname.replace(/\.html$/, ".md");
137
- return url.toString();
138
- }
139
-
140
140
  private flashCopied(labelKey: "copyMarkdownLabel" | "copyUrlLabel") {
141
141
  if (this.copyTooltipResetTimeout !== null) {
142
142
  window.clearTimeout(this.copyTooltipResetTimeout);
@@ -289,7 +289,7 @@ export default class ContentLayout extends LightningElement {
289
289
  * after the first H1 found inside this layout.
290
290
  */
291
291
  protected updateContentActionToolbar(): void {
292
- if (!this.showContentActionToolbar) {
292
+ if (!this.showContentActionToolbar || !this.sidebarValue) {
293
293
  this.removeContentActionToolbar();
294
294
  return;
295
295
  }