@nerimity/html-embed 1.1.6 → 1.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqHA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;IAEtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwHA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;IAEtC"}
package/dist/index.js CHANGED
@@ -9,6 +9,9 @@ const css_1 = __importDefault(require("css"));
9
9
  const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', 'strong', 'a', "style", "p", "ul", "li", "ol", "table", "thead", "tbody", "tr", "td", "th", "blockquote", "pre", "br"];
10
10
  const allowedAttributes = ["href", "src", "color", "style", "class"];
11
11
  const allowedCssProperties = [
12
+ "background-clip",
13
+ "-webkitBackgroundClip",
14
+ "-webkitTextFillColor",
12
15
  "display",
13
16
  "position",
14
17
  "inset",
@@ -136,14 +139,17 @@ function checkCSS(cssVal) {
136
139
  }
137
140
  }
138
141
  function cssNameToJsName(name) {
139
- var split = name.split("-");
142
+ var split = name.split("-").filter(n => n);
140
143
  var output = "";
141
144
  for (var i = 0; i < split.length; i++) {
142
145
  if (i > 0 && split[i].length > 0 && !(i == 1 && split[i] == "ms")) {
143
- split[i] = split[i].substr(0, 1).toUpperCase() + split[i].substr(1);
146
+ split[i] = split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
144
147
  }
145
148
  output += split[i];
146
149
  }
150
+ if (name.startsWith("-")) {
151
+ output = "-" + output;
152
+ }
147
153
  return output;
148
154
  }
149
155
  function jsNameToCssName(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerimity/html-embed",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -5,6 +5,9 @@ import css from 'css';
5
5
  const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', 'strong', 'a', "style", "p", "ul", "li", "ol", "table", "thead", "tbody", "tr", "td", "th", "blockquote", "pre", "br"]
6
6
  const allowedAttributes = ["href", "src", "color", "style", "class"]
7
7
  const allowedCssProperties = [
8
+ "background-clip",
9
+ "-webkitBackgroundClip",
10
+ "-webkitTextFillColor",
8
11
  "display",
9
12
  "position",
10
13
  "inset",
@@ -142,14 +145,17 @@ function checkCSS(cssVal: string) {
142
145
 
143
146
 
144
147
  function cssNameToJsName(name: string) {
145
- var split = name.split("-");
148
+ var split = name.split("-").filter(n => n);
146
149
  var output = "";
147
150
  for (var i = 0; i < split.length; i++) {
148
151
  if (i > 0 && split[i].length > 0 && !(i == 1 && split[i] == "ms")) {
149
- split[i] = split[i].substr(0, 1).toUpperCase() + split[i].substr(1);
152
+ split[i] = split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
150
153
  }
151
154
  output += split[i];
152
155
  }
156
+ if (name.startsWith("-")) {
157
+ output = "-" + output
158
+ }
153
159
  return output;
154
160
  }
155
161