@vue/shared 3.2.47 → 3.3.0-alpha.2
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 +299 -490
- package/dist/shared.cjs.prod.js +298 -488
- package/dist/shared.d.ts +308 -363
- package/dist/shared.esm-bundler.js +301 -493
- package/package.json +1 -1
|
@@ -1,600 +1,408 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Make a map and return a function for checking if a key
|
|
3
|
-
* is in that map.
|
|
4
|
-
* IMPORTANT: all calls of this function must be prefixed with
|
|
5
|
-
* \/\*#\_\_PURE\_\_\*\/
|
|
6
|
-
* So that rollup can tree-shake them if necessary.
|
|
7
|
-
*/
|
|
8
1
|
function makeMap(str, expectsLowerCase) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
3
|
+
const list = str.split(",");
|
|
4
|
+
for (let i = 0; i < list.length; i++) {
|
|
5
|
+
map[list[i]] = true;
|
|
6
|
+
}
|
|
7
|
+
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
15
8
|
}
|
|
16
9
|
|
|
17
|
-
/**
|
|
18
|
-
* dev only flag -> name mapping
|
|
19
|
-
*/
|
|
20
10
|
const PatchFlagNames = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
[1]: `TEXT`,
|
|
12
|
+
[2]: `CLASS`,
|
|
13
|
+
[4]: `STYLE`,
|
|
14
|
+
[8]: `PROPS`,
|
|
15
|
+
[16]: `FULL_PROPS`,
|
|
16
|
+
[32]: `HYDRATE_EVENTS`,
|
|
17
|
+
[64]: `STABLE_FRAGMENT`,
|
|
18
|
+
[128]: `KEYED_FRAGMENT`,
|
|
19
|
+
[256]: `UNKEYED_FRAGMENT`,
|
|
20
|
+
[512]: `NEED_PATCH`,
|
|
21
|
+
[1024]: `DYNAMIC_SLOTS`,
|
|
22
|
+
[2048]: `DEV_ROOT_FRAGMENT`,
|
|
23
|
+
[-1]: `HOISTED`,
|
|
24
|
+
[-2]: `BAIL`
|
|
35
25
|
};
|
|
36
26
|
|
|
37
|
-
/**
|
|
38
|
-
* Dev only
|
|
39
|
-
*/
|
|
40
27
|
const slotFlagsText = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
[1]: "STABLE",
|
|
29
|
+
[2]: "DYNAMIC",
|
|
30
|
+
[3]: "FORWARDED"
|
|
44
31
|
};
|
|
45
32
|
|
|
46
|
-
const GLOBALS_WHITE_LISTED =
|
|
47
|
-
|
|
48
|
-
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
|
49
|
-
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
|
33
|
+
const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
|
|
34
|
+
const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
|
|
50
35
|
|
|
51
36
|
const range = 2;
|
|
52
37
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const length = Math.max(Math.min(end - count, lineLength), 1);
|
|
84
|
-
res.push(` | ` + '^'.repeat(length));
|
|
85
|
-
}
|
|
86
|
-
count += lineLength + newLineSeqLength;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
break;
|
|
38
|
+
let lines = source.split(/(\r?\n)/);
|
|
39
|
+
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
|
40
|
+
lines = lines.filter((_, idx) => idx % 2 === 0);
|
|
41
|
+
let count = 0;
|
|
42
|
+
const res = [];
|
|
43
|
+
for (let i = 0; i < lines.length; i++) {
|
|
44
|
+
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
|
45
|
+
if (count >= start) {
|
|
46
|
+
for (let j = i - range; j <= i + range || end > count; j++) {
|
|
47
|
+
if (j < 0 || j >= lines.length)
|
|
48
|
+
continue;
|
|
49
|
+
const line = j + 1;
|
|
50
|
+
res.push(
|
|
51
|
+
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
|
52
|
+
);
|
|
53
|
+
const lineLength = lines[j].length;
|
|
54
|
+
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
|
55
|
+
if (j === i) {
|
|
56
|
+
const pad = start - (count - (lineLength + newLineSeqLength));
|
|
57
|
+
const length = Math.max(
|
|
58
|
+
1,
|
|
59
|
+
end > count ? lineLength - pad : end - start
|
|
60
|
+
);
|
|
61
|
+
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
|
62
|
+
} else if (j > i) {
|
|
63
|
+
if (end > count) {
|
|
64
|
+
const length = Math.max(Math.min(end - count, lineLength), 1);
|
|
65
|
+
res.push(` | ` + "^".repeat(length));
|
|
66
|
+
}
|
|
67
|
+
count += lineLength + newLineSeqLength;
|
|
90
68
|
}
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
91
71
|
}
|
|
92
|
-
|
|
72
|
+
}
|
|
73
|
+
return res.join("\n");
|
|
93
74
|
}
|
|
94
75
|
|
|
95
76
|
function normalizeStyle(value) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
for (const key in normalized) {
|
|
105
|
-
res[key] = normalized[key];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
77
|
+
if (isArray(value)) {
|
|
78
|
+
const res = {};
|
|
79
|
+
for (let i = 0; i < value.length; i++) {
|
|
80
|
+
const item = value[i];
|
|
81
|
+
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
|
82
|
+
if (normalized) {
|
|
83
|
+
for (const key in normalized) {
|
|
84
|
+
res[key] = normalized[key];
|
|
108
85
|
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
else if (isString(value)) {
|
|
112
|
-
return value;
|
|
113
|
-
}
|
|
114
|
-
else if (isObject(value)) {
|
|
115
|
-
return value;
|
|
86
|
+
}
|
|
116
87
|
}
|
|
88
|
+
return res;
|
|
89
|
+
} else if (isString(value)) {
|
|
90
|
+
return value;
|
|
91
|
+
} else if (isObject(value)) {
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
117
94
|
}
|
|
118
95
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
119
96
|
const propertyDelimiterRE = /:([^]+)/;
|
|
120
|
-
const styleCommentRE =
|
|
97
|
+
const styleCommentRE = new RegExp("\\/\\*.*?\\*\\/", "gs");
|
|
121
98
|
function parseStringStyle(cssText) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
return ret;
|
|
99
|
+
const ret = {};
|
|
100
|
+
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
101
|
+
if (item) {
|
|
102
|
+
const tmp = item.split(propertyDelimiterRE);
|
|
103
|
+
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return ret;
|
|
133
107
|
}
|
|
134
108
|
function stringifyStyle(styles) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return ret;
|
|
138
|
-
}
|
|
139
|
-
for (const key in styles) {
|
|
140
|
-
const value = styles[key];
|
|
141
|
-
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
|
142
|
-
if (isString(value) || typeof value === 'number') {
|
|
143
|
-
// only render valid values
|
|
144
|
-
ret += `${normalizedKey}:${value};`;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
109
|
+
let ret = "";
|
|
110
|
+
if (!styles || isString(styles)) {
|
|
147
111
|
return ret;
|
|
112
|
+
}
|
|
113
|
+
for (const key in styles) {
|
|
114
|
+
const value = styles[key];
|
|
115
|
+
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
|
116
|
+
if (isString(value) || typeof value === "number") {
|
|
117
|
+
ret += `${normalizedKey}:${value};`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return ret;
|
|
148
121
|
}
|
|
149
122
|
function normalizeClass(value) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
}
|
|
123
|
+
let res = "";
|
|
124
|
+
if (isString(value)) {
|
|
125
|
+
res = value;
|
|
126
|
+
} else if (isArray(value)) {
|
|
127
|
+
for (let i = 0; i < value.length; i++) {
|
|
128
|
+
const normalized = normalizeClass(value[i]);
|
|
129
|
+
if (normalized) {
|
|
130
|
+
res += normalized + " ";
|
|
131
|
+
}
|
|
161
132
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
133
|
+
} else if (isObject(value)) {
|
|
134
|
+
for (const name in value) {
|
|
135
|
+
if (value[name]) {
|
|
136
|
+
res += name + " ";
|
|
137
|
+
}
|
|
168
138
|
}
|
|
169
|
-
|
|
139
|
+
}
|
|
140
|
+
return res.trim();
|
|
170
141
|
}
|
|
171
142
|
function normalizeProps(props) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
143
|
+
if (!props)
|
|
144
|
+
return null;
|
|
145
|
+
let { class: klass, style } = props;
|
|
146
|
+
if (klass && !isString(klass)) {
|
|
147
|
+
props.class = normalizeClass(klass);
|
|
148
|
+
}
|
|
149
|
+
if (style) {
|
|
150
|
+
props.style = normalizeStyle(style);
|
|
151
|
+
}
|
|
152
|
+
return props;
|
|
182
153
|
}
|
|
183
154
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
|
191
|
-
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
|
192
|
-
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
|
193
|
-
'option,output,progress,select,textarea,details,dialog,menu,' +
|
|
194
|
-
'summary,template,blockquote,iframe,tfoot';
|
|
195
|
-
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
|
196
|
-
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
|
197
|
-
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
|
198
|
-
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
|
199
|
-
'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
|
200
|
-
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
|
201
|
-
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
|
202
|
-
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
|
203
|
-
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
|
204
|
-
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
|
205
|
-
'text,textPath,title,tspan,unknown,use,view';
|
|
206
|
-
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
|
207
|
-
/**
|
|
208
|
-
* Compiler only.
|
|
209
|
-
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
|
210
|
-
*/
|
|
211
|
-
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
|
212
|
-
/**
|
|
213
|
-
* Compiler only.
|
|
214
|
-
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
|
215
|
-
*/
|
|
216
|
-
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
|
217
|
-
/**
|
|
218
|
-
* Compiler only.
|
|
219
|
-
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
|
220
|
-
*/
|
|
221
|
-
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
|
155
|
+
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
|
156
|
+
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
|
157
|
+
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
|
158
|
+
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
|
159
|
+
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
|
160
|
+
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
|
222
161
|
|
|
223
|
-
/**
|
|
224
|
-
* On the client we only need to offer special cases for boolean attributes that
|
|
225
|
-
* have different names from their corresponding dom properties:
|
|
226
|
-
* - itemscope -> N/A
|
|
227
|
-
* - allowfullscreen -> allowFullscreen
|
|
228
|
-
* - formnovalidate -> formNoValidate
|
|
229
|
-
* - ismap -> isMap
|
|
230
|
-
* - nomodule -> noModule
|
|
231
|
-
* - novalidate -> noValidate
|
|
232
|
-
* - readonly -> readOnly
|
|
233
|
-
*/
|
|
234
162
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
235
|
-
const isSpecialBooleanAttr =
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
|
240
|
-
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
|
241
|
-
`loop,open,required,reversed,scoped,seamless,` +
|
|
242
|
-
`checked,muted,multiple,selected`);
|
|
243
|
-
/**
|
|
244
|
-
* Boolean attributes should be included if the value is truthy or ''.
|
|
245
|
-
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
246
|
-
*/
|
|
163
|
+
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
|
164
|
+
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
|
165
|
+
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
|
166
|
+
);
|
|
247
167
|
function includeBooleanAttr(value) {
|
|
248
|
-
|
|
168
|
+
return !!value || value === "";
|
|
249
169
|
}
|
|
250
170
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
|
251
171
|
const attrValidationCache = {};
|
|
252
172
|
function isSSRSafeAttrName(name) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
173
|
+
if (attrValidationCache.hasOwnProperty(name)) {
|
|
174
|
+
return attrValidationCache[name];
|
|
175
|
+
}
|
|
176
|
+
const isUnsafe = unsafeAttrCharRE.test(name);
|
|
177
|
+
if (isUnsafe) {
|
|
178
|
+
console.error(`unsafe attribute name: ${name}`);
|
|
179
|
+
}
|
|
180
|
+
return attrValidationCache[name] = !isUnsafe;
|
|
261
181
|
}
|
|
262
182
|
const propsToAttrMap = {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
183
|
+
acceptCharset: "accept-charset",
|
|
184
|
+
className: "class",
|
|
185
|
+
htmlFor: "for",
|
|
186
|
+
httpEquiv: "http-equiv"
|
|
267
187
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
|
275
|
-
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
|
276
|
-
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
|
277
|
-
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
|
278
|
-
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
|
279
|
-
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
|
280
|
-
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
|
281
|
-
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
|
282
|
-
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
|
283
|
-
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
|
284
|
-
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
|
285
|
-
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
|
286
|
-
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
|
287
|
-
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
|
288
|
-
`value,width,wrap`);
|
|
289
|
-
/**
|
|
290
|
-
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
291
|
-
*/
|
|
292
|
-
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
|
293
|
-
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
|
294
|
-
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
|
295
|
-
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
|
296
|
-
`color-interpolation-filters,color-profile,color-rendering,` +
|
|
297
|
-
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
|
298
|
-
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
|
299
|
-
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
|
300
|
-
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
|
301
|
-
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
|
302
|
-
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
|
303
|
-
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
|
304
|
-
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
|
305
|
-
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
|
306
|
-
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
|
307
|
-
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
|
308
|
-
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
|
309
|
-
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
|
310
|
-
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
|
311
|
-
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
|
312
|
-
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
|
313
|
-
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
|
314
|
-
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
|
315
|
-
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
|
316
|
-
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
|
317
|
-
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
|
318
|
-
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
|
319
|
-
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
|
320
|
-
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
|
321
|
-
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
|
322
|
-
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
|
323
|
-
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
|
324
|
-
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
|
325
|
-
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
|
326
|
-
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
|
327
|
-
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
|
328
|
-
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
|
329
|
-
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
|
330
|
-
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
|
188
|
+
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
|
189
|
+
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
|
190
|
+
);
|
|
191
|
+
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
|
192
|
+
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
|
193
|
+
);
|
|
331
194
|
|
|
332
195
|
const escapeRE = /["'&<>]/;
|
|
333
196
|
function escapeHtml(string) {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
197
|
+
const str = "" + string;
|
|
198
|
+
const match = escapeRE.exec(str);
|
|
199
|
+
if (!match) {
|
|
200
|
+
return str;
|
|
201
|
+
}
|
|
202
|
+
let html = "";
|
|
203
|
+
let escaped;
|
|
204
|
+
let index;
|
|
205
|
+
let lastIndex = 0;
|
|
206
|
+
for (index = match.index; index < str.length; index++) {
|
|
207
|
+
switch (str.charCodeAt(index)) {
|
|
208
|
+
case 34:
|
|
209
|
+
escaped = """;
|
|
210
|
+
break;
|
|
211
|
+
case 38:
|
|
212
|
+
escaped = "&";
|
|
213
|
+
break;
|
|
214
|
+
case 39:
|
|
215
|
+
escaped = "'";
|
|
216
|
+
break;
|
|
217
|
+
case 60:
|
|
218
|
+
escaped = "<";
|
|
219
|
+
break;
|
|
220
|
+
case 62:
|
|
221
|
+
escaped = ">";
|
|
222
|
+
break;
|
|
223
|
+
default:
|
|
224
|
+
continue;
|
|
338
225
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
let index;
|
|
342
|
-
let lastIndex = 0;
|
|
343
|
-
for (index = match.index; index < str.length; index++) {
|
|
344
|
-
switch (str.charCodeAt(index)) {
|
|
345
|
-
case 34: // "
|
|
346
|
-
escaped = '"';
|
|
347
|
-
break;
|
|
348
|
-
case 38: // &
|
|
349
|
-
escaped = '&';
|
|
350
|
-
break;
|
|
351
|
-
case 39: // '
|
|
352
|
-
escaped = ''';
|
|
353
|
-
break;
|
|
354
|
-
case 60: // <
|
|
355
|
-
escaped = '<';
|
|
356
|
-
break;
|
|
357
|
-
case 62: // >
|
|
358
|
-
escaped = '>';
|
|
359
|
-
break;
|
|
360
|
-
default:
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
if (lastIndex !== index) {
|
|
364
|
-
html += str.slice(lastIndex, index);
|
|
365
|
-
}
|
|
366
|
-
lastIndex = index + 1;
|
|
367
|
-
html += escaped;
|
|
226
|
+
if (lastIndex !== index) {
|
|
227
|
+
html += str.slice(lastIndex, index);
|
|
368
228
|
}
|
|
369
|
-
|
|
229
|
+
lastIndex = index + 1;
|
|
230
|
+
html += escaped;
|
|
231
|
+
}
|
|
232
|
+
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
|
370
233
|
}
|
|
371
|
-
// https://www.w3.org/TR/html52/syntax.html#comments
|
|
372
234
|
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
|
373
235
|
function escapeHtmlComment(src) {
|
|
374
|
-
|
|
236
|
+
return src.replace(commentStripRE, "");
|
|
375
237
|
}
|
|
376
238
|
|
|
377
239
|
function looseCompareArrays(a, b) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
240
|
+
if (a.length !== b.length)
|
|
241
|
+
return false;
|
|
242
|
+
let equal = true;
|
|
243
|
+
for (let i = 0; equal && i < a.length; i++) {
|
|
244
|
+
equal = looseEqual(a[i], b[i]);
|
|
245
|
+
}
|
|
246
|
+
return equal;
|
|
385
247
|
}
|
|
386
248
|
function looseEqual(a, b) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
249
|
+
if (a === b)
|
|
250
|
+
return true;
|
|
251
|
+
let aValidType = isDate(a);
|
|
252
|
+
let bValidType = isDate(b);
|
|
253
|
+
if (aValidType || bValidType) {
|
|
254
|
+
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
|
255
|
+
}
|
|
256
|
+
aValidType = isSymbol(a);
|
|
257
|
+
bValidType = isSymbol(b);
|
|
258
|
+
if (aValidType || bValidType) {
|
|
259
|
+
return a === b;
|
|
260
|
+
}
|
|
261
|
+
aValidType = isArray(a);
|
|
262
|
+
bValidType = isArray(b);
|
|
263
|
+
if (aValidType || bValidType) {
|
|
264
|
+
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
|
265
|
+
}
|
|
266
|
+
aValidType = isObject(a);
|
|
267
|
+
bValidType = isObject(b);
|
|
268
|
+
if (aValidType || bValidType) {
|
|
269
|
+
if (!aValidType || !bValidType) {
|
|
270
|
+
return false;
|
|
393
271
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (
|
|
397
|
-
|
|
272
|
+
const aKeysCount = Object.keys(a).length;
|
|
273
|
+
const bKeysCount = Object.keys(b).length;
|
|
274
|
+
if (aKeysCount !== bKeysCount) {
|
|
275
|
+
return false;
|
|
398
276
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
bValidType = isObject(b);
|
|
406
|
-
if (aValidType || bValidType) {
|
|
407
|
-
/* istanbul ignore if: this if will probably never be called */
|
|
408
|
-
if (!aValidType || !bValidType) {
|
|
409
|
-
return false;
|
|
410
|
-
}
|
|
411
|
-
const aKeysCount = Object.keys(a).length;
|
|
412
|
-
const bKeysCount = Object.keys(b).length;
|
|
413
|
-
if (aKeysCount !== bKeysCount) {
|
|
414
|
-
return false;
|
|
415
|
-
}
|
|
416
|
-
for (const key in a) {
|
|
417
|
-
const aHasKey = a.hasOwnProperty(key);
|
|
418
|
-
const bHasKey = b.hasOwnProperty(key);
|
|
419
|
-
if ((aHasKey && !bHasKey) ||
|
|
420
|
-
(!aHasKey && bHasKey) ||
|
|
421
|
-
!looseEqual(a[key], b[key])) {
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
277
|
+
for (const key in a) {
|
|
278
|
+
const aHasKey = a.hasOwnProperty(key);
|
|
279
|
+
const bHasKey = b.hasOwnProperty(key);
|
|
280
|
+
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
425
283
|
}
|
|
426
|
-
|
|
284
|
+
}
|
|
285
|
+
return String(a) === String(b);
|
|
427
286
|
}
|
|
428
287
|
function looseIndexOf(arr, val) {
|
|
429
|
-
|
|
288
|
+
return arr.findIndex((item) => looseEqual(item, val));
|
|
430
289
|
}
|
|
431
290
|
|
|
432
|
-
/**
|
|
433
|
-
* For converting {{ interpolation }} values to displayed strings.
|
|
434
|
-
* @private
|
|
435
|
-
*/
|
|
436
291
|
const toDisplayString = (val) => {
|
|
437
|
-
|
|
438
|
-
? val
|
|
439
|
-
: val == null
|
|
440
|
-
? ''
|
|
441
|
-
: isArray(val) ||
|
|
442
|
-
(isObject(val) &&
|
|
443
|
-
(val.toString === objectToString || !isFunction(val.toString)))
|
|
444
|
-
? JSON.stringify(val, replacer, 2)
|
|
445
|
-
: String(val);
|
|
292
|
+
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
|
446
293
|
};
|
|
447
294
|
const replacer = (_key, val) => {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
|
466
|
-
return String(val);
|
|
467
|
-
}
|
|
468
|
-
return val;
|
|
295
|
+
if (val && val.__v_isRef) {
|
|
296
|
+
return replacer(_key, val.value);
|
|
297
|
+
} else if (isMap(val)) {
|
|
298
|
+
return {
|
|
299
|
+
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
|
|
300
|
+
entries[`${key} =>`] = val2;
|
|
301
|
+
return entries;
|
|
302
|
+
}, {})
|
|
303
|
+
};
|
|
304
|
+
} else if (isSet(val)) {
|
|
305
|
+
return {
|
|
306
|
+
[`Set(${val.size})`]: [...val.values()]
|
|
307
|
+
};
|
|
308
|
+
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
|
309
|
+
return String(val);
|
|
310
|
+
}
|
|
311
|
+
return val;
|
|
469
312
|
};
|
|
470
313
|
|
|
471
|
-
const EMPTY_OBJ =
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const NOOP = () => { };
|
|
476
|
-
/**
|
|
477
|
-
* Always return false.
|
|
478
|
-
*/
|
|
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
|
+
};
|
|
479
318
|
const NO = () => false;
|
|
480
319
|
const onRE = /^on[^a-z]/;
|
|
481
320
|
const isOn = (key) => onRE.test(key);
|
|
482
|
-
const isModelListener = (key) => key.startsWith(
|
|
321
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
483
322
|
const extend = Object.assign;
|
|
484
323
|
const remove = (arr, el) => {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
324
|
+
const i = arr.indexOf(el);
|
|
325
|
+
if (i > -1) {
|
|
326
|
+
arr.splice(i, 1);
|
|
327
|
+
}
|
|
489
328
|
};
|
|
490
329
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
491
330
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
492
331
|
const isArray = Array.isArray;
|
|
493
|
-
const isMap = (val) => toTypeString(val) ===
|
|
494
|
-
const isSet = (val) => toTypeString(val) ===
|
|
495
|
-
const isDate = (val) => toTypeString(val) ===
|
|
496
|
-
const isRegExp = (val) => toTypeString(val) ===
|
|
497
|
-
const isFunction = (val) => typeof val ===
|
|
498
|
-
const isString = (val) => typeof val ===
|
|
499
|
-
const isSymbol = (val) => typeof val ===
|
|
500
|
-
const isObject = (val) => val !== null && typeof val ===
|
|
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";
|
|
501
340
|
const isPromise = (val) => {
|
|
502
|
-
|
|
341
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
503
342
|
};
|
|
504
343
|
const objectToString = Object.prototype.toString;
|
|
505
344
|
const toTypeString = (value) => objectToString.call(value);
|
|
506
345
|
const toRawType = (value) => {
|
|
507
|
-
|
|
508
|
-
return toTypeString(value).slice(8, -1);
|
|
346
|
+
return toTypeString(value).slice(8, -1);
|
|
509
347
|
};
|
|
510
|
-
const isPlainObject = (val) => toTypeString(val) ===
|
|
511
|
-
const isIntegerKey = (key) => isString(key) &&
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
520
|
-
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
521
|
-
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
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
|
+
);
|
|
522
357
|
const cacheStringFunction = (fn) => {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
358
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
359
|
+
return (str) => {
|
|
360
|
+
const hit = cache[str];
|
|
361
|
+
return hit || (cache[str] = fn(str));
|
|
362
|
+
};
|
|
528
363
|
};
|
|
529
364
|
const camelizeRE = /-(\w)/g;
|
|
530
|
-
/**
|
|
531
|
-
* @private
|
|
532
|
-
*/
|
|
533
365
|
const camelize = cacheStringFunction((str) => {
|
|
534
|
-
|
|
366
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
535
367
|
});
|
|
536
368
|
const hyphenateRE = /\B([A-Z])/g;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
* @private
|
|
547
|
-
*/
|
|
548
|
-
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
|
549
|
-
// compare whether a value has changed, accounting for NaN.
|
|
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
|
+
);
|
|
550
378
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
551
379
|
const invokeArrayFns = (fns, arg) => {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
380
|
+
for (let i = 0; i < fns.length; i++) {
|
|
381
|
+
fns[i](arg);
|
|
382
|
+
}
|
|
555
383
|
};
|
|
556
384
|
const def = (obj, key, value) => {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
385
|
+
Object.defineProperty(obj, key, {
|
|
386
|
+
configurable: true,
|
|
387
|
+
enumerable: false,
|
|
388
|
+
value
|
|
389
|
+
});
|
|
562
390
|
};
|
|
563
|
-
/**
|
|
564
|
-
* "123-foo" will be parsed to 123
|
|
565
|
-
* This is used for the .number modifier in v-model
|
|
566
|
-
*/
|
|
567
391
|
const looseToNumber = (val) => {
|
|
568
|
-
|
|
569
|
-
|
|
392
|
+
const n = parseFloat(val);
|
|
393
|
+
return isNaN(n) ? val : n;
|
|
570
394
|
};
|
|
571
|
-
/**
|
|
572
|
-
* Only conerces number-like strings
|
|
573
|
-
* "123-foo" will be returned as-is
|
|
574
|
-
*/
|
|
575
395
|
const toNumber = (val) => {
|
|
576
|
-
|
|
577
|
-
|
|
396
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
397
|
+
return isNaN(n) ? val : n;
|
|
578
398
|
};
|
|
579
399
|
let _globalThis;
|
|
580
400
|
const getGlobalThis = () => {
|
|
581
|
-
|
|
582
|
-
(_globalThis =
|
|
583
|
-
typeof globalThis !== 'undefined'
|
|
584
|
-
? globalThis
|
|
585
|
-
: typeof self !== 'undefined'
|
|
586
|
-
? self
|
|
587
|
-
: typeof window !== 'undefined'
|
|
588
|
-
? window
|
|
589
|
-
: typeof global !== 'undefined'
|
|
590
|
-
? global
|
|
591
|
-
: {}));
|
|
401
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
592
402
|
};
|
|
593
403
|
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
594
404
|
function genPropsAccessExp(name) {
|
|
595
|
-
|
|
596
|
-
? `__props.${name}`
|
|
597
|
-
: `__props[${JSON.stringify(name)}]`;
|
|
405
|
+
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
598
406
|
}
|
|
599
407
|
|
|
600
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 };
|