@salesforcedevs/docs-components 1.3.304-async-fix-alpha1 → 1.3.319-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.304-async-fix-alpha1",
3
+ "version": "1.3.319-alpha.0",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -17,8 +17,7 @@
17
17
  "lodash.orderby": "^4.6.0",
18
18
  "lodash.uniqby": "^4.7.0",
19
19
  "query-string": "^7.1.3",
20
- "sentence-case": "^3.0.4",
21
- "yieldable-json": "^2.0.1"
20
+ "sentence-case": "^3.0.4"
22
21
  },
23
22
  "devDependencies": {
24
23
  "@types/classnames": "^2.2.10",
@@ -1475,10 +1475,18 @@ export default class AmfReference extends LightningElement {
1475
1475
  // update topic view
1476
1476
  const { referenceId, amfId, type } = this.selectedTopic!;
1477
1477
 
1478
+ // Adding stringify inside try/catch
1479
+ let amfModelString = "";
1480
+ try {
1481
+ amfModelString = JSON.stringify(this.amfMap[referenceId].model);
1482
+ } catch (error) {
1483
+ console.error(`Error stringifying amf model: ${error}`);
1484
+ }
1485
+
1478
1486
  // This updates the component in the content section.
1479
1487
  this.topicModel = {
1480
1488
  type,
1481
- amf: this.amfMap[referenceId].model,
1489
+ amf: amfModelString,
1482
1490
  parser: this.amfMap[referenceId].parser,
1483
1491
  id: amfId
1484
1492
  };
@@ -95,7 +95,7 @@ export interface ParsedTopicModel {
95
95
  export interface TopicModel {
96
96
  id: string;
97
97
  type: string;
98
- amf: AmfModel;
98
+ amf: string;
99
99
  parser: AmfParser;
100
100
  }
101
101
 
@@ -9,7 +9,6 @@ import {
9
9
  } from "./utils";
10
10
  import type { TopicModel } from "./types";
11
11
  import { Json } from "typings/custom";
12
- import { parse, stringify } from "yieldable-json";
13
12
 
14
13
  const TABLE_SIZE_MATCH = "769px";
15
14
 
@@ -28,13 +27,17 @@ export default class AmfTopic extends LightningElement {
28
27
  !this.amf ||
29
28
  (value && this._model && value.amf !== this._model?.amf)
30
29
  ) {
31
- this.amf = value && clone(value.amf);
30
+ try {
31
+ this.amf = value && JSON.parse(value.amf);
32
+ } catch (error) {
33
+ console.error(`Error parsing amf model: ${error}`);
34
+ }
32
35
  }
33
36
  if (
34
37
  !this.type ||
35
38
  (value && this._model && value.type !== this._model?.type)
36
39
  ) {
37
- this.type = value && clone(value.type);
40
+ this.type = value && value.type;
38
41
  }
39
42
 
40
43
  this._model = value;
@@ -106,14 +109,3 @@ export default class AmfTopic extends LightningElement {
106
109
  }
107
110
  }
108
111
  }
109
-
110
- /**
111
- * The underlying web components we use from api-console mutate their models we pass in.
112
- * Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
113
- * @param value JSON Serializable object to clone.
114
- * @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
115
- */
116
- async function clone(value: any): any {
117
- const parsedValue = await parse(stringify(value));
118
- return parsedValue;
119
- }
@@ -51,6 +51,6 @@ export type AmfModel = Json;
51
51
  export interface TopicModel {
52
52
  id: string;
53
53
  type: string;
54
- amf: AmfModel;
54
+ amf: string;
55
55
  parser: AmfModelParser;
56
56
  }
@@ -12,7 +12,7 @@
12
12
 
13
13
  <div class="dx-callout-content">
14
14
  <p class="doc-status-title dx-callout-title dx-text-body-3">
15
- {title}
15
+ {header}
16
16
  </p>
17
17
  <span class="dx-callout-body dx-text-body-3">
18
18
  <slot onslotchange={onSlotChange}></slot>
@@ -3,7 +3,7 @@ import cx from "classnames";
3
3
  import { CalloutVariant, LightningSlotElement } from "typings/custom";
4
4
 
5
5
  export default class ContentCallout extends LightningElement {
6
- @api title!: string;
6
+ @api header!: string;
7
7
  @api variant!: CalloutVariant;
8
8
  cardVariant?: string;
9
9
  iconName?: string;
@@ -50,7 +50,7 @@
50
50
  </div>
51
51
  <div lwc:if={showToc} class="right-nav-bar is-sticky">
52
52
  <dx-toc
53
- title={tocTitle}
53
+ header={tocTitle}
54
54
  options={tocOptions}
55
55
  value={tocValue}
56
56
  ></dx-toc>
@@ -343,8 +343,10 @@ export default class ContentLayout extends LightningElement {
343
343
  );
344
344
 
345
345
  for (const headingElement of headingElements as any) {
346
- // Sometimes elements hash is not being set when slot content is wrapped with div
346
+ // Sometimes elements hash and header is not being set when slot content is wrapped with div
347
347
  headingElement.hash = headingElement.attributes.hash?.nodeValue;
348
+ headingElement.header =
349
+ headingElement.attributes.header?.nodeValue;
348
350
  }
349
351
 
350
352
  const tocOptions = [];
@@ -361,7 +363,7 @@ export default class ContentLayout extends LightningElement {
361
363
  const tocItem = {
362
364
  anchor: `#${headingElement.hash}`,
363
365
  id: headingElement.id,
364
- label: headingElement.title
366
+ label: headingElement.header
365
367
  };
366
368
  tocOptions.push(tocItem);
367
369
  this.tocOptionIdsSet.add(headingElement.id);
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <h1 class={className} if:true={isAriaLevelOne}>
3
- <doc-heading-content title={title} hash={hash}></doc-heading-content>
3
+ <doc-heading-content header={header} hash={hash}></doc-heading-content>
4
4
  </h1>
5
5
  <h2 class={className} if:true={isAriaLevelTwo}>
6
- <doc-heading-content title={title} hash={hash}></doc-heading-content>
6
+ <doc-heading-content header={header} hash={hash}></doc-heading-content>
7
7
  </h2>
8
8
  <h3 class={className} if:true={isAriaLevelThree}>
9
- <doc-heading-content title={title} hash={hash}></doc-heading-content>
9
+ <doc-heading-content header={header} hash={hash}></doc-heading-content>
10
10
  </h3>
11
11
  <h4 class={className} if:true={isAriaLevelFour}>
12
- <doc-heading-content title={title} hash={hash}></doc-heading-content>
12
+ <doc-heading-content header={header} hash={hash}></doc-heading-content>
13
13
  </h4>
14
14
  </template>
@@ -13,7 +13,7 @@ export const displayLevels = Object.values(ariaDisplayLevels);
13
13
 
14
14
  // @ts-ignore: Really Dark Magic (TM) to do with ariaLevel needing explicit getter/setters
15
15
  export default class Heading extends LightningElement {
16
- @api title: string = "";
16
+ @api header: string = "";
17
17
  @api hash: string | null = null;
18
18
 
19
19
  @api
@@ -6,7 +6,7 @@ export default class HeadingAnchor extends LightningElement {
6
6
  @api iconSize?: IconSize = "override";
7
7
  @api iconSprite?: IconSprite = "utility";
8
8
  @api iconSymbol?: IconSymbol;
9
- @api title: string = "";
9
+ @api header: string = "";
10
10
  @api urlText: string = "";
11
11
 
12
12
  label: string = "Copy link to clipboard";
@@ -22,7 +22,7 @@ export default class HeadingAnchor extends LightningElement {
22
22
  }, 2000);
23
23
 
24
24
  try {
25
- if (this.title && this.urlText) {
25
+ if (this.header && this.urlText) {
26
26
  const [hostUrl] = window.location.href.split("#");
27
27
  const url = `${hostUrl}#${this.urlText}`;
28
28
  await navigator.clipboard.writeText(url);
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <template if:false={hash}>{title}</template>
2
+ <template if:false={hash}>{header}</template>
3
3
  <template if:true={hash}>
4
- <span class="title">{title}&nbsp;</span>
4
+ <span class="title">{header}&nbsp;</span>
5
5
  <dx-tooltip placement="top" label={label}>
6
6
  <span class="button-container">
7
7
  <button onclick={copy} aria-label="copy">
@@ -1,7 +1,7 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
 
3
3
  export default class HeadingContent extends LightningElement {
4
- @api title: string = "";
4
+ @api header: string = "";
5
5
  @api hash: string | null = null;
6
6
 
7
7
  label: string = "Copy link to clipboard";
@@ -18,7 +18,7 @@ export default class HeadingContent extends LightningElement {
18
18
  }, 2000);
19
19
 
20
20
  try {
21
- if (this.title && this.hash) {
21
+ if (this.header && this.hash) {
22
22
  const [hostUrl] = window.location.href.split("#");
23
23
  const url = `${hostUrl}#${this.hash}`;
24
24
  await navigator.clipboard.writeText(url);
@@ -10,7 +10,7 @@
10
10
  <div class="content">
11
11
  <dx-group-text
12
12
  class="description"
13
- title={title}
13
+ header={header}
14
14
  body={description}
15
15
  size="large"
16
16
  title-aria-level="1"
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
  <div>
22
22
  <dx-group-text
23
- title={featuresListTitle}
23
+ header={featuresListTitle}
24
24
  size="medium"
25
25
  class="features"
26
26
  ></dx-group-text>
@@ -3,7 +3,7 @@ import { DocPhaseInfo, FeatureItem, Link } from "typings/custom";
3
3
 
4
4
  export default class Overview extends LightningElement {
5
5
  @api docPhaseInfo!: DocPhaseInfo;
6
- @api title!: string;
6
+ @api header!: string;
7
7
  @api description!: string;
8
8
  @api primaryLink!: Link;
9
9
  @api secondaryLink!: Link;
@@ -1,3 +0,0 @@
1
- onmessage = function (event) {
2
- postMessage(JSON.parse(JSON.stringify(event.data)));
3
- };