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