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