@vue/shared 3.3.0-alpha.3 → 3.3.0-alpha.5
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/shared.cjs.js +94 -94
- package/dist/shared.cjs.prod.js +94 -94
- package/dist/shared.d.ts +72 -71
- package/dist/shared.esm-bundler.js +94 -94
- package/package.json +1 -1
package/dist/shared.cjs.js
CHANGED
|
@@ -11,6 +11,100 @@ function makeMap(str, expectsLowerCase) {
|
|
|
11
11
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const EMPTY_OBJ = Object.freeze({}) ;
|
|
15
|
+
const EMPTY_ARR = Object.freeze([]) ;
|
|
16
|
+
const NOOP = () => {
|
|
17
|
+
};
|
|
18
|
+
const NO = () => false;
|
|
19
|
+
const onRE = /^on[^a-z]/;
|
|
20
|
+
const isOn = (key) => onRE.test(key);
|
|
21
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
22
|
+
const extend = Object.assign;
|
|
23
|
+
const remove = (arr, el) => {
|
|
24
|
+
const i = arr.indexOf(el);
|
|
25
|
+
if (i > -1) {
|
|
26
|
+
arr.splice(i, 1);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
30
|
+
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
31
|
+
const isArray = Array.isArray;
|
|
32
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
33
|
+
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
34
|
+
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
35
|
+
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
36
|
+
const isFunction = (val) => typeof val === "function";
|
|
37
|
+
const isString = (val) => typeof val === "string";
|
|
38
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
39
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
40
|
+
const isPromise = (val) => {
|
|
41
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
42
|
+
};
|
|
43
|
+
const objectToString = Object.prototype.toString;
|
|
44
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
45
|
+
const toRawType = (value) => {
|
|
46
|
+
return toTypeString(value).slice(8, -1);
|
|
47
|
+
};
|
|
48
|
+
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
49
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
50
|
+
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
51
|
+
// the leading comma is intentional so empty string "" is also included
|
|
52
|
+
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
53
|
+
);
|
|
54
|
+
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
55
|
+
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
56
|
+
);
|
|
57
|
+
const cacheStringFunction = (fn) => {
|
|
58
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
59
|
+
return (str) => {
|
|
60
|
+
const hit = cache[str];
|
|
61
|
+
return hit || (cache[str] = fn(str));
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const camelizeRE = /-(\w)/g;
|
|
65
|
+
const camelize = cacheStringFunction((str) => {
|
|
66
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
67
|
+
});
|
|
68
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
69
|
+
const hyphenate = cacheStringFunction(
|
|
70
|
+
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
71
|
+
);
|
|
72
|
+
const capitalize = cacheStringFunction(
|
|
73
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
74
|
+
);
|
|
75
|
+
const toHandlerKey = cacheStringFunction(
|
|
76
|
+
(str) => str ? `on${capitalize(str)}` : ``
|
|
77
|
+
);
|
|
78
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
79
|
+
const invokeArrayFns = (fns, arg) => {
|
|
80
|
+
for (let i = 0; i < fns.length; i++) {
|
|
81
|
+
fns[i](arg);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const def = (obj, key, value) => {
|
|
85
|
+
Object.defineProperty(obj, key, {
|
|
86
|
+
configurable: true,
|
|
87
|
+
enumerable: false,
|
|
88
|
+
value
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const looseToNumber = (val) => {
|
|
92
|
+
const n = parseFloat(val);
|
|
93
|
+
return isNaN(n) ? val : n;
|
|
94
|
+
};
|
|
95
|
+
const toNumber = (val) => {
|
|
96
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
97
|
+
return isNaN(n) ? val : n;
|
|
98
|
+
};
|
|
99
|
+
let _globalThis;
|
|
100
|
+
const getGlobalThis = () => {
|
|
101
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
102
|
+
};
|
|
103
|
+
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
104
|
+
function genPropsAccessExp(name) {
|
|
105
|
+
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
106
|
+
}
|
|
107
|
+
|
|
14
108
|
const PatchFlagNames = {
|
|
15
109
|
[1]: `TEXT`,
|
|
16
110
|
[2]: `CLASS`,
|
|
@@ -315,100 +409,6 @@ const replacer = (_key, val) => {
|
|
|
315
409
|
return val;
|
|
316
410
|
};
|
|
317
411
|
|
|
318
|
-
const EMPTY_OBJ = Object.freeze({}) ;
|
|
319
|
-
const EMPTY_ARR = Object.freeze([]) ;
|
|
320
|
-
const NOOP = () => {
|
|
321
|
-
};
|
|
322
|
-
const NO = () => false;
|
|
323
|
-
const onRE = /^on[^a-z]/;
|
|
324
|
-
const isOn = (key) => onRE.test(key);
|
|
325
|
-
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
326
|
-
const extend = Object.assign;
|
|
327
|
-
const remove = (arr, el) => {
|
|
328
|
-
const i = arr.indexOf(el);
|
|
329
|
-
if (i > -1) {
|
|
330
|
-
arr.splice(i, 1);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
334
|
-
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
335
|
-
const isArray = Array.isArray;
|
|
336
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
337
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
338
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
339
|
-
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
340
|
-
const isFunction = (val) => typeof val === "function";
|
|
341
|
-
const isString = (val) => typeof val === "string";
|
|
342
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
343
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
344
|
-
const isPromise = (val) => {
|
|
345
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
346
|
-
};
|
|
347
|
-
const objectToString = Object.prototype.toString;
|
|
348
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
349
|
-
const toRawType = (value) => {
|
|
350
|
-
return toTypeString(value).slice(8, -1);
|
|
351
|
-
};
|
|
352
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
353
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
354
|
-
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
355
|
-
// the leading comma is intentional so empty string "" is also included
|
|
356
|
-
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
357
|
-
);
|
|
358
|
-
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
359
|
-
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
360
|
-
);
|
|
361
|
-
const cacheStringFunction = (fn) => {
|
|
362
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
363
|
-
return (str) => {
|
|
364
|
-
const hit = cache[str];
|
|
365
|
-
return hit || (cache[str] = fn(str));
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
const camelizeRE = /-(\w)/g;
|
|
369
|
-
const camelize = cacheStringFunction((str) => {
|
|
370
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
371
|
-
});
|
|
372
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
373
|
-
const hyphenate = cacheStringFunction(
|
|
374
|
-
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
375
|
-
);
|
|
376
|
-
const capitalize = cacheStringFunction(
|
|
377
|
-
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
378
|
-
);
|
|
379
|
-
const toHandlerKey = cacheStringFunction(
|
|
380
|
-
(str) => str ? `on${capitalize(str)}` : ``
|
|
381
|
-
);
|
|
382
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
383
|
-
const invokeArrayFns = (fns, arg) => {
|
|
384
|
-
for (let i = 0; i < fns.length; i++) {
|
|
385
|
-
fns[i](arg);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
const def = (obj, key, value) => {
|
|
389
|
-
Object.defineProperty(obj, key, {
|
|
390
|
-
configurable: true,
|
|
391
|
-
enumerable: false,
|
|
392
|
-
value
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
const looseToNumber = (val) => {
|
|
396
|
-
const n = parseFloat(val);
|
|
397
|
-
return isNaN(n) ? val : n;
|
|
398
|
-
};
|
|
399
|
-
const toNumber = (val) => {
|
|
400
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
401
|
-
return isNaN(n) ? val : n;
|
|
402
|
-
};
|
|
403
|
-
let _globalThis;
|
|
404
|
-
const getGlobalThis = () => {
|
|
405
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
406
|
-
};
|
|
407
|
-
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
408
|
-
function genPropsAccessExp(name) {
|
|
409
|
-
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
412
|
exports.EMPTY_ARR = EMPTY_ARR;
|
|
413
413
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
|
414
414
|
exports.NO = NO;
|
package/dist/shared.cjs.prod.js
CHANGED
|
@@ -11,6 +11,100 @@ function makeMap(str, expectsLowerCase) {
|
|
|
11
11
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const EMPTY_OBJ = {};
|
|
15
|
+
const EMPTY_ARR = [];
|
|
16
|
+
const NOOP = () => {
|
|
17
|
+
};
|
|
18
|
+
const NO = () => false;
|
|
19
|
+
const onRE = /^on[^a-z]/;
|
|
20
|
+
const isOn = (key) => onRE.test(key);
|
|
21
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
22
|
+
const extend = Object.assign;
|
|
23
|
+
const remove = (arr, el) => {
|
|
24
|
+
const i = arr.indexOf(el);
|
|
25
|
+
if (i > -1) {
|
|
26
|
+
arr.splice(i, 1);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
30
|
+
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
31
|
+
const isArray = Array.isArray;
|
|
32
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
33
|
+
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
34
|
+
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
35
|
+
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
36
|
+
const isFunction = (val) => typeof val === "function";
|
|
37
|
+
const isString = (val) => typeof val === "string";
|
|
38
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
39
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
40
|
+
const isPromise = (val) => {
|
|
41
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
42
|
+
};
|
|
43
|
+
const objectToString = Object.prototype.toString;
|
|
44
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
45
|
+
const toRawType = (value) => {
|
|
46
|
+
return toTypeString(value).slice(8, -1);
|
|
47
|
+
};
|
|
48
|
+
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
49
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
50
|
+
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
51
|
+
// the leading comma is intentional so empty string "" is also included
|
|
52
|
+
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
53
|
+
);
|
|
54
|
+
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
55
|
+
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
56
|
+
);
|
|
57
|
+
const cacheStringFunction = (fn) => {
|
|
58
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
59
|
+
return (str) => {
|
|
60
|
+
const hit = cache[str];
|
|
61
|
+
return hit || (cache[str] = fn(str));
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const camelizeRE = /-(\w)/g;
|
|
65
|
+
const camelize = cacheStringFunction((str) => {
|
|
66
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
67
|
+
});
|
|
68
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
69
|
+
const hyphenate = cacheStringFunction(
|
|
70
|
+
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
71
|
+
);
|
|
72
|
+
const capitalize = cacheStringFunction(
|
|
73
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
74
|
+
);
|
|
75
|
+
const toHandlerKey = cacheStringFunction(
|
|
76
|
+
(str) => str ? `on${capitalize(str)}` : ``
|
|
77
|
+
);
|
|
78
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
79
|
+
const invokeArrayFns = (fns, arg) => {
|
|
80
|
+
for (let i = 0; i < fns.length; i++) {
|
|
81
|
+
fns[i](arg);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const def = (obj, key, value) => {
|
|
85
|
+
Object.defineProperty(obj, key, {
|
|
86
|
+
configurable: true,
|
|
87
|
+
enumerable: false,
|
|
88
|
+
value
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const looseToNumber = (val) => {
|
|
92
|
+
const n = parseFloat(val);
|
|
93
|
+
return isNaN(n) ? val : n;
|
|
94
|
+
};
|
|
95
|
+
const toNumber = (val) => {
|
|
96
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
97
|
+
return isNaN(n) ? val : n;
|
|
98
|
+
};
|
|
99
|
+
let _globalThis;
|
|
100
|
+
const getGlobalThis = () => {
|
|
101
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
102
|
+
};
|
|
103
|
+
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
104
|
+
function genPropsAccessExp(name) {
|
|
105
|
+
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
106
|
+
}
|
|
107
|
+
|
|
14
108
|
const PatchFlagNames = {
|
|
15
109
|
[1]: `TEXT`,
|
|
16
110
|
[2]: `CLASS`,
|
|
@@ -315,100 +409,6 @@ const replacer = (_key, val) => {
|
|
|
315
409
|
return val;
|
|
316
410
|
};
|
|
317
411
|
|
|
318
|
-
const EMPTY_OBJ = {};
|
|
319
|
-
const EMPTY_ARR = [];
|
|
320
|
-
const NOOP = () => {
|
|
321
|
-
};
|
|
322
|
-
const NO = () => false;
|
|
323
|
-
const onRE = /^on[^a-z]/;
|
|
324
|
-
const isOn = (key) => onRE.test(key);
|
|
325
|
-
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
326
|
-
const extend = Object.assign;
|
|
327
|
-
const remove = (arr, el) => {
|
|
328
|
-
const i = arr.indexOf(el);
|
|
329
|
-
if (i > -1) {
|
|
330
|
-
arr.splice(i, 1);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
334
|
-
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
335
|
-
const isArray = Array.isArray;
|
|
336
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
337
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
338
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
339
|
-
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
340
|
-
const isFunction = (val) => typeof val === "function";
|
|
341
|
-
const isString = (val) => typeof val === "string";
|
|
342
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
343
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
344
|
-
const isPromise = (val) => {
|
|
345
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
346
|
-
};
|
|
347
|
-
const objectToString = Object.prototype.toString;
|
|
348
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
349
|
-
const toRawType = (value) => {
|
|
350
|
-
return toTypeString(value).slice(8, -1);
|
|
351
|
-
};
|
|
352
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
353
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
354
|
-
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
355
|
-
// the leading comma is intentional so empty string "" is also included
|
|
356
|
-
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
357
|
-
);
|
|
358
|
-
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
359
|
-
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
360
|
-
);
|
|
361
|
-
const cacheStringFunction = (fn) => {
|
|
362
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
363
|
-
return (str) => {
|
|
364
|
-
const hit = cache[str];
|
|
365
|
-
return hit || (cache[str] = fn(str));
|
|
366
|
-
};
|
|
367
|
-
};
|
|
368
|
-
const camelizeRE = /-(\w)/g;
|
|
369
|
-
const camelize = cacheStringFunction((str) => {
|
|
370
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
371
|
-
});
|
|
372
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
373
|
-
const hyphenate = cacheStringFunction(
|
|
374
|
-
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
375
|
-
);
|
|
376
|
-
const capitalize = cacheStringFunction(
|
|
377
|
-
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
378
|
-
);
|
|
379
|
-
const toHandlerKey = cacheStringFunction(
|
|
380
|
-
(str) => str ? `on${capitalize(str)}` : ``
|
|
381
|
-
);
|
|
382
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
383
|
-
const invokeArrayFns = (fns, arg) => {
|
|
384
|
-
for (let i = 0; i < fns.length; i++) {
|
|
385
|
-
fns[i](arg);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
const def = (obj, key, value) => {
|
|
389
|
-
Object.defineProperty(obj, key, {
|
|
390
|
-
configurable: true,
|
|
391
|
-
enumerable: false,
|
|
392
|
-
value
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
const looseToNumber = (val) => {
|
|
396
|
-
const n = parseFloat(val);
|
|
397
|
-
return isNaN(n) ? val : n;
|
|
398
|
-
};
|
|
399
|
-
const toNumber = (val) => {
|
|
400
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
401
|
-
return isNaN(n) ? val : n;
|
|
402
|
-
};
|
|
403
|
-
let _globalThis;
|
|
404
|
-
const getGlobalThis = () => {
|
|
405
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
406
|
-
};
|
|
407
|
-
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
408
|
-
function genPropsAccessExp(name) {
|
|
409
|
-
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
412
|
exports.EMPTY_ARR = EMPTY_ARR;
|
|
413
413
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
|
414
414
|
exports.NO = NO;
|
package/dist/shared.d.ts
CHANGED
|
@@ -7,6 +7,74 @@
|
|
|
7
7
|
*/
|
|
8
8
|
declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
|
9
9
|
|
|
10
|
+
declare const EMPTY_OBJ: {
|
|
11
|
+
readonly [key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
declare const EMPTY_ARR: readonly never[];
|
|
14
|
+
declare const NOOP: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Always return false.
|
|
17
|
+
*/
|
|
18
|
+
declare const NO: () => boolean;
|
|
19
|
+
declare const isOn: (key: string) => boolean;
|
|
20
|
+
declare const isModelListener: (key: string) => boolean;
|
|
21
|
+
declare const extend: {
|
|
22
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
|
23
|
+
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
24
|
+
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
25
|
+
(target: object, ...sources: any[]): any;
|
|
26
|
+
};
|
|
27
|
+
declare const remove: <T>(arr: T[], el: T) => void;
|
|
28
|
+
declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
|
29
|
+
declare const isArray: (arg: any) => arg is any[];
|
|
30
|
+
declare const isMap: (val: unknown) => val is Map<any, any>;
|
|
31
|
+
declare const isSet: (val: unknown) => val is Set<any>;
|
|
32
|
+
declare const isDate: (val: unknown) => val is Date;
|
|
33
|
+
declare const isRegExp: (val: unknown) => val is RegExp;
|
|
34
|
+
declare const isFunction: (val: unknown) => val is Function;
|
|
35
|
+
declare const isString: (val: unknown) => val is string;
|
|
36
|
+
declare const isSymbol: (val: unknown) => val is symbol;
|
|
37
|
+
declare const isObject: (val: unknown) => val is Record<any, any>;
|
|
38
|
+
declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
39
|
+
declare const objectToString: () => string;
|
|
40
|
+
declare const toTypeString: (value: unknown) => string;
|
|
41
|
+
declare const toRawType: (value: unknown) => string;
|
|
42
|
+
declare const isPlainObject: (val: unknown) => val is object;
|
|
43
|
+
declare const isIntegerKey: (key: unknown) => boolean;
|
|
44
|
+
declare const isReservedProp: (key: string) => boolean;
|
|
45
|
+
declare const isBuiltInDirective: (key: string) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
declare const camelize: (str: string) => string;
|
|
50
|
+
/**
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
declare const hyphenate: (str: string) => string;
|
|
54
|
+
/**
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
declare const capitalize: (str: string) => string;
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
declare const toHandlerKey: (str: string) => string;
|
|
62
|
+
declare const hasChanged: (value: any, oldValue: any) => boolean;
|
|
63
|
+
declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
|
64
|
+
declare const def: (obj: object, key: string | symbol, value: any) => void;
|
|
65
|
+
/**
|
|
66
|
+
* "123-foo" will be parsed to 123
|
|
67
|
+
* This is used for the .number modifier in v-model
|
|
68
|
+
*/
|
|
69
|
+
declare const looseToNumber: (val: any) => any;
|
|
70
|
+
/**
|
|
71
|
+
* Only conerces number-like strings
|
|
72
|
+
* "123-foo" will be returned as-is
|
|
73
|
+
*/
|
|
74
|
+
declare const toNumber: (val: any) => any;
|
|
75
|
+
declare const getGlobalThis: () => any;
|
|
76
|
+
declare function genPropsAccessExp(name: string): string;
|
|
77
|
+
|
|
10
78
|
/**
|
|
11
79
|
* Patch flags are optimization hints generated by the compiler.
|
|
12
80
|
* when a block with dynamicChildren is encountered during diff, the algorithm
|
|
@@ -120,9 +188,7 @@ declare const enum PatchFlags {
|
|
|
120
188
|
/**
|
|
121
189
|
* dev only flag -> name mapping
|
|
122
190
|
*/
|
|
123
|
-
declare const PatchFlagNames:
|
|
124
|
-
[x: number]: string;
|
|
125
|
-
};
|
|
191
|
+
declare const PatchFlagNames: Record<PatchFlags, string>;
|
|
126
192
|
|
|
127
193
|
declare const enum ShapeFlags {
|
|
128
194
|
ELEMENT = 1,
|
|
@@ -231,78 +297,13 @@ declare function looseIndexOf(arr: any[], val: any): number;
|
|
|
231
297
|
*/
|
|
232
298
|
declare const toDisplayString: (val: unknown) => string;
|
|
233
299
|
|
|
300
|
+
export type Prettify<T> = {
|
|
301
|
+
[K in keyof T]: T[K];
|
|
302
|
+
} & {};
|
|
234
303
|
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
235
304
|
export type LooseRequired<T> = {
|
|
236
305
|
[P in keyof (T & Required<T>)]: T[P];
|
|
237
306
|
};
|
|
238
307
|
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
239
308
|
|
|
240
|
-
declare const EMPTY_OBJ: {
|
|
241
|
-
readonly [key: string]: any;
|
|
242
|
-
};
|
|
243
|
-
declare const EMPTY_ARR: readonly never[];
|
|
244
|
-
declare const NOOP: () => void;
|
|
245
|
-
/**
|
|
246
|
-
* Always return false.
|
|
247
|
-
*/
|
|
248
|
-
declare const NO: () => boolean;
|
|
249
|
-
declare const isOn: (key: string) => boolean;
|
|
250
|
-
declare const isModelListener: (key: string) => boolean;
|
|
251
|
-
declare const extend: {
|
|
252
|
-
<T extends {}, U>(target: T, source: U): T & U;
|
|
253
|
-
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
254
|
-
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
255
|
-
(target: object, ...sources: any[]): any;
|
|
256
|
-
};
|
|
257
|
-
declare const remove: <T>(arr: T[], el: T) => void;
|
|
258
|
-
declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
|
259
|
-
declare const isArray: (arg: any) => arg is any[];
|
|
260
|
-
declare const isMap: (val: unknown) => val is Map<any, any>;
|
|
261
|
-
declare const isSet: (val: unknown) => val is Set<any>;
|
|
262
|
-
declare const isDate: (val: unknown) => val is Date;
|
|
263
|
-
declare const isRegExp: (val: unknown) => val is RegExp;
|
|
264
|
-
declare const isFunction: (val: unknown) => val is Function;
|
|
265
|
-
declare const isString: (val: unknown) => val is string;
|
|
266
|
-
declare const isSymbol: (val: unknown) => val is symbol;
|
|
267
|
-
declare const isObject: (val: unknown) => val is Record<any, any>;
|
|
268
|
-
declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
269
|
-
declare const objectToString: () => string;
|
|
270
|
-
declare const toTypeString: (value: unknown) => string;
|
|
271
|
-
declare const toRawType: (value: unknown) => string;
|
|
272
|
-
declare const isPlainObject: (val: unknown) => val is object;
|
|
273
|
-
declare const isIntegerKey: (key: unknown) => boolean;
|
|
274
|
-
declare const isReservedProp: (key: string) => boolean;
|
|
275
|
-
declare const isBuiltInDirective: (key: string) => boolean;
|
|
276
|
-
/**
|
|
277
|
-
* @private
|
|
278
|
-
*/
|
|
279
|
-
declare const camelize: (str: string) => string;
|
|
280
|
-
/**
|
|
281
|
-
* @private
|
|
282
|
-
*/
|
|
283
|
-
declare const hyphenate: (str: string) => string;
|
|
284
|
-
/**
|
|
285
|
-
* @private
|
|
286
|
-
*/
|
|
287
|
-
declare const capitalize: (str: string) => string;
|
|
288
|
-
/**
|
|
289
|
-
* @private
|
|
290
|
-
*/
|
|
291
|
-
declare const toHandlerKey: (str: string) => string;
|
|
292
|
-
declare const hasChanged: (value: any, oldValue: any) => boolean;
|
|
293
|
-
declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
|
294
|
-
declare const def: (obj: object, key: string | symbol, value: any) => void;
|
|
295
|
-
/**
|
|
296
|
-
* "123-foo" will be parsed to 123
|
|
297
|
-
* This is used for the .number modifier in v-model
|
|
298
|
-
*/
|
|
299
|
-
declare const looseToNumber: (val: any) => any;
|
|
300
|
-
/**
|
|
301
|
-
* Only conerces number-like strings
|
|
302
|
-
* "123-foo" will be returned as-is
|
|
303
|
-
*/
|
|
304
|
-
declare const toNumber: (val: any) => any;
|
|
305
|
-
declare const getGlobalThis: () => any;
|
|
306
|
-
declare function genPropsAccessExp(name: string): string;
|
|
307
|
-
|
|
308
309
|
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
|
@@ -7,6 +7,100 @@ function makeMap(str, expectsLowerCase) {
|
|
|
7
7
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
const EMPTY_OBJ = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
|
|
11
|
+
const EMPTY_ARR = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [];
|
|
12
|
+
const NOOP = () => {
|
|
13
|
+
};
|
|
14
|
+
const NO = () => false;
|
|
15
|
+
const onRE = /^on[^a-z]/;
|
|
16
|
+
const isOn = (key) => onRE.test(key);
|
|
17
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
18
|
+
const extend = Object.assign;
|
|
19
|
+
const remove = (arr, el) => {
|
|
20
|
+
const i = arr.indexOf(el);
|
|
21
|
+
if (i > -1) {
|
|
22
|
+
arr.splice(i, 1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
26
|
+
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
27
|
+
const isArray = Array.isArray;
|
|
28
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
29
|
+
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
30
|
+
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
31
|
+
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
32
|
+
const isFunction = (val) => typeof val === "function";
|
|
33
|
+
const isString = (val) => typeof val === "string";
|
|
34
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
35
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
36
|
+
const isPromise = (val) => {
|
|
37
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
38
|
+
};
|
|
39
|
+
const objectToString = Object.prototype.toString;
|
|
40
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
41
|
+
const toRawType = (value) => {
|
|
42
|
+
return toTypeString(value).slice(8, -1);
|
|
43
|
+
};
|
|
44
|
+
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
45
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
46
|
+
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
47
|
+
// the leading comma is intentional so empty string "" is also included
|
|
48
|
+
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
49
|
+
);
|
|
50
|
+
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
51
|
+
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
52
|
+
);
|
|
53
|
+
const cacheStringFunction = (fn) => {
|
|
54
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
55
|
+
return (str) => {
|
|
56
|
+
const hit = cache[str];
|
|
57
|
+
return hit || (cache[str] = fn(str));
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const camelizeRE = /-(\w)/g;
|
|
61
|
+
const camelize = cacheStringFunction((str) => {
|
|
62
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
63
|
+
});
|
|
64
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
65
|
+
const hyphenate = cacheStringFunction(
|
|
66
|
+
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
67
|
+
);
|
|
68
|
+
const capitalize = cacheStringFunction(
|
|
69
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
70
|
+
);
|
|
71
|
+
const toHandlerKey = cacheStringFunction(
|
|
72
|
+
(str) => str ? `on${capitalize(str)}` : ``
|
|
73
|
+
);
|
|
74
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
75
|
+
const invokeArrayFns = (fns, arg) => {
|
|
76
|
+
for (let i = 0; i < fns.length; i++) {
|
|
77
|
+
fns[i](arg);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const def = (obj, key, value) => {
|
|
81
|
+
Object.defineProperty(obj, key, {
|
|
82
|
+
configurable: true,
|
|
83
|
+
enumerable: false,
|
|
84
|
+
value
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const looseToNumber = (val) => {
|
|
88
|
+
const n = parseFloat(val);
|
|
89
|
+
return isNaN(n) ? val : n;
|
|
90
|
+
};
|
|
91
|
+
const toNumber = (val) => {
|
|
92
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
93
|
+
return isNaN(n) ? val : n;
|
|
94
|
+
};
|
|
95
|
+
let _globalThis;
|
|
96
|
+
const getGlobalThis = () => {
|
|
97
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
98
|
+
};
|
|
99
|
+
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
100
|
+
function genPropsAccessExp(name) {
|
|
101
|
+
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
102
|
+
}
|
|
103
|
+
|
|
10
104
|
const PatchFlagNames = {
|
|
11
105
|
[1]: `TEXT`,
|
|
12
106
|
[2]: `CLASS`,
|
|
@@ -311,98 +405,4 @@ const replacer = (_key, val) => {
|
|
|
311
405
|
return val;
|
|
312
406
|
};
|
|
313
407
|
|
|
314
|
-
const EMPTY_OBJ = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
|
|
315
|
-
const EMPTY_ARR = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [];
|
|
316
|
-
const NOOP = () => {
|
|
317
|
-
};
|
|
318
|
-
const NO = () => false;
|
|
319
|
-
const onRE = /^on[^a-z]/;
|
|
320
|
-
const isOn = (key) => onRE.test(key);
|
|
321
|
-
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
322
|
-
const extend = Object.assign;
|
|
323
|
-
const remove = (arr, el) => {
|
|
324
|
-
const i = arr.indexOf(el);
|
|
325
|
-
if (i > -1) {
|
|
326
|
-
arr.splice(i, 1);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
330
|
-
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
331
|
-
const isArray = Array.isArray;
|
|
332
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
333
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
334
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
335
|
-
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
336
|
-
const isFunction = (val) => typeof val === "function";
|
|
337
|
-
const isString = (val) => typeof val === "string";
|
|
338
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
339
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
340
|
-
const isPromise = (val) => {
|
|
341
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
342
|
-
};
|
|
343
|
-
const objectToString = Object.prototype.toString;
|
|
344
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
345
|
-
const toRawType = (value) => {
|
|
346
|
-
return toTypeString(value).slice(8, -1);
|
|
347
|
-
};
|
|
348
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
349
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
350
|
-
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
351
|
-
// the leading comma is intentional so empty string "" is also included
|
|
352
|
-
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
353
|
-
);
|
|
354
|
-
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
355
|
-
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
356
|
-
);
|
|
357
|
-
const cacheStringFunction = (fn) => {
|
|
358
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
359
|
-
return (str) => {
|
|
360
|
-
const hit = cache[str];
|
|
361
|
-
return hit || (cache[str] = fn(str));
|
|
362
|
-
};
|
|
363
|
-
};
|
|
364
|
-
const camelizeRE = /-(\w)/g;
|
|
365
|
-
const camelize = cacheStringFunction((str) => {
|
|
366
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
367
|
-
});
|
|
368
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
369
|
-
const hyphenate = cacheStringFunction(
|
|
370
|
-
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
371
|
-
);
|
|
372
|
-
const capitalize = cacheStringFunction(
|
|
373
|
-
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
374
|
-
);
|
|
375
|
-
const toHandlerKey = cacheStringFunction(
|
|
376
|
-
(str) => str ? `on${capitalize(str)}` : ``
|
|
377
|
-
);
|
|
378
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
379
|
-
const invokeArrayFns = (fns, arg) => {
|
|
380
|
-
for (let i = 0; i < fns.length; i++) {
|
|
381
|
-
fns[i](arg);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
const def = (obj, key, value) => {
|
|
385
|
-
Object.defineProperty(obj, key, {
|
|
386
|
-
configurable: true,
|
|
387
|
-
enumerable: false,
|
|
388
|
-
value
|
|
389
|
-
});
|
|
390
|
-
};
|
|
391
|
-
const looseToNumber = (val) => {
|
|
392
|
-
const n = parseFloat(val);
|
|
393
|
-
return isNaN(n) ? val : n;
|
|
394
|
-
};
|
|
395
|
-
const toNumber = (val) => {
|
|
396
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
397
|
-
return isNaN(n) ? val : n;
|
|
398
|
-
};
|
|
399
|
-
let _globalThis;
|
|
400
|
-
const getGlobalThis = () => {
|
|
401
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
402
|
-
};
|
|
403
|
-
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
404
|
-
function genPropsAccessExp(name) {
|
|
405
|
-
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
408
|
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|