@salesforcedevs/dx-components 1.3.314 → 1.3.317

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/dx-components",
3
- "version": "1.3.314",
3
+ "version": "1.3.317",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -46,5 +46,5 @@
46
46
  "volta": {
47
47
  "node": "16.19.1"
48
48
  },
49
- "gitHead": "c0a16e87a2a142a2806b79f82d59f7315a476694"
49
+ "gitHead": "9e40898b8728d5ec2c08afdd49ccbcb4b065cc5d"
50
50
  }
@@ -7,7 +7,7 @@ import {
7
7
  } from "@salesforcedevs/sfdocs-wires";
8
8
  import { track as gtmTrack } from "dxUtils/analytics";
9
9
  import prism from "dxUtils/prismjs";
10
- import { ampscript } from "./customLanguages";
10
+ import { ampscript, sqlDocsTemplate } from "./customLanguages";
11
11
 
12
12
  /*
13
13
  Here we create custom syntax highlighting rules for proprietary languages
@@ -29,6 +29,13 @@ prism.languages.gtl = prism.languages.extend(
29
29
  // LWC
30
30
  prism.languages.lwc = prism.languages.extend("jsx");
31
31
 
32
+ /*
33
+ Prismjs's SQL native language rules doesn't highlight keyword like "RECURSIVE" and "WINDOW".
34
+ Instead of modifying the native SQL language rules, we create a new language called "sql_docs_template"
35
+ that treats all uppercase words as keywords.
36
+ */
37
+ prism.languages.sql_docs_template = sqlDocsTemplate;
38
+
32
39
  // Used for remove enclosing <pre> tag's (if occurs)
33
40
  const preTagRegexp: RegExp = /^<pre.*?>(.*)<\/pre>$/is;
34
41
 
@@ -84,7 +91,8 @@ export default class CodeBlock extends LightningElement {
84
91
  { label: "AMPScript", id: "ampscript" },
85
92
  { label: "SSJS", id: "ssjs" },
86
93
  { label: "GTL", id: "gtl" },
87
- { label: "LWC", id: "lwc" }
94
+ { label: "LWC", id: "lwc" },
95
+ { label: "SQL Documentation", id: "sql_docs_template" }
88
96
  ];
89
97
 
90
98
  connectedCallback() {
@@ -23,13 +23,26 @@ export const ampscript = {
23
23
  },
24
24
  boolean: /\b(true|false|null)\b/i,
25
25
  number: /\b(0(x|X)[0-9a-fA-F]+|([0-9]+(\.[0-9]+)?))\b/,
26
- keyword: /\b(do|else|elseif|for|if(?:\s+not)?|endif|next|then|to|downto|var|set)\b/i,
26
+ keyword:
27
+ /\b(do|else|elseif|for|if(?:\s+not)?|endif|next|then|to|downto|var|set)\b/i,
27
28
  operator: /==|!=|>|<|>=|<=|=/,
28
29
  variable: {
29
30
  pattern: /@\w+|\[\w+\]/,
30
31
  greedy: true
31
32
  },
32
- constant: /\b(xtmonth|xtmonthnumeric|xtday|xtdayofweek|xtyear|xtshortdate|xtlongdate)\b/i,
33
+ constant:
34
+ /\b(xtmonth|xtmonthnumeric|xtday|xtdayofweek|xtyear|xtshortdate|xtlongdate)\b/i,
33
35
  logical: /\b(and|or|not)\b/i
34
36
  }
35
37
  };
38
+
39
+ export const sqlDocsTemplate = {
40
+ comment: /--.*/,
41
+ variable: [
42
+ /<[^>\s]+>/,
43
+ { pattern: /(\s|\[|\[, ])\.\.\.(?=\]|\))/, lookbehind: true }
44
+ ],
45
+ keyword: /\b[A-Z_]+\b/,
46
+ string: /'[^']*'/,
47
+ punctuation: /[;[\]{}]/
48
+ };