@salesforcedevs/docs-components 0.54.7-alpha → 0.55.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "0.54.7-alpha",
3
+ "version": "0.55.0",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
27
+ "gitHead": "4605730d0e1fbcfb0535d2b97424dc61678cd918"
28
28
  }
@@ -66,31 +66,47 @@ td > img.content-image:first-child:last-child[alt="No"] {
66
66
 
67
67
  h1 {
68
68
  font-family: var(--dx-g-font-display);
69
- font-size: 40px;
69
+ font-size: var(--dx-g-text-4xl);
70
70
 
71
71
  /* not registered */
72
72
  color: var(--dx-g-blue-vibrant-20);
73
73
  letter-spacing: -0.4px;
74
- line-height: 40px;
74
+ line-height: 56px;
75
75
  }
76
76
 
77
77
  h2 {
78
78
  font-family: var(--dx-g-font-display);
79
- font-size: var(--dx-g-text-xl);
79
+ font-size: var(--dx-g-text-3xl);
80
80
  color: var(--dx-g-blue-vibrant-20);
81
81
  letter-spacing: -0.1px;
82
- line-height: var(--dx-g-spacing-lg);
82
+ line-height: var(--dx-g-spacing-3xl);
83
83
  }
84
84
 
85
85
  h3 {
86
86
  font-family: var(--dx-g-font-display);
87
- font-size: var(--dx-g-text-lg);
87
+ font-size: 32px;
88
88
  color: var(--dx-g-blue-vibrant-20);
89
89
  letter-spacing: -0.1px;
90
- line-height: var(--dx-g-spacing-lg);
90
+ line-height: var(--dx-g-spacing-2xl);
91
91
  }
92
92
 
93
93
  h4 {
94
+ font-family: var(--dx-g-font-display);
95
+ font-size: var(--dx-g-text-xl);
96
+ color: var(--dx-g-blue-vibrant-20);
97
+ letter-spacing: 0;
98
+ line-height: var(--dx-g-spacing-xl);
99
+ }
100
+
101
+ h5 {
102
+ font-family: var(--dx-g-font-display);
103
+ font-size: var(--dx-g-text-lg);
104
+ color: var(--dx-g-blue-vibrant-20);
105
+ letter-spacing: 0;
106
+ line-height: 28px;
107
+ }
108
+
109
+ h6 {
94
110
  font-family: var(--dx-g-font-display);
95
111
  font-size: var(--dx-g-text-base);
96
112
  color: var(--dx-g-blue-vibrant-20);
@@ -116,6 +132,12 @@ p,
116
132
  margin-bottom: var(--dx-g-spacing-md);
117
133
  }
118
134
 
135
+ dd > p,
136
+ dd > .p {
137
+ margin-top: 0;
138
+ margin-bottom: 0;
139
+ }
140
+
119
141
  .li {
120
142
  font-family: var(--dx-g-font-sans);
121
143
  font-size: var(--dx-g-text-base);
@@ -175,7 +197,8 @@ a,
175
197
  margin-right: var(--dx-g-spacing-lg);
176
198
  }
177
199
 
178
- .codeph {
200
+ .codeph,
201
+ .filepath {
179
202
  font-family: var(--dx-g-font-mono);
180
203
  font-size: var(--dx-g-text-sm);
181
204
  line-height: var(--dx-g-text-lg);
@@ -239,6 +262,7 @@ dd {
239
262
  letter-spacing: 0;
240
263
  line-height: var(--dx-g-spacing-lg);
241
264
  margin-left: var(--dx-g-spacing-smd);
265
+ margin-bottom: var(--dx-g-spacing-md);
242
266
  }
243
267
 
244
268
  li {
@@ -21,6 +21,12 @@ export enum HistoryState {
21
21
  REPLACE_STATE = "replaceState"
22
22
  }
23
23
 
24
+ export type Labels = {
25
+ language_english: string;
26
+ language_japanese: string;
27
+ toc_title: string;
28
+ };
29
+
24
30
  export type TreeNode = {
25
31
  label: string;
26
32
  name: string;
@@ -8,18 +8,22 @@ import {
8
8
  DocumentData,
9
9
  DocLanguage,
10
10
  DocVersion,
11
+ Labels,
11
12
  TreeNode
12
13
  } from "./types";
13
- import { Language } from "typings/custom";
14
- import { getLanguageDisplayTextById } from "dxUtils/language";
14
+
15
+ const LOCALE_TO_LABEL = {
16
+ "en-us": "language_english",
17
+ "ja-jp": "language_japanese"
18
+ };
15
19
 
16
20
  export class FetchContent {
17
21
  private apiDomain: string;
18
- private languages: Array<Language> = [];
22
+ private labels: Labels;
19
23
 
20
- constructor(apiDomain: string, languages: Array<Language>) {
24
+ constructor(apiDomain: string, labels: Labels) {
21
25
  this.apiDomain = apiDomain;
22
- this.languages = languages;
26
+ this.labels = labels;
23
27
  }
24
28
 
25
29
  async fetchDocumentData(docId: string): Promise<DocumentData | null> {
@@ -144,10 +148,11 @@ export class FetchContent {
144
148
  }
145
149
 
146
150
  private normalizeLanguage(language: ApiDocLanguage): DocLanguage {
147
-
151
+ const labelKey = language.locale && LOCALE_TO_LABEL[language.locale];
148
152
  return (
149
153
  language && {
150
- label: getLanguageDisplayTextById(this.languages, language.locale) ||
154
+ label:
155
+ (labelKey && this.labels && this.labels[labelKey]) ||
151
156
  language.label,
152
157
  id: language.locale,
153
158
  code: language.code,
@@ -5,6 +5,7 @@ import {
5
5
  CoveoAdvancedQueryXMLConfig,
6
6
  DocLanguage,
7
7
  DocVersion,
8
+ Labels,
8
9
  TreeNode,
9
10
  Header,
10
11
  HistoryState,
@@ -12,7 +13,6 @@ import {
12
13
  } from "./types";
13
14
  import { SearchSyncer } from "docUtils/SearchSyncer";
14
15
  import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
15
- import { Language } from "typings/custom";
16
16
 
17
17
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
18
18
  const handleContentError = (error): void => console.log(error);
@@ -35,17 +35,6 @@ export default class DocXmlContent extends LightningElementWithState<{
35
35
  this._labels = toJson(value);
36
36
  }
37
37
 
38
- @api
39
- get allLanguages(): Array<Language> {
40
- return this._allLanguages;
41
- }
42
-
43
- set allLanguages(value: string) {
44
- if (value) {
45
- this._allLanguages = JSON.parse(value);
46
- }
47
- }
48
-
49
38
  private _labels: Labels = null;
50
39
  private availableLanguages: Array<DocLanguage> = [];
51
40
  private availableVersions: Array<DocVersion> = [];
@@ -98,7 +87,6 @@ export default class DocXmlContent extends LightningElementWithState<{
98
87
  shouldStopPropagation: true,
99
88
  target: window
100
89
  });
101
- private _allLanguages: Array<Language> = [];
102
90
 
103
91
  @track private pageReference: PageReference = {};
104
92
 
@@ -121,7 +109,8 @@ export default class DocXmlContent extends LightningElementWithState<{
121
109
  window.location.href = "/docs";
122
110
  return;
123
111
  }
124
- this.contentProvider = new FetchContent(this.apiDomain, this.allLanguages);
112
+
113
+ this.contentProvider = new FetchContent(this.apiDomain, this._labels);
125
114
  this.fetchDocument().then(() => (this.loaded = true));
126
115
  window.addEventListener("popstate", this.handlePopState);
127
116