@salesforcedevs/docs-components 1.3.200-alpha → 1.3.209

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": "1.3.200-alpha",
3
+ "version": "1.3.209",
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": "6450e25a2aa9396fe2296aeb3690e159b6486ac1"
28
28
  }
@@ -185,12 +185,10 @@ export default class AmfReference extends LightningElement {
185
185
  constructor() {
186
186
  super();
187
187
 
188
- this._boundOnApiNavigationChanged = this.onApiNavigationChanged.bind(
189
- this
190
- );
191
- this._boundUpdateSelectedItemFromUrlQuery = this.updateSelectedItemFromUrlQuery.bind(
192
- this
193
- );
188
+ this._boundOnApiNavigationChanged =
189
+ this.onApiNavigationChanged.bind(this);
190
+ this._boundUpdateSelectedItemFromUrlQuery =
191
+ this.updateSelectedItemFromUrlQuery.bind(this);
194
192
  }
195
193
 
196
194
  connectedCallback(): void {
@@ -246,9 +244,8 @@ export default class AmfReference extends LightningElement {
246
244
  const updatedReferenceId =
247
245
  oldReferenceIdNewReferenceIdMap[referenceId];
248
246
  const newReferenceId = updatedReferenceId || referenceId;
249
- const referenceItemConfig = this.getAmfConfigWithId(
250
- newReferenceId
251
- );
247
+ const referenceItemConfig =
248
+ this.getAmfConfigWithId(newReferenceId);
252
249
  if (referenceItemConfig) {
253
250
  hashBasedRedirectUrl = `${referenceItemConfig.href}?meta=${encodedMeta}`;
254
251
  }
@@ -328,9 +325,8 @@ export default class AmfReference extends LightningElement {
328
325
  for (let i = 0; i < allVersions.length; i++) {
329
326
  const versionItem = allVersions[i];
330
327
  const referenceLink = versionItem.link.href;
331
- const referenceId = this.getReferenceIdFromUrl(
332
- referenceLink
333
- );
328
+ const referenceId =
329
+ this.getReferenceIdFromUrl(referenceLink);
334
330
  if (this._currentReferenceId === referenceId) {
335
331
  // This is to navigate to respective topic in the changed version
336
332
  versionItem.link.href = `${referenceLink}/${currentRefMeta}`;
@@ -844,9 +840,8 @@ export default class AmfReference extends LightningElement {
844
840
  this._currentReferenceId
845
841
  );
846
842
  if (specBasedReference) {
847
- const currentMeta:
848
- | RouteMeta
849
- | undefined = this.getReferenceMetaInfo(window.location.href);
843
+ const currentMeta: RouteMeta | undefined =
844
+ this.getReferenceMetaInfo(window.location.href);
850
845
  const metadata =
851
846
  currentMeta && this.getMetadataByUrlQuery(currentMeta);
852
847
  if (metadata) {
@@ -1166,7 +1161,7 @@ export default class AmfReference extends LightningElement {
1166
1161
  selectedItemMetaData.parentReferencePath,
1167
1162
  selectedItemMetaData.meta
1168
1163
  );
1169
- this.updateNavTitleMetaTag(selectedItemMetaData.navTitle);
1164
+ this.updateTags(selectedItemMetaData.navTitle);
1170
1165
  }
1171
1166
  });
1172
1167
  } else {
@@ -1272,18 +1267,16 @@ export default class AmfReference extends LightningElement {
1272
1267
  }
1273
1268
  if (!isRedirecting) {
1274
1269
  const currentReferenceUrl = window.location.href;
1275
- const referenceMeta = this.getMarkdownReferenceMeta(
1276
- currentReferenceUrl
1277
- );
1278
- const selectedItemRefId = this.getReferenceIdFromUrl(
1279
- currentReferenceUrl
1280
- );
1270
+ const referenceMeta =
1271
+ this.getMarkdownReferenceMeta(currentReferenceUrl);
1272
+ const selectedItemRefId =
1273
+ this.getReferenceIdFromUrl(currentReferenceUrl);
1281
1274
  const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1282
1275
  selectedItemRefId,
1283
1276
  referenceMeta
1284
1277
  );
1285
1278
  if (referenceDetails) {
1286
- this.updateNavTitleMetaTag(referenceDetails.topicTitle);
1279
+ this.updateTags(referenceDetails.topicTitle);
1287
1280
  }
1288
1281
 
1289
1282
  this.versions = this.getVersions();
@@ -1311,22 +1304,67 @@ export default class AmfReference extends LightningElement {
1311
1304
  this.showVersionBanner = false;
1312
1305
  }
1313
1306
 
1314
- private updateNavTitleMetaTag(navTitle = ""): void {
1307
+ private updateTags(navTitle = ""): void {
1308
+ if (!navTitle) {
1309
+ return;
1310
+ }
1311
+
1315
1312
  // this is required to update the nav title meta tag.
1316
1313
  // eslint-disable-next-line @lwc/lwc/no-document-query
1317
1314
  const metaNavTitle = document.querySelector('meta[name="nav-title"]');
1318
- if (metaNavTitle && navTitle) {
1315
+ // eslint-disable-next-line @lwc/lwc/no-document-query
1316
+ const titleTag = document.querySelector("title");
1317
+ const TITLE_SEPARATOR = " | ";
1318
+
1319
+ if (metaNavTitle) {
1319
1320
  metaNavTitle.setAttribute("content", navTitle);
1320
1321
  }
1322
+
1323
+ /**
1324
+ * Right now, the title tag only changes when you pick a Ref spec,
1325
+ * not every time you choose a subsection of the Ref spec.
1326
+ * This update aims to refresh the title tag with each selection.
1327
+ * If a Ref spec is chosen, we add the value of the <selected topic> to the title.
1328
+ * If a subsection is selected, we update the first part of the current
1329
+ * title with the new <selected topic>.
1330
+ * Example: Following is a sample project structure.
1331
+ * - Project Name
1332
+ * - Ref Spec1
1333
+ * - Summary
1334
+ * - Endpoints
1335
+ * - E1
1336
+ * - E2
1337
+ * - Ref Spec2
1338
+ * - Summary
1339
+ * - Endpoints
1340
+ * - E1 (Selected)
1341
+ * - E2
1342
+ * Previous Title: Ref Spec2 | Project Name | Salesforce Developer
1343
+ * New Title: E1 | Ref Spec2 | Project Name | Salesforce Developer
1344
+ *
1345
+ */
1346
+ if (titleTag) {
1347
+ let titleTagValue = titleTag.textContent;
1348
+ const titleTagSectionValues: string[] =
1349
+ titleTagValue?.split(TITLE_SEPARATOR);
1350
+ if (titleTagSectionValues) {
1351
+ if (titleTagSectionValues.length <= 3) {
1352
+ titleTagValue = navTitle + TITLE_SEPARATOR + titleTagValue;
1353
+ } else {
1354
+ titleTagSectionValues[0] = navTitle;
1355
+ titleTagValue = titleTagSectionValues.join(TITLE_SEPARATOR);
1356
+ }
1357
+ }
1358
+ titleTag.textContent = titleTagValue;
1359
+ }
1321
1360
  }
1322
1361
 
1323
1362
  onNavSelect(event: CustomEvent): void {
1324
1363
  const name = event.detail.name;
1325
1364
  if (name) {
1326
1365
  const urlReferenceId = this.getReferenceIdFromUrl(name);
1327
- const specBasedReference = this.isSpecBasedReference(
1328
- urlReferenceId
1329
- );
1366
+ const specBasedReference =
1367
+ this.isSpecBasedReference(urlReferenceId);
1330
1368
  if (specBasedReference) {
1331
1369
  const metaVal = this.getMetaFromUrl(name);
1332
1370
  const currentSelectedMeta = this.selectedTopic
@@ -1361,7 +1399,7 @@ export default class AmfReference extends LightningElement {
1361
1399
  this.coveoAnalyticsToken
1362
1400
  );
1363
1401
  this.updateUrlWithSelected(parentReferencePath, metaVal);
1364
- this.updateNavTitleMetaTag(metadata.navTitle);
1402
+ this.updateTags(metadata.navTitle);
1365
1403
  } else {
1366
1404
  if (this.isParentReferencePath(name)) {
1367
1405
  this.loadNewReferenceItem(name);
@@ -1381,9 +1419,8 @@ export default class AmfReference extends LightningElement {
1381
1419
  const currentReferenceId = this.getReferenceIdFromUrl(currentUrl);
1382
1420
  //No need to do anything if user is expanding currently selected reference
1383
1421
  if (referenceId !== currentReferenceId) {
1384
- const isSpecBasedReference = this.isSpecBasedReference(
1385
- referenceId
1386
- );
1422
+ const isSpecBasedReference =
1423
+ this.isSpecBasedReference(referenceId);
1387
1424
  if (isSpecBasedReference) {
1388
1425
  // Perform functionality same as item selection
1389
1426
  this.onNavSelect(event);
@@ -52,3 +52,8 @@
52
52
  display: flex;
53
53
  flex-direction: row;
54
54
  }
55
+
56
+ .dx-callout-content {
57
+ flex: 1;
58
+ overflow: auto;
59
+ }