@salesforcedevs/docs-components 0.6.0 → 0.7.59-sppage-alpha1

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.
Files changed (102) hide show
  1. package/lwc.config.json +17 -3
  2. package/package.json +16 -6
  3. package/src/modules/README.md +41 -0
  4. package/src/modules/doc/amfModelParser/amfModelParser.ts +674 -0
  5. package/src/modules/doc/amfReference/amfReference.css +25 -0
  6. package/src/modules/doc/amfReference/amfReference.html +60 -0
  7. package/src/modules/doc/amfReference/amfReference.ts +1494 -0
  8. package/src/modules/doc/amfReference/constants.ts +76 -0
  9. package/src/modules/doc/amfReference/types.ts +125 -0
  10. package/src/modules/doc/amfTopic/amfTopic.css +21 -0
  11. package/src/modules/doc/amfTopic/amfTopic.html +3 -0
  12. package/src/modules/doc/amfTopic/amfTopic.ts +111 -0
  13. package/src/modules/doc/amfTopic/types.ts +56 -0
  14. package/src/modules/doc/amfTopic/utils.ts +136 -0
  15. package/src/modules/doc/breadcrumbItem/breadcrumbItem.css +51 -0
  16. package/src/modules/doc/breadcrumbItem/breadcrumbItem.html +5 -0
  17. package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +71 -0
  18. package/src/modules/doc/breadcrumbs/breadcrumbs.css +27 -0
  19. package/src/modules/doc/breadcrumbs/breadcrumbs.html +58 -0
  20. package/src/modules/doc/breadcrumbs/breadcrumbs.ts +192 -0
  21. package/src/modules/doc/content/content.css +94 -70
  22. package/src/modules/doc/content/content.ts +233 -169
  23. package/src/modules/doc/contentCallout/contentCallout.css +17 -23
  24. package/src/modules/doc/contentCallout/contentCallout.html +13 -4
  25. package/src/modules/doc/contentCallout/contentCallout.ts +16 -3
  26. package/src/modules/doc/contentLayout/contentLayout.css +131 -0
  27. package/src/modules/doc/contentLayout/contentLayout.html +64 -0
  28. package/src/modules/doc/contentLayout/contentLayout.ts +610 -0
  29. package/src/modules/doc/doDont/doDont.css +47 -0
  30. package/src/modules/doc/doDont/doDont.html +27 -0
  31. package/src/modules/doc/doDont/doDont.ts +17 -0
  32. package/src/modules/doc/header/header.css +70 -37
  33. package/src/modules/doc/header/header.html +40 -134
  34. package/src/modules/doc/header/header.ts +29 -78
  35. package/src/modules/doc/heading/heading.css +33 -0
  36. package/src/modules/doc/heading/heading.html +14 -0
  37. package/src/modules/doc/heading/heading.ts +67 -0
  38. package/src/modules/doc/headingAnchor/headingAnchor.css +33 -0
  39. package/src/modules/doc/headingAnchor/headingAnchor.html +19 -0
  40. package/src/modules/doc/headingAnchor/headingAnchor.ts +43 -0
  41. package/src/modules/doc/headingContent/headingContent.css +53 -0
  42. package/src/modules/doc/headingContent/headingContent.html +13 -0
  43. package/src/modules/doc/headingContent/headingContent.ts +30 -0
  44. package/src/modules/doc/overview/overview.css +40 -0
  45. package/src/modules/doc/overview/overview.html +34 -0
  46. package/src/modules/doc/overview/overview.ts +12 -0
  47. package/src/modules/doc/phase/phase.css +70 -0
  48. package/src/modules/doc/phase/phase.html +38 -0
  49. package/src/modules/doc/phase/phase.ts +93 -0
  50. package/src/modules/doc/specificationContent/specificationContent.css +3 -0
  51. package/src/modules/doc/specificationContent/specificationContent.html +99 -0
  52. package/src/modules/doc/specificationContent/specificationContent.ts +56 -0
  53. package/src/modules/doc/sprigSurvey/sprigSurvey.html +20 -0
  54. package/src/modules/doc/sprigSurvey/sprigSurvey.scoped.css +16 -0
  55. package/src/modules/doc/sprigSurvey/sprigSurvey.ts +16 -0
  56. package/src/modules/doc/toc/toc.ts +1 -1
  57. package/src/modules/doc/versionPicker/versionPicker.css +64 -0
  58. package/src/modules/doc/versionPicker/versionPicker.html +38 -0
  59. package/src/modules/doc/versionPicker/versionPicker.ts +65 -0
  60. package/src/modules/doc/xmlContent/types.ts +120 -0
  61. package/src/modules/doc/xmlContent/utils.ts +163 -0
  62. package/src/modules/doc/xmlContent/xmlContent.css +54 -0
  63. package/src/modules/doc/xmlContent/xmlContent.html +52 -0
  64. package/src/modules/doc/xmlContent/xmlContent.ts +780 -0
  65. package/src/modules/docHelpers/amfStyle/amfStyle.css +355 -0
  66. package/src/modules/docHelpers/imgStyle/imgStyle.css +59 -0
  67. package/src/modules/docHelpers/status/status.css +22 -0
  68. package/src/modules/docUtils/searchSyncer/searchSyncer.ts +86 -0
  69. package/src/modules/docUtils/utils/utils.ts +32 -0
  70. package/LICENSE +0 -12
  71. package/src/modules/doc/content/__tests__/content.test.ts +0 -120
  72. package/src/modules/doc/content/__tests__/mockDocContent.ts +0 -292
  73. package/src/modules/doc/content/__tests__/mockPageReference.ts +0 -8
  74. package/src/modules/doc/content/content.stories.ts +0 -108
  75. package/src/modules/doc/contentCallout/__tests__/contentCallout.test.ts +0 -80
  76. package/src/modules/doc/contentCallout/__tests__/mockProps.ts +0 -14
  77. package/src/modules/doc/contentCallout/contentCallout.stories.ts +0 -29
  78. package/src/modules/doc/contentMedia/__tests__/contentMedia.test.ts +0 -97
  79. package/src/modules/doc/contentMedia/contentMedia.stories.ts +0 -113
  80. package/src/modules/doc/header/__tests__/coveoConfig.ts +0 -12
  81. package/src/modules/doc/header/__tests__/header.test.ts +0 -409
  82. package/src/modules/doc/header/__tests__/mockNavDevelopers.ts +0 -427
  83. package/src/modules/doc/header/__tests__/mockNavs.ts +0 -115
  84. package/src/modules/doc/header/__tests__/mockProps.ts +0 -149
  85. package/src/modules/doc/header/header.stories.ts +0 -160
  86. package/src/modules/doc/nav/__tests__/mockAvailableLanguages.ts +0 -8
  87. package/src/modules/doc/nav/__tests__/mockAvailableVersions.ts +0 -122
  88. package/src/modules/doc/nav/__tests__/mockPageReference.ts +0 -8
  89. package/src/modules/doc/nav/__tests__/mockPdfUrl.ts +0 -1
  90. package/src/modules/doc/nav/__tests__/mockSelectedLanguage.ts +0 -8
  91. package/src/modules/doc/nav/__tests__/mockSelectedVersion.ts +0 -8
  92. package/src/modules/doc/nav/__tests__/mockToc.ts +0 -146
  93. package/src/modules/doc/nav/__tests__/nav.test.ts +0 -58
  94. package/src/modules/doc/toc/__tests__/mockPageReference.ts +0 -8
  95. package/src/modules/doc/toc/__tests__/mockToc.ts +0 -146
  96. package/src/modules/doc/toc/__tests__/toc.test.ts +0 -29
  97. package/src/modules/doc/toolbar/__tests__/mockAvailableLanguages.ts +0 -8
  98. package/src/modules/doc/toolbar/__tests__/mockAvailableVersions.ts +0 -122
  99. package/src/modules/doc/toolbar/__tests__/mockPdfUrl.ts +0 -1
  100. package/src/modules/doc/toolbar/__tests__/mockSelectedLanguage.ts +0 -8
  101. package/src/modules/doc/toolbar/__tests__/mockSelectedVersion.ts +0 -8
  102. package/src/modules/doc/toolbar/__tests__/toolbar.test.ts +0 -44
@@ -1,14 +1,29 @@
1
1
  /* eslint-disable @lwc/lwc/no-inner-html */
2
2
  import { createElement, LightningElement, api, track } from "lwc";
3
- import { DocContent, PageReference } from "../../../../../../../typings/custom";
4
- import ContentCallout from "doc/contentCallout";
3
+ import { DocContent, PageReference } from "typings/custom";
5
4
  import CodeBlock from "dx/codeBlock";
6
- import ContentMedia from "doc/contentMedia";
7
5
  import Button from "dx/button";
6
+ import { highlightTerms } from "dxUtils/highlight";
7
+ import ContentCallout from "doc/contentCallout";
8
+ import ContentMedia from "doc/contentMedia";
9
+
10
+ const HIGHLIGHTABLE_SELECTOR = [
11
+ "p",
12
+ ".p",
13
+ ".shortdesc",
14
+ "h1",
15
+ "h2",
16
+ "h3",
17
+ "h4",
18
+ "h5",
19
+ "h6",
20
+ "li",
21
+ "dl",
22
+ "th",
23
+ "td"
24
+ ].join(",");
8
25
 
9
26
  const LANGUAGE_MAP: { [key: string]: string } = {
10
- xml: "plain",
11
- html: "plain",
12
27
  js: "javascript"
13
28
  };
14
29
 
@@ -17,31 +32,48 @@ export default class Content extends LightningElement {
17
32
  @api pageReference!: PageReference;
18
33
  @api codeBlockType: string = "card";
19
34
  @api showPaginationButtons: boolean = false;
35
+
20
36
  @api
21
37
  set docsData(value) {
22
38
  this._docRendered = false;
23
- this.docContent = value;
39
+ this.docContent = (value && value.trim()) || "";
24
40
  }
41
+
25
42
  get docsData() {
26
43
  return this.docContent;
27
44
  }
28
- _codeBlockTheme: string = "dark";
45
+
29
46
  @api
30
47
  set codeBlockTheme(value) {
31
48
  this._codeBlockTheme = value;
32
49
  }
50
+
33
51
  get codeBlockTheme() {
34
52
  return this._codeBlockTheme;
35
53
  }
36
54
 
37
55
  @track docContent: DocContent = "";
56
+ _codeBlockTheme: string = "dark";
38
57
  _docRendered: boolean = false;
39
58
  originalCodeBlockThemeValue: String = "";
59
+
40
60
  connectedCallback() {
41
61
  this.template.addEventListener(
42
62
  "themechange",
43
63
  this.updateTheme.bind(this) // eslint-disableline no-use-before-define
44
64
  );
65
+
66
+ window.addEventListener(
67
+ "highlightedtermchange",
68
+ this.updateHighlighted
69
+ );
70
+ }
71
+
72
+ disconnectedCallback(): void {
73
+ window.removeEventListener(
74
+ "highlightedtermchange",
75
+ this.updateHighlighted
76
+ );
45
77
  }
46
78
 
47
79
  updateTheme() {
@@ -54,7 +86,7 @@ export default class Content extends LightningElement {
54
86
  }
55
87
 
56
88
  renderPaginationButton(anchorEl: HTMLElement) {
57
- const isNext = anchorEl.textContent.includes("Next →");
89
+ const isNext = anchorEl.textContent!.includes("Next →");
58
90
  anchorEl.innerHTML = "";
59
91
  const buttonEl = createElement("dx-button", { is: Button });
60
92
  const params = isNext
@@ -74,178 +106,197 @@ export default class Content extends LightningElement {
74
106
  // We don't use any tracked field here. The challenge is that
75
107
  // for security reasons you can't pass pure HTML via a class
76
108
  // field to the template. Hence we manipulate the DOM manually.
77
- insertDocHtml() {
78
- const divEl = this.template.querySelector("div");
109
+ insertDocHtml(docContent?: string) {
110
+ const divEl = this.getCleanContainer();
79
111
 
80
- // Some simple data mutation to make Prism work on-the-fly with the existing datasource
81
- const templateEl = document.createElement("template");
82
- this.docContent = this.docContent.trim();
83
- // eslint-disable-next-line no-use-before-define
84
- templateEl.innerHTML = this.docContent;
112
+ if (divEl) {
113
+ divEl.innerHTML = docContent || this.docContent;
85
114
 
86
- // Query the code blocks and create a dx-code-block component that contains the code
87
- const codeBlockEls = templateEl.content.querySelectorAll(
88
- ".codeSection"
89
- );
90
- codeBlockEls.forEach((codeBlockEl) => {
91
- codeBlockEl.setAttribute("lwc:dom", "manual");
92
- const classList = codeBlockEl.firstChild.classList;
93
- let language = "";
94
- for (const key in classList) {
95
- if (typeof classList[key] === "string") {
96
- const className = classList[key];
97
- if (className.startsWith("brush:")) {
98
- language = className.split(":")[1];
115
+ // Query the code blocks and create a dx-code-block component that contains the code
116
+ const codeBlockEls = divEl.querySelectorAll(".codeSection");
117
+ codeBlockEls.forEach((codeBlockEl) => {
118
+ codeBlockEl.setAttribute("lwc:dom", "manual");
119
+ const classList = (codeBlockEl.firstChild as any).classList;
120
+ let language = "";
121
+ for (const key in classList) {
122
+ if (typeof classList[key] === "string") {
123
+ const className = classList[key];
124
+ if (className.startsWith("brush:")) {
125
+ language = className.split(":")[1];
126
+ }
99
127
  }
100
128
  }
101
- }
102
- const blockCmp = createElement("dx-code-block", { is: CodeBlock });
103
- Object.assign(blockCmp, {
104
- codeBlock: codeBlockEl.innerHTML,
105
- // ! Hot fix for incoming html tags from couchdb for xml blocks, fix me soon please
106
- language: LANGUAGE_MAP[language] || language,
107
- theme: this.codeBlockTheme,
108
- title: "", // Default no title.
109
- variant: this.codeBlockType
129
+ const blockCmp = createElement("dx-code-block", {
130
+ is: CodeBlock
131
+ });
132
+ Object.assign(blockCmp, {
133
+ codeBlock: codeBlockEl.innerHTML,
134
+ // ! Hot fix for incoming html tags from couchdb for xml blocks, fix me soon please
135
+ language: LANGUAGE_MAP[language] || language,
136
+ theme: this.codeBlockTheme,
137
+ header: "", // Default no title.
138
+ variant: this.codeBlockType,
139
+ isEncoded: true
140
+ });
141
+ // eslint-disable-next-line no-use-before-define
142
+ codeBlockEl.innerHTML = "";
143
+ codeBlockEl.appendChild(blockCmp);
110
144
  });
111
- // eslint-disable-next-line no-use-before-define
112
- codeBlockEl.innerHTML = "";
113
- codeBlockEl.appendChild(blockCmp);
114
- });
115
145
 
116
- // Query the callouts and create a doc-content-callout component that contains the code
117
- const calloutEls = templateEl.content.querySelectorAll(".message");
118
- calloutEls.forEach((calloutEl) => {
119
- const calloutCompEl = createElement("doc-content-callout", {
120
- is: ContentCallout
121
- });
122
- const detailEls = calloutEl.querySelectorAll(
123
- "p, div.data, ol, ul, .codeSection, .mediaBd > span.ph"
124
- );
125
- detailEls.forEach((detailEl) => {
126
- calloutCompEl.appendChild(detailEl);
127
- });
128
- const type = calloutEl.querySelector("h4").textContent;
129
- const typeLower = type.toLowerCase();
130
- Object.assign(calloutCompEl, {
131
- title: type,
132
- variant: typeLower
133
- });
134
- // eslint-disable-next-line no-use-before-define
135
- calloutEl.innerHTML = "";
136
- calloutEl.appendChild(calloutCompEl);
137
- });
146
+ // Query the callouts and create a doc-content-callout component that contains the code
147
+ const calloutEls = divEl.querySelectorAll(".message");
148
+ calloutEls.forEach((calloutEl) => {
149
+ const calloutCompEl = createElement("doc-content-callout", {
150
+ is: ContentCallout
151
+ });
152
+ const detailEls = calloutEl.querySelectorAll(
153
+ "p, .p, div.data, ol, ul, p+.codeSection, p~.codeSection, div >.codeSection, .mediaBd > span.ph"
154
+ );
155
+ detailEls.forEach((detailEl) => {
156
+ if (detailEl.innerHTML.trim() !== "") {
157
+ calloutCompEl.appendChild(detailEl);
158
+ }
159
+ });
138
160
 
139
- // Modify links to work with any domain, links that start with "#" are excluded
140
- const anchorEls = templateEl.content.querySelectorAll(
141
- "a:not([href^='#'])"
142
- );
143
- anchorEls.forEach((anchorEl) => {
144
- if (
145
- anchorEl.textContent.includes("Next →") ||
146
- anchorEl.textContent.includes("← Previous")
147
- ) {
148
- if (this.showPaginationButtons) {
149
- this.renderPaginationButton(anchorEl);
150
- } else {
151
- anchorEl.remove();
161
+ let flag = 1;
162
+ for (let i: number = 0; i < detailEls.length; i++) {
163
+ flag &= (detailEls[i].innerHTML.trim() === "") as any; // Dark Magic TM
152
164
  }
153
- }
154
-
155
- const href = anchorEl.href.split("/");
156
- if (
157
- (href[3] === this.pageReference.docId && this.isStorybook) ||
158
- href[4] === this.pageReference.docId ||
159
- href[6] === this.pageReference.docId
160
- ) {
161
- let updatedURL;
162
- switch (href.length) {
163
- case 8:
164
- updatedURL = href.splice(5).join("/");
165
- break;
166
- case 7:
167
- updatedURL = href.splice(4).join("/");
168
- break;
169
- case 6:
170
- updatedURL = href.splice(3).join("/");
171
- break;
172
- default:
173
- updatedURL = href.splice(6).join("/");
174
- break;
165
+
166
+ if (flag) {
167
+ const codeEls = calloutEl.querySelectorAll(".codeSection");
168
+ codeEls.forEach((codeEl) => {
169
+ calloutCompEl.appendChild(codeEl);
170
+ });
175
171
  }
176
- anchorEl.addEventListener(
177
- "click",
178
- // eslint-disable-next-line no-use-before-define
179
- this.handleNavClick.bind(this)
180
- );
181
- // anchor href event is not propagated here as we want SPA nature.
182
- // But in prerender.io - as javascript is not executed, we want the anchor links are proper (absolute urls).
183
- anchorEl.setAttribute("href", "/docs/" + updatedURL);
184
- anchorEl.setAttribute("data-id", "docs/" + updatedURL);
185
- return;
186
- }
187
-
188
- anchorEl.setAttribute("data-id", anchorEl.href);
189
- });
190
172
 
191
- // Modify image src to work with any domain and replace images/iframes with doc-content-media
192
- const imgEls = templateEl.content.querySelectorAll("img, iframe");
193
-
194
- imgEls.forEach((mediaEl) => {
195
- const isImage = mediaEl.nodeName === "IMG";
196
- let src = mediaEl.getAttribute("src");
197
- if (!src) {
198
- return;
199
- }
200
- const alt = mediaEl.getAttribute("alt");
201
- const title = mediaEl.getAttribute("title");
202
- const label = mediaEl.getAttribute("label");
203
- const width = mediaEl.getAttribute("width");
204
- const height = mediaEl.getAttribute("height");
205
-
206
- if (isImage) {
207
- src = src.startsWith("/")
208
- ? `https://developer.salesforce.com${src}`
209
- : src.replace(
210
- window.location.origin,
211
- "https://developer.salesforce.com"
212
- );
213
-
214
- const img: HTMLImageElement = document.createElement("img");
215
- img.src = src;
216
- if (alt) {
217
- img.alt = alt;
173
+ const type = calloutEl.querySelector("h4")!.textContent!;
174
+ const typeLower = type.toLowerCase();
175
+ Object.assign(calloutCompEl, {
176
+ header: type,
177
+ variant: typeLower
178
+ });
179
+ // eslint-disable-next-line no-use-before-define
180
+ calloutEl.innerHTML = "";
181
+ calloutEl.appendChild(calloutCompEl);
182
+ });
183
+
184
+ // Modify links to work with any domain, links that start with "#" are excluded
185
+ const anchorEls = divEl.querySelectorAll("a:not([href^='#'])");
186
+
187
+ anchorEls.forEach((anchorEl: any) => {
188
+ if (
189
+ anchorEl.textContent!.includes("Next →") ||
190
+ anchorEl.textContent!.includes("← Previous")
191
+ ) {
192
+ if (this.showPaginationButtons) {
193
+ this.renderPaginationButton(anchorEl);
194
+ } else {
195
+ anchorEl.remove();
196
+ }
218
197
  }
219
- if (title) {
220
- img.title = title;
198
+
199
+ // ! This is a hack
200
+ // Normalize urls in case it doesn't come complete.
201
+ if (anchorEl.href.startsWith("atlas.")) {
202
+ anchorEl.href = "/docs/" + anchorEl.href;
221
203
  }
222
- if (height) {
223
- img.height = parseFloat(height);
204
+
205
+ const href = anchorEl.href.split("/");
206
+ if (
207
+ (href[3] === this.pageReference.docId &&
208
+ this.isStorybook) ||
209
+ href[4] === this.pageReference.docId ||
210
+ href[6] === this.pageReference.docId
211
+ ) {
212
+ let updatedURL;
213
+ switch (href.length) {
214
+ case 8:
215
+ updatedURL = href.splice(5).join("/");
216
+ break;
217
+ case 7:
218
+ updatedURL = href.splice(4).join("/");
219
+ break;
220
+ case 6:
221
+ updatedURL = href.splice(3).join("/");
222
+ break;
223
+ default:
224
+ updatedURL = href.splice(6).join("/");
225
+ break;
226
+ }
227
+ anchorEl.addEventListener(
228
+ "click",
229
+ // eslint-disable-next-line no-use-before-define
230
+ this.handleNavClick.bind(this)
231
+ );
232
+ // anchor href event is not propagated here as we want SPA nature.
233
+ // But in prerender.io - as javascript is not executed, we want the anchor links are proper (absolute urls).
234
+ anchorEl.setAttribute("href", "/docs/" + updatedURL);
235
+ anchorEl.setAttribute("data-id", "docs/" + updatedURL);
236
+ return;
224
237
  }
225
- if (width) {
226
- img.width = parseFloat(width);
238
+
239
+ anchorEl.setAttribute("data-id", anchorEl.href);
240
+ });
241
+
242
+ // Modify image src to work with any domain and replace images/iframes with doc-content-media
243
+ const imgEls = divEl.querySelectorAll("img, iframe");
244
+
245
+ imgEls.forEach((mediaEl) => {
246
+ const isImage = mediaEl.nodeName === "IMG";
247
+ let src = mediaEl.getAttribute("src");
248
+ if (!src) {
249
+ return;
227
250
  }
251
+ const alt = mediaEl.getAttribute("alt");
252
+ const title = mediaEl.getAttribute("title");
253
+ const label = mediaEl.getAttribute("label");
254
+ const width = mediaEl.getAttribute("width");
255
+ const height = mediaEl.getAttribute("height");
256
+ const className = mediaEl.getAttribute("class");
228
257
 
229
- img.className = "content-image";
230
- mediaEl.parentNode!.insertBefore(img, mediaEl);
231
- } else {
232
- const contentMediaEl = createElement("doc-content-media", {
233
- is: ContentMedia
234
- });
235
- Object.assign(contentMediaEl, {
236
- contentType: "iframe",
237
- contentSrc: src,
238
- mediaTitle: alt || title || label
239
- });
240
- mediaEl.parentNode!.insertBefore(contentMediaEl, mediaEl);
241
- }
242
- mediaEl.remove();
243
- });
258
+ if (isImage) {
259
+ src = src.startsWith("/")
260
+ ? `https://developer.salesforce.com${src}`
261
+ : src.replace(
262
+ window.location.origin,
263
+ "https://developer.salesforce.com"
264
+ );
244
265
 
245
- if (divEl) {
246
- // eslint-disable-next-line no-use-before-define
247
- divEl.innerHTML = "";
248
- divEl.append(templateEl.content);
266
+ const img: HTMLImageElement = document.createElement("img");
267
+ img.src = src;
268
+ img.alt = "";
269
+ if (alt) {
270
+ img.alt = alt;
271
+ }
272
+ if (title) {
273
+ img.title = title;
274
+ }
275
+ if (height) {
276
+ img.height = parseFloat(height);
277
+ }
278
+ if (width) {
279
+ img.width = parseFloat(width);
280
+ }
281
+ if (className) {
282
+ img.className = className;
283
+ }
284
+
285
+ img.className = `content-image ${img.className}`;
286
+ mediaEl.parentNode!.insertBefore(img, mediaEl);
287
+ } else {
288
+ const contentMediaEl = createElement("doc-content-media", {
289
+ is: ContentMedia
290
+ });
291
+ Object.assign(contentMediaEl, {
292
+ contentType: "iframe",
293
+ contentSrc: src,
294
+ mediaTitle: alt || title || label
295
+ });
296
+ mediaEl.parentNode!.insertBefore(contentMediaEl, mediaEl);
297
+ }
298
+ mediaEl.remove();
299
+ });
249
300
  }
250
301
 
251
302
  // Once the html has been corectly modified, naviage to the page reference on the page
@@ -254,6 +305,15 @@ export default class Content extends LightningElement {
254
305
  }
255
306
  }
256
307
 
308
+ private getCleanContainer(): HTMLElement | null {
309
+ const divEl = this.template.querySelector("div");
310
+ if (divEl?.hasChildNodes()) {
311
+ divEl.removeChild(divEl.firstChild!);
312
+ }
313
+
314
+ return divEl;
315
+ }
316
+
257
317
  isSamePage(reference: PageReference): boolean {
258
318
  return (
259
319
  this.pageReference.contentDocumentId ===
@@ -266,11 +326,9 @@ export default class Content extends LightningElement {
266
326
 
267
327
  handleNavClick(event: InputEvent) {
268
328
  event.preventDefault();
269
- // eslint-disable-next-line no-use-before-define
270
- const target = event.currentTarget.dataset.id;
271
- const [page, docId, deliverable, tempContentDocumentId] = target.split(
272
- "/"
273
- );
329
+ const target = (event.currentTarget! as any).dataset.id;
330
+ const [page, docId, deliverable, tempContentDocumentId] =
331
+ target.split("/");
274
332
  const [contentDocumentId, hash] = tempContentDocumentId.split("#");
275
333
  const newPageReference = {
276
334
  page: page,
@@ -294,6 +352,12 @@ export default class Content extends LightningElement {
294
352
  }
295
353
  }
296
354
 
355
+ updateHighlighted = (event: any) =>
356
+ highlightTerms(
357
+ this.template.querySelectorAll(HIGHLIGHTABLE_SELECTOR),
358
+ event.detail
359
+ );
360
+
297
361
  @api
298
362
  public navigateToHash(hash: String) {
299
363
  const splitHash = hash.split("#");
@@ -1,20 +1,22 @@
1
- @import "helpers/reset";
2
- @import "helpers/text";
1
+ @import "dxHelpers/reset";
2
+ @import "dxHelpers/text";
3
+ @import "docHelpers/status";
3
4
 
4
5
  .dx-callout {
5
6
  border-radius: 4px;
6
- border-left: 4px solid;
7
7
  }
8
8
 
9
- .dx-callout-icon {
10
- padding-right: var(--dx-g-spacing-md);
11
- }
12
-
13
- .dx-callout-base {
9
+ .dx-callout-base,
10
+ .dx-callout-plain {
14
11
  background-color: var(--dx-g-gray-95);
15
12
  border-color: var(--dx-g-gray-50);
16
13
  }
17
14
 
15
+ .dx-callout-plain {
16
+ border: none;
17
+ margin-bottom: var(--dx-g-text-2xl);
18
+ }
19
+
18
20
  .dx-callout-note {
19
21
  background-color: var(--dx-g-blue-vibrant-95);
20
22
  border-color: var(--dx-g-blue-vibrant-50);
@@ -25,19 +27,18 @@
25
27
  border-color: var(--dx-g-green-vibrant-60);
26
28
  }
27
29
 
28
- .dx-callout-warning {
29
- background-color: rgb(254, 243, 217);
30
- border-color: var(--dx-g-yellow-vibrant-80);
30
+ .dx-callout-caution {
31
+ background-color: var(--dx-g-red-natural-95);
32
+ border-color: var(--dx-g-red-vibrant-50);
31
33
  }
32
34
 
33
- .dx-callout-caution {
35
+ .dx-callout-warning {
34
36
  background-color: var(--dx-g-red-natural-95);
35
37
  border-color: var(--dx-g-red-vibrant-50);
36
38
  }
37
39
 
38
40
  .dx-callout-base_section {
39
41
  width: 100%;
40
- padding: var(--dx-g-spacing-md);
41
42
  }
42
43
 
43
44
  .dx-callout-base_section-large {
@@ -52,14 +53,7 @@
52
53
  flex-direction: row;
53
54
  }
54
55
 
55
- .dx-callout-base_column > *:not(:last-child):not(dx-type-badge-group) {
56
- margin-bottom: var(--dx-g-spacing-sm);
57
- }
58
-
59
- .dx-callout-base_column > dx-type-badge-group {
60
- margin-bottom: var(--dx-g-spacing-sm);
61
- }
62
-
63
- .dx-callout-title {
64
- font-weight: bold;
56
+ .dx-callout-content {
57
+ flex: 1;
58
+ overflow: auto;
65
59
  }
@@ -1,10 +1,19 @@
1
1
  <template>
2
2
  <div class={className}>
3
- <div class="dx-callout-icon">
4
- <dx-icon symbol={iconName} size="large" color={iconColor}></dx-icon>
5
- </div>
3
+ <template if:false={hideIcon}>
4
+ <div class="doc-status-icon dx-callout-icon">
5
+ <dx-icon
6
+ symbol={iconName}
7
+ size="large"
8
+ color={iconColor}
9
+ ></dx-icon>
10
+ </div>
11
+ </template>
12
+
6
13
  <div class="dx-callout-content">
7
- <p class="dx-callout-title dx-text-body-3">{title}</p>
14
+ <p class="doc-status-title dx-callout-title dx-text-body-3">
15
+ {header}
16
+ </p>
8
17
  <span class="dx-callout-body dx-text-body-3">
9
18
  <slot onslotchange={onSlotChange}></slot>
10
19
  </span>
@@ -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;
@@ -11,14 +11,17 @@ export default class ContentCallout extends LightningElement {
11
11
 
12
12
  connectedCallback() {
13
13
  switch (this.variant) {
14
+ case "plain":
15
+ this.cardVariant = "dx-callout-plain";
16
+ break;
14
17
  case "tip":
15
18
  this.cardVariant = "dx-callout-tip";
16
19
  this.iconColor = "green-vibrant-60";
17
20
  this.iconName = "success";
18
21
  break;
19
22
  case "warning":
20
- this.cardVariant = "dx-callout-warning";
21
- this.iconColor = "gray-10";
23
+ this.cardVariant = "doc-status-container dx-callout-warning";
24
+ this.iconColor = "red-vibrant-50";
22
25
  this.iconName = "warning";
23
26
  break;
24
27
  case "caution":
@@ -26,6 +29,11 @@ export default class ContentCallout extends LightningElement {
26
29
  this.iconColor = "red-vibrant-50";
27
30
  this.iconName = "alert";
28
31
  break;
32
+ case "important":
33
+ this.cardVariant = "doc-status-container dx-callout-important";
34
+ this.iconColor = "gray-10";
35
+ this.iconName = "announcement";
36
+ break;
29
37
  case "note":
30
38
  default:
31
39
  this.cardVariant = "dx-callout-note";
@@ -37,12 +45,17 @@ export default class ContentCallout extends LightningElement {
37
45
  get className() {
38
46
  return cx(
39
47
  "dx-callout",
48
+ "doc-status-base",
40
49
  "dx-callout-base_section",
41
50
  "dx-callout-base_column",
42
51
  this.cardVariant
43
52
  );
44
53
  }
45
54
 
55
+ get hideIcon() {
56
+ return this.variant === "plain";
57
+ }
58
+
46
59
  private isSlotEmpty: boolean = true;
47
60
  private onSlotChange(e: LightningSlotElement) {
48
61
  // @ts-ignore