@vue/shared 3.6.0-rc.13 → 3.6.0-rc.15
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 +48 -28
- package/dist/shared.cjs.prod.js +48 -28
- package/dist/shared.d.ts +19 -1
- package/dist/shared.esm-bundler.js +46 -29
- package/package.json +1 -1
package/dist/shared.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.6.0-rc.
|
|
2
|
+
* @vue/shared v3.6.0-rc.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -66,10 +66,18 @@ const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" &
|
|
|
66
66
|
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
67
67
|
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
|
|
68
68
|
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
69
|
+
const STRING_CACHE_MAX_SIZE = 1e4;
|
|
69
70
|
const cacheStringFunction = (fn) => {
|
|
70
|
-
|
|
71
|
+
let cache = Object.create(null);
|
|
72
|
+
let size = 0;
|
|
71
73
|
return ((str) => {
|
|
72
|
-
|
|
74
|
+
const hit = cache[str];
|
|
75
|
+
if (hit !== void 0) return hit;
|
|
76
|
+
if (++size > STRING_CACHE_MAX_SIZE) {
|
|
77
|
+
cache = Object.create(null);
|
|
78
|
+
size = 1;
|
|
79
|
+
}
|
|
80
|
+
return cache[str] = fn(str);
|
|
73
81
|
});
|
|
74
82
|
};
|
|
75
83
|
const camelizeRE = /-(\w)/g;
|
|
@@ -77,22 +85,22 @@ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
|
77
85
|
/**
|
|
78
86
|
* @private
|
|
79
87
|
*/
|
|
80
|
-
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
88
|
+
const camelize = /*@__PURE__*/ cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
81
89
|
const hyphenateRE = /\B([A-Z])/g;
|
|
82
90
|
/**
|
|
83
91
|
* @private
|
|
84
92
|
*/
|
|
85
|
-
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
93
|
+
const hyphenate = /*@__PURE__*/ cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
86
94
|
/**
|
|
87
95
|
* @private
|
|
88
96
|
*/
|
|
89
|
-
const capitalize = cacheStringFunction((str) => {
|
|
97
|
+
const capitalize = /*@__PURE__*/ cacheStringFunction((str) => {
|
|
90
98
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
91
99
|
});
|
|
92
100
|
/**
|
|
93
101
|
* @private
|
|
94
102
|
*/
|
|
95
|
-
const toHandlerKey = cacheStringFunction((str) => {
|
|
103
|
+
const toHandlerKey = /*@__PURE__*/ cacheStringFunction((str) => {
|
|
96
104
|
return str ? `on${capitalize(str)}` : ``;
|
|
97
105
|
});
|
|
98
106
|
/**
|
|
@@ -398,26 +406,11 @@ const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
|
|
|
398
406
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
399
407
|
*/
|
|
400
408
|
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
|
|
401
|
-
|
|
402
|
-
//#region packages/shared/src/domAttrConfig.ts
|
|
403
|
-
/**
|
|
404
|
-
* On the client we only need to offer special cases for boolean attributes that
|
|
405
|
-
* have different names from their corresponding dom properties:
|
|
406
|
-
* - itemscope -> N/A
|
|
407
|
-
* - allowfullscreen -> allowFullscreen
|
|
408
|
-
* - formnovalidate -> formNoValidate
|
|
409
|
-
* - ismap -> isMap
|
|
410
|
-
* - nomodule -> noModule
|
|
411
|
-
* - novalidate -> noValidate
|
|
412
|
-
* - playsinline -> playsInline
|
|
413
|
-
* - readonly -> readOnly
|
|
414
|
-
*/
|
|
415
|
-
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
|
|
416
|
-
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
409
|
+
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap("itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly");
|
|
417
410
|
/**
|
|
418
411
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
419
412
|
*/
|
|
420
|
-
const isBooleanAttr = /*@__PURE__*/ makeMap(
|
|
413
|
+
const isBooleanAttr = /*@__PURE__*/ makeMap("itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
421
414
|
/**
|
|
422
415
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
423
416
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -426,12 +419,10 @@ function includeBooleanAttr(value) {
|
|
|
426
419
|
return !!value || value === "";
|
|
427
420
|
}
|
|
428
421
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
|
|
429
|
-
const attrValidationCache = {};
|
|
430
422
|
function isSSRSafeAttrName(name) {
|
|
431
|
-
if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
|
|
432
423
|
const isUnsafe = unsafeAttrCharRE.test(name);
|
|
433
424
|
if (isUnsafe) console.error(`unsafe attribute name: ${name}`);
|
|
434
|
-
return
|
|
425
|
+
return !isUnsafe;
|
|
435
426
|
}
|
|
436
427
|
const propsToAttrMap = {
|
|
437
428
|
acceptCharset: "accept-charset",
|
|
@@ -712,7 +703,9 @@ const VaporBlockShape = {
|
|
|
712
703
|
"SINGLE_ROOT": 1,
|
|
713
704
|
"1": "SINGLE_ROOT",
|
|
714
705
|
"MULTI_ROOT": 2,
|
|
715
|
-
"2": "MULTI_ROOT"
|
|
706
|
+
"2": "MULTI_ROOT",
|
|
707
|
+
"ELSE_IF": 3,
|
|
708
|
+
"3": "ELSE_IF"
|
|
716
709
|
};
|
|
717
710
|
/**
|
|
718
711
|
* Bit layout for vapor `createIf` flags.
|
|
@@ -768,6 +761,30 @@ const VaporSlotFlags = {
|
|
|
768
761
|
function isForwardedSlot(flags) {
|
|
769
762
|
return !!(flags & 4);
|
|
770
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* The data of the comment a vapor server render opens the branch of a `v-if`
|
|
766
|
+
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
|
|
767
|
+
* and `<!--]-->` closes it like a fragment.
|
|
768
|
+
*/
|
|
769
|
+
function isVaporBranchStart(data) {
|
|
770
|
+
if (data.length < 2 || data.charCodeAt(0) !== 91) return false;
|
|
771
|
+
for (let i = 1; i < data.length; i++) {
|
|
772
|
+
const c = data.charCodeAt(i);
|
|
773
|
+
if (c < 48 || c > 57) return false;
|
|
774
|
+
}
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* The data of a comment opening a range only a vapor server render emits:
|
|
779
|
+
* `<!--{-->` around the render of a component, or a v-if branch's.
|
|
780
|
+
*/
|
|
781
|
+
function isVaporRangeStart(data) {
|
|
782
|
+
return data === "{" || isVaporBranchStart(data);
|
|
783
|
+
}
|
|
784
|
+
/** The data of the comment closing the range `open` opens. */
|
|
785
|
+
function rangeCloseOf(open) {
|
|
786
|
+
return open === "(" ? ")" : open === "{" ? "}" : "]";
|
|
787
|
+
}
|
|
771
788
|
function slotNotifiesBoundary(flags) {
|
|
772
789
|
return isForwardedSlot(flags) && !(flags & 2);
|
|
773
790
|
}
|
|
@@ -873,6 +890,8 @@ exports.isSet = isSet;
|
|
|
873
890
|
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
|
874
891
|
exports.isString = isString;
|
|
875
892
|
exports.isSymbol = isSymbol;
|
|
893
|
+
exports.isVaporBranchStart = isVaporBranchStart;
|
|
894
|
+
exports.isVaporRangeStart = isVaporRangeStart;
|
|
876
895
|
exports.isVoidTag = isVoidTag;
|
|
877
896
|
exports.looseEqual = looseEqual;
|
|
878
897
|
exports.looseIndexOf = looseIndexOf;
|
|
@@ -885,6 +904,7 @@ exports.normalizeStyle = normalizeStyle;
|
|
|
885
904
|
exports.objectToString = objectToString;
|
|
886
905
|
exports.parseStringStyle = parseStringStyle;
|
|
887
906
|
exports.propsToAttrMap = propsToAttrMap;
|
|
907
|
+
exports.rangeCloseOf = rangeCloseOf;
|
|
888
908
|
exports.remove = remove;
|
|
889
909
|
exports.shouldSetAsAttr = shouldSetAsAttr;
|
|
890
910
|
exports.slotFlagsText = slotFlagsText;
|
package/dist/shared.cjs.prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.6.0-rc.
|
|
2
|
+
* @vue/shared v3.6.0-rc.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -66,10 +66,18 @@ const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" &
|
|
|
66
66
|
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
67
67
|
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
|
|
68
68
|
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
69
|
+
const STRING_CACHE_MAX_SIZE = 1e4;
|
|
69
70
|
const cacheStringFunction = (fn) => {
|
|
70
|
-
|
|
71
|
+
let cache = Object.create(null);
|
|
72
|
+
let size = 0;
|
|
71
73
|
return ((str) => {
|
|
72
|
-
|
|
74
|
+
const hit = cache[str];
|
|
75
|
+
if (hit !== void 0) return hit;
|
|
76
|
+
if (++size > STRING_CACHE_MAX_SIZE) {
|
|
77
|
+
cache = Object.create(null);
|
|
78
|
+
size = 1;
|
|
79
|
+
}
|
|
80
|
+
return cache[str] = fn(str);
|
|
73
81
|
});
|
|
74
82
|
};
|
|
75
83
|
const camelizeRE = /-(\w)/g;
|
|
@@ -77,22 +85,22 @@ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
|
77
85
|
/**
|
|
78
86
|
* @private
|
|
79
87
|
*/
|
|
80
|
-
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
88
|
+
const camelize = /*@__PURE__*/ cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
81
89
|
const hyphenateRE = /\B([A-Z])/g;
|
|
82
90
|
/**
|
|
83
91
|
* @private
|
|
84
92
|
*/
|
|
85
|
-
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
93
|
+
const hyphenate = /*@__PURE__*/ cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
86
94
|
/**
|
|
87
95
|
* @private
|
|
88
96
|
*/
|
|
89
|
-
const capitalize = cacheStringFunction((str) => {
|
|
97
|
+
const capitalize = /*@__PURE__*/ cacheStringFunction((str) => {
|
|
90
98
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
91
99
|
});
|
|
92
100
|
/**
|
|
93
101
|
* @private
|
|
94
102
|
*/
|
|
95
|
-
const toHandlerKey = cacheStringFunction((str) => {
|
|
103
|
+
const toHandlerKey = /*@__PURE__*/ cacheStringFunction((str) => {
|
|
96
104
|
return str ? `on${capitalize(str)}` : ``;
|
|
97
105
|
});
|
|
98
106
|
/**
|
|
@@ -398,26 +406,11 @@ const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
|
|
|
398
406
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
399
407
|
*/
|
|
400
408
|
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
|
|
401
|
-
|
|
402
|
-
//#region packages/shared/src/domAttrConfig.ts
|
|
403
|
-
/**
|
|
404
|
-
* On the client we only need to offer special cases for boolean attributes that
|
|
405
|
-
* have different names from their corresponding dom properties:
|
|
406
|
-
* - itemscope -> N/A
|
|
407
|
-
* - allowfullscreen -> allowFullscreen
|
|
408
|
-
* - formnovalidate -> formNoValidate
|
|
409
|
-
* - ismap -> isMap
|
|
410
|
-
* - nomodule -> noModule
|
|
411
|
-
* - novalidate -> noValidate
|
|
412
|
-
* - playsinline -> playsInline
|
|
413
|
-
* - readonly -> readOnly
|
|
414
|
-
*/
|
|
415
|
-
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
|
|
416
|
-
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
409
|
+
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap("itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly");
|
|
417
410
|
/**
|
|
418
411
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
419
412
|
*/
|
|
420
|
-
const isBooleanAttr = /*@__PURE__*/ makeMap(
|
|
413
|
+
const isBooleanAttr = /*@__PURE__*/ makeMap("itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
421
414
|
/**
|
|
422
415
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
423
416
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -426,12 +419,10 @@ function includeBooleanAttr(value) {
|
|
|
426
419
|
return !!value || value === "";
|
|
427
420
|
}
|
|
428
421
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
|
|
429
|
-
const attrValidationCache = {};
|
|
430
422
|
function isSSRSafeAttrName(name) {
|
|
431
|
-
if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
|
|
432
423
|
const isUnsafe = unsafeAttrCharRE.test(name);
|
|
433
424
|
if (isUnsafe) console.error(`unsafe attribute name: ${name}`);
|
|
434
|
-
return
|
|
425
|
+
return !isUnsafe;
|
|
435
426
|
}
|
|
436
427
|
const propsToAttrMap = {
|
|
437
428
|
acceptCharset: "accept-charset",
|
|
@@ -712,7 +703,9 @@ const VaporBlockShape = {
|
|
|
712
703
|
"SINGLE_ROOT": 1,
|
|
713
704
|
"1": "SINGLE_ROOT",
|
|
714
705
|
"MULTI_ROOT": 2,
|
|
715
|
-
"2": "MULTI_ROOT"
|
|
706
|
+
"2": "MULTI_ROOT",
|
|
707
|
+
"ELSE_IF": 3,
|
|
708
|
+
"3": "ELSE_IF"
|
|
716
709
|
};
|
|
717
710
|
/**
|
|
718
711
|
* Bit layout for vapor `createIf` flags.
|
|
@@ -768,6 +761,30 @@ const VaporSlotFlags = {
|
|
|
768
761
|
function isForwardedSlot(flags) {
|
|
769
762
|
return !!(flags & 4);
|
|
770
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* The data of the comment a vapor server render opens the branch of a `v-if`
|
|
766
|
+
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
|
|
767
|
+
* and `<!--]-->` closes it like a fragment.
|
|
768
|
+
*/
|
|
769
|
+
function isVaporBranchStart(data) {
|
|
770
|
+
if (data.length < 2 || data.charCodeAt(0) !== 91) return false;
|
|
771
|
+
for (let i = 1; i < data.length; i++) {
|
|
772
|
+
const c = data.charCodeAt(i);
|
|
773
|
+
if (c < 48 || c > 57) return false;
|
|
774
|
+
}
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* The data of a comment opening a range only a vapor server render emits:
|
|
779
|
+
* `<!--{-->` around the render of a component, or a v-if branch's.
|
|
780
|
+
*/
|
|
781
|
+
function isVaporRangeStart(data) {
|
|
782
|
+
return data === "{" || isVaporBranchStart(data);
|
|
783
|
+
}
|
|
784
|
+
/** The data of the comment closing the range `open` opens. */
|
|
785
|
+
function rangeCloseOf(open) {
|
|
786
|
+
return open === "(" ? ")" : open === "{" ? "}" : "]";
|
|
787
|
+
}
|
|
771
788
|
function slotNotifiesBoundary(flags) {
|
|
772
789
|
return isForwardedSlot(flags) && !(flags & 2);
|
|
773
790
|
}
|
|
@@ -873,6 +890,8 @@ exports.isSet = isSet;
|
|
|
873
890
|
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
|
874
891
|
exports.isString = isString;
|
|
875
892
|
exports.isSymbol = isSymbol;
|
|
893
|
+
exports.isVaporBranchStart = isVaporBranchStart;
|
|
894
|
+
exports.isVaporRangeStart = isVaporRangeStart;
|
|
876
895
|
exports.isVoidTag = isVoidTag;
|
|
877
896
|
exports.looseEqual = looseEqual;
|
|
878
897
|
exports.looseIndexOf = looseIndexOf;
|
|
@@ -885,6 +904,7 @@ exports.normalizeStyle = normalizeStyle;
|
|
|
885
904
|
exports.objectToString = objectToString;
|
|
886
905
|
exports.parseStringStyle = parseStringStyle;
|
|
887
906
|
exports.propsToAttrMap = propsToAttrMap;
|
|
907
|
+
exports.rangeCloseOf = rangeCloseOf;
|
|
888
908
|
exports.remove = remove;
|
|
889
909
|
exports.shouldSetAsAttr = shouldSetAsAttr;
|
|
890
910
|
exports.slotFlagsText = slotFlagsText;
|
package/dist/shared.d.ts
CHANGED
|
@@ -428,7 +428,12 @@ export declare enum VaporVForFlags {
|
|
|
428
428
|
export declare enum VaporBlockShape {
|
|
429
429
|
EMPTY = 0,
|
|
430
430
|
SINGLE_ROOT = 1,
|
|
431
|
-
MULTI_ROOT = 2
|
|
431
|
+
MULTI_ROOT = 2,
|
|
432
|
+
/**
|
|
433
|
+
* A `createIf` false branch that is the `v-else-if` rest of the chain: a
|
|
434
|
+
* nested `createIf` that renders the chain's later branches.
|
|
435
|
+
*/
|
|
436
|
+
ELSE_IF = 3
|
|
432
437
|
}
|
|
433
438
|
/**
|
|
434
439
|
* Bit layout for vapor `createIf` flags.
|
|
@@ -498,6 +503,19 @@ export declare enum VaporSlotFlags {
|
|
|
498
503
|
FORWARDED = 4
|
|
499
504
|
}
|
|
500
505
|
export declare function isForwardedSlot(flags: number): boolean;
|
|
506
|
+
/**
|
|
507
|
+
* The data of the comment a vapor server render opens the branch of a `v-if`
|
|
508
|
+
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
|
|
509
|
+
* and `<!--]-->` closes it like a fragment.
|
|
510
|
+
*/
|
|
511
|
+
export declare function isVaporBranchStart(data: string): boolean;
|
|
512
|
+
/**
|
|
513
|
+
* The data of a comment opening a range only a vapor server render emits:
|
|
514
|
+
* `<!--{-->` around the render of a component, or a v-if branch's.
|
|
515
|
+
*/
|
|
516
|
+
export declare function isVaporRangeStart(data: string): boolean;
|
|
517
|
+
/** The data of the comment closing the range `open` opens. */
|
|
518
|
+
export declare function rangeCloseOf(open: string): string;
|
|
501
519
|
export declare function slotNotifiesBoundary(flags: number): boolean;
|
|
502
520
|
/**
|
|
503
521
|
* Per-slot-function metadata attached by the compiler as `fn._`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/shared v3.6.0-rc.
|
|
2
|
+
* @vue/shared v3.6.0-rc.15
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -62,10 +62,18 @@ const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" &
|
|
|
62
62
|
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
63
63
|
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
|
|
64
64
|
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
65
|
+
const STRING_CACHE_MAX_SIZE = 1e4;
|
|
65
66
|
const cacheStringFunction = (fn) => {
|
|
66
|
-
|
|
67
|
+
let cache = Object.create(null);
|
|
68
|
+
let size = 0;
|
|
67
69
|
return ((str) => {
|
|
68
|
-
|
|
70
|
+
const hit = cache[str];
|
|
71
|
+
if (hit !== void 0) return hit;
|
|
72
|
+
if (++size > STRING_CACHE_MAX_SIZE) {
|
|
73
|
+
cache = Object.create(null);
|
|
74
|
+
size = 1;
|
|
75
|
+
}
|
|
76
|
+
return cache[str] = fn(str);
|
|
69
77
|
});
|
|
70
78
|
};
|
|
71
79
|
const camelizeRE = /-(\w)/g;
|
|
@@ -73,22 +81,22 @@ const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
|
73
81
|
/**
|
|
74
82
|
* @private
|
|
75
83
|
*/
|
|
76
|
-
const camelize = cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
84
|
+
const camelize = /*@__PURE__*/ cacheStringFunction((str) => str.replace(camelizeRE, camelizeReplacer));
|
|
77
85
|
const hyphenateRE = /\B([A-Z])/g;
|
|
78
86
|
/**
|
|
79
87
|
* @private
|
|
80
88
|
*/
|
|
81
|
-
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
89
|
+
const hyphenate = /*@__PURE__*/ cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
82
90
|
/**
|
|
83
91
|
* @private
|
|
84
92
|
*/
|
|
85
|
-
const capitalize = cacheStringFunction((str) => {
|
|
93
|
+
const capitalize = /*@__PURE__*/ cacheStringFunction((str) => {
|
|
86
94
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
87
95
|
});
|
|
88
96
|
/**
|
|
89
97
|
* @private
|
|
90
98
|
*/
|
|
91
|
-
const toHandlerKey = cacheStringFunction((str) => {
|
|
99
|
+
const toHandlerKey = /*@__PURE__*/ cacheStringFunction((str) => {
|
|
92
100
|
return str ? `on${capitalize(str)}` : ``;
|
|
93
101
|
});
|
|
94
102
|
/**
|
|
@@ -394,26 +402,11 @@ const isFormattingTag = /*@__PURE__*/ makeMap(FORMATTING_TAGS);
|
|
|
394
402
|
* Do NOT use in runtime code paths unless behind `!!(process.env.NODE_ENV !== 'production')` flag.
|
|
395
403
|
*/
|
|
396
404
|
const isAlwaysCloseTag = /*@__PURE__*/ makeMap(ALWAYS_CLOSE_TAGS);
|
|
397
|
-
|
|
398
|
-
//#region packages/shared/src/domAttrConfig.ts
|
|
399
|
-
/**
|
|
400
|
-
* On the client we only need to offer special cases for boolean attributes that
|
|
401
|
-
* have different names from their corresponding dom properties:
|
|
402
|
-
* - itemscope -> N/A
|
|
403
|
-
* - allowfullscreen -> allowFullscreen
|
|
404
|
-
* - formnovalidate -> formNoValidate
|
|
405
|
-
* - ismap -> isMap
|
|
406
|
-
* - nomodule -> noModule
|
|
407
|
-
* - novalidate -> noValidate
|
|
408
|
-
* - playsinline -> playsInline
|
|
409
|
-
* - readonly -> readOnly
|
|
410
|
-
*/
|
|
411
|
-
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`;
|
|
412
|
-
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
405
|
+
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap("itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly");
|
|
413
406
|
/**
|
|
414
407
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
415
408
|
*/
|
|
416
|
-
const isBooleanAttr = /*@__PURE__*/ makeMap(
|
|
409
|
+
const isBooleanAttr = /*@__PURE__*/ makeMap("itemscope,allowfullscreen,disablepictureinpicture,disableremoteplayback,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
417
410
|
/**
|
|
418
411
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
419
412
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -422,12 +415,10 @@ function includeBooleanAttr(value) {
|
|
|
422
415
|
return !!value || value === "";
|
|
423
416
|
}
|
|
424
417
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
|
|
425
|
-
const attrValidationCache = {};
|
|
426
418
|
function isSSRSafeAttrName(name) {
|
|
427
|
-
if (attrValidationCache.hasOwnProperty(name)) return attrValidationCache[name];
|
|
428
419
|
const isUnsafe = unsafeAttrCharRE.test(name);
|
|
429
420
|
if (isUnsafe) console.error(`unsafe attribute name: ${name}`);
|
|
430
|
-
return
|
|
421
|
+
return !isUnsafe;
|
|
431
422
|
}
|
|
432
423
|
const propsToAttrMap = {
|
|
433
424
|
acceptCharset: "accept-charset",
|
|
@@ -710,7 +701,9 @@ const VaporBlockShape = {
|
|
|
710
701
|
"SINGLE_ROOT": 1,
|
|
711
702
|
"1": "SINGLE_ROOT",
|
|
712
703
|
"MULTI_ROOT": 2,
|
|
713
|
-
"2": "MULTI_ROOT"
|
|
704
|
+
"2": "MULTI_ROOT",
|
|
705
|
+
"ELSE_IF": 3,
|
|
706
|
+
"3": "ELSE_IF"
|
|
714
707
|
};
|
|
715
708
|
/**
|
|
716
709
|
* Bit layout for vapor `createIf` flags.
|
|
@@ -766,6 +759,30 @@ const VaporSlotFlags = {
|
|
|
766
759
|
function isForwardedSlot(flags) {
|
|
767
760
|
return !!(flags & 4);
|
|
768
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* The data of the comment a vapor server render opens the branch of a `v-if`
|
|
764
|
+
* chain with, `<!--[1-->`: the digits are the branch's position in the chain,
|
|
765
|
+
* and `<!--]-->` closes it like a fragment.
|
|
766
|
+
*/
|
|
767
|
+
function isVaporBranchStart(data) {
|
|
768
|
+
if (data.length < 2 || data.charCodeAt(0) !== 91) return false;
|
|
769
|
+
for (let i = 1; i < data.length; i++) {
|
|
770
|
+
const c = data.charCodeAt(i);
|
|
771
|
+
if (c < 48 || c > 57) return false;
|
|
772
|
+
}
|
|
773
|
+
return true;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* The data of a comment opening a range only a vapor server render emits:
|
|
777
|
+
* `<!--{-->` around the render of a component, or a v-if branch's.
|
|
778
|
+
*/
|
|
779
|
+
function isVaporRangeStart(data) {
|
|
780
|
+
return data === "{" || isVaporBranchStart(data);
|
|
781
|
+
}
|
|
782
|
+
/** The data of the comment closing the range `open` opens. */
|
|
783
|
+
function rangeCloseOf(open) {
|
|
784
|
+
return open === "(" ? ")" : open === "{" ? "}" : "]";
|
|
785
|
+
}
|
|
769
786
|
function slotNotifiesBoundary(flags) {
|
|
770
787
|
return isForwardedSlot(flags) && !(flags & 2);
|
|
771
788
|
}
|
|
@@ -800,4 +817,4 @@ const VaporSingleRoot = {
|
|
|
800
817
|
"2": "SLOT"
|
|
801
818
|
};
|
|
802
819
|
//#endregion
|
|
803
|
-
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, TemplateFlags, VaporBlockShape, VaporDynamicComponentFlags, VaporIfFlags, VaporSingleRoot, VaporSlotFlags, VaporSlotStability, VaporVForFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isForwardedSlot, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, shouldSetAsAttr, slotFlagsText, slotNotifiesBoundary, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
|
820
|
+
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, Namespaces, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, TemplateFlags, VaporBlockShape, VaporDynamicComponentFlags, VaporIfFlags, VaporSingleRoot, VaporSlotFlags, VaporSlotStability, VaporVForFlags, YES, camelize, canSetValueDirectly, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, getModifierPropName, getSequence, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isAlwaysCloseTag, isArray, isBooleanAttr, isBuiltInDirective, isBuiltInTag, isDate, isFormattingTag, isForwardedSlot, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isNativeOn, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVaporBranchStart, isVaporRangeStart, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, rangeCloseOf, remove, shouldSetAsAttr, slotFlagsText, slotNotifiesBoundary, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|