@salesforcedevs/docs-components 1.3.194-search1-alpha → 1.3.194-search2-alpha

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.194-search1-alpha",
3
+ "version": "1.3.194-search2-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -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) {
@@ -1272,12 +1267,10 @@ 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
@@ -1321,6 +1314,8 @@ export default class AmfReference extends LightningElement {
1321
1314
  const metaNavTitle = document.querySelector('meta[name="nav-title"]');
1322
1315
  // eslint-disable-next-line @lwc/lwc/no-document-query
1323
1316
  const titleTag = document.querySelector("title");
1317
+ const TITLE_SEPARATOR = " | ";
1318
+
1324
1319
  if (metaNavTitle) {
1325
1320
  metaNavTitle.setAttribute("content", navTitle);
1326
1321
  }
@@ -1332,16 +1327,32 @@ export default class AmfReference extends LightningElement {
1332
1327
  * If a Ref spec is chosen, we add the value of the <selected topic> to the title.
1333
1328
  * If a subsection is selected, we update the first part of the current
1334
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
+ *
1335
1345
  */
1336
1346
  if (titleTag) {
1337
1347
  let titleTagValue = titleTag.textContent;
1338
- const titleTagSectionValues: string[] = titleTagValue?.split(" | ");
1348
+ const titleTagSectionValues: string[] =
1349
+ titleTagValue?.split(TITLE_SEPARATOR);
1339
1350
  if (titleTagSectionValues) {
1340
1351
  if (titleTagSectionValues.length <= 3) {
1341
- titleTagValue = navTitle + " | " + titleTagValue;
1352
+ titleTagValue = navTitle + TITLE_SEPARATOR + titleTagValue;
1342
1353
  } else {
1343
1354
  titleTagSectionValues[0] = navTitle;
1344
- titleTagValue = titleTagSectionValues.join(" | ");
1355
+ titleTagValue = titleTagSectionValues.join(TITLE_SEPARATOR);
1345
1356
  }
1346
1357
  }
1347
1358
  titleTag.textContent = titleTagValue;
@@ -1352,9 +1363,8 @@ export default class AmfReference extends LightningElement {
1352
1363
  const name = event.detail.name;
1353
1364
  if (name) {
1354
1365
  const urlReferenceId = this.getReferenceIdFromUrl(name);
1355
- const specBasedReference = this.isSpecBasedReference(
1356
- urlReferenceId
1357
- );
1366
+ const specBasedReference =
1367
+ this.isSpecBasedReference(urlReferenceId);
1358
1368
  if (specBasedReference) {
1359
1369
  const metaVal = this.getMetaFromUrl(name);
1360
1370
  const currentSelectedMeta = this.selectedTopic
@@ -1409,9 +1419,8 @@ export default class AmfReference extends LightningElement {
1409
1419
  const currentReferenceId = this.getReferenceIdFromUrl(currentUrl);
1410
1420
  //No need to do anything if user is expanding currently selected reference
1411
1421
  if (referenceId !== currentReferenceId) {
1412
- const isSpecBasedReference = this.isSpecBasedReference(
1413
- referenceId
1414
- );
1422
+ const isSpecBasedReference =
1423
+ this.isSpecBasedReference(referenceId);
1415
1424
  if (isSpecBasedReference) {
1416
1425
  // Perform functionality same as item selection
1417
1426
  this.onNavSelect(event);