@wiajs/core 1.1.18 → 1.1.20

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.18
2
+ * wia core v1.1.19
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.18
2
+ * wia core v1.1.19
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.18
2
+ * wia core v1.1.19
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.18
7
+ * wia core v1.1.19
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.18
2
+ * wia core v1.1.19
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.18
2
+ * wia core v1.1.19
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -7,409 +7,35 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11
-
12
10
  var jsxDevRuntime = {};
13
11
 
14
- /**
15
- * lodash (Custom Build) <https://lodash.com/>
16
- * Build: `lodash modularize exports="npm" -o ./`
17
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
18
- * Released under MIT license <https://lodash.com/license>
19
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
20
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
21
- */
22
-
23
- /** Used as references for various `Number` constants. */
24
- var INFINITY = 1 / 0,
25
- MAX_SAFE_INTEGER = 9007199254740991;
26
-
27
- /** `Object#toString` result references. */
28
- var argsTag = '[object Arguments]',
29
- funcTag = '[object Function]',
30
- genTag = '[object GeneratorFunction]';
31
-
32
- /** Detect free variable `global` from Node.js. */
33
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
34
-
35
- /** Detect free variable `self`. */
36
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
37
-
38
- /** Used as a reference to the global object. */
39
- var root = freeGlobal || freeSelf || Function('return this')();
40
-
41
- /**
42
- * Appends the elements of `values` to `array`.
43
- *
44
- * @private
45
- * @param {Array} array The array to modify.
46
- * @param {Array} values The values to append.
47
- * @returns {Array} Returns `array`.
48
- */
49
- function arrayPush(array, values) {
50
- var index = -1,
51
- length = values.length,
52
- offset = array.length;
53
-
54
- while (++index < length) {
55
- array[offset + index] = values[index];
56
- }
57
- return array;
58
- }
59
-
60
- /** Used for built-in method references. */
61
- var objectProto = Object.prototype;
62
-
63
- /** Used to check objects for own properties. */
64
- var hasOwnProperty = objectProto.hasOwnProperty;
65
-
66
- /**
67
- * Used to resolve the
68
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
69
- * of values.
70
- */
71
- var objectToString = objectProto.toString;
72
-
73
- /** Built-in value references. */
74
- var Symbol = root.Symbol,
75
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
76
- spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
77
-
78
- /**
79
- * The base implementation of `_.flatten` with support for restricting flattening.
80
- *
81
- * @private
82
- * @param {Array} array The array to flatten.
83
- * @param {number} depth The maximum recursion depth.
84
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
85
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
86
- * @param {Array} [result=[]] The initial result value.
87
- * @returns {Array} Returns the new flattened array.
88
- */
89
- function baseFlatten(array, depth, predicate, isStrict, result) {
90
- var index = -1,
91
- length = array.length;
92
-
93
- predicate || (predicate = isFlattenable);
94
- result || (result = []);
95
-
96
- while (++index < length) {
97
- var value = array[index];
98
- if (depth > 0 && predicate(value)) {
99
- if (depth > 1) {
100
- // Recursively flatten arrays (susceptible to call stack limits).
101
- baseFlatten(value, depth - 1, predicate, isStrict, result);
102
- } else {
103
- arrayPush(result, value);
104
- }
105
- } else if (!isStrict) {
106
- result[result.length] = value;
107
- }
108
- }
109
- return result;
110
- }
111
-
112
- /**
113
- * Checks if `value` is a flattenable `arguments` object or array.
114
- *
115
- * @private
116
- * @param {*} value The value to check.
117
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
118
- */
119
- function isFlattenable(value) {
120
- return isArray(value) || isArguments(value) ||
121
- !!(spreadableSymbol && value && value[spreadableSymbol]);
122
- }
123
-
124
- /**
125
- * Recursively flattens `array`.
126
- *
127
- * @static
128
- * @memberOf _
129
- * @since 3.0.0
130
- * @category Array
131
- * @param {Array} array The array to flatten.
132
- * @returns {Array} Returns the new flattened array.
133
- * @example
134
- *
135
- * _.flattenDeep([1, [2, [3, [4]], 5]]);
136
- * // => [1, 2, 3, 4, 5]
137
- */
138
- function flattenDeep(array) {
139
- var length = array ? array.length : 0;
140
- return length ? baseFlatten(array, INFINITY) : [];
141
- }
142
-
143
- /**
144
- * Checks if `value` is likely an `arguments` object.
145
- *
146
- * @static
147
- * @memberOf _
148
- * @since 0.1.0
149
- * @category Lang
150
- * @param {*} value The value to check.
151
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
152
- * else `false`.
153
- * @example
154
- *
155
- * _.isArguments(function() { return arguments; }());
156
- * // => true
157
- *
158
- * _.isArguments([1, 2, 3]);
159
- * // => false
160
- */
161
- function isArguments(value) {
162
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
163
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
164
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
165
- }
166
-
167
- /**
168
- * Checks if `value` is classified as an `Array` object.
169
- *
170
- * @static
171
- * @memberOf _
172
- * @since 0.1.0
173
- * @category Lang
174
- * @param {*} value The value to check.
175
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
176
- * @example
177
- *
178
- * _.isArray([1, 2, 3]);
179
- * // => true
180
- *
181
- * _.isArray(document.body.children);
182
- * // => false
183
- *
184
- * _.isArray('abc');
185
- * // => false
186
- *
187
- * _.isArray(_.noop);
188
- * // => false
189
- */
190
- var isArray = Array.isArray;
191
-
192
- /**
193
- * Checks if `value` is array-like. A value is considered array-like if it's
194
- * not a function and has a `value.length` that's an integer greater than or
195
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
196
- *
197
- * @static
198
- * @memberOf _
199
- * @since 4.0.0
200
- * @category Lang
201
- * @param {*} value The value to check.
202
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
203
- * @example
204
- *
205
- * _.isArrayLike([1, 2, 3]);
206
- * // => true
207
- *
208
- * _.isArrayLike(document.body.children);
209
- * // => true
210
- *
211
- * _.isArrayLike('abc');
212
- * // => true
213
- *
214
- * _.isArrayLike(_.noop);
215
- * // => false
216
- */
217
- function isArrayLike(value) {
218
- return value != null && isLength(value.length) && !isFunction(value);
219
- }
220
-
221
- /**
222
- * This method is like `_.isArrayLike` except that it also checks if `value`
223
- * is an object.
224
- *
225
- * @static
226
- * @memberOf _
227
- * @since 4.0.0
228
- * @category Lang
229
- * @param {*} value The value to check.
230
- * @returns {boolean} Returns `true` if `value` is an array-like object,
231
- * else `false`.
232
- * @example
233
- *
234
- * _.isArrayLikeObject([1, 2, 3]);
235
- * // => true
236
- *
237
- * _.isArrayLikeObject(document.body.children);
238
- * // => true
239
- *
240
- * _.isArrayLikeObject('abc');
241
- * // => false
242
- *
243
- * _.isArrayLikeObject(_.noop);
244
- * // => false
245
- */
246
- function isArrayLikeObject(value) {
247
- return isObjectLike(value) && isArrayLike(value);
248
- }
249
-
250
- /**
251
- * Checks if `value` is classified as a `Function` object.
252
- *
253
- * @static
254
- * @memberOf _
255
- * @since 0.1.0
256
- * @category Lang
257
- * @param {*} value The value to check.
258
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
259
- * @example
260
- *
261
- * _.isFunction(_);
262
- * // => true
263
- *
264
- * _.isFunction(/abc/);
265
- * // => false
266
- */
267
- function isFunction(value) {
268
- // The use of `Object#toString` avoids issues with the `typeof` operator
269
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
270
- var tag = isObject(value) ? objectToString.call(value) : '';
271
- return tag == funcTag || tag == genTag;
272
- }
273
-
274
- /**
275
- * Checks if `value` is a valid array-like length.
276
- *
277
- * **Note:** This method is loosely based on
278
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
279
- *
280
- * @static
281
- * @memberOf _
282
- * @since 4.0.0
283
- * @category Lang
284
- * @param {*} value The value to check.
285
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
286
- * @example
287
- *
288
- * _.isLength(3);
289
- * // => true
290
- *
291
- * _.isLength(Number.MIN_VALUE);
292
- * // => false
293
- *
294
- * _.isLength(Infinity);
295
- * // => false
296
- *
297
- * _.isLength('3');
298
- * // => false
299
- */
300
- function isLength(value) {
301
- return typeof value == 'number' &&
302
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
303
- }
304
-
305
- /**
306
- * Checks if `value` is the
307
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
308
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
309
- *
310
- * @static
311
- * @memberOf _
312
- * @since 0.1.0
313
- * @category Lang
314
- * @param {*} value The value to check.
315
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
316
- * @example
317
- *
318
- * _.isObject({});
319
- * // => true
320
- *
321
- * _.isObject([1, 2, 3]);
322
- * // => true
323
- *
324
- * _.isObject(_.noop);
325
- * // => true
326
- *
327
- * _.isObject(null);
328
- * // => false
329
- */
330
- function isObject(value) {
331
- var type = typeof value;
332
- return !!value && (type == 'object' || type == 'function');
333
- }
334
-
335
- /**
336
- * Checks if `value` is object-like. A value is object-like if it's not `null`
337
- * and has a `typeof` result of "object".
338
- *
339
- * @static
340
- * @memberOf _
341
- * @since 4.0.0
342
- * @category Lang
343
- * @param {*} value The value to check.
344
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
345
- * @example
346
- *
347
- * _.isObjectLike({});
348
- * // => true
349
- *
350
- * _.isObjectLike([1, 2, 3]);
351
- * // => true
352
- *
353
- * _.isObjectLike(_.noop);
354
- * // => false
355
- *
356
- * _.isObjectLike(null);
357
- * // => false
358
- */
359
- function isObjectLike(value) {
360
- return !!value && typeof value == 'object';
361
- }
362
-
363
- var lodash_flattendeep = flattenDeep;
364
-
365
- const flatten = lodash_flattendeep;
366
-
367
- var jsxDEV = jsxDevRuntime.jsxDEV = (tag, { ref, children, ...props } = {}) => {
368
- if (typeof tag === 'string') {
369
- const element = document.createElement(tag);
370
-
371
- Object.keys(props).forEach((key) => {
372
- if (!props[key]) ; else if (typeof props[key] === 'function') {
373
- element[key] = props[key];
374
- } else {
375
- element.setAttribute(key, props[key]);
376
- }
377
- });
378
-
379
- if (!children) ; else {
380
- children = Array.isArray(children) ? flatten(children) : [children];
381
-
382
- children.forEach((child) => {
383
- child && element.append(child);
384
- });
385
- }
386
-
387
- if (!ref) ; else if (typeof ref === 'function') {
388
- ref(element);
389
- } else {
390
- element.setAttribute('ref', ref);
391
- }
392
-
393
- return element;
394
- } else if (typeof tag === 'function') {
395
- return tag({ ref, children, ...props });
396
- } else {
397
- console.error('未知 tag 类型', tag);
398
- }
399
- };
400
-
401
- var Fragment = jsxDevRuntime.Fragment = ({ children } = {}) => {
402
- const element = document.createDocumentFragment();
403
-
404
- if (!children) ; else {
405
- children = Array.isArray(children) ? flatten(children) : [children];
406
-
407
- children.forEach((child) => {
408
- child && element.append(child);
409
- });
410
- }
411
-
412
- return element;
12
+ var jsxDEV = jsxDevRuntime.jsxDEV = (tag, props, ...args) => {
13
+ const attrs = props || {};
14
+ const children = args || [];
15
+
16
+ const attrsString = Object.keys(attrs)
17
+ .map(attr => {
18
+ if (attr[0] === '_') {
19
+ if (attrs[attr]) return attr.replace('_', '');
20
+ return '';
21
+ }
22
+ return `${attr}="${attrs[attr]}"`;
23
+ })
24
+ .filter(attr => !!attr)
25
+ .join(' ');
26
+
27
+ if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
28
+ return `<${tag} ${attrsString} />`.trim();
29
+ }
30
+ const childrenContent = children
31
+ .filter(c => !!c)
32
+ .map(c => (Array.isArray(c) ? c.join('') : c))
33
+ .join('');
34
+ return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
35
+ };
36
+
37
+ var Fragment = jsxDevRuntime.Fragment = ({children} = {}) => {
38
+ return '';
413
39
  };
414
40
 
415
41
  exports.Fragment = Fragment;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.18
2
+ * wia core v1.1.19
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -7,412 +7,38 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11
-
12
10
  var jsxRuntime = {};
13
11
 
14
- /**
15
- * lodash (Custom Build) <https://lodash.com/>
16
- * Build: `lodash modularize exports="npm" -o ./`
17
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
18
- * Released under MIT license <https://lodash.com/license>
19
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
20
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
21
- */
22
-
23
- /** Used as references for various `Number` constants. */
24
- var INFINITY = 1 / 0,
25
- MAX_SAFE_INTEGER = 9007199254740991;
26
-
27
- /** `Object#toString` result references. */
28
- var argsTag = '[object Arguments]',
29
- funcTag = '[object Function]',
30
- genTag = '[object GeneratorFunction]';
31
-
32
- /** Detect free variable `global` from Node.js. */
33
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
34
-
35
- /** Detect free variable `self`. */
36
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
37
-
38
- /** Used as a reference to the global object. */
39
- var root = freeGlobal || freeSelf || Function('return this')();
40
-
41
- /**
42
- * Appends the elements of `values` to `array`.
43
- *
44
- * @private
45
- * @param {Array} array The array to modify.
46
- * @param {Array} values The values to append.
47
- * @returns {Array} Returns `array`.
48
- */
49
- function arrayPush(array, values) {
50
- var index = -1,
51
- length = values.length,
52
- offset = array.length;
53
-
54
- while (++index < length) {
55
- array[offset + index] = values[index];
56
- }
57
- return array;
58
- }
59
-
60
- /** Used for built-in method references. */
61
- var objectProto = Object.prototype;
62
-
63
- /** Used to check objects for own properties. */
64
- var hasOwnProperty = objectProto.hasOwnProperty;
65
-
66
- /**
67
- * Used to resolve the
68
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
69
- * of values.
70
- */
71
- var objectToString = objectProto.toString;
72
-
73
- /** Built-in value references. */
74
- var Symbol = root.Symbol,
75
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
76
- spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
77
-
78
- /**
79
- * The base implementation of `_.flatten` with support for restricting flattening.
80
- *
81
- * @private
82
- * @param {Array} array The array to flatten.
83
- * @param {number} depth The maximum recursion depth.
84
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
85
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
86
- * @param {Array} [result=[]] The initial result value.
87
- * @returns {Array} Returns the new flattened array.
88
- */
89
- function baseFlatten(array, depth, predicate, isStrict, result) {
90
- var index = -1,
91
- length = array.length;
92
-
93
- predicate || (predicate = isFlattenable);
94
- result || (result = []);
95
-
96
- while (++index < length) {
97
- var value = array[index];
98
- if (depth > 0 && predicate(value)) {
99
- if (depth > 1) {
100
- // Recursively flatten arrays (susceptible to call stack limits).
101
- baseFlatten(value, depth - 1, predicate, isStrict, result);
102
- } else {
103
- arrayPush(result, value);
104
- }
105
- } else if (!isStrict) {
106
- result[result.length] = value;
107
- }
108
- }
109
- return result;
110
- }
111
-
112
- /**
113
- * Checks if `value` is a flattenable `arguments` object or array.
114
- *
115
- * @private
116
- * @param {*} value The value to check.
117
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
118
- */
119
- function isFlattenable(value) {
120
- return isArray(value) || isArguments(value) ||
121
- !!(spreadableSymbol && value && value[spreadableSymbol]);
122
- }
123
-
124
- /**
125
- * Recursively flattens `array`.
126
- *
127
- * @static
128
- * @memberOf _
129
- * @since 3.0.0
130
- * @category Array
131
- * @param {Array} array The array to flatten.
132
- * @returns {Array} Returns the new flattened array.
133
- * @example
134
- *
135
- * _.flattenDeep([1, [2, [3, [4]], 5]]);
136
- * // => [1, 2, 3, 4, 5]
137
- */
138
- function flattenDeep(array) {
139
- var length = array ? array.length : 0;
140
- return length ? baseFlatten(array, INFINITY) : [];
141
- }
142
-
143
- /**
144
- * Checks if `value` is likely an `arguments` object.
145
- *
146
- * @static
147
- * @memberOf _
148
- * @since 0.1.0
149
- * @category Lang
150
- * @param {*} value The value to check.
151
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
152
- * else `false`.
153
- * @example
154
- *
155
- * _.isArguments(function() { return arguments; }());
156
- * // => true
157
- *
158
- * _.isArguments([1, 2, 3]);
159
- * // => false
160
- */
161
- function isArguments(value) {
162
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
163
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
164
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
165
- }
166
-
167
- /**
168
- * Checks if `value` is classified as an `Array` object.
169
- *
170
- * @static
171
- * @memberOf _
172
- * @since 0.1.0
173
- * @category Lang
174
- * @param {*} value The value to check.
175
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
176
- * @example
177
- *
178
- * _.isArray([1, 2, 3]);
179
- * // => true
180
- *
181
- * _.isArray(document.body.children);
182
- * // => false
183
- *
184
- * _.isArray('abc');
185
- * // => false
186
- *
187
- * _.isArray(_.noop);
188
- * // => false
189
- */
190
- var isArray = Array.isArray;
191
-
192
- /**
193
- * Checks if `value` is array-like. A value is considered array-like if it's
194
- * not a function and has a `value.length` that's an integer greater than or
195
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
196
- *
197
- * @static
198
- * @memberOf _
199
- * @since 4.0.0
200
- * @category Lang
201
- * @param {*} value The value to check.
202
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
203
- * @example
204
- *
205
- * _.isArrayLike([1, 2, 3]);
206
- * // => true
207
- *
208
- * _.isArrayLike(document.body.children);
209
- * // => true
210
- *
211
- * _.isArrayLike('abc');
212
- * // => true
213
- *
214
- * _.isArrayLike(_.noop);
215
- * // => false
216
- */
217
- function isArrayLike(value) {
218
- return value != null && isLength(value.length) && !isFunction(value);
219
- }
220
-
221
- /**
222
- * This method is like `_.isArrayLike` except that it also checks if `value`
223
- * is an object.
224
- *
225
- * @static
226
- * @memberOf _
227
- * @since 4.0.0
228
- * @category Lang
229
- * @param {*} value The value to check.
230
- * @returns {boolean} Returns `true` if `value` is an array-like object,
231
- * else `false`.
232
- * @example
233
- *
234
- * _.isArrayLikeObject([1, 2, 3]);
235
- * // => true
236
- *
237
- * _.isArrayLikeObject(document.body.children);
238
- * // => true
239
- *
240
- * _.isArrayLikeObject('abc');
241
- * // => false
242
- *
243
- * _.isArrayLikeObject(_.noop);
244
- * // => false
245
- */
246
- function isArrayLikeObject(value) {
247
- return isObjectLike(value) && isArrayLike(value);
248
- }
249
-
250
- /**
251
- * Checks if `value` is classified as a `Function` object.
252
- *
253
- * @static
254
- * @memberOf _
255
- * @since 0.1.0
256
- * @category Lang
257
- * @param {*} value The value to check.
258
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
259
- * @example
260
- *
261
- * _.isFunction(_);
262
- * // => true
263
- *
264
- * _.isFunction(/abc/);
265
- * // => false
266
- */
267
- function isFunction(value) {
268
- // The use of `Object#toString` avoids issues with the `typeof` operator
269
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
270
- var tag = isObject(value) ? objectToString.call(value) : '';
271
- return tag == funcTag || tag == genTag;
272
- }
273
-
274
- /**
275
- * Checks if `value` is a valid array-like length.
276
- *
277
- * **Note:** This method is loosely based on
278
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
279
- *
280
- * @static
281
- * @memberOf _
282
- * @since 4.0.0
283
- * @category Lang
284
- * @param {*} value The value to check.
285
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
286
- * @example
287
- *
288
- * _.isLength(3);
289
- * // => true
290
- *
291
- * _.isLength(Number.MIN_VALUE);
292
- * // => false
293
- *
294
- * _.isLength(Infinity);
295
- * // => false
296
- *
297
- * _.isLength('3');
298
- * // => false
299
- */
300
- function isLength(value) {
301
- return typeof value == 'number' &&
302
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
303
- }
304
-
305
- /**
306
- * Checks if `value` is the
307
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
308
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
309
- *
310
- * @static
311
- * @memberOf _
312
- * @since 0.1.0
313
- * @category Lang
314
- * @param {*} value The value to check.
315
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
316
- * @example
317
- *
318
- * _.isObject({});
319
- * // => true
320
- *
321
- * _.isObject([1, 2, 3]);
322
- * // => true
323
- *
324
- * _.isObject(_.noop);
325
- * // => true
326
- *
327
- * _.isObject(null);
328
- * // => false
329
- */
330
- function isObject(value) {
331
- var type = typeof value;
332
- return !!value && (type == 'object' || type == 'function');
333
- }
334
-
335
- /**
336
- * Checks if `value` is object-like. A value is object-like if it's not `null`
337
- * and has a `typeof` result of "object".
338
- *
339
- * @static
340
- * @memberOf _
341
- * @since 4.0.0
342
- * @category Lang
343
- * @param {*} value The value to check.
344
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
345
- * @example
346
- *
347
- * _.isObjectLike({});
348
- * // => true
349
- *
350
- * _.isObjectLike([1, 2, 3]);
351
- * // => true
352
- *
353
- * _.isObjectLike(_.noop);
354
- * // => false
355
- *
356
- * _.isObjectLike(null);
357
- * // => false
358
- */
359
- function isObjectLike(value) {
360
- return !!value && typeof value == 'object';
361
- }
362
-
363
- var lodash_flattendeep = flattenDeep;
364
-
365
- const flatten = lodash_flattendeep;
366
-
367
- function jsx(tag, {ref, children, ...props} = {}) {
368
- if (typeof tag === 'string') {
369
- const element = document.createElement(tag);
370
-
371
- Object.keys(props).forEach(key => {
372
- if (!props[key]) ; else if (typeof props[key] === 'function') {
373
- element[key] = props[key];
374
- } else {
375
- element.setAttribute(key, props[key]);
376
- }
377
- });
378
-
379
- if (!children) ; else {
380
- children = Array.isArray(children) ? flatten(children) : [children];
381
-
382
- children.forEach(child => {
383
- child && element.append(child);
384
- });
385
- }
386
-
387
- if (!ref) ; else if (typeof ref === 'function') {
388
- ref(element);
389
- } else {
390
- element.setAttribute('ref', ref);
391
- }
392
-
393
- return element;
394
- } else if (typeof tag === 'function') {
395
- return tag({ref, children, ...props});
396
- } else {
397
- console.error('未知 tag 类型', tag);
398
- }
399
- }
400
-
401
- var Fragment = jsxRuntime.Fragment = ({children} = {}) => {
402
- const element = document.createDocumentFragment();
403
-
404
- if (!children) ; else {
405
- children = Array.isArray(children) ? flatten(children) : [children];
406
-
407
- children.forEach(child => {
408
- child && element.append(child);
409
- });
410
- }
411
-
412
- return element;
413
- };
414
-
415
- var jsx_1 = jsxRuntime.jsx = jsx;
12
+ function jsx(tag, props, ...args) {
13
+ const attrs = props || {};
14
+ const children = args || [];
15
+
16
+ const attrsString = Object.keys(attrs)
17
+ .map(attr => {
18
+ if (attr[0] === '_') {
19
+ if (attrs[attr]) return attr.replace('_', '');
20
+ return '';
21
+ }
22
+ return `${attr}="${attrs[attr]}"`;
23
+ })
24
+ .filter(attr => !!attr)
25
+ .join(' ');
26
+
27
+ if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
28
+ return `<${tag} ${attrsString} />`.trim();
29
+ }
30
+ const childrenContent = children
31
+ .filter(c => !!c)
32
+ .map(c => (Array.isArray(c) ? c.join('') : c))
33
+ .join('');
34
+ return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
35
+ }
36
+
37
+ var Fragment = jsxRuntime.Fragment = ({children} = {}) => {
38
+ return '';
39
+ };
40
+
41
+ var jsx_1 = jsxRuntime.jsx = jsx;
416
42
  var jsxs = jsxRuntime.jsxs = jsx;
417
43
 
418
44
  exports.Fragment = Fragment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wiajs/core",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "wia app core package",
5
5
  "main": "./dist/core.cjs",
6
6
  "module": "./dist/core.mjs",