@wiajs/core 1.1.26 → 1.1.28

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.26
2
+ * wia core v1.1.28
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.26
2
+ * wia core v1.1.28
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/core.min.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * wia core v1.1.26
2
+ * wia core v1.1.28
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.26
7
+ * wia core v1.1.28
8
8
  * (c) 2015-2024 Sibyl Yu and contributors
9
9
  * Released under the MIT License.
10
10
  */
package/dist/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.26
2
+ * wia core v1.1.28
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,55 +1,67 @@
1
- /*!
2
- * wia core v1.1.26
3
- * (c) 2015-2024 Sibyl Yu and contributors
4
- * Released under the MIT License.
5
- */
6
- 'use strict';
7
-
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
- var jsxRuntime = {};
11
-
12
- // replace react, use by @babel/plugin-transform-react-jsx
13
- /* eslint-disable prefer-rest-params */
14
- function jsx(tag, props) {
15
- const attrs = props || {};
16
- const children = props.children || [];
17
- if (attrs.children) delete attrs.children;
18
-
19
- // console.log({tag, props, attrs, children})
20
-
21
- const attrsString = Object.keys(attrs)
22
- .map((attr) => {
23
- if (attr[0] === '_') {
24
- if (attrs[attr]) return attr.replace('_', '');
25
- return '';
26
- }
27
- return `${attr}="${attrs[attr]}"`;
28
- })
29
- .filter((attr) => !!attr)
30
- .join(' ');
31
-
32
- if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
33
- return `<${tag} ${attrsString} />`.trim();
1
+ /*!
2
+ * wia core v1.1.28
3
+ * (c) 2015-2024 Sibyl Yu and contributors
4
+ * Released under the MIT License.
5
+ */
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var jsxRuntime = {};
11
+
12
+ // runtime: 'automatic', // automatic or classic automatic 使用 JSX 运行时(在React 17 中引入)
13
+ function jsx(tag, {children, ...props} = {}) {
14
+ let R = '';
15
+
16
+ if (typeof tag === 'function') R = tag({children, ...props});
17
+ else if (typeof tag === 'string') {
18
+ const attrs = props || {};
19
+ const attrsString = Object.keys(attrs)
20
+ .map(attr => {
21
+ if (attr[0] === '_') {
22
+ if (attrs[attr]) return attr.replace('_', '');
23
+ return '';
24
+ }
25
+ return `${attr}="${attrs[attr]}"`;
26
+ })
27
+ .filter(attr => !!attr)
28
+ .join(' ');
29
+
30
+ if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0)
31
+ R = `<${tag} ${attrsString} />`.trim();
32
+ else {
33
+ const childrenContent = Array.isArray(children)
34
+ ? children
35
+ .filter(c => !!c)
36
+ .map(c => (Array.isArray(c) ? c.join('') : c))
37
+ .join('')
38
+ : children;
39
+
40
+ R = `<${tag} ${attrsString}>${childrenContent ?? ''}</${tag}>`.trim();
41
+ }
34
42
  }
35
- const childrenContent = Array.isArray(children) ? children
36
- .filter((c) => !!c)
37
- .map((c) => (Array.isArray(c) ? c.join('') : c))
38
- .join('')
39
- : children;
40
- return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
43
+
44
+ return R;
41
45
  }
42
- function Fragment(props) {
43
- return props.children;
46
+
47
+ function Fragment({children} = {}) {
48
+ const R = Array.isArray(children)
49
+ ? children
50
+ .filter(c => !!c)
51
+ .map(c => (Array.isArray(c) ? c.join('') : c))
52
+ .join('')
53
+ : children;
54
+
55
+ return R ?? '';
44
56
  }
45
57
 
46
58
  var Fragment_1 = jsxRuntime.Fragment = Fragment;
47
59
  var jsx_1 = jsxRuntime.jsx = jsx;
48
60
  var jsxs = jsxRuntime.jsxs = jsx;
49
- var jsxDEV = jsxRuntime.jsxDEV = jsx;
50
-
51
- exports.Fragment = Fragment_1;
52
- exports.default = jsxRuntime;
53
- exports.jsx = jsx_1;
54
- exports.jsxDEV = jsxDEV;
55
- exports.jsxs = jsxs;
61
+ var jsxDEV = jsxRuntime.jsxDEV = jsx;
62
+
63
+ exports.Fragment = Fragment_1;
64
+ exports.default = jsxRuntime;
65
+ exports.jsx = jsx_1;
66
+ exports.jsxDEV = jsxDEV;
67
+ exports.jsxs = jsxs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiajs/core",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "wia app core package",
5
5
  "main": "./dist/core.cjs",
6
6
  "module": "./dist/core.mjs",