@vue/shared 3.3.0-alpha.4 → 3.3.0-alpha.6

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.
@@ -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;
@@ -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
@@ -5,7 +5,75 @@
5
5
  * \/\*#\_\_PURE\_\_\*\/
6
6
  * So that rollup can tree-shake them if necessary.
7
7
  */
8
- declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
8
+ export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
9
+
10
+ export declare const EMPTY_OBJ: {
11
+ readonly [key: string]: any;
12
+ };
13
+ export declare const EMPTY_ARR: readonly never[];
14
+ export declare const NOOP: () => void;
15
+ /**
16
+ * Always return false.
17
+ */
18
+ export declare const NO: () => boolean;
19
+ export declare const isOn: (key: string) => boolean;
20
+ export declare const isModelListener: (key: string) => boolean;
21
+ export 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
+ export declare const remove: <T>(arr: T[], el: T) => void;
28
+ export declare const hasOwn: (val: object, key: string | symbol) => key is never;
29
+ export declare const isArray: (arg: any) => arg is any[];
30
+ export declare const isMap: (val: unknown) => val is Map<any, any>;
31
+ export declare const isSet: (val: unknown) => val is Set<any>;
32
+ export declare const isDate: (val: unknown) => val is Date;
33
+ export declare const isRegExp: (val: unknown) => val is RegExp;
34
+ export declare const isFunction: (val: unknown) => val is Function;
35
+ export declare const isString: (val: unknown) => val is string;
36
+ export declare const isSymbol: (val: unknown) => val is symbol;
37
+ export declare const isObject: (val: unknown) => val is Record<any, any>;
38
+ export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
39
+ export declare const objectToString: () => string;
40
+ export declare const toTypeString: (value: unknown) => string;
41
+ export declare const toRawType: (value: unknown) => string;
42
+ export declare const isPlainObject: (val: unknown) => val is object;
43
+ export declare const isIntegerKey: (key: unknown) => boolean;
44
+ export declare const isReservedProp: (key: string) => boolean;
45
+ export declare const isBuiltInDirective: (key: string) => boolean;
46
+ /**
47
+ * @private
48
+ */
49
+ export declare const camelize: (str: string) => string;
50
+ /**
51
+ * @private
52
+ */
53
+ export declare const hyphenate: (str: string) => string;
54
+ /**
55
+ * @private
56
+ */
57
+ export declare const capitalize: (str: string) => string;
58
+ /**
59
+ * @private
60
+ */
61
+ export declare const toHandlerKey: (str: string) => string;
62
+ export declare const hasChanged: (value: any, oldValue: any) => boolean;
63
+ export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
64
+ export 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
+ export declare const looseToNumber: (val: any) => any;
70
+ /**
71
+ * Only conerces number-like strings
72
+ * "123-foo" will be returned as-is
73
+ */
74
+ export declare const toNumber: (val: any) => any;
75
+ export declare const getGlobalThis: () => any;
76
+ export declare function genPropsAccessExp(name: string): string;
9
77
 
10
78
  /**
11
79
  * Patch flags are optimization hints generated by the compiler.
@@ -25,7 +93,7 @@ declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string)
25
93
  * Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the
26
94
  * flags are handled during diff.
27
95
  */
28
- declare const enum PatchFlags {
96
+ export declare const enum PatchFlags {
29
97
  /**
30
98
  * Indicates an element with dynamic textContent (children fast path)
31
99
  */
@@ -120,11 +188,9 @@ 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
+ export declare const PatchFlagNames: Record<PatchFlags, string>;
126
192
 
127
- declare const enum ShapeFlags {
193
+ export declare const enum ShapeFlags {
128
194
  ELEMENT = 1,
129
195
  FUNCTIONAL_COMPONENT = 2,
130
196
  STATEFUL_COMPONENT = 4,
@@ -138,7 +204,7 @@ declare const enum ShapeFlags {
138
204
  COMPONENT = 6
139
205
  }
140
206
 
141
- declare const enum SlotFlags {
207
+ export declare const enum SlotFlags {
142
208
  /**
143
209
  * Stable slots that only reference slot props or context state. The slot
144
210
  * can fully capture its own dependencies so when passed down the parent won't
@@ -162,147 +228,81 @@ declare const enum SlotFlags {
162
228
  /**
163
229
  * Dev only
164
230
  */
165
- declare const slotFlagsText: {
231
+ export declare const slotFlagsText: {
166
232
  1: string;
167
233
  2: string;
168
234
  3: string;
169
235
  };
170
236
 
171
- declare const isGloballyWhitelisted: (key: string) => boolean;
237
+ export declare const isGloballyWhitelisted: (key: string) => boolean;
172
238
 
173
- declare function generateCodeFrame(source: string, start?: number, end?: number): string;
239
+ export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
174
240
 
175
241
  export type NormalizedStyle = Record<string, string | number>;
176
- declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
177
- declare function parseStringStyle(cssText: string): NormalizedStyle;
178
- declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
179
- declare function normalizeClass(value: unknown): string;
180
- declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
242
+ export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
243
+ export declare function parseStringStyle(cssText: string): NormalizedStyle;
244
+ export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
245
+ export declare function normalizeClass(value: unknown): string;
246
+ export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
181
247
 
182
248
  /**
183
249
  * Compiler only.
184
250
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
185
251
  */
186
- declare const isHTMLTag: (key: string) => boolean;
252
+ export declare const isHTMLTag: (key: string) => boolean;
187
253
  /**
188
254
  * Compiler only.
189
255
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
190
256
  */
191
- declare const isSVGTag: (key: string) => boolean;
257
+ export declare const isSVGTag: (key: string) => boolean;
192
258
  /**
193
259
  * Compiler only.
194
260
  * Do NOT use in runtime code paths unless behind `__DEV__` flag.
195
261
  */
196
- declare const isVoidTag: (key: string) => boolean;
262
+ export declare const isVoidTag: (key: string) => boolean;
197
263
 
198
- declare const isSpecialBooleanAttr: (key: string) => boolean;
264
+ export declare const isSpecialBooleanAttr: (key: string) => boolean;
199
265
  /**
200
266
  * The full list is needed during SSR to produce the correct initial markup.
201
267
  */
202
- declare const isBooleanAttr: (key: string) => boolean;
268
+ export declare const isBooleanAttr: (key: string) => boolean;
203
269
  /**
204
270
  * Boolean attributes should be included if the value is truthy or ''.
205
271
  * e.g. `<select multiple>` compiles to `{ multiple: '' }`
206
272
  */
207
- declare function includeBooleanAttr(value: unknown): boolean;
208
- declare function isSSRSafeAttrName(name: string): boolean;
209
- declare const propsToAttrMap: Record<string, string | undefined>;
273
+ export declare function includeBooleanAttr(value: unknown): boolean;
274
+ export declare function isSSRSafeAttrName(name: string): boolean;
275
+ export declare const propsToAttrMap: Record<string, string | undefined>;
210
276
  /**
211
277
  * Known attributes, this is used for stringification of runtime static nodes
212
278
  * so that we don't stringify bindings that cannot be set from HTML.
213
279
  * Don't also forget to allow `data-*` and `aria-*`!
214
280
  * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
215
281
  */
216
- declare const isKnownHtmlAttr: (key: string) => boolean;
282
+ export declare const isKnownHtmlAttr: (key: string) => boolean;
217
283
  /**
218
284
  * Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
219
285
  */
220
- declare const isKnownSvgAttr: (key: string) => boolean;
286
+ export declare const isKnownSvgAttr: (key: string) => boolean;
221
287
 
222
- declare function escapeHtml(string: unknown): string;
223
- declare function escapeHtmlComment(src: string): string;
288
+ export declare function escapeHtml(string: unknown): string;
289
+ export declare function escapeHtmlComment(src: string): string;
224
290
 
225
- declare function looseEqual(a: any, b: any): boolean;
226
- declare function looseIndexOf(arr: any[], val: any): number;
291
+ export declare function looseEqual(a: any, b: any): boolean;
292
+ export declare function looseIndexOf(arr: any[], val: any): number;
227
293
 
228
294
  /**
229
295
  * For converting {{ interpolation }} values to displayed strings.
230
296
  * @private
231
297
  */
232
- declare const toDisplayString: (val: unknown) => string;
298
+ export 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
- 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/shared",
3
- "version": "3.3.0-alpha.4",
3
+ "version": "3.3.0-alpha.6",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",