@nerimity/html-embed 1.1.10 → 1.1.12
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/example.js +2 -1
- package/package.json +21 -21
- package/src/index.ts +7 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgIA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;IAEtC"}
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,8 @@ const allowedCssProperties = [
|
|
|
74
74
|
"verticalAlign",
|
|
75
75
|
"lineHeight",
|
|
76
76
|
"backdropFilter",
|
|
77
|
+
"filter",
|
|
78
|
+
"object-fit",
|
|
77
79
|
"backgroundClip",
|
|
78
80
|
"cursor",
|
|
79
81
|
"overflowX",
|
|
@@ -127,6 +129,11 @@ function htmlToJson(html) {
|
|
|
127
129
|
}
|
|
128
130
|
function checkCSS(cssVal) {
|
|
129
131
|
var _a;
|
|
132
|
+
const openCurlyBracketCount = cssVal.match(/{/gi);
|
|
133
|
+
const closeCurlyBracketCount = cssVal.match(/}/gi);
|
|
134
|
+
if ((openCurlyBracketCount === null || openCurlyBracketCount === void 0 ? void 0 : openCurlyBracketCount.length) !== (closeCurlyBracketCount === null || closeCurlyBracketCount === void 0 ? void 0 : closeCurlyBracketCount.length)) {
|
|
135
|
+
throw new Error("Extra curly or missing curly brackets found in css!");
|
|
136
|
+
}
|
|
130
137
|
const rules = (_a = css_1.default.parse(cssVal).stylesheet) === null || _a === void 0 ? void 0 : _a.rules;
|
|
131
138
|
if (!rules)
|
|
132
139
|
return;
|
package/example.js
CHANGED
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nerimity/html-embed",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"css": "^
|
|
15
|
-
"
|
|
16
|
-
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nerimity/html-embed",
|
|
3
|
+
"version": "1.1.12",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"example": "tsc & node example.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/css": "^0.0.37",
|
|
15
|
+
"typescript": "^5.5.2"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"css": "^3.0.0",
|
|
19
|
+
"htm": "^3.1.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -70,6 +70,8 @@ const allowedCssProperties = [
|
|
|
70
70
|
"verticalAlign",
|
|
71
71
|
"lineHeight",
|
|
72
72
|
"backdropFilter",
|
|
73
|
+
"filter",
|
|
74
|
+
"object-fit",
|
|
73
75
|
"backgroundClip",
|
|
74
76
|
"cursor",
|
|
75
77
|
"overflowX",
|
|
@@ -131,6 +133,11 @@ export function htmlToJson(html: string) {
|
|
|
131
133
|
|
|
132
134
|
|
|
133
135
|
function checkCSS(cssVal: string) {
|
|
136
|
+
const openCurlyBracketCount = cssVal.match(/{/gi)
|
|
137
|
+
const closeCurlyBracketCount = cssVal.match(/}/gi)
|
|
138
|
+
if (openCurlyBracketCount?.length !== closeCurlyBracketCount?.length) {
|
|
139
|
+
throw new Error("Extra curly or missing curly brackets found in css!")
|
|
140
|
+
}
|
|
134
141
|
const rules = css.parse(cssVal).stylesheet?.rules;
|
|
135
142
|
if (!rules) return;
|
|
136
143
|
for (let i = 0; i < rules.length; i++) {
|