@wiajs/core 1.1.19 → 1.1.21
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/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/core.min.js +2 -2
- package/dist/core.mjs +1 -1
- package/dist/jsx-dev-runtime.js +93 -25
- package/dist/jsx-runtime.js +92 -26
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
package/dist/core.js
CHANGED
package/dist/core.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wia core v1.1.
|
|
2
|
+
* wia core v1.1.20
|
|
3
3
|
* (c) 2015-2024 Sibyl Yu and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
/*!
|
|
7
|
-
* wia core v1.1.
|
|
7
|
+
* wia core v1.1.20
|
|
8
8
|
* (c) 2015-2024 Sibyl Yu and contributors
|
|
9
9
|
* Released under the MIT License.
|
|
10
10
|
*/
|
package/dist/core.mjs
CHANGED
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wia core v1.1.
|
|
2
|
+
* wia core v1.1.20
|
|
3
3
|
* (c) 2015-2024 Sibyl Yu and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -9,35 +9,103 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
9
9
|
|
|
10
10
|
var jsxDevRuntime = {};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const svgNs = 'http://www.w3.org/2000/svg';
|
|
13
|
+
const mathmlNs = 'http://www.w3.org/1998/Math/MathML';
|
|
14
|
+
const properties = new Set(['value']);
|
|
15
|
+
const internalKeys = new Set(['_', 'children', 'ref']);
|
|
16
|
+
const extensions = new Map([['style', (node, value, key) => {
|
|
17
|
+
if ('string' == typeof value) {
|
|
18
|
+
node.setAttribute(key, value);
|
|
19
|
+
} else {
|
|
20
|
+
for (key in value) {
|
|
21
|
+
if (key.startsWith('-')) {
|
|
22
|
+
node.style.setProperty(key, value[key]);
|
|
23
|
+
} else {
|
|
24
|
+
node.style[key] = value[key];
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}], ['$', (node, value, key) => {
|
|
29
|
+
for (key in value) {
|
|
30
|
+
node.addEventListener(key, value[key]);
|
|
31
|
+
}
|
|
32
|
+
}]]);
|
|
33
|
+
const appendChildren = (content, node) => Array.isArray(content) ? content.some(i => appendChildren(i, node)) : false !== content && null != content && node.append(content);
|
|
34
|
+
const Fragment = content => (appendChildren(content, content = new DocumentFragment()), content);
|
|
35
|
+
const jsx = (tag, props) => {
|
|
36
|
+
let key,
|
|
37
|
+
value,
|
|
38
|
+
node = props._ ? document.createElementNS(props._, tag) : document.createElement(tag, props.is ? {
|
|
39
|
+
is: props.is
|
|
40
|
+
} : key);
|
|
41
|
+
for (key in props) {
|
|
42
|
+
if (!internalKeys.has(key)) {
|
|
43
|
+
value = props[key];
|
|
44
|
+
if (extensions.has(key)) {
|
|
45
|
+
extensions.get(key)(node, value, key);
|
|
46
|
+
} else if (properties.has(key) || key.startsWith('on')) {
|
|
47
|
+
node[key] = value;
|
|
48
|
+
} else if (null != value) {
|
|
49
|
+
if ('boolean' != typeof value || key.startsWith('-', 4)) {
|
|
50
|
+
node.setAttribute(key, value);
|
|
51
|
+
} else if (value) {
|
|
52
|
+
node.setAttribute(key, '');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
appendChildren(props.children, 'template' == tag ? node.content : node);
|
|
58
|
+
if (value = props.ref) {
|
|
59
|
+
if ('function' == typeof value) {
|
|
60
|
+
value(node);
|
|
61
|
+
} else {
|
|
62
|
+
value.current = node;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return node;
|
|
66
|
+
};
|
|
26
67
|
|
|
27
|
-
|
|
28
|
-
|
|
68
|
+
const useRef = current => ({
|
|
69
|
+
current
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const parseFromString = html => jsx('template', {
|
|
73
|
+
ref(node) {
|
|
74
|
+
node.innerHTML = html;
|
|
29
75
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
76
|
+
}).content;
|
|
77
|
+
const Template = props => /*#__PURE__*/parseFromString(props.children);
|
|
78
|
+
|
|
79
|
+
const useText = initContent => {
|
|
80
|
+
const text = new Text(initContent);
|
|
81
|
+
return [text, content => {
|
|
82
|
+
if (initContent !== content) {
|
|
83
|
+
text.textContent = initContent = content;
|
|
84
|
+
}
|
|
85
|
+
}];
|
|
35
86
|
};
|
|
36
87
|
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
88
|
+
var Fragment_1 = jsxDevRuntime.Fragment = Fragment;
|
|
89
|
+
var Template_1 = jsxDevRuntime.Template = Template;
|
|
90
|
+
var appendChildren_1 = jsxDevRuntime.appendChildren = appendChildren;
|
|
91
|
+
var extensions_1 = jsxDevRuntime.extensions = extensions;
|
|
92
|
+
var jsxDEV = jsxDevRuntime.jsxDEV = jsx;
|
|
93
|
+
var mathmlNs_1 = jsxDevRuntime.mathmlNs = mathmlNs;
|
|
94
|
+
var parseFromString_1 = jsxDevRuntime.parseFromString = parseFromString;
|
|
95
|
+
var properties_1 = jsxDevRuntime.properties = properties;
|
|
96
|
+
var svgNs_1 = jsxDevRuntime.svgNs = svgNs;
|
|
97
|
+
var useRef_1 = jsxDevRuntime.useRef = useRef;
|
|
98
|
+
var useText_1 = jsxDevRuntime.useText = useText;
|
|
40
99
|
|
|
41
|
-
exports.Fragment =
|
|
100
|
+
exports.Fragment = Fragment_1;
|
|
101
|
+
exports.Template = Template_1;
|
|
102
|
+
exports.appendChildren = appendChildren_1;
|
|
42
103
|
exports.default = jsxDevRuntime;
|
|
104
|
+
exports.extensions = extensions_1;
|
|
43
105
|
exports.jsxDEV = jsxDEV;
|
|
106
|
+
exports.mathmlNs = mathmlNs_1;
|
|
107
|
+
exports.parseFromString = parseFromString_1;
|
|
108
|
+
exports.properties = properties_1;
|
|
109
|
+
exports.svgNs = svgNs_1;
|
|
110
|
+
exports.useRef = useRef_1;
|
|
111
|
+
exports.useText = useText_1;
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* wia core v1.1.
|
|
2
|
+
* wia core v1.1.20
|
|
3
3
|
* (c) 2015-2024 Sibyl Yu and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -9,39 +9,105 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
9
9
|
|
|
10
10
|
var jsxRuntime = {};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const svgNs = 'http://www.w3.org/2000/svg';
|
|
13
|
+
const mathmlNs = 'http://www.w3.org/1998/Math/MathML';
|
|
14
|
+
const properties = new Set(['value']);
|
|
15
|
+
const internalKeys = new Set(['_', 'children', 'ref']);
|
|
16
|
+
const extensions = new Map([['style', (node, value, key) => {
|
|
17
|
+
if ('string' == typeof value) {
|
|
18
|
+
node.setAttribute(key, value);
|
|
19
|
+
} else {
|
|
20
|
+
for (key in value) {
|
|
21
|
+
if (key.startsWith('-')) {
|
|
22
|
+
node.style.setProperty(key, value[key]);
|
|
23
|
+
} else {
|
|
24
|
+
node.style[key] = value[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}], ['$', (node, value, key) => {
|
|
29
|
+
for (key in value) {
|
|
30
|
+
node.addEventListener(key, value[key]);
|
|
31
|
+
}
|
|
32
|
+
}]]);
|
|
33
|
+
const appendChildren = (content, node) => Array.isArray(content) ? content.some(i => appendChildren(i, node)) : false !== content && null != content && node.append(content);
|
|
34
|
+
const Fragment = content => (appendChildren(content, content = new DocumentFragment()), content);
|
|
35
|
+
const jsx = (tag, props) => {
|
|
36
|
+
let key,
|
|
37
|
+
value,
|
|
38
|
+
node = props._ ? document.createElementNS(props._, tag) : document.createElement(tag, props.is ? {
|
|
39
|
+
is: props.is
|
|
40
|
+
} : key);
|
|
41
|
+
for (key in props) {
|
|
42
|
+
if (!internalKeys.has(key)) {
|
|
43
|
+
value = props[key];
|
|
44
|
+
if (extensions.has(key)) {
|
|
45
|
+
extensions.get(key)(node, value, key);
|
|
46
|
+
} else if (properties.has(key) || key.startsWith('on')) {
|
|
47
|
+
node[key] = value;
|
|
48
|
+
} else if (null != value) {
|
|
49
|
+
if ('boolean' != typeof value || key.startsWith('-', 4)) {
|
|
50
|
+
node.setAttribute(key, value);
|
|
51
|
+
} else if (value) {
|
|
52
|
+
node.setAttribute(key, '');
|
|
53
|
+
}
|
|
21
54
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
appendChildren(props.children, 'template' == tag ? node.content : node);
|
|
58
|
+
if (value = props.ref) {
|
|
59
|
+
if ('function' == typeof value) {
|
|
60
|
+
value(node);
|
|
61
|
+
} else {
|
|
62
|
+
value.current = node;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return node;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const useRef = current => ({
|
|
69
|
+
current
|
|
70
|
+
});
|
|
26
71
|
|
|
27
|
-
|
|
28
|
-
|
|
72
|
+
const parseFromString = html => jsx('template', {
|
|
73
|
+
ref(node) {
|
|
74
|
+
node.innerHTML = html;
|
|
29
75
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.map(c => (Array.isArray(c) ? c.join('') : c))
|
|
33
|
-
.join('');
|
|
34
|
-
return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
|
|
35
|
-
}
|
|
76
|
+
}).content;
|
|
77
|
+
const Template = props => /*#__PURE__*/parseFromString(props.children);
|
|
36
78
|
|
|
37
|
-
|
|
38
|
-
|
|
79
|
+
const useText = initContent => {
|
|
80
|
+
const text = new Text(initContent);
|
|
81
|
+
return [text, content => {
|
|
82
|
+
if (initContent !== content) {
|
|
83
|
+
text.textContent = initContent = content;
|
|
84
|
+
}
|
|
85
|
+
}];
|
|
39
86
|
};
|
|
40
87
|
|
|
88
|
+
var Fragment_1 = jsxRuntime.Fragment = Fragment;
|
|
89
|
+
var Template_1 = jsxRuntime.Template = Template;
|
|
90
|
+
var appendChildren_1 = jsxRuntime.appendChildren = appendChildren;
|
|
91
|
+
var extensions_1 = jsxRuntime.extensions = extensions;
|
|
41
92
|
var jsx_1 = jsxRuntime.jsx = jsx;
|
|
42
|
-
var jsxs = jsxRuntime.jsxs = jsx;
|
|
93
|
+
var jsxs = jsxRuntime.jsxs = jsx;
|
|
94
|
+
var mathmlNs_1 = jsxRuntime.mathmlNs = mathmlNs;
|
|
95
|
+
var parseFromString_1 = jsxRuntime.parseFromString = parseFromString;
|
|
96
|
+
var properties_1 = jsxRuntime.properties = properties;
|
|
97
|
+
var svgNs_1 = jsxRuntime.svgNs = svgNs;
|
|
98
|
+
var useRef_1 = jsxRuntime.useRef = useRef;
|
|
99
|
+
var useText_1 = jsxRuntime.useText = useText;
|
|
43
100
|
|
|
44
|
-
exports.Fragment =
|
|
101
|
+
exports.Fragment = Fragment_1;
|
|
102
|
+
exports.Template = Template_1;
|
|
103
|
+
exports.appendChildren = appendChildren_1;
|
|
45
104
|
exports.default = jsxRuntime;
|
|
105
|
+
exports.extensions = extensions_1;
|
|
46
106
|
exports.jsx = jsx_1;
|
|
47
107
|
exports.jsxs = jsxs;
|
|
108
|
+
exports.mathmlNs = mathmlNs_1;
|
|
109
|
+
exports.parseFromString = parseFromString_1;
|
|
110
|
+
exports.properties = properties_1;
|
|
111
|
+
exports.svgNs = svgNs_1;
|
|
112
|
+
exports.useRef = useRef_1;
|
|
113
|
+
exports.useText = useText_1;
|