@nerimity/html-embed 1.1.7 → 1.1.9

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":"AAwHA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;IAEtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyHA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;IAEtC"}
package/dist/index.js CHANGED
@@ -10,11 +10,12 @@ const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', '
10
10
  const allowedAttributes = ["href", "src", "color", "style", "class"];
11
11
  const allowedCssProperties = [
12
12
  "background-clip",
13
- "-webkit-background-clip",
14
- "-webkit-text-fill-color",
13
+ "-webkitBackgroundClip",
14
+ "-webkitTextFillColor",
15
15
  "display",
16
16
  "position",
17
17
  "inset",
18
+ "background",
18
19
  "backgroundColor",
19
20
  "backgroundImage",
20
21
  "backgroundRepeat",
@@ -139,14 +140,17 @@ function checkCSS(cssVal) {
139
140
  }
140
141
  }
141
142
  function cssNameToJsName(name) {
142
- var split = name.split("-");
143
+ var split = name.split("-").filter(n => n);
143
144
  var output = "";
144
145
  for (var i = 0; i < split.length; i++) {
145
146
  if (i > 0 && split[i].length > 0 && !(i == 1 && split[i] == "ms")) {
146
- split[i] = split[i].substr(0, 1).toUpperCase() + split[i].substr(1);
147
+ split[i] = split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
147
148
  }
148
149
  output += split[i];
149
150
  }
151
+ if (name.startsWith("-")) {
152
+ output = "-" + output;
153
+ }
150
154
  return output;
151
155
  }
152
156
  function jsNameToCssName(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerimity/html-embed",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -6,11 +6,12 @@ const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'img', 'span', '
6
6
  const allowedAttributes = ["href", "src", "color", "style", "class"]
7
7
  const allowedCssProperties = [
8
8
  "background-clip",
9
- "-webkit-background-clip",
10
- "-webkit-text-fill-color",
9
+ "-webkitBackgroundClip",
10
+ "-webkitTextFillColor",
11
11
  "display",
12
12
  "position",
13
13
  "inset",
14
+ "background",
14
15
  "backgroundColor",
15
16
  "backgroundImage",
16
17
  "backgroundRepeat",
@@ -145,14 +146,17 @@ function checkCSS(cssVal: string) {
145
146
 
146
147
 
147
148
  function cssNameToJsName(name: string) {
148
- var split = name.split("-");
149
+ var split = name.split("-").filter(n => n);
149
150
  var output = "";
150
151
  for (var i = 0; i < split.length; i++) {
151
152
  if (i > 0 && split[i].length > 0 && !(i == 1 && split[i] == "ms")) {
152
- split[i] = split[i].substr(0, 1).toUpperCase() + split[i].substr(1);
153
+ split[i] = split[i].substring(0, 1).toUpperCase() + split[i].substring(1);
153
154
  }
154
155
  output += split[i];
155
156
  }
157
+ if (name.startsWith("-")) {
158
+ output = "-" + output
159
+ }
156
160
  return output;
157
161
  }
158
162