preact-render-to-string 5.1.16 → 6.0.0-experimental.0
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/README.md +1 -1
- package/dist/commonjs.js +1 -1
- package/dist/commonjs.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/jsx-entry.js +1 -1
- package/dist/jsx-entry.js.map +1 -1
- package/dist/jsx.js.map +1 -1
- package/dist/jsx.mjs +1 -1
- package/dist/jsx.modern.js +1 -1
- package/dist/jsx.modern.js.map +1 -1
- package/dist/jsx.module.js +1 -1
- package/dist/jsx.module.js.map +1 -1
- package/package.json +33 -18
- package/src/index.js +66 -44
- package/src/util.js +21 -11
package/src/util.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// DOM properties that should NOT have "px" added when numeric
|
|
2
2
|
export const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
const ENCODED_ENTITIES = /[&<>"]/;
|
|
5
|
+
|
|
6
|
+
export function encodeEntities(input) {
|
|
7
|
+
const s = String(input);
|
|
8
|
+
if (!ENCODED_ENTITIES.test(s)) {
|
|
9
|
+
return s;
|
|
10
|
+
}
|
|
11
|
+
return s
|
|
12
|
+
.replace(/&/g, '&')
|
|
13
|
+
.replace(/</g, '<')
|
|
14
|
+
.replace(/>/g, '>')
|
|
15
|
+
.replace(/"/g, '"');
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export let indent = (s, char) =>
|
|
@@ -75,3 +76,12 @@ export function getChildren(accumulator, children) {
|
|
|
75
76
|
}
|
|
76
77
|
return accumulator;
|
|
77
78
|
}
|
|
79
|
+
|
|
80
|
+
export function createInternalFromVnode(vnode, context) {
|
|
81
|
+
return {
|
|
82
|
+
type: vnode.type,
|
|
83
|
+
props: vnode.props,
|
|
84
|
+
data: {},
|
|
85
|
+
c: context
|
|
86
|
+
};
|
|
87
|
+
}
|