@vue/runtime-dom 3.6.0-beta.9 → 3.6.0-rc.10
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/runtime-dom.cjs.js +147 -98
- package/dist/runtime-dom.cjs.prod.js +136 -90
- package/dist/runtime-dom.d.ts +147 -151
- package/dist/runtime-dom.esm-browser.js +1221 -738
- package/dist/runtime-dom.esm-browser.prod.js +4 -3
- package/dist/runtime-dom.esm-bundler.js +194 -143
- package/dist/runtime-dom.global.js +1221 -738
- package/dist/runtime-dom.global.prod.js +4 -3
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.6.0-
|
|
2
|
+
* @vue/runtime-dom v3.6.0-rc.10
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* \/\*#\_\_PURE\_\_\*\/
|
|
12
12
|
* So that they can be tree-shaken if necessary.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
15
15
|
function makeMap(str) {
|
|
16
16
|
const map = Object.create(null);
|
|
17
17
|
for (const key of str.split(",")) map[key] = 1;
|
|
@@ -55,9 +55,9 @@ const toRawType = (value) => {
|
|
|
55
55
|
};
|
|
56
56
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
57
57
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
58
|
-
const isReservedProp =
|
|
59
|
-
const isBuiltInTag =
|
|
60
|
-
const isBuiltInDirective =
|
|
58
|
+
const isReservedProp = /*@__PURE__*/ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
59
|
+
const isBuiltInTag = /*#__PURE__*/ makeMap("slot,component");
|
|
60
|
+
const isBuiltInDirective = /*@__PURE__*/ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
61
61
|
const cacheStringFunction = (fn) => {
|
|
62
62
|
const cache = Object.create(null);
|
|
63
63
|
return ((str) => {
|
|
@@ -131,7 +131,7 @@ const getGlobalThis = () => {
|
|
|
131
131
|
function canSetValueDirectly(tagName) {
|
|
132
132
|
return tagName !== "PROGRESS" && !tagName.includes("-");
|
|
133
133
|
}
|
|
134
|
-
const isGloballyAllowed =
|
|
134
|
+
const isGloballyAllowed = /*@__PURE__*/ makeMap("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol");
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region packages/shared/src/normalizeProp.ts
|
|
137
137
|
function normalizeStyle(value) {
|
|
@@ -147,10 +147,10 @@ function normalizeStyle(value) {
|
|
|
147
147
|
}
|
|
148
148
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
149
149
|
const propertyDelimiterRE = /:([^]+)/;
|
|
150
|
-
const styleCommentRE =
|
|
150
|
+
const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
|
|
151
151
|
function parseStringStyle(cssText) {
|
|
152
152
|
const ret = {};
|
|
153
|
-
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
153
|
+
cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
|
|
154
154
|
if (item) {
|
|
155
155
|
const tmp = item.split(propertyDelimiterRE);
|
|
156
156
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
@@ -199,17 +199,17 @@ const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math
|
|
|
199
199
|
* Compiler only.
|
|
200
200
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
201
201
|
*/
|
|
202
|
-
const isHTMLTag =
|
|
202
|
+
const isHTMLTag = /*@__PURE__*/ makeMap(HTML_TAGS);
|
|
203
203
|
/**
|
|
204
204
|
* Compiler only.
|
|
205
205
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
206
206
|
*/
|
|
207
|
-
const isSVGTag =
|
|
207
|
+
const isSVGTag = /*@__PURE__*/ makeMap(SVG_TAGS);
|
|
208
208
|
/**
|
|
209
209
|
* Compiler only.
|
|
210
210
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
211
211
|
*/
|
|
212
|
-
const isMathMLTag =
|
|
212
|
+
const isMathMLTag = /*@__PURE__*/ makeMap(MATH_TAGS);
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region packages/shared/src/domAttrConfig.ts
|
|
215
215
|
/**
|
|
@@ -224,11 +224,11 @@ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
|
224
224
|
* - readonly -> readOnly
|
|
225
225
|
*/
|
|
226
226
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
227
|
-
const isSpecialBooleanAttr =
|
|
227
|
+
const isSpecialBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs);
|
|
228
228
|
/**
|
|
229
229
|
* The full list is needed during SSR to produce the correct initial markup.
|
|
230
230
|
*/
|
|
231
|
-
const isBooleanAttr =
|
|
231
|
+
const isBooleanAttr = /*@__PURE__*/ makeMap(specialBooleanAttrs + ",async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
|
|
232
232
|
/**
|
|
233
233
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
234
234
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
@@ -242,11 +242,11 @@ function includeBooleanAttr(value) {
|
|
|
242
242
|
* Don't also forget to allow `data-*` and `aria-*`!
|
|
243
243
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
|
244
244
|
*/
|
|
245
|
-
const isKnownHtmlAttr =
|
|
245
|
+
const isKnownHtmlAttr = /*@__PURE__*/ makeMap("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,inert,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");
|
|
246
246
|
/**
|
|
247
247
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
248
248
|
*/
|
|
249
|
-
const isKnownSvgAttr =
|
|
249
|
+
const isKnownSvgAttr = /*@__PURE__*/ makeMap("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,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan");
|
|
250
250
|
/**
|
|
251
251
|
* Shared between server-renderer and runtime-core hydration logic
|
|
252
252
|
*/
|
|
@@ -272,13 +272,54 @@ function getEscapedCssVarName(key, doubleEscape) {
|
|
|
272
272
|
}
|
|
273
273
|
//#endregion
|
|
274
274
|
//#region packages/shared/src/looseEqual.ts
|
|
275
|
-
function looseCompareArrays(a, b) {
|
|
275
|
+
function looseCompareArrays(a, b, seen) {
|
|
276
276
|
if (a.length !== b.length) return false;
|
|
277
277
|
let equal = true;
|
|
278
|
-
for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i]);
|
|
278
|
+
for (let i = 0; equal && i < a.length; i++) equal = looseEqual(a[i], b[i], seen);
|
|
279
279
|
return equal;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function looseCompareCollections(a, b, seen) {
|
|
282
|
+
if (a.size !== b.size) return false;
|
|
283
|
+
const candidates = Array.from(b);
|
|
284
|
+
const matched = new Uint8Array(candidates.length);
|
|
285
|
+
for (const item of a) {
|
|
286
|
+
let index = -1;
|
|
287
|
+
for (let i = 0; i < candidates.length; i++) if (!matched[i] && looseEqual(item, candidates[i], seen)) {
|
|
288
|
+
index = i;
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
if (index < 0) return false;
|
|
292
|
+
matched[index] = 1;
|
|
293
|
+
}
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
function looseCompareObjects(a, b, seen) {
|
|
297
|
+
let aValidType = isMap(a);
|
|
298
|
+
let bValidType = isMap(b);
|
|
299
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
|
|
300
|
+
aValidType = isSet(a);
|
|
301
|
+
bValidType = isSet(b);
|
|
302
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareCollections(a, b, seen) : false;
|
|
303
|
+
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
304
|
+
for (const key in a) {
|
|
305
|
+
const aHasKey = a.hasOwnProperty(key);
|
|
306
|
+
const bHasKey = b.hasOwnProperty(key);
|
|
307
|
+
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key], seen)) return false;
|
|
308
|
+
}
|
|
309
|
+
return String(a) === String(b);
|
|
310
|
+
}
|
|
311
|
+
function looseCompareNested(a, b, seen, compare) {
|
|
312
|
+
if (!seen) seen = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map()];
|
|
313
|
+
const [seenA, seenB] = seen;
|
|
314
|
+
if (seenA.has(a) || seenB.has(b)) return seenA.get(a) === b && seenB.get(b) === a;
|
|
315
|
+
seenA.set(a, b);
|
|
316
|
+
seenB.set(b, a);
|
|
317
|
+
const equal = compare(a, b, seen);
|
|
318
|
+
seenA.delete(a);
|
|
319
|
+
seenB.delete(b);
|
|
320
|
+
return equal;
|
|
321
|
+
}
|
|
322
|
+
function looseEqual(a, b, seen) {
|
|
282
323
|
if (a === b) return true;
|
|
283
324
|
let aValidType = isDate(a);
|
|
284
325
|
let bValidType = isDate(b);
|
|
@@ -288,17 +329,12 @@ function looseEqual(a, b) {
|
|
|
288
329
|
if (aValidType || bValidType) return a === b;
|
|
289
330
|
aValidType = isArray(a);
|
|
290
331
|
bValidType = isArray(b);
|
|
291
|
-
if (aValidType || bValidType) return aValidType && bValidType ?
|
|
332
|
+
if (aValidType || bValidType) return aValidType && bValidType ? looseCompareNested(a, b, seen, looseCompareArrays) : false;
|
|
292
333
|
aValidType = isObject(a);
|
|
293
334
|
bValidType = isObject(b);
|
|
294
335
|
if (aValidType || bValidType) {
|
|
295
336
|
if (!aValidType || !bValidType) return false;
|
|
296
|
-
|
|
297
|
-
for (const key in a) {
|
|
298
|
-
const aHasKey = a.hasOwnProperty(key);
|
|
299
|
-
const bHasKey = b.hasOwnProperty(key);
|
|
300
|
-
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) return false;
|
|
301
|
-
}
|
|
337
|
+
return looseCompareNested(a, b, seen, looseCompareObjects);
|
|
302
338
|
}
|
|
303
339
|
return String(a) === String(b);
|
|
304
340
|
}
|
|
@@ -428,9 +464,18 @@ function setupFlagsHandler(target) {
|
|
|
428
464
|
function warn$2(msg, ...args) {
|
|
429
465
|
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
430
466
|
}
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region packages/reactivity/src/system.ts
|
|
431
469
|
const notifyBuffer = [];
|
|
432
470
|
let batchDepth = 0;
|
|
433
471
|
let activeSub = void 0;
|
|
472
|
+
let runDepth = 0;
|
|
473
|
+
function incRunDepth() {
|
|
474
|
+
++runDepth;
|
|
475
|
+
}
|
|
476
|
+
function decRunDepth() {
|
|
477
|
+
--runDepth;
|
|
478
|
+
}
|
|
434
479
|
let globalVersion = 0;
|
|
435
480
|
let notifyIndex = 0;
|
|
436
481
|
let notifyBufferLength = 0;
|
|
@@ -504,8 +549,10 @@ function propagate(link) {
|
|
|
504
549
|
const sub = link.sub;
|
|
505
550
|
let flags = sub.flags;
|
|
506
551
|
if (flags & 3) {
|
|
507
|
-
if (!(flags & 60))
|
|
508
|
-
|
|
552
|
+
if (!(flags & 60)) {
|
|
553
|
+
sub.flags = flags | 32;
|
|
554
|
+
if (runDepth) sub.flags |= 8;
|
|
555
|
+
} else if (!(flags & 12)) flags = 0;
|
|
509
556
|
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
510
557
|
else if (!(flags & 48) && isValidLink(link, sub)) {
|
|
511
558
|
sub.flags = flags | 40;
|
|
@@ -557,13 +604,23 @@ function endTracking(sub, prevSub) {
|
|
|
557
604
|
sub.flags &= -5;
|
|
558
605
|
}
|
|
559
606
|
function flush() {
|
|
607
|
+
let hasError = false;
|
|
608
|
+
let error;
|
|
560
609
|
while (notifyIndex < notifyBufferLength) {
|
|
561
610
|
const effect = notifyBuffer[notifyIndex];
|
|
562
611
|
notifyBuffer[notifyIndex++] = void 0;
|
|
563
|
-
|
|
612
|
+
try {
|
|
613
|
+
effect.notify();
|
|
614
|
+
} catch (err) {
|
|
615
|
+
if (!hasError) {
|
|
616
|
+
hasError = true;
|
|
617
|
+
error = err;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
564
620
|
}
|
|
565
621
|
notifyIndex = 0;
|
|
566
622
|
notifyBufferLength = 0;
|
|
623
|
+
if (hasError) throw error;
|
|
567
624
|
}
|
|
568
625
|
function checkDirty(link, sub) {
|
|
569
626
|
let stack;
|
|
@@ -574,13 +631,13 @@ function checkDirty(link, sub) {
|
|
|
574
631
|
let dirty = false;
|
|
575
632
|
if (sub.flags & 16) dirty = true;
|
|
576
633
|
else if ((depFlags & 17) === 17) {
|
|
634
|
+
const subs = dep.subs;
|
|
577
635
|
if (dep.update()) {
|
|
578
|
-
const subs = dep.subs;
|
|
579
636
|
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
580
637
|
dirty = true;
|
|
581
638
|
}
|
|
582
639
|
} else if ((depFlags & 33) === 33) {
|
|
583
|
-
|
|
640
|
+
stack = {
|
|
584
641
|
value: link,
|
|
585
642
|
prev: stack
|
|
586
643
|
};
|
|
@@ -595,15 +652,12 @@ function checkDirty(link, sub) {
|
|
|
595
652
|
}
|
|
596
653
|
while (checkDepth) {
|
|
597
654
|
--checkDepth;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
if (hasMultipleSubs) {
|
|
601
|
-
link = stack.value;
|
|
602
|
-
stack = stack.prev;
|
|
603
|
-
} else link = firstSub;
|
|
655
|
+
link = stack.value;
|
|
656
|
+
stack = stack.prev;
|
|
604
657
|
if (dirty) {
|
|
658
|
+
const subs = sub.subs;
|
|
605
659
|
if (sub.update()) {
|
|
606
|
-
if (
|
|
660
|
+
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
607
661
|
sub = link.sub;
|
|
608
662
|
continue;
|
|
609
663
|
}
|
|
@@ -615,7 +669,7 @@ function checkDirty(link, sub) {
|
|
|
615
669
|
}
|
|
616
670
|
dirty = false;
|
|
617
671
|
}
|
|
618
|
-
return dirty;
|
|
672
|
+
return dirty && !!sub.flags;
|
|
619
673
|
} while (true);
|
|
620
674
|
}
|
|
621
675
|
function shallowPropagate(link) {
|
|
@@ -650,7 +704,7 @@ var Dep = class {
|
|
|
650
704
|
}
|
|
651
705
|
set subs(value) {
|
|
652
706
|
this._subs = value;
|
|
653
|
-
if (value === void 0) this.map.delete(this.key);
|
|
707
|
+
if (value === void 0 && this.map) this.map.delete(this.key);
|
|
654
708
|
}
|
|
655
709
|
};
|
|
656
710
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -733,9 +787,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
733
787
|
if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
734
788
|
}
|
|
735
789
|
break;
|
|
736
|
-
case "set":
|
|
737
|
-
if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
738
|
-
break;
|
|
790
|
+
case "set": if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
739
791
|
}
|
|
740
792
|
}
|
|
741
793
|
}
|
|
@@ -750,13 +802,17 @@ function getDepFromReactive(object, key) {
|
|
|
750
802
|
/**
|
|
751
803
|
* Track array iteration and return:
|
|
752
804
|
* - if input is reactive: a cloned raw array with reactive values
|
|
753
|
-
* - if input is
|
|
805
|
+
* - if input is readonly: a cloned raw array with readonly values, preserving
|
|
806
|
+
* reactivity
|
|
807
|
+
* - if input is raw or shallow: the original raw array
|
|
754
808
|
*/
|
|
755
809
|
function reactiveReadArray(array) {
|
|
756
810
|
const raw = /* @__PURE__ */ toRaw(array);
|
|
757
811
|
if (raw === array) return raw;
|
|
758
812
|
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
759
|
-
|
|
813
|
+
if (/* @__PURE__ */ isShallow(array)) return raw;
|
|
814
|
+
if (!/* @__PURE__ */ isReadonly(array)) return raw.map(toReactive);
|
|
815
|
+
return /* @__PURE__ */ isReactive(array) ? raw.map((item) => toReadonly(toReactive(item))) : raw.map(toReadonly);
|
|
760
816
|
}
|
|
761
817
|
/**
|
|
762
818
|
* Track array iteration and return raw array
|
|
@@ -932,8 +988,8 @@ function noTracking(self, method, args = []) {
|
|
|
932
988
|
}
|
|
933
989
|
//#endregion
|
|
934
990
|
//#region packages/reactivity/src/baseHandlers.ts
|
|
935
|
-
const isNonTrackableKeys =
|
|
936
|
-
const builtInSymbols = new Set(
|
|
991
|
+
const isNonTrackableKeys = /*@__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
992
|
+
const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
|
|
937
993
|
function hasOwnProperty(key) {
|
|
938
994
|
if (!isSymbol(key)) key = String(key);
|
|
939
995
|
const obj = /* @__PURE__ */ toRaw(this);
|
|
@@ -988,17 +1044,19 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
|
988
1044
|
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
989
1045
|
value = /* @__PURE__ */ toRaw(value);
|
|
990
1046
|
}
|
|
991
|
-
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value))
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1047
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
1048
|
+
if (isOldValueReadonly) {
|
|
1049
|
+
warn$2(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
1050
|
+
return true;
|
|
1051
|
+
} else {
|
|
1052
|
+
oldValue.value = value;
|
|
1053
|
+
return true;
|
|
1054
|
+
}
|
|
997
1055
|
}
|
|
998
1056
|
}
|
|
999
1057
|
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
1000
1058
|
const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
|
|
1001
|
-
if (target === /* @__PURE__ */ toRaw(receiver)) {
|
|
1059
|
+
if (target === /* @__PURE__ */ toRaw(receiver) && result) {
|
|
1002
1060
|
if (!hadKey) trigger(target, "add", key, value);
|
|
1003
1061
|
else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
1004
1062
|
}
|
|
@@ -1034,10 +1092,10 @@ var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
|
1034
1092
|
return true;
|
|
1035
1093
|
}
|
|
1036
1094
|
};
|
|
1037
|
-
const mutableHandlers =
|
|
1038
|
-
const readonlyHandlers =
|
|
1039
|
-
const shallowReactiveHandlers =
|
|
1040
|
-
const shallowReadonlyHandlers =
|
|
1095
|
+
const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
|
|
1096
|
+
const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
|
|
1097
|
+
const shallowReactiveHandlers = /*@__PURE__*/ new MutableReactiveHandler(true);
|
|
1098
|
+
const shallowReadonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler(true);
|
|
1041
1099
|
//#endregion
|
|
1042
1100
|
//#region packages/reactivity/src/collectionHandlers.ts
|
|
1043
1101
|
const toShallow = (value) => value;
|
|
@@ -1188,10 +1246,10 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
1188
1246
|
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
1189
1247
|
};
|
|
1190
1248
|
}
|
|
1191
|
-
const mutableCollectionHandlers = { get:
|
|
1192
|
-
const shallowCollectionHandlers = { get:
|
|
1193
|
-
const readonlyCollectionHandlers = { get:
|
|
1194
|
-
const shallowReadonlyCollectionHandlers = { get:
|
|
1249
|
+
const mutableCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, false) };
|
|
1250
|
+
const shallowCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(false, true) };
|
|
1251
|
+
const readonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, false) };
|
|
1252
|
+
const shallowReadonlyCollectionHandlers = { get: /*@__PURE__*/ createInstrumentationGetter(true, true) };
|
|
1195
1253
|
function checkIdentityKeys(target, has, key) {
|
|
1196
1254
|
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
1197
1255
|
if (rawKey !== key && has.call(target, rawKey)) {
|
|
@@ -1216,10 +1274,7 @@ function targetTypeMap(rawType) {
|
|
|
1216
1274
|
default: return 0;
|
|
1217
1275
|
}
|
|
1218
1276
|
}
|
|
1219
|
-
|
|
1220
|
-
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
|
1221
|
-
}
|
|
1222
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1277
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1223
1278
|
function reactive(target) {
|
|
1224
1279
|
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
1225
1280
|
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
@@ -1254,7 +1309,7 @@ function reactive(target) {
|
|
|
1254
1309
|
* @param target - The source object.
|
|
1255
1310
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
|
1256
1311
|
*/
|
|
1257
|
-
|
|
1312
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1258
1313
|
function shallowReactive(target) {
|
|
1259
1314
|
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
1260
1315
|
}
|
|
@@ -1287,7 +1342,7 @@ function shallowReactive(target) {
|
|
|
1287
1342
|
* @param target - The source object.
|
|
1288
1343
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
|
1289
1344
|
*/
|
|
1290
|
-
|
|
1345
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1291
1346
|
function readonly(target) {
|
|
1292
1347
|
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
1293
1348
|
}
|
|
@@ -1321,7 +1376,7 @@ function readonly(target) {
|
|
|
1321
1376
|
* @param target - The source object.
|
|
1322
1377
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
|
1323
1378
|
*/
|
|
1324
|
-
|
|
1379
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1325
1380
|
function shallowReadonly(target) {
|
|
1326
1381
|
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
1327
1382
|
}
|
|
@@ -1331,10 +1386,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1331
1386
|
return target;
|
|
1332
1387
|
}
|
|
1333
1388
|
if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
|
|
1334
|
-
|
|
1335
|
-
if (targetType === 0) return target;
|
|
1389
|
+
if (target["__v_skip"] || !Object.isExtensible(target)) return target;
|
|
1336
1390
|
const existingProxy = proxyMap.get(target);
|
|
1337
1391
|
if (existingProxy) return existingProxy;
|
|
1392
|
+
const targetType = targetTypeMap(toRawType(target));
|
|
1393
|
+
if (targetType === 0) return target;
|
|
1338
1394
|
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1339
1395
|
proxyMap.set(target, proxy);
|
|
1340
1396
|
return proxy;
|
|
@@ -1357,7 +1413,7 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1357
1413
|
* @param value - The value to check.
|
|
1358
1414
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
|
1359
1415
|
*/
|
|
1360
|
-
|
|
1416
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1361
1417
|
function isReactive(value) {
|
|
1362
1418
|
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
1363
1419
|
return !!(value && value["__v_isReactive"]);
|
|
@@ -1373,11 +1429,11 @@ function isReactive(value) {
|
|
|
1373
1429
|
* @param value - The value to check.
|
|
1374
1430
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
|
1375
1431
|
*/
|
|
1376
|
-
|
|
1432
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1377
1433
|
function isReadonly(value) {
|
|
1378
1434
|
return !!(value && value["__v_isReadonly"]);
|
|
1379
1435
|
}
|
|
1380
|
-
|
|
1436
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1381
1437
|
function isShallow(value) {
|
|
1382
1438
|
return !!(value && value["__v_isShallow"]);
|
|
1383
1439
|
}
|
|
@@ -1388,7 +1444,7 @@ function isShallow(value) {
|
|
|
1388
1444
|
* @param value - The value to check.
|
|
1389
1445
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
|
1390
1446
|
*/
|
|
1391
|
-
|
|
1447
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1392
1448
|
function isProxy(value) {
|
|
1393
1449
|
return value ? !!value["__v_raw"] : false;
|
|
1394
1450
|
}
|
|
@@ -1415,7 +1471,7 @@ function isProxy(value) {
|
|
|
1415
1471
|
* @param observed - The object for which the "raw" value is requested.
|
|
1416
1472
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
|
1417
1473
|
*/
|
|
1418
|
-
|
|
1474
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1419
1475
|
function toRaw(observed) {
|
|
1420
1476
|
const raw = observed && observed["__v_raw"];
|
|
1421
1477
|
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
@@ -1464,15 +1520,15 @@ const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value)
|
|
|
1464
1520
|
const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1465
1521
|
//#endregion
|
|
1466
1522
|
//#region packages/reactivity/src/ref.ts
|
|
1467
|
-
|
|
1523
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1468
1524
|
function isRef(r) {
|
|
1469
1525
|
return r ? r["__v_isRef"] === true : false;
|
|
1470
1526
|
}
|
|
1471
|
-
|
|
1527
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1472
1528
|
function ref(value) {
|
|
1473
1529
|
return createRef(value, toReactive);
|
|
1474
1530
|
}
|
|
1475
|
-
|
|
1531
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1476
1532
|
function shallowRef(value) {
|
|
1477
1533
|
return createRef(value);
|
|
1478
1534
|
}
|
|
@@ -1675,7 +1731,7 @@ function customRef(factory) {
|
|
|
1675
1731
|
* @param object - Reactive object to be made into an object of linked refs.
|
|
1676
1732
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
|
1677
1733
|
*/
|
|
1678
|
-
|
|
1734
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1679
1735
|
function toRefs(object) {
|
|
1680
1736
|
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1681
1737
|
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
@@ -1726,7 +1782,7 @@ var GetterRefImpl = class {
|
|
|
1726
1782
|
return this._value = this._getter();
|
|
1727
1783
|
}
|
|
1728
1784
|
};
|
|
1729
|
-
|
|
1785
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
1730
1786
|
function toRef(source, key, defaultValue) {
|
|
1731
1787
|
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1732
1788
|
else if (isFunction(source)) return new GetterRefImpl(source);
|
|
@@ -1767,9 +1823,11 @@ var ReactiveEffect = class {
|
|
|
1767
1823
|
if (!this.active) return this.fn();
|
|
1768
1824
|
cleanup(this);
|
|
1769
1825
|
const prevSub = startTracking(this);
|
|
1826
|
+
incRunDepth();
|
|
1770
1827
|
try {
|
|
1771
1828
|
return this.fn();
|
|
1772
1829
|
} finally {
|
|
1830
|
+
decRunDepth();
|
|
1773
1831
|
endTracking(this, prevSub);
|
|
1774
1832
|
const flags = this.flags;
|
|
1775
1833
|
if ((flags & 136) === 136) {
|
|
@@ -1790,10 +1848,12 @@ var ReactiveEffect = class {
|
|
|
1790
1848
|
get dirty() {
|
|
1791
1849
|
const flags = this.flags;
|
|
1792
1850
|
if (flags & 16) return true;
|
|
1793
|
-
if (flags & 32)
|
|
1794
|
-
this.
|
|
1795
|
-
|
|
1796
|
-
|
|
1851
|
+
if (flags & 32) {
|
|
1852
|
+
if (checkDirty(this.deps, this)) {
|
|
1853
|
+
this.flags = flags | 16;
|
|
1854
|
+
return true;
|
|
1855
|
+
} else this.flags = flags & -33;
|
|
1856
|
+
}
|
|
1797
1857
|
return false;
|
|
1798
1858
|
}
|
|
1799
1859
|
};
|
|
@@ -1972,10 +2032,12 @@ var ComputedRefImpl = class {
|
|
|
1972
2032
|
get _dirty() {
|
|
1973
2033
|
const flags = this.flags;
|
|
1974
2034
|
if (flags & 16) return true;
|
|
1975
|
-
if (flags & 32)
|
|
1976
|
-
this.
|
|
1977
|
-
|
|
1978
|
-
|
|
2035
|
+
if (flags & 32) {
|
|
2036
|
+
if (checkDirty(this.deps, this)) {
|
|
2037
|
+
this.flags = flags | 16;
|
|
2038
|
+
return true;
|
|
2039
|
+
} else this.flags = flags & -33;
|
|
2040
|
+
}
|
|
1979
2041
|
return false;
|
|
1980
2042
|
}
|
|
1981
2043
|
/**
|
|
@@ -2036,7 +2098,7 @@ var ComputedRefImpl = class {
|
|
|
2036
2098
|
}
|
|
2037
2099
|
};
|
|
2038
2100
|
setupOnTrigger(ComputedRefImpl);
|
|
2039
|
-
|
|
2101
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
2040
2102
|
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
2041
2103
|
let getter;
|
|
2042
2104
|
let setter;
|
|
@@ -2114,25 +2176,26 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
2114
2176
|
else if (isFunction(s)) return call ? call(s, 2) : s();
|
|
2115
2177
|
else warnInvalidSource(s, onWarn);
|
|
2116
2178
|
});
|
|
2117
|
-
} else if (isFunction(source))
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2179
|
+
} else if (isFunction(source)) {
|
|
2180
|
+
if (cb) getter = call ? () => call(source, 2) : source;
|
|
2181
|
+
else getter = () => {
|
|
2182
|
+
if (this.cleanupsLength) {
|
|
2183
|
+
const prevSub = setActiveSub();
|
|
2184
|
+
try {
|
|
2185
|
+
cleanup(this);
|
|
2186
|
+
} finally {
|
|
2187
|
+
setActiveSub(prevSub);
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
const currentEffect = activeWatcher;
|
|
2191
|
+
activeWatcher = this;
|
|
2121
2192
|
try {
|
|
2122
|
-
|
|
2193
|
+
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
2123
2194
|
} finally {
|
|
2124
|
-
|
|
2195
|
+
activeWatcher = currentEffect;
|
|
2125
2196
|
}
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
activeWatcher = this;
|
|
2129
|
-
try {
|
|
2130
|
-
return call ? call(source, 3, [this.boundCleanup]) : source(this.boundCleanup);
|
|
2131
|
-
} finally {
|
|
2132
|
-
activeWatcher = currentEffect;
|
|
2133
|
-
}
|
|
2134
|
-
};
|
|
2135
|
-
else {
|
|
2197
|
+
};
|
|
2198
|
+
} else {
|
|
2136
2199
|
getter = NOOP;
|
|
2137
2200
|
warnInvalidSource(source, onWarn);
|
|
2138
2201
|
}
|
|
@@ -2150,8 +2213,9 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
2150
2213
|
if (once && cb) {
|
|
2151
2214
|
const _cb = cb;
|
|
2152
2215
|
cb = (...args) => {
|
|
2153
|
-
_cb(...args);
|
|
2216
|
+
const res = _cb(...args);
|
|
2154
2217
|
this.stop();
|
|
2218
|
+
return res;
|
|
2155
2219
|
};
|
|
2156
2220
|
}
|
|
2157
2221
|
this.cb = cb;
|
|
@@ -2165,7 +2229,7 @@ var WatcherEffect = class extends ReactiveEffect {
|
|
|
2165
2229
|
if (!this.cb) return;
|
|
2166
2230
|
const { immediate, deep, call } = this.options;
|
|
2167
2231
|
if (initialRun && !immediate) return;
|
|
2168
|
-
if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2232
|
+
if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
2169
2233
|
cleanup(this);
|
|
2170
2234
|
const currentWatcher = activeWatcher;
|
|
2171
2235
|
activeWatcher = this;
|
|
@@ -2455,7 +2519,7 @@ let currentFlushPromise = null;
|
|
|
2455
2519
|
let jobsLength = 0;
|
|
2456
2520
|
let flushIndex = 0;
|
|
2457
2521
|
let postFlushIndex = 0;
|
|
2458
|
-
const resolvedPromise =
|
|
2522
|
+
const resolvedPromise = /*@__PURE__*/ Promise.resolve();
|
|
2459
2523
|
const RECURSION_LIMIT = 100;
|
|
2460
2524
|
function nextTick(fn) {
|
|
2461
2525
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -2472,8 +2536,8 @@ function findInsertionIndex(order, queue, start, end) {
|
|
|
2472
2536
|
/**
|
|
2473
2537
|
* @internal for runtime-vapor only
|
|
2474
2538
|
*/
|
|
2475
|
-
function queueJob(job, id, isPre = false) {
|
|
2476
|
-
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
2539
|
+
function queueJob(job, id, isPre = false, order = 0) {
|
|
2540
|
+
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : order ? id * 2 + 1 + order / (order + 1) : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
2477
2541
|
jobsLength++;
|
|
2478
2542
|
queueFlush();
|
|
2479
2543
|
}
|
|
@@ -2494,6 +2558,7 @@ const doFlushJobs = () => {
|
|
|
2494
2558
|
flushJobs();
|
|
2495
2559
|
} catch (e) {
|
|
2496
2560
|
currentFlushPromise = null;
|
|
2561
|
+
if (jobsLength || postJobs.length) queueFlush();
|
|
2497
2562
|
throw e;
|
|
2498
2563
|
}
|
|
2499
2564
|
};
|
|
@@ -2501,9 +2566,10 @@ function queueFlush() {
|
|
|
2501
2566
|
if (!currentFlushPromise) currentFlushPromise = resolvedPromise.then(doFlushJobs);
|
|
2502
2567
|
}
|
|
2503
2568
|
function queuePostFlushCb(jobs, id = Infinity) {
|
|
2504
|
-
if (!isArray(jobs))
|
|
2505
|
-
|
|
2506
|
-
|
|
2569
|
+
if (!isArray(jobs)) {
|
|
2570
|
+
if (activePostJobs && id === -1) activePostJobs.splice(postFlushIndex, 0, jobs);
|
|
2571
|
+
else queueJobWorker(jobs, id, postJobs, postJobs.length, 0);
|
|
2572
|
+
} else for (let i = 0; i < jobs.length; i++) queueJobWorker(jobs[i], id, postJobs, postJobs.length, 0);
|
|
2507
2573
|
queueFlush();
|
|
2508
2574
|
}
|
|
2509
2575
|
function flushPreFlushCbs(instance, seen) {
|
|
@@ -2517,32 +2583,39 @@ function flushPreFlushCbs(instance, seen) {
|
|
|
2517
2583
|
i--;
|
|
2518
2584
|
jobsLength--;
|
|
2519
2585
|
if (cb.flags & 2) cb.flags &= -2;
|
|
2520
|
-
|
|
2521
|
-
|
|
2586
|
+
try {
|
|
2587
|
+
cb();
|
|
2588
|
+
} finally {
|
|
2589
|
+
if (!(cb.flags & 2)) cb.flags &= -2;
|
|
2590
|
+
}
|
|
2522
2591
|
}
|
|
2523
2592
|
}
|
|
2524
2593
|
function flushPostFlushCbs(seen) {
|
|
2525
2594
|
if (postJobs.length) {
|
|
2526
2595
|
if (activePostJobs) {
|
|
2527
|
-
activePostJobs.push(
|
|
2596
|
+
for (let i = 0; i < postJobs.length; i++) activePostJobs.push(postJobs[i]);
|
|
2528
2597
|
postJobs.length = 0;
|
|
2529
2598
|
return;
|
|
2530
2599
|
}
|
|
2531
2600
|
activePostJobs = postJobs;
|
|
2532
2601
|
postJobs = [];
|
|
2533
2602
|
seen = seen || /* @__PURE__ */ new Map();
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
cb
|
|
2540
|
-
|
|
2541
|
-
|
|
2603
|
+
try {
|
|
2604
|
+
while (postFlushIndex < activePostJobs.length) {
|
|
2605
|
+
const cb = activePostJobs[postFlushIndex++];
|
|
2606
|
+
if (checkRecursiveUpdates(seen, cb)) continue;
|
|
2607
|
+
if (cb.flags & 2) cb.flags &= -2;
|
|
2608
|
+
if (!(cb.flags & 4)) try {
|
|
2609
|
+
cb();
|
|
2610
|
+
} finally {
|
|
2611
|
+
if (!(cb.flags & 2)) cb.flags &= -2;
|
|
2612
|
+
}
|
|
2542
2613
|
}
|
|
2614
|
+
} finally {
|
|
2615
|
+
while (postFlushIndex < activePostJobs.length) activePostJobs[postFlushIndex++].flags &= -2;
|
|
2616
|
+
activePostJobs = null;
|
|
2617
|
+
postFlushIndex = 0;
|
|
2543
2618
|
}
|
|
2544
|
-
activePostJobs = null;
|
|
2545
|
-
postFlushIndex = 0;
|
|
2546
2619
|
}
|
|
2547
2620
|
}
|
|
2548
2621
|
let isFlushing = false;
|
|
@@ -2552,9 +2625,12 @@ let isFlushing = false;
|
|
|
2552
2625
|
function flushOnAppMount(instance) {
|
|
2553
2626
|
if (!isFlushing) {
|
|
2554
2627
|
isFlushing = true;
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2628
|
+
try {
|
|
2629
|
+
flushPreFlushCbs(instance);
|
|
2630
|
+
flushPostFlushCbs();
|
|
2631
|
+
} finally {
|
|
2632
|
+
isFlushing = false;
|
|
2633
|
+
}
|
|
2558
2634
|
}
|
|
2559
2635
|
}
|
|
2560
2636
|
function flushJobs(seen) {
|
|
@@ -2582,9 +2658,10 @@ function flushJobs(seen) {
|
|
|
2582
2658
|
}
|
|
2583
2659
|
flushIndex = 0;
|
|
2584
2660
|
jobsLength = 0;
|
|
2661
|
+
jobs.length = 0;
|
|
2585
2662
|
flushPostFlushCbs(seen);
|
|
2586
|
-
currentFlushPromise = null;
|
|
2587
2663
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
2664
|
+
else currentFlushPromise = null;
|
|
2588
2665
|
}
|
|
2589
2666
|
}
|
|
2590
2667
|
function checkRecursiveUpdates(seen, fn) {
|
|
@@ -2615,6 +2692,19 @@ getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
|
2615
2692
|
rerender: tryWrap(rerender),
|
|
2616
2693
|
reload: tryWrap(reload)
|
|
2617
2694
|
};
|
|
2695
|
+
function runWithHmrUpdating(fn) {
|
|
2696
|
+
isHmrUpdating = true;
|
|
2697
|
+
let done = false;
|
|
2698
|
+
try {
|
|
2699
|
+
fn();
|
|
2700
|
+
done = true;
|
|
2701
|
+
} finally {
|
|
2702
|
+
if (done) nextTick(() => {
|
|
2703
|
+
isHmrUpdating = false;
|
|
2704
|
+
});
|
|
2705
|
+
else isHmrUpdating = false;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2618
2708
|
const map = /* @__PURE__ */ new Map();
|
|
2619
2709
|
function registerHMR(instance) {
|
|
2620
2710
|
const id = instance.type.__hmrId;
|
|
@@ -2639,6 +2729,14 @@ function createRecord(id, initialDef) {
|
|
|
2639
2729
|
function normalizeClassComponent(component) {
|
|
2640
2730
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
2641
2731
|
}
|
|
2732
|
+
function hasDirtyAncestor(instance, dirtyInstances) {
|
|
2733
|
+
let parent = instance.parent;
|
|
2734
|
+
while (parent) {
|
|
2735
|
+
if (dirtyInstances.has(parent)) return true;
|
|
2736
|
+
parent = parent.parent;
|
|
2737
|
+
}
|
|
2738
|
+
return false;
|
|
2739
|
+
}
|
|
2642
2740
|
function rerender(id, newRender) {
|
|
2643
2741
|
const record = map.get(id);
|
|
2644
2742
|
if (!record) return;
|
|
@@ -2648,18 +2746,16 @@ function rerender(id, newRender) {
|
|
|
2648
2746
|
instance.render = newRender;
|
|
2649
2747
|
normalizeClassComponent(instance.type).render = newRender;
|
|
2650
2748
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2749
|
+
runWithHmrUpdating(() => {
|
|
2750
|
+
if (instance.vapor) {
|
|
2751
|
+
if (!instance.isUnmounted) instance.hmrRerender();
|
|
2752
|
+
} else {
|
|
2753
|
+
const i = instance;
|
|
2754
|
+
if (!(i.effect.flags & 1024)) {
|
|
2755
|
+
i.renderCache = [];
|
|
2756
|
+
i.effect.run();
|
|
2757
|
+
}
|
|
2659
2758
|
}
|
|
2660
|
-
}
|
|
2661
|
-
nextTick(() => {
|
|
2662
|
-
isHmrUpdating = false;
|
|
2663
2759
|
});
|
|
2664
2760
|
});
|
|
2665
2761
|
}
|
|
@@ -2670,42 +2766,61 @@ function reload(id, newComp) {
|
|
|
2670
2766
|
const isVapor = record.initialDef.__vapor;
|
|
2671
2767
|
updateComponentDef(record.initialDef, newComp);
|
|
2672
2768
|
const instances = [...record.instances];
|
|
2673
|
-
if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
|
|
2769
|
+
if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
|
|
2674
2770
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
2687
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
2688
|
-
if (instance.ceReload) {
|
|
2689
|
-
dirtyInstances.add(instance);
|
|
2690
|
-
instance.ceReload(newComp.styles);
|
|
2691
|
-
dirtyInstances.delete(instance);
|
|
2692
|
-
} else if (instance.parent) queueJob(() => {
|
|
2693
|
-
isHmrUpdating = true;
|
|
2694
|
-
const parent = instance.parent;
|
|
2695
|
-
if (parent.vapor) parent.hmrRerender();
|
|
2696
|
-
else if (!(parent.effect.flags & 1024)) {
|
|
2697
|
-
parent.renderCache = [];
|
|
2698
|
-
parent.effect.run();
|
|
2771
|
+
const dirtyInstances = new Set(instances);
|
|
2772
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
2773
|
+
runWithHmrUpdating(() => {
|
|
2774
|
+
for (const instance of instances) {
|
|
2775
|
+
const parent = instance.parent;
|
|
2776
|
+
if (parent) {
|
|
2777
|
+
if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
|
|
2778
|
+
rerenderedParents.add(parent);
|
|
2779
|
+
parent.hmrRerender();
|
|
2780
|
+
}
|
|
2781
|
+
} else instance.hmrReload(newComp);
|
|
2699
2782
|
}
|
|
2700
|
-
|
|
2701
|
-
|
|
2783
|
+
});
|
|
2784
|
+
} else {
|
|
2785
|
+
const parents = /* @__PURE__ */ new Set();
|
|
2786
|
+
const dirtyInstanceSet = new Set(instances);
|
|
2787
|
+
for (const instance of instances) {
|
|
2788
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2789
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2790
|
+
if (!dirtyInstances) {
|
|
2791
|
+
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
2792
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
2793
|
+
}
|
|
2794
|
+
dirtyInstances.add(instance);
|
|
2795
|
+
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
2796
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2797
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2798
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2799
|
+
if (instance.ceReload) {
|
|
2800
|
+
dirtyInstances.add(instance);
|
|
2801
|
+
instance.ceReload(newComp.styles);
|
|
2802
|
+
dirtyInstances.delete(instance);
|
|
2803
|
+
} else if (instance.parent) {
|
|
2804
|
+
if (!hasDirtyAncestor(instance, dirtyInstanceSet)) parents.add(instance.parent);
|
|
2805
|
+
} else if (instance.appContext.reload) instance.appContext.reload();
|
|
2806
|
+
else if (typeof window !== "undefined") window.location.reload();
|
|
2807
|
+
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2808
|
+
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
2809
|
+
}
|
|
2810
|
+
parents.forEach((parent) => {
|
|
2811
|
+
queueJob(() => {
|
|
2812
|
+
runWithHmrUpdating(() => {
|
|
2813
|
+
if (parent.vapor) parent.hmrRerender();
|
|
2814
|
+
else {
|
|
2815
|
+
const i = parent;
|
|
2816
|
+
if (!(i.effect.flags & 1024)) {
|
|
2817
|
+
i.renderCache = [];
|
|
2818
|
+
i.effect.run();
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
});
|
|
2702
2822
|
});
|
|
2703
|
-
dirtyInstances.delete(instance);
|
|
2704
2823
|
});
|
|
2705
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
2706
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
2707
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2708
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
2709
2824
|
}
|
|
2710
2825
|
queuePostFlushCb(() => {
|
|
2711
2826
|
hmrDirtyComponents.clear();
|
|
@@ -2772,20 +2887,20 @@ function devtoolsInitApp(app, version) {
|
|
|
2772
2887
|
function devtoolsUnmountApp(app) {
|
|
2773
2888
|
emit$1("app:unmount", app);
|
|
2774
2889
|
}
|
|
2775
|
-
const devtoolsComponentAdded =
|
|
2776
|
-
const devtoolsComponentUpdated =
|
|
2777
|
-
const _devtoolsComponentRemoved =
|
|
2890
|
+
const devtoolsComponentAdded = /*@__PURE__*/ createDevtoolsComponentHook("component:added");
|
|
2891
|
+
const devtoolsComponentUpdated = /*@__PURE__*/ createDevtoolsComponentHook("component:updated");
|
|
2892
|
+
const _devtoolsComponentRemoved = /*@__PURE__*/ createDevtoolsComponentHook("component:removed");
|
|
2778
2893
|
const devtoolsComponentRemoved = (component) => {
|
|
2779
2894
|
if (devtools$1 && typeof devtools$1.cleanupBuffer === "function" && !devtools$1.cleanupBuffer(component)) _devtoolsComponentRemoved(component);
|
|
2780
2895
|
};
|
|
2781
|
-
|
|
2896
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
2782
2897
|
function createDevtoolsComponentHook(hook) {
|
|
2783
2898
|
return (component) => {
|
|
2784
2899
|
emit$1(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : void 0, component);
|
|
2785
2900
|
};
|
|
2786
2901
|
}
|
|
2787
|
-
const devtoolsPerfStart =
|
|
2788
|
-
const devtoolsPerfEnd =
|
|
2902
|
+
const devtoolsPerfStart = /*@__PURE__*/ createDevtoolsPerformanceHook("perf:start");
|
|
2903
|
+
const devtoolsPerfEnd = /*@__PURE__*/ createDevtoolsPerformanceHook("perf:end");
|
|
2789
2904
|
function createDevtoolsPerformanceHook(hook) {
|
|
2790
2905
|
return (component, type, time) => {
|
|
2791
2906
|
emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
|
@@ -2848,10 +2963,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
2848
2963
|
const renderFnWithContext = (...args) => {
|
|
2849
2964
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
2850
2965
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
2966
|
+
const prevStackSize = blockStack.length;
|
|
2851
2967
|
let res;
|
|
2852
2968
|
try {
|
|
2853
2969
|
res = fn(...args);
|
|
2854
2970
|
} finally {
|
|
2971
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2855
2972
|
setCurrentRenderingInstance(prevInstance);
|
|
2856
2973
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
2857
2974
|
}
|
|
@@ -3026,7 +3143,7 @@ function instanceWatch(source, value, options) {
|
|
|
3026
3143
|
}
|
|
3027
3144
|
const prev = setCurrentInstance(this);
|
|
3028
3145
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
3029
|
-
|
|
3146
|
+
restoreCurrentInstance(prev);
|
|
3030
3147
|
return res;
|
|
3031
3148
|
}
|
|
3032
3149
|
function createPathGetter(ctx, path) {
|
|
@@ -3039,6 +3156,7 @@ function createPathGetter(ctx, path) {
|
|
|
3039
3156
|
}
|
|
3040
3157
|
//#endregion
|
|
3041
3158
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
3159
|
+
const pendingMounts = /* @__PURE__ */ new WeakMap();
|
|
3042
3160
|
const TeleportEndKey = Symbol("_vte");
|
|
3043
3161
|
const isTeleport = (type) => type.__isTeleport;
|
|
3044
3162
|
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
@@ -3047,15 +3165,16 @@ const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target inst
|
|
|
3047
3165
|
const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
|
3048
3166
|
const resolveTarget = (props, select) => {
|
|
3049
3167
|
const targetSelector = props && props.to;
|
|
3050
|
-
if (isString(targetSelector))
|
|
3051
|
-
|
|
3052
|
-
|
|
3168
|
+
if (isString(targetSelector)) {
|
|
3169
|
+
if (!select) {
|
|
3170
|
+
warn$1("Current renderer does not support string target for Teleports. (missing querySelector renderer option)");
|
|
3171
|
+
return null;
|
|
3172
|
+
} else {
|
|
3173
|
+
const target = select(targetSelector);
|
|
3174
|
+
if (!target && !isTeleportDisabled(props)) warn$1(`Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`);
|
|
3175
|
+
return target;
|
|
3176
|
+
}
|
|
3053
3177
|
} else {
|
|
3054
|
-
const target = select(targetSelector);
|
|
3055
|
-
if (!target && !isTeleportDisabled(props)) warn$1(`Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`);
|
|
3056
|
-
return target;
|
|
3057
|
-
}
|
|
3058
|
-
else {
|
|
3059
3178
|
if (!targetSelector && !isTeleportDisabled(props)) warn$1(`Invalid Teleport target: ${targetSelector}`);
|
|
3060
3179
|
return targetSelector;
|
|
3061
3180
|
}
|
|
@@ -3064,58 +3183,71 @@ const TeleportImpl = {
|
|
|
3064
3183
|
name: "Teleport",
|
|
3065
3184
|
__isTeleport: true,
|
|
3066
3185
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
3067
|
-
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
|
3186
|
+
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
|
|
3068
3187
|
const disabled = isTeleportDisabled(n2.props);
|
|
3069
|
-
let {
|
|
3188
|
+
let { dynamicChildren } = n2;
|
|
3070
3189
|
if (isHmrUpdating) {
|
|
3071
3190
|
optimized = false;
|
|
3072
3191
|
dynamicChildren = null;
|
|
3073
3192
|
}
|
|
3193
|
+
const mount = (vnode, container, anchor) => {
|
|
3194
|
+
if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
3195
|
+
};
|
|
3196
|
+
const mountToTarget = (vnode = n2) => {
|
|
3197
|
+
const disabled = isTeleportDisabled(vnode.props);
|
|
3198
|
+
const target = vnode.target = resolveTarget(vnode.props, querySelector);
|
|
3199
|
+
const targetAnchor = prepareAnchor(target, vnode, createText, insert);
|
|
3200
|
+
if (target) {
|
|
3201
|
+
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
3202
|
+
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
3203
|
+
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
3204
|
+
if (!disabled) {
|
|
3205
|
+
mount(vnode, target, targetAnchor);
|
|
3206
|
+
updateCssVars(vnode, false);
|
|
3207
|
+
}
|
|
3208
|
+
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
3209
|
+
};
|
|
3210
|
+
const queuePendingMount = (vnode) => {
|
|
3211
|
+
const mountJob = () => {
|
|
3212
|
+
if (pendingMounts.get(vnode) !== mountJob) return;
|
|
3213
|
+
pendingMounts.delete(vnode);
|
|
3214
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
3215
|
+
const mountContainer = parentNode(vnode.el) || container;
|
|
3216
|
+
mount(vnode, mountContainer, vnode.anchor);
|
|
3217
|
+
updateCssVars(vnode, true);
|
|
3218
|
+
}
|
|
3219
|
+
mountToTarget(vnode);
|
|
3220
|
+
};
|
|
3221
|
+
pendingMounts.set(vnode, mountJob);
|
|
3222
|
+
queuePostRenderEffect(mountJob, void 0, parentSuspense);
|
|
3223
|
+
};
|
|
3074
3224
|
if (n1 == null) {
|
|
3075
3225
|
const placeholder = n2.el = createComment("teleport start");
|
|
3076
3226
|
const mainAnchor = n2.anchor = createComment("teleport end");
|
|
3077
3227
|
insert(placeholder, container, anchor);
|
|
3078
3228
|
insert(mainAnchor, container, anchor);
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
3084
|
-
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
3085
|
-
if (target) {
|
|
3086
|
-
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
3087
|
-
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
3088
|
-
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
3089
|
-
if (!disabled) {
|
|
3090
|
-
mount(target, targetAnchor);
|
|
3091
|
-
updateCssVars(n2, false);
|
|
3092
|
-
}
|
|
3093
|
-
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
3094
|
-
};
|
|
3229
|
+
if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
|
|
3230
|
+
queuePendingMount(n2);
|
|
3231
|
+
return;
|
|
3232
|
+
}
|
|
3095
3233
|
if (disabled) {
|
|
3096
|
-
mount(container, mainAnchor);
|
|
3234
|
+
mount(n2, container, mainAnchor);
|
|
3097
3235
|
updateCssVars(n2, true);
|
|
3098
3236
|
}
|
|
3099
|
-
|
|
3100
|
-
n2.el.__isMounted = false;
|
|
3101
|
-
queuePostRenderEffect(() => {
|
|
3102
|
-
if (n2.el.__isMounted !== false) return;
|
|
3103
|
-
mountToTarget();
|
|
3104
|
-
delete n2.el.__isMounted;
|
|
3105
|
-
}, void 0, parentSuspense);
|
|
3106
|
-
} else mountToTarget();
|
|
3237
|
+
mountToTarget();
|
|
3107
3238
|
} else {
|
|
3108
3239
|
n2.el = n1.el;
|
|
3109
|
-
n2.targetStart = n1.targetStart;
|
|
3110
3240
|
const mainAnchor = n2.anchor = n1.anchor;
|
|
3111
|
-
const
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
}, void 0, parentSuspense);
|
|
3241
|
+
const pendingMount = pendingMounts.get(n1);
|
|
3242
|
+
if (pendingMount) {
|
|
3243
|
+
pendingMount.flags |= 4;
|
|
3244
|
+
pendingMounts.delete(n1);
|
|
3245
|
+
queuePendingMount(n2);
|
|
3117
3246
|
return;
|
|
3118
3247
|
}
|
|
3248
|
+
n2.targetStart = n1.targetStart;
|
|
3249
|
+
const target = n2.target = n1.target;
|
|
3250
|
+
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
3119
3251
|
const wasDisabled = isTeleportDisabled(n1.props);
|
|
3120
3252
|
const currentContainer = wasDisabled ? container : target;
|
|
3121
3253
|
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
@@ -3129,24 +3261,30 @@ const TeleportImpl = {
|
|
|
3129
3261
|
if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
|
|
3130
3262
|
else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
|
|
3131
3263
|
} else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
3132
|
-
const nextTarget =
|
|
3133
|
-
if (nextTarget)
|
|
3134
|
-
|
|
3264
|
+
const nextTarget = resolveTarget(n2.props, querySelector);
|
|
3265
|
+
if (nextTarget) {
|
|
3266
|
+
n2.target = nextTarget;
|
|
3267
|
+
moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
|
|
3268
|
+
} else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
|
|
3135
3269
|
} else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
|
|
3136
3270
|
updateCssVars(n2, disabled);
|
|
3137
3271
|
}
|
|
3138
3272
|
},
|
|
3139
3273
|
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
3140
|
-
const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
|
|
3274
|
+
const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
|
|
3275
|
+
const disabled = isTeleportDisabled(props);
|
|
3276
|
+
const shouldRemove = doRemove || !disabled;
|
|
3277
|
+
const pendingMount = pendingMounts.get(vnode);
|
|
3278
|
+
if (pendingMount) {
|
|
3279
|
+
pendingMount.flags |= 4;
|
|
3280
|
+
pendingMounts.delete(vnode);
|
|
3281
|
+
}
|
|
3141
3282
|
if (targetStart) hostRemove(targetStart);
|
|
3142
3283
|
if (targetAnchor) hostRemove(targetAnchor);
|
|
3143
3284
|
doRemove && hostRemove(anchor);
|
|
3144
|
-
if (shapeFlag & 16) {
|
|
3145
|
-
const
|
|
3146
|
-
|
|
3147
|
-
const child = children[i];
|
|
3148
|
-
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
3149
|
-
}
|
|
3285
|
+
if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
|
|
3286
|
+
const child = children[i];
|
|
3287
|
+
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
3150
3288
|
}
|
|
3151
3289
|
},
|
|
3152
3290
|
move: moveTeleport,
|
|
@@ -3157,7 +3295,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
3157
3295
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
3158
3296
|
const isReorder = moveType === 2;
|
|
3159
3297
|
if (isReorder) insert(el, container, parentAnchor);
|
|
3160
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
3298
|
+
if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
|
|
3161
3299
|
if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
|
|
3162
3300
|
}
|
|
3163
3301
|
if (isReorder) insert(anchor, container, parentAnchor);
|
|
@@ -3184,15 +3322,17 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
3184
3322
|
const disabled = isTeleportDisabled(vnode.props);
|
|
3185
3323
|
if (target) {
|
|
3186
3324
|
const targetNode = target._lpa || target.firstChild;
|
|
3187
|
-
if (vnode.shapeFlag & 16)
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3325
|
+
if (vnode.shapeFlag & 16) {
|
|
3326
|
+
if (disabled) {
|
|
3327
|
+
hydrateDisabledTeleport(node, vnode);
|
|
3328
|
+
hydrateAnchor(target, targetNode);
|
|
3329
|
+
if (!vnode.targetAnchor) prepareAnchor(target, vnode, createText, insert, parentNode(node) === target ? node : null);
|
|
3330
|
+
} else {
|
|
3331
|
+
vnode.anchor = nextSibling(node);
|
|
3332
|
+
hydrateAnchor(target, targetNode);
|
|
3333
|
+
if (!vnode.targetAnchor) prepareAnchor(target, vnode, createText, insert);
|
|
3334
|
+
hydrateChildren(targetNode && nextSibling(targetNode), vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3335
|
+
}
|
|
3196
3336
|
}
|
|
3197
3337
|
updateCssVars(vnode, disabled);
|
|
3198
3338
|
} else if (disabled) {
|
|
@@ -3280,49 +3420,16 @@ const BaseTransitionImpl = {
|
|
|
3280
3420
|
setup(props, { slots }) {
|
|
3281
3421
|
const instance = getCurrentInstance();
|
|
3282
3422
|
const state = useTransitionState();
|
|
3423
|
+
let resumeAfterLeave;
|
|
3283
3424
|
return () => {
|
|
3284
|
-
const
|
|
3285
|
-
if (!
|
|
3286
|
-
const child = findNonCommentChild(children);
|
|
3425
|
+
const child = resolveTransitionChild(slots.default && slots.default(), !!instance.subTree);
|
|
3426
|
+
if (!child) return;
|
|
3287
3427
|
const rawProps = /* @__PURE__ */ toRaw(props);
|
|
3288
3428
|
const { mode } = rawProps;
|
|
3289
3429
|
checkTransitionMode(mode);
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
let enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance, (hooks) => enterHooks = hooks);
|
|
3294
|
-
if (innerChild.type !== Comment) setTransitionHooks(innerChild, enterHooks);
|
|
3295
|
-
let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
|
|
3296
|
-
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
|
3297
|
-
let leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance);
|
|
3298
|
-
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
3299
|
-
if (mode === "out-in" && innerChild.type !== Comment) {
|
|
3300
|
-
state.isLeaving = true;
|
|
3301
|
-
leavingHooks.afterLeave = () => {
|
|
3302
|
-
state.isLeaving = false;
|
|
3303
|
-
if (!(instance.job.flags & 4)) instance.update();
|
|
3304
|
-
delete leavingHooks.afterLeave;
|
|
3305
|
-
oldInnerChild = void 0;
|
|
3306
|
-
};
|
|
3307
|
-
return emptyPlaceholder(child);
|
|
3308
|
-
} else if (mode === "in-out" && innerChild.type !== Comment) leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
3309
|
-
const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild);
|
|
3310
|
-
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
|
3311
|
-
el[leaveCbKey] = () => {
|
|
3312
|
-
earlyRemove();
|
|
3313
|
-
el[leaveCbKey] = void 0;
|
|
3314
|
-
delete enterHooks.delayedLeave;
|
|
3315
|
-
oldInnerChild = void 0;
|
|
3316
|
-
};
|
|
3317
|
-
enterHooks.delayedLeave = () => {
|
|
3318
|
-
delayedLeave();
|
|
3319
|
-
delete enterHooks.delayedLeave;
|
|
3320
|
-
oldInnerChild = void 0;
|
|
3321
|
-
};
|
|
3322
|
-
};
|
|
3323
|
-
else oldInnerChild = void 0;
|
|
3324
|
-
} else if (oldInnerChild) oldInnerChild = void 0;
|
|
3325
|
-
return child;
|
|
3430
|
+
return prepareTransitionSwitch(instance.subTree, child, rawProps, state, instance, mode === "out-in" ? resumeAfterLeave || (resumeAfterLeave = () => {
|
|
3431
|
+
if (!(instance.job.flags & 4)) instance.update();
|
|
3432
|
+
}) : NOOP);
|
|
3326
3433
|
};
|
|
3327
3434
|
}
|
|
3328
3435
|
};
|
|
@@ -3391,8 +3498,10 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
3391
3498
|
persisted,
|
|
3392
3499
|
beforeEnter(el) {
|
|
3393
3500
|
let hook = onBeforeEnter;
|
|
3394
|
-
if (!state.isMounted)
|
|
3395
|
-
|
|
3501
|
+
if (!state.isMounted) {
|
|
3502
|
+
if (appear) hook = onBeforeAppear || onBeforeEnter;
|
|
3503
|
+
else return;
|
|
3504
|
+
}
|
|
3396
3505
|
if (el[leaveCbKey]) el[leaveCbKey](true);
|
|
3397
3506
|
earlyRemove();
|
|
3398
3507
|
callHook(hook, [el]);
|
|
@@ -3402,11 +3511,13 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
3402
3511
|
let hook = onEnter;
|
|
3403
3512
|
let afterHook = onAfterEnter;
|
|
3404
3513
|
let cancelHook = onEnterCancelled;
|
|
3405
|
-
if (!state.isMounted)
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3514
|
+
if (!state.isMounted) {
|
|
3515
|
+
if (appear) {
|
|
3516
|
+
hook = onAppear || onEnter;
|
|
3517
|
+
afterHook = onAfterAppear || onAfterEnter;
|
|
3518
|
+
cancelHook = onAppearCancelled || onEnterCancelled;
|
|
3519
|
+
} else return;
|
|
3520
|
+
}
|
|
3410
3521
|
let called = false;
|
|
3411
3522
|
el[enterCbKey$1] = (cancelled) => {
|
|
3412
3523
|
if (called) return;
|
|
@@ -3440,7 +3551,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
3440
3551
|
else done();
|
|
3441
3552
|
},
|
|
3442
3553
|
clone(node) {
|
|
3443
|
-
return cloneHooks(node);
|
|
3554
|
+
return cloneHooks ? cloneHooks(node) : hooks;
|
|
3444
3555
|
}
|
|
3445
3556
|
};
|
|
3446
3557
|
return hooks;
|
|
@@ -3464,16 +3575,91 @@ function getInnerChild$1(vnode) {
|
|
|
3464
3575
|
if (shapeFlag & 32 && isFunction(children.default)) return children.default();
|
|
3465
3576
|
}
|
|
3466
3577
|
}
|
|
3578
|
+
function resolveTransitionChild(children, renderEmpty = false) {
|
|
3579
|
+
const branches = children && getTransitionRawChildren(children, true);
|
|
3580
|
+
return branches && branches.length ? findNonCommentChild(branches) : renderEmpty ? createCommentVNode() : void 0;
|
|
3581
|
+
}
|
|
3582
|
+
/**
|
|
3583
|
+
* @internal
|
|
3584
|
+
*/
|
|
3585
|
+
function prepareTransitionSwitch(previous, next, props, state, instance, resumeAfterLeave, delayedLeaveSource) {
|
|
3586
|
+
if (state.isLeaving) return emptyPlaceholder(next);
|
|
3587
|
+
const nextInner = getInnerChild$1(next);
|
|
3588
|
+
if (!nextInner) return emptyPlaceholder(next);
|
|
3589
|
+
let enterHooks = resolveTransitionHooks(nextInner, props, state, instance, (hooks) => {
|
|
3590
|
+
if (delayedLeaveSource) forwardDelayedLeave(hooks, delayedLeaveSource);
|
|
3591
|
+
enterHooks = hooks;
|
|
3592
|
+
});
|
|
3593
|
+
if (delayedLeaveSource) forwardDelayedLeave(enterHooks, delayedLeaveSource);
|
|
3594
|
+
if (nextInner.type !== Comment) setTransitionHooks(nextInner, enterHooks);
|
|
3595
|
+
const mode = props.mode;
|
|
3596
|
+
const previousInner = previous && getInnerChild$1(previous);
|
|
3597
|
+
if (previous && previousInner && previousInner.type !== Comment && !isSameVNodeType(previousInner, nextInner) && (!previous.component || recursiveGetSubtree(previous.component).type !== Comment)) {
|
|
3598
|
+
const leavingHooks = prepareLeavingTransitionHooks(previousInner, props, state, instance);
|
|
3599
|
+
if (nextInner.type !== Comment && (mode === "out-in" || mode === "in-out") && applyTransitionModeSwitch(previousInner, leavingHooks, mode === "in-out" ? () => enterHooks : void 0, props, state, resumeAfterLeave)) return emptyPlaceholder(next);
|
|
3600
|
+
}
|
|
3601
|
+
return next;
|
|
3602
|
+
}
|
|
3603
|
+
function forwardDelayedLeave(hooks, source) {
|
|
3604
|
+
const delayedLeave = source && source.delayedLeave;
|
|
3605
|
+
if (!delayedLeave) return;
|
|
3606
|
+
hooks.delayedLeave = () => {
|
|
3607
|
+
if (source.delayedLeave === delayedLeave) delayedLeave();
|
|
3608
|
+
delete hooks.delayedLeave;
|
|
3609
|
+
};
|
|
3610
|
+
}
|
|
3611
|
+
function prepareLeavingTransitionHooks(previousInner, props, state, instance) {
|
|
3612
|
+
return setTransitionHooks(previousInner, resolveTransitionHooks(previousInner, props, state, instance));
|
|
3613
|
+
}
|
|
3614
|
+
function applyTransitionModeSwitch(leavingVNode, leavingHooks, getEnterHooks, props, state, resumeAfterLeave) {
|
|
3615
|
+
if (props.mode === "out-in") {
|
|
3616
|
+
state.isLeaving = true;
|
|
3617
|
+
leavingHooks.afterLeave = () => {
|
|
3618
|
+
state.isLeaving = false;
|
|
3619
|
+
resumeAfterLeave();
|
|
3620
|
+
delete leavingHooks.afterLeave;
|
|
3621
|
+
};
|
|
3622
|
+
return true;
|
|
3623
|
+
} else if (props.mode === "in-out" && getEnterHooks) {
|
|
3624
|
+
let delayedLeavingVNode = leavingVNode;
|
|
3625
|
+
leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
3626
|
+
const enterHooks = getEnterHooks();
|
|
3627
|
+
if (!enterHooks) {
|
|
3628
|
+
delayedLeave();
|
|
3629
|
+
return;
|
|
3630
|
+
}
|
|
3631
|
+
const vnode = delayedLeavingVNode;
|
|
3632
|
+
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
3633
|
+
leavingVNodesCache[String(vnode.key)] = vnode;
|
|
3634
|
+
el[leaveCbKey] = () => {
|
|
3635
|
+
earlyRemove();
|
|
3636
|
+
el[leaveCbKey] = void 0;
|
|
3637
|
+
delete enterHooks.delayedLeave;
|
|
3638
|
+
delayedLeavingVNode = void 0;
|
|
3639
|
+
};
|
|
3640
|
+
enterHooks.delayedLeave = () => {
|
|
3641
|
+
delayedLeave();
|
|
3642
|
+
delete enterHooks.delayedLeave;
|
|
3643
|
+
delayedLeavingVNode = void 0;
|
|
3644
|
+
};
|
|
3645
|
+
};
|
|
3646
|
+
}
|
|
3647
|
+
return false;
|
|
3648
|
+
}
|
|
3467
3649
|
function setTransitionHooks(vnode, hooks) {
|
|
3468
|
-
if (vnode.shapeFlag & 6 && vnode.component)
|
|
3469
|
-
else {
|
|
3650
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
3470
3651
|
vnode.transition = hooks;
|
|
3471
|
-
setTransitionHooks(vnode.component
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3652
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
|
|
3653
|
+
else {
|
|
3654
|
+
const subTree = vnode.component.subTree;
|
|
3655
|
+
return setTransitionHooks(isTeleport(subTree.type) ? getInnerChild$1(subTree) || subTree : subTree, hooks);
|
|
3656
|
+
}
|
|
3657
|
+
} else if (vnode.shapeFlag & 128) {
|
|
3658
|
+
const contentHooks = vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
3659
|
+
const fallbackHooks = vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
3660
|
+
return vnode.suspense && vnode.suspense.activeBranch === vnode.ssFallback ? fallbackHooks : contentHooks;
|
|
3476
3661
|
} else vnode.transition = hooks;
|
|
3662
|
+
return hooks;
|
|
3477
3663
|
}
|
|
3478
3664
|
function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
3479
3665
|
let ret = [];
|
|
@@ -3497,9 +3683,9 @@ function checkTransitionMode(mode) {
|
|
|
3497
3683
|
}
|
|
3498
3684
|
//#endregion
|
|
3499
3685
|
//#region packages/runtime-core/src/apiDefineComponent.ts
|
|
3500
|
-
|
|
3686
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
3501
3687
|
function defineComponent(options, extraOptions) {
|
|
3502
|
-
return isFunction(options) ? extend({ name: options.name }, extraOptions, { setup: options }) : options;
|
|
3688
|
+
return isFunction(options) ? /*@__PURE__*/ (() => extend({ name: options.name }, extraOptions, { setup: options }))() : options;
|
|
3503
3689
|
}
|
|
3504
3690
|
//#endregion
|
|
3505
3691
|
//#region packages/runtime-core/src/helpers/useId.ts
|
|
@@ -3596,15 +3782,16 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3596
3782
|
if (rawRef.f) {
|
|
3597
3783
|
const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
|
|
3598
3784
|
if (isUnmount) isArray(existing) && remove(existing, refValue);
|
|
3599
|
-
else if (!isArray(existing))
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3785
|
+
else if (!isArray(existing)) {
|
|
3786
|
+
if (_isString) {
|
|
3787
|
+
refs[ref] = [refValue];
|
|
3788
|
+
if (canSetSetupRef(ref)) setupState[ref] = refs[ref];
|
|
3789
|
+
} else {
|
|
3790
|
+
const newVal = [refValue];
|
|
3791
|
+
if (canSetRef(ref, rawRef.k)) ref.value = newVal;
|
|
3792
|
+
if (rawRef.k) refs[rawRef.k] = newVal;
|
|
3793
|
+
}
|
|
3794
|
+
} else if (!existing.includes(refValue)) existing.push(refValue);
|
|
3608
3795
|
} else if (_isString) {
|
|
3609
3796
|
refs[ref] = value;
|
|
3610
3797
|
if (canSetSetupRef(ref)) setupState[ref] = value;
|
|
@@ -3656,7 +3843,18 @@ const logMismatchError = () => {
|
|
|
3656
3843
|
hasLoggedMismatchError = true;
|
|
3657
3844
|
};
|
|
3658
3845
|
const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
|
|
3659
|
-
const isMathMLContainer = (container) =>
|
|
3846
|
+
const isMathMLContainer = (container) => {
|
|
3847
|
+
if (!container.namespaceURI.includes("MathML")) return false;
|
|
3848
|
+
if (container.tagName !== "annotation-xml") return true;
|
|
3849
|
+
const encoding = container.getAttribute("encoding");
|
|
3850
|
+
return !encoding || !encoding.includes("html");
|
|
3851
|
+
};
|
|
3852
|
+
/**
|
|
3853
|
+
* Resolve the element namespace a container's children should be created in.
|
|
3854
|
+
* The live DOM is the source of truth, so this also covers containers that are
|
|
3855
|
+
* only known at runtime (interop boundaries, teleport targets).
|
|
3856
|
+
* @internal
|
|
3857
|
+
*/
|
|
3660
3858
|
const getContainerType = (container) => {
|
|
3661
3859
|
if (container.nodeType !== 1) return void 0;
|
|
3662
3860
|
if (isSVGContainer(container)) return "svg";
|
|
@@ -3680,7 +3878,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3680
3878
|
};
|
|
3681
3879
|
const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {
|
|
3682
3880
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
3683
|
-
const isFragmentStart = isComment(node) && node.data === "[";
|
|
3881
|
+
const isFragmentStart = isComment(node) && (node.data === "[" || node.data === "(");
|
|
3684
3882
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
3685
3883
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
3686
3884
|
let domType = node.nodeType;
|
|
@@ -3694,11 +3892,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3694
3892
|
let nextNode = null;
|
|
3695
3893
|
switch (type) {
|
|
3696
3894
|
case Text:
|
|
3697
|
-
if (domType !== 3)
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3895
|
+
if (domType !== 3) {
|
|
3896
|
+
if (vnode.children === "") {
|
|
3897
|
+
insert(vnode.el = createText(""), parentNode(node), node);
|
|
3898
|
+
nextNode = node;
|
|
3899
|
+
} else nextNode = onMismatch();
|
|
3900
|
+
} else {
|
|
3702
3901
|
if (node.data !== vnode.children) {
|
|
3703
3902
|
warn$1(`Hydration text mismatch in`, node.parentNode, `\n - rendered on server: ${JSON.stringify(node.data)}\n - expected on client: ${JSON.stringify(vnode.children)}`);
|
|
3704
3903
|
logMismatchError();
|
|
@@ -3735,30 +3934,35 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3735
3934
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3736
3935
|
break;
|
|
3737
3936
|
case VaporSlot:
|
|
3738
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
3937
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense, slotScopeIds);
|
|
3739
3938
|
break;
|
|
3740
|
-
default: if (shapeFlag & 1)
|
|
3741
|
-
|
|
3742
|
-
|
|
3939
|
+
default: if (shapeFlag & 1) {
|
|
3940
|
+
if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
3941
|
+
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3942
|
+
} else if (shapeFlag & 6) {
|
|
3743
3943
|
vnode.slotScopeIds = slotScopeIds;
|
|
3744
3944
|
const container = parentNode(node);
|
|
3745
3945
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
3746
3946
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
3747
3947
|
else nextNode = nextSibling(node);
|
|
3748
|
-
if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container,
|
|
3749
|
-
else
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
if (
|
|
3753
|
-
subTree
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3948
|
+
if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense);
|
|
3949
|
+
else {
|
|
3950
|
+
mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
|
|
3951
|
+
const component = vnode.component;
|
|
3952
|
+
if (!component.subTree && (isAsyncWrapper(vnode) || component.asyncDep)) {
|
|
3953
|
+
let subTree;
|
|
3954
|
+
if (isFragmentStart) {
|
|
3955
|
+
subTree = createVNode(Static);
|
|
3956
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
3957
|
+
} else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode(node.nodeType === 8 ? Comment : "div");
|
|
3958
|
+
subTree.el = node;
|
|
3959
|
+
component.subTree = subTree;
|
|
3960
|
+
}
|
|
3758
3961
|
}
|
|
3759
|
-
} else if (shapeFlag & 64)
|
|
3760
|
-
|
|
3761
|
-
|
|
3962
|
+
} else if (shapeFlag & 64) {
|
|
3963
|
+
if (domType !== 8) nextNode = onMismatch();
|
|
3964
|
+
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
3965
|
+
} else if (shapeFlag & 128) nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, getContainerType(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
3762
3966
|
else warn$1("Invalid HostVNode type:", type, `(${typeof type})`);
|
|
3763
3967
|
}
|
|
3764
3968
|
if (ref != null) setRef(ref, null, parentSuspense, vnode);
|
|
@@ -3766,7 +3970,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3766
3970
|
};
|
|
3767
3971
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
3768
3972
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
3769
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
3973
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
3770
3974
|
const forcePatch = type === "input" || type === "option";
|
|
3771
3975
|
{
|
|
3772
3976
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
@@ -3784,15 +3988,11 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3784
3988
|
}
|
|
3785
3989
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
3786
3990
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3787
|
-
|
|
3991
|
+
if (next && !isMismatchAllowed(el, 1)) {
|
|
3992
|
+
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
3993
|
+
logMismatchError();
|
|
3994
|
+
}
|
|
3788
3995
|
while (next) {
|
|
3789
|
-
if (!isMismatchAllowed(el, 1)) {
|
|
3790
|
-
if (!hasWarned) {
|
|
3791
|
-
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
3792
|
-
hasWarned = true;
|
|
3793
|
-
}
|
|
3794
|
-
logMismatchError();
|
|
3795
|
-
}
|
|
3796
3996
|
const cur = next;
|
|
3797
3997
|
next = next.nextSibling;
|
|
3798
3998
|
remove(cur);
|
|
@@ -3811,9 +4011,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3811
4011
|
}
|
|
3812
4012
|
if (props) {
|
|
3813
4013
|
const isCustomElement = el.tagName.includes("-");
|
|
4014
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
3814
4015
|
for (const key in props) {
|
|
3815
4016
|
if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
|
|
3816
|
-
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key)
|
|
4017
|
+
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) {
|
|
4018
|
+
if (isUnchangedResourceProp(el, key, props[key])) continue;
|
|
4019
|
+
patchProp(el, key, null, props[key], namespace, parentComponent);
|
|
4020
|
+
}
|
|
3817
4021
|
}
|
|
3818
4022
|
}
|
|
3819
4023
|
let vnodeHooks;
|
|
@@ -3831,7 +4035,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3831
4035
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
3832
4036
|
const children = parentVNode.children;
|
|
3833
4037
|
const l = children.length;
|
|
3834
|
-
let
|
|
4038
|
+
let hasCheckedMismatch = false;
|
|
3835
4039
|
for (let i = 0; i < l; i++) {
|
|
3836
4040
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
3837
4041
|
const isText = vnode.type === Text;
|
|
@@ -3845,12 +4049,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3845
4049
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3846
4050
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
3847
4051
|
else {
|
|
3848
|
-
if (!
|
|
3849
|
-
|
|
4052
|
+
if (!hasCheckedMismatch) {
|
|
4053
|
+
hasCheckedMismatch = true;
|
|
4054
|
+
if (!isMismatchAllowed(container, 1)) {
|
|
3850
4055
|
warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
|
|
3851
|
-
|
|
4056
|
+
logMismatchError();
|
|
3852
4057
|
}
|
|
3853
|
-
logMismatchError();
|
|
3854
4058
|
}
|
|
3855
4059
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
3856
4060
|
}
|
|
@@ -3861,8 +4065,9 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3861
4065
|
const { slotScopeIds: fragmentSlotScopeIds } = vnode;
|
|
3862
4066
|
if (fragmentSlotScopeIds) slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;
|
|
3863
4067
|
const container = parentNode(node);
|
|
3864
|
-
const
|
|
3865
|
-
|
|
4068
|
+
const first = nextSibling(node);
|
|
4069
|
+
const next = vnode.vo && node.data === "(" ? getVaporInterface(parentComponent, vnode).hydrateSlotOutlet(vnode, node, parentComponent, parentSuspense, slotScopeIds) : hydrateChildren(first, vnode, container, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4070
|
+
if (next && isComment(next) && next.data === (node.data === "(" ? ")" : "]")) return nextSibling(vnode.anchor = next);
|
|
3866
4071
|
else {
|
|
3867
4072
|
logMismatchError();
|
|
3868
4073
|
insert(vnode.anchor = createComment(`]`), container, next);
|
|
@@ -3870,8 +4075,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3870
4075
|
}
|
|
3871
4076
|
};
|
|
3872
4077
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
3873
|
-
if (!
|
|
3874
|
-
warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
|
|
4078
|
+
if (!isNodeMismatchAllowed(node, vnode)) {
|
|
4079
|
+
warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && (node.data === "[" || node.data === "(") ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
|
|
3875
4080
|
logMismatchError();
|
|
3876
4081
|
}
|
|
3877
4082
|
vnode.el = null;
|
|
@@ -3887,20 +4092,22 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3887
4092
|
const container = parentNode(node);
|
|
3888
4093
|
remove(node);
|
|
3889
4094
|
patch(null, vnode, container, next, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
3890
|
-
if (parentComponent) {
|
|
4095
|
+
if (parentComponent && parentComponent.vnode) {
|
|
3891
4096
|
parentComponent.vnode.el = vnode.el;
|
|
3892
4097
|
updateHOCHostEl(parentComponent, vnode.el);
|
|
3893
4098
|
}
|
|
3894
4099
|
return next;
|
|
3895
4100
|
};
|
|
3896
|
-
const locateClosingAnchor = (node, open = "[", close = "]") => {
|
|
4101
|
+
const locateClosingAnchor = (node, open = node && isComment(node) && node.data === "(" ? "(" : "[", close = open === "(" ? ")" : "]") => {
|
|
3897
4102
|
let match = 0;
|
|
3898
4103
|
while (node) {
|
|
3899
4104
|
node = nextSibling(node);
|
|
3900
4105
|
if (node && isComment(node)) {
|
|
3901
4106
|
if (node.data === open) match++;
|
|
3902
|
-
if (node.data === close)
|
|
3903
|
-
|
|
4107
|
+
if (node.data === close) {
|
|
4108
|
+
if (match === 0) return nextSibling(node);
|
|
4109
|
+
else match--;
|
|
4110
|
+
}
|
|
3904
4111
|
}
|
|
3905
4112
|
}
|
|
3906
4113
|
return node;
|
|
@@ -3910,7 +4117,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3910
4117
|
if (parentNode) parentNode.replaceChild(newNode, oldNode);
|
|
3911
4118
|
let parent = parentComponent;
|
|
3912
4119
|
while (parent) {
|
|
3913
|
-
if (parent.vnode.el === oldNode) parent.vnode.el = parent.subTree.el = newNode;
|
|
4120
|
+
if (parent.vnode && parent.vnode.el === oldNode) parent.vnode.el = parent.subTree.el = newNode;
|
|
3914
4121
|
parent = parent.parent;
|
|
3915
4122
|
}
|
|
3916
4123
|
};
|
|
@@ -3919,6 +4126,16 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3919
4126
|
const isTemplateNode = (node) => {
|
|
3920
4127
|
return node.nodeType === 1 && node.tagName === "TEMPLATE";
|
|
3921
4128
|
};
|
|
4129
|
+
const resourceProps = /*@__PURE__*/ new Set([
|
|
4130
|
+
"src",
|
|
4131
|
+
"srcset",
|
|
4132
|
+
"href",
|
|
4133
|
+
"poster"
|
|
4134
|
+
]);
|
|
4135
|
+
function isUnchangedResourceProp(el, key, clientValue) {
|
|
4136
|
+
if (!resourceProps.has(key)) return false;
|
|
4137
|
+
return el.getAttribute(key) === (clientValue == null ? null : `${clientValue}`);
|
|
4138
|
+
}
|
|
3922
4139
|
/**
|
|
3923
4140
|
* Dev only
|
|
3924
4141
|
*/
|
|
@@ -3962,7 +4179,10 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
|
|
|
3962
4179
|
function getAttributeMismatch(el, key, clientValue) {
|
|
3963
4180
|
let actual;
|
|
3964
4181
|
let expected;
|
|
3965
|
-
if (
|
|
4182
|
+
if (key === "hidden") {
|
|
4183
|
+
actual = normalizeHiddenValue(el.getAttribute(key));
|
|
4184
|
+
expected = normalizeHiddenValue(clientValue);
|
|
4185
|
+
} else if (isBooleanAttr(key)) {
|
|
3966
4186
|
actual = el.hasAttribute(key);
|
|
3967
4187
|
expected = includeBooleanAttr(clientValue);
|
|
3968
4188
|
} else if (clientValue == null) {
|
|
@@ -3990,6 +4210,11 @@ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
|
|
|
3990
4210
|
}
|
|
3991
4211
|
return false;
|
|
3992
4212
|
}
|
|
4213
|
+
function normalizeHiddenValue(value) {
|
|
4214
|
+
if (!isRenderableAttrValue(value)) return false;
|
|
4215
|
+
if (isString(value)) return value.toLowerCase() === "until-found" ? "until-found" : "";
|
|
4216
|
+
return includeBooleanAttr(value) ? "" : false;
|
|
4217
|
+
}
|
|
3993
4218
|
function toClassSet(str) {
|
|
3994
4219
|
return new Set(str.trim().split(/\s+/));
|
|
3995
4220
|
}
|
|
@@ -4034,7 +4259,9 @@ const MismatchTypeString = {
|
|
|
4034
4259
|
};
|
|
4035
4260
|
function isMismatchAllowed(el, allowedType) {
|
|
4036
4261
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
4037
|
-
|
|
4262
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
4263
|
+
}
|
|
4264
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
4038
4265
|
if (allowedAttr == null) return false;
|
|
4039
4266
|
else if (allowedAttr === "") return true;
|
|
4040
4267
|
else {
|
|
@@ -4043,6 +4270,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
4043
4270
|
return list.includes(MismatchTypeString[allowedType]);
|
|
4044
4271
|
}
|
|
4045
4272
|
}
|
|
4273
|
+
function isNodeMismatchAllowed(node, vnode) {
|
|
4274
|
+
return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
|
|
4275
|
+
}
|
|
4276
|
+
function isMismatchAllowedByNode(node) {
|
|
4277
|
+
return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
|
|
4278
|
+
}
|
|
4279
|
+
function isMismatchAllowedByVNode({ props }) {
|
|
4280
|
+
const allowedAttr = props && props[allowMismatchAttr];
|
|
4281
|
+
return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
|
|
4282
|
+
}
|
|
4046
4283
|
//#endregion
|
|
4047
4284
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
4048
4285
|
let requestIdleCallback;
|
|
@@ -4116,16 +4353,18 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
|
|
|
4116
4353
|
return teardown;
|
|
4117
4354
|
};
|
|
4118
4355
|
function forEachElement(node, cb) {
|
|
4119
|
-
if (isComment(node) && node.data === "[") {
|
|
4356
|
+
if (isComment(node) && (node.data === "[" || node.data === "(")) {
|
|
4357
|
+
const open = node.data;
|
|
4358
|
+
const close = open === "[" ? "]" : ")";
|
|
4120
4359
|
let depth = 1;
|
|
4121
4360
|
let next = node.nextSibling;
|
|
4122
4361
|
while (next) {
|
|
4123
4362
|
if (next.nodeType === 1) {
|
|
4124
4363
|
if (cb(next) === false) break;
|
|
4125
4364
|
} else if (isComment(next)) {
|
|
4126
|
-
if (next.data ===
|
|
4365
|
+
if (next.data === close) {
|
|
4127
4366
|
if (--depth === 0) break;
|
|
4128
|
-
} else if (next.data ===
|
|
4367
|
+
} else if (next.data === open) depth++;
|
|
4129
4368
|
}
|
|
4130
4369
|
next = next.nextSibling;
|
|
4131
4370
|
}
|
|
@@ -4134,14 +4373,14 @@ function forEachElement(node, cb) {
|
|
|
4134
4373
|
//#endregion
|
|
4135
4374
|
//#region packages/runtime-core/src/apiAsyncComponent.ts
|
|
4136
4375
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
4137
|
-
|
|
4376
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
4138
4377
|
function defineAsyncComponent(source) {
|
|
4139
4378
|
const { load, getResolvedComp, setPendingRequest, source: { loadingComponent, errorComponent, delay, hydrate: hydrateStrategy, timeout, suspensible = true } } = createAsyncComponentContext(source);
|
|
4140
4379
|
return /* @__PURE__ */ defineComponent({
|
|
4141
4380
|
name: "AsyncComponentWrapper",
|
|
4142
4381
|
__asyncLoader: load,
|
|
4143
4382
|
__asyncHydrate(el, instance, hydrate) {
|
|
4144
|
-
performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy);
|
|
4383
|
+
performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy, true);
|
|
4145
4384
|
},
|
|
4146
4385
|
get __asyncResolved() {
|
|
4147
4386
|
return getResolvedComp();
|
|
@@ -4161,11 +4400,16 @@ function defineAsyncComponent(source) {
|
|
|
4161
4400
|
onError(err);
|
|
4162
4401
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
4163
4402
|
});
|
|
4164
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
4403
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
4165
4404
|
load().then(() => {
|
|
4405
|
+
if (instance.isUnmounted) return;
|
|
4166
4406
|
loaded.value = true;
|
|
4167
4407
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
4168
4408
|
}).catch((err) => {
|
|
4409
|
+
if (instance.isUnmounted) {
|
|
4410
|
+
setPendingRequest(null);
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4169
4413
|
onError(err);
|
|
4170
4414
|
error.value = err;
|
|
4171
4415
|
});
|
|
@@ -4223,14 +4467,22 @@ function createAsyncComponentContext(source) {
|
|
|
4223
4467
|
setPendingRequest: (request) => pendingRequest = request
|
|
4224
4468
|
};
|
|
4225
4469
|
}
|
|
4226
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
4470
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
4227
4471
|
const loaded = /* @__PURE__ */ ref(false);
|
|
4228
4472
|
const error = /* @__PURE__ */ ref();
|
|
4229
4473
|
const delayed = /* @__PURE__ */ ref(!!delay);
|
|
4230
|
-
|
|
4474
|
+
let timeoutTimer;
|
|
4475
|
+
let delayTimer;
|
|
4476
|
+
if (instance) onUnmounted(() => {
|
|
4477
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
4478
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
4479
|
+
}, instance);
|
|
4480
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
4481
|
+
if (instance && instance.isUnmounted) return;
|
|
4231
4482
|
delayed.value = false;
|
|
4232
4483
|
}, delay);
|
|
4233
|
-
if (timeout != null) setTimeout(() => {
|
|
4484
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
4485
|
+
if (instance && instance.isUnmounted) return;
|
|
4234
4486
|
if (!loaded.value && !error.value) {
|
|
4235
4487
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
4236
4488
|
onError(err);
|
|
@@ -4247,9 +4499,10 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
4247
4499
|
* shared between core and vapor
|
|
4248
4500
|
* @internal
|
|
4249
4501
|
*/
|
|
4250
|
-
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
4502
|
+
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy, skipIfUpdated) {
|
|
4503
|
+
const wasConnected = el.isConnected;
|
|
4251
4504
|
let patched = false;
|
|
4252
|
-
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
4505
|
+
if (skipIfUpdated) (instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
4253
4506
|
const performHydrate = () => {
|
|
4254
4507
|
if (patched) {
|
|
4255
4508
|
{
|
|
@@ -4258,6 +4511,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
|
|
|
4258
4511
|
}
|
|
4259
4512
|
return;
|
|
4260
4513
|
}
|
|
4514
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
4261
4515
|
hydrate();
|
|
4262
4516
|
};
|
|
4263
4517
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -4334,10 +4588,13 @@ const KeepAlive = {
|
|
|
4334
4588
|
});
|
|
4335
4589
|
let pendingCacheKey = null;
|
|
4336
4590
|
const cacheSubtree = () => {
|
|
4337
|
-
if (pendingCacheKey != null)
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4591
|
+
if (pendingCacheKey != null) {
|
|
4592
|
+
if (isSuspense(keepAliveInstance.subTree.type)) queuePostRenderEffect(() => {
|
|
4593
|
+
const vnode = getInnerChild(keepAliveInstance.subTree);
|
|
4594
|
+
if (vnode.component) cache.set(pendingCacheKey, vnode);
|
|
4595
|
+
}, void 0, keepAliveInstance.subTree.suspense);
|
|
4596
|
+
else cache.set(pendingCacheKey, getInnerChild(keepAliveInstance.subTree));
|
|
4597
|
+
}
|
|
4341
4598
|
};
|
|
4342
4599
|
onMounted(cacheSubtree);
|
|
4343
4600
|
onUpdated(cacheSubtree);
|
|
@@ -4494,7 +4751,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4494
4751
|
try {
|
|
4495
4752
|
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
4496
4753
|
} finally {
|
|
4497
|
-
|
|
4754
|
+
restoreCurrentInstance(prev);
|
|
4498
4755
|
setActiveSub(prevSub);
|
|
4499
4756
|
}
|
|
4500
4757
|
});
|
|
@@ -4579,23 +4836,25 @@ function renderList(source, renderItem, cache, index) {
|
|
|
4579
4836
|
}
|
|
4580
4837
|
ret = new Array(source.length);
|
|
4581
4838
|
for (let i = 0, l = source.length; i < l; i++) ret[i] = renderItem(needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i], i, void 0, cached && cached[i]);
|
|
4582
|
-
} else if (typeof source === "number")
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
else if (isObject(source)) if (source[Symbol.iterator]) ret = Array.from(source, (item, i) => renderItem(item, i, void 0, cached && cached[i]));
|
|
4590
|
-
else {
|
|
4591
|
-
const keys = Object.keys(source);
|
|
4592
|
-
ret = new Array(keys.length);
|
|
4593
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
4594
|
-
const key = keys[i];
|
|
4595
|
-
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
4839
|
+
} else if (typeof source === "number") {
|
|
4840
|
+
if (!Number.isInteger(source) || source < 0) {
|
|
4841
|
+
warn$1(`The v-for range expects a positive integer value but got ${source}.`);
|
|
4842
|
+
ret = [];
|
|
4843
|
+
} else {
|
|
4844
|
+
ret = new Array(source);
|
|
4845
|
+
for (let i = 0; i < source; i++) ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);
|
|
4596
4846
|
}
|
|
4597
|
-
}
|
|
4598
|
-
|
|
4847
|
+
} else if (isObject(source)) {
|
|
4848
|
+
if (source[Symbol.iterator]) ret = Array.from(source, (item, i) => renderItem(item, i, void 0, cached && cached[i]));
|
|
4849
|
+
else {
|
|
4850
|
+
const keys = Object.keys(source);
|
|
4851
|
+
ret = new Array(keys.length);
|
|
4852
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
4853
|
+
const key = keys[i];
|
|
4854
|
+
ret[i] = renderItem(source[key], key, i, cached && cached[i]);
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
} else ret = [];
|
|
4599
4858
|
if (cache) cache[index] = ret;
|
|
4600
4859
|
return ret;
|
|
4601
4860
|
}
|
|
@@ -4620,37 +4879,64 @@ function createSlots(slots, dynamicSlots) {
|
|
|
4620
4879
|
//#endregion
|
|
4621
4880
|
//#region packages/runtime-core/src/helpers/renderSlot.ts
|
|
4622
4881
|
/**
|
|
4882
|
+
* Links a slot function to its raw vapor slot: a raw vapor slot carries
|
|
4883
|
+
* itself, and the wrapper the interop slots proxy hands out carries the raw
|
|
4884
|
+
* slot it wraps — one lookup answers both "is this a vapor slot" and
|
|
4885
|
+
* "which one". Internal to vapor interop.
|
|
4886
|
+
*/
|
|
4887
|
+
const rawVaporSlotKey = Symbol(`rawVaporSlot`);
|
|
4888
|
+
/**
|
|
4623
4889
|
* Compiler runtime helper for rendering `<slot/>`
|
|
4624
4890
|
* @private
|
|
4625
4891
|
*/
|
|
4626
|
-
function renderSlot(slots, name, props
|
|
4892
|
+
function renderSlot(slots, name, props, fallback, noSlotted, branchKey) {
|
|
4893
|
+
if (props == null) props = {};
|
|
4627
4894
|
let slot = slots[name];
|
|
4628
|
-
const vaporSlot = slot &&
|
|
4895
|
+
const vaporSlot = slot && slot[rawVaporSlotKey];
|
|
4629
4896
|
if (vaporSlot) {
|
|
4630
4897
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
4631
4898
|
ret.vs = {
|
|
4632
4899
|
slot: vaporSlot,
|
|
4633
|
-
fallback
|
|
4900
|
+
outlets: fallback ? [{
|
|
4901
|
+
fallback,
|
|
4902
|
+
owner: currentRenderingInstance
|
|
4903
|
+
}] : void 0
|
|
4634
4904
|
};
|
|
4905
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
4635
4906
|
return ret;
|
|
4636
4907
|
}
|
|
4637
4908
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
4638
|
-
const
|
|
4639
|
-
|
|
4640
|
-
|
|
4909
|
+
const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
|
|
4910
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
4911
|
+
if (name !== "default") slotProps.name = name;
|
|
4912
|
+
return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
|
|
4641
4913
|
}
|
|
4642
4914
|
if (slot && slot.length > 1) {
|
|
4643
4915
|
warn$1("SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.");
|
|
4644
4916
|
slot = () => [];
|
|
4645
4917
|
}
|
|
4646
4918
|
if (slot && slot._c) slot._d = false;
|
|
4919
|
+
const prevStackSize = blockStack.length;
|
|
4647
4920
|
openBlock();
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4921
|
+
let rendered;
|
|
4922
|
+
try {
|
|
4923
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4924
|
+
let attached = false;
|
|
4925
|
+
if (fallback && validSlotContent && currentRenderingInstance) {
|
|
4926
|
+
const interop = currentRenderingInstance.appContext.vapor;
|
|
4927
|
+
if (interop) attached = interop.attachSlotOutlet(validSlotContent, fallback, currentRenderingInstance);
|
|
4928
|
+
}
|
|
4929
|
+
const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
|
|
4930
|
+
rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
|
|
4931
|
+
if (!validSlotContent && fallback) rendered.shapeFlag |= 1024;
|
|
4932
|
+
if (attached) rendered.vo = true;
|
|
4933
|
+
} catch (err) {
|
|
4934
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
4935
|
+
throw err;
|
|
4936
|
+
} finally {
|
|
4937
|
+
if (slot && slot._c) slot._d = true;
|
|
4938
|
+
}
|
|
4652
4939
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
4653
|
-
if (slot && slot._c) slot._d = true;
|
|
4654
4940
|
return rendered;
|
|
4655
4941
|
}
|
|
4656
4942
|
function ensureValidVNode(vnodes) {
|
|
@@ -4661,12 +4947,6 @@ function ensureValidVNode(vnodes) {
|
|
|
4661
4947
|
return true;
|
|
4662
4948
|
}) ? vnodes : null;
|
|
4663
4949
|
}
|
|
4664
|
-
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
4665
|
-
let vaporSlot;
|
|
4666
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
|
|
4667
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
4668
|
-
}
|
|
4669
|
-
}
|
|
4670
4950
|
//#endregion
|
|
4671
4951
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
4672
4952
|
/**
|
|
@@ -4694,11 +4974,38 @@ const getPublicInstance = (i) => {
|
|
|
4694
4974
|
if (isStatefulComponent(i)) return getComponentPublicInstance(i);
|
|
4695
4975
|
return getPublicInstance(i.parent);
|
|
4696
4976
|
};
|
|
4977
|
+
const resolveDevRootEl = (vnode) => {
|
|
4978
|
+
let found = false;
|
|
4979
|
+
while (true) {
|
|
4980
|
+
if (vnode.patchFlag > 0 && vnode.patchFlag & 2048) {
|
|
4981
|
+
const root = filterSingleRoot(vnode.children);
|
|
4982
|
+
if (!root) return;
|
|
4983
|
+
vnode = root;
|
|
4984
|
+
found = true;
|
|
4985
|
+
continue;
|
|
4986
|
+
}
|
|
4987
|
+
const component = vnode.component;
|
|
4988
|
+
if (component && component.subTree) {
|
|
4989
|
+
vnode = component.subTree;
|
|
4990
|
+
continue;
|
|
4991
|
+
}
|
|
4992
|
+
const suspense = vnode.suspense;
|
|
4993
|
+
if (suspense && suspense.activeBranch) {
|
|
4994
|
+
vnode = suspense.activeBranch;
|
|
4995
|
+
continue;
|
|
4996
|
+
}
|
|
4997
|
+
return found ? vnode.el : void 0;
|
|
4998
|
+
}
|
|
4999
|
+
};
|
|
5000
|
+
const getDevRootFragmentEl = (i) => {
|
|
5001
|
+
const el = i.subTree && resolveDevRootEl(i.subTree);
|
|
5002
|
+
return el === void 0 ? i.vnode.el : el;
|
|
5003
|
+
};
|
|
4697
5004
|
let publicPropertiesMap;
|
|
4698
5005
|
const getPublicPropertiesMap = () => {
|
|
4699
5006
|
if (!publicPropertiesMap) publicPropertiesMap = extend(Object.create(null), {
|
|
4700
5007
|
$: (i) => i,
|
|
4701
|
-
$el: (i) => i
|
|
5008
|
+
$el: (i) => getDevRootFragmentEl(i),
|
|
4702
5009
|
$data: (i) => i.data,
|
|
4703
5010
|
$props: (i) => /* @__PURE__ */ shallowReadonly(i.props),
|
|
4704
5011
|
$attrs: (i) => /* @__PURE__ */ shallowReadonly(i.attrs),
|
|
@@ -4804,7 +5111,7 @@ PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
|
4804
5111
|
warn$1("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.");
|
|
4805
5112
|
return Reflect.ownKeys(target);
|
|
4806
5113
|
};
|
|
4807
|
-
const RuntimeCompiledPublicInstanceProxyHandlers =
|
|
5114
|
+
const RuntimeCompiledPublicInstanceProxyHandlers = /*@__PURE__*/ extend({}, PublicInstanceProxyHandlers, {
|
|
4808
5115
|
get(target, key) {
|
|
4809
5116
|
if (key === Symbol.unscopables) return;
|
|
4810
5117
|
return PublicInstanceProxyHandlers.get(target, key, target);
|
|
@@ -4976,12 +5283,13 @@ function mergeDefaults(raw, defaults) {
|
|
|
4976
5283
|
for (const key in defaults) {
|
|
4977
5284
|
if (key.startsWith("__skip")) continue;
|
|
4978
5285
|
let opt = props[key];
|
|
4979
|
-
if (opt)
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
5286
|
+
if (opt) {
|
|
5287
|
+
if (isArray(opt) || isFunction(opt)) opt = props[key] = {
|
|
5288
|
+
type: opt,
|
|
5289
|
+
default: defaults[key]
|
|
5290
|
+
};
|
|
5291
|
+
else opt.default = defaults[key];
|
|
5292
|
+
} else if (opt === null) opt = props[key] = { default: defaults[key] };
|
|
4985
5293
|
else warn$1(`props default key "${key}" has no corresponding declaration.`);
|
|
4986
5294
|
if (opt && defaults[`__skip_${key}`]) opt.skipFactory = true;
|
|
4987
5295
|
}
|
|
@@ -5036,21 +5344,29 @@ function withAsyncContext(getAwaitable) {
|
|
|
5036
5344
|
setCurrentInstance(null, void 0);
|
|
5037
5345
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
5038
5346
|
const restore = () => {
|
|
5347
|
+
const stoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
5039
5348
|
setCurrentInstance(ctx);
|
|
5040
5349
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
5350
|
+
return stoppedScope;
|
|
5041
5351
|
};
|
|
5042
5352
|
const cleanup = () => {
|
|
5043
5353
|
setCurrentInstance(null, void 0);
|
|
5044
5354
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
5045
5355
|
};
|
|
5046
5356
|
if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
|
|
5047
|
-
restore();
|
|
5048
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
5357
|
+
const stoppedScope = restore();
|
|
5358
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
5359
|
+
if (stoppedScope) stoppedScope.reset();
|
|
5360
|
+
cleanup();
|
|
5361
|
+
}));
|
|
5049
5362
|
throw e;
|
|
5050
5363
|
});
|
|
5051
5364
|
return [awaitable, () => {
|
|
5052
|
-
restore();
|
|
5053
|
-
Promise.resolve().then(
|
|
5365
|
+
const stoppedScope = restore();
|
|
5366
|
+
Promise.resolve().then(() => {
|
|
5367
|
+
if (stoppedScope) stoppedScope.reset();
|
|
5368
|
+
cleanup();
|
|
5369
|
+
});
|
|
5054
5370
|
}];
|
|
5055
5371
|
}
|
|
5056
5372
|
//#endregion
|
|
@@ -5111,11 +5427,12 @@ function applyOptions(instance) {
|
|
|
5111
5427
|
const opt = computedOptions[key];
|
|
5112
5428
|
const get = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
|
5113
5429
|
if (get === NOOP) warn$1(`Computed property "${key}" has no getter.`);
|
|
5430
|
+
const set = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
|
|
5431
|
+
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
5432
|
+
};
|
|
5114
5433
|
const c = computed({
|
|
5115
5434
|
get,
|
|
5116
|
-
set
|
|
5117
|
-
warn$1(`Write operation failed: computed property "${key}" is readonly.`);
|
|
5118
|
-
}
|
|
5435
|
+
set
|
|
5119
5436
|
});
|
|
5120
5437
|
Object.defineProperty(ctx, key, {
|
|
5121
5438
|
enumerable: true,
|
|
@@ -5171,9 +5488,10 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
5171
5488
|
for (const key in injectOptions) {
|
|
5172
5489
|
const opt = injectOptions[key];
|
|
5173
5490
|
let injected;
|
|
5174
|
-
if (isObject(opt))
|
|
5175
|
-
|
|
5176
|
-
|
|
5491
|
+
if (isObject(opt)) {
|
|
5492
|
+
if ("default" in opt) injected = inject(opt.from || key, opt.default, true);
|
|
5493
|
+
else injected = inject(opt.from || key);
|
|
5494
|
+
} else injected = inject(opt);
|
|
5177
5495
|
if (/* @__PURE__ */ isRef(injected)) Object.defineProperty(ctx, key, {
|
|
5178
5496
|
enumerable: true,
|
|
5179
5497
|
configurable: true,
|
|
@@ -5194,13 +5512,14 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
5194
5512
|
if (isFunction(handler)) watch(getter, handler);
|
|
5195
5513
|
else warn$1(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
5196
5514
|
} else if (isFunction(raw)) watch(getter, raw.bind(publicThis));
|
|
5197
|
-
else if (isObject(raw))
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5515
|
+
else if (isObject(raw)) {
|
|
5516
|
+
if (isArray(raw)) raw.forEach((r) => createWatcher(r, ctx, publicThis, key));
|
|
5517
|
+
else {
|
|
5518
|
+
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
|
5519
|
+
if (isFunction(handler)) watch(getter, handler, raw);
|
|
5520
|
+
else warn$1(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
5521
|
+
}
|
|
5522
|
+
} else warn$1(`Invalid watch option: "${key}"`, raw);
|
|
5204
5523
|
}
|
|
5205
5524
|
/**
|
|
5206
5525
|
* Resolve merged options and cache it on the component.
|
|
@@ -5286,7 +5605,7 @@ function mergeObjectOptions(to, from) {
|
|
|
5286
5605
|
}
|
|
5287
5606
|
function mergeEmitsOrPropsOptions(to, from) {
|
|
5288
5607
|
if (to) {
|
|
5289
|
-
if (isArray(to) && isArray(from)) return [
|
|
5608
|
+
if (isArray(to) && isArray(from)) return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
5290
5609
|
return extend(Object.create(null), normalizePropsOrEmits(to), normalizePropsOrEmits(from !== null && from !== void 0 ? from : {}));
|
|
5291
5610
|
} else return from;
|
|
5292
5611
|
}
|
|
@@ -5405,8 +5724,10 @@ function createAppAPI(mount, unmount, getPublicInstance, render) {
|
|
|
5405
5724
|
} else warn$1(`Cannot unmount an app that is not mounted.`);
|
|
5406
5725
|
},
|
|
5407
5726
|
provide(key, value) {
|
|
5408
|
-
if (key in context.provides)
|
|
5409
|
-
|
|
5727
|
+
if (key in context.provides) {
|
|
5728
|
+
if (hasOwn(context.provides, key)) warn$1(`App already provides property with key "${String(key)}". It will be overwritten with the new value.`);
|
|
5729
|
+
else warn$1(`App already provides property with key "${String(key)}" inherited from its parent element. It will be overwritten with the new value.`);
|
|
5730
|
+
}
|
|
5410
5731
|
context.provides[key] = value;
|
|
5411
5732
|
return app;
|
|
5412
5733
|
},
|
|
@@ -5445,13 +5766,17 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
5445
5766
|
const modifiers = getModelModifiers(props, camelizedName, defaultPropGetter);
|
|
5446
5767
|
const res = customRef((track, trigger) => {
|
|
5447
5768
|
let localValue;
|
|
5769
|
+
let prevPropValue = EMPTY_OBJ;
|
|
5448
5770
|
let prevSetValue = EMPTY_OBJ;
|
|
5449
5771
|
let prevEmittedValue;
|
|
5450
5772
|
watchSyncEffect(() => {
|
|
5451
5773
|
const propValue = props[camelizedName];
|
|
5452
|
-
if (hasChanged(
|
|
5453
|
-
|
|
5454
|
-
|
|
5774
|
+
if (hasChanged(prevPropValue, propValue)) {
|
|
5775
|
+
prevPropValue = propValue;
|
|
5776
|
+
if (hasChanged(localValue, propValue)) {
|
|
5777
|
+
localValue = propValue;
|
|
5778
|
+
trigger();
|
|
5779
|
+
}
|
|
5455
5780
|
}
|
|
5456
5781
|
});
|
|
5457
5782
|
return {
|
|
@@ -5474,12 +5799,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
|
|
|
5474
5799
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
5475
5800
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
5476
5801
|
}
|
|
5477
|
-
|
|
5802
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
5803
|
+
if (!hasVModel) {
|
|
5478
5804
|
localValue = value;
|
|
5479
5805
|
trigger();
|
|
5480
5806
|
}
|
|
5481
5807
|
i.emit(`update:${name}`, emittedValue);
|
|
5482
|
-
if (hasChanged(value,
|
|
5808
|
+
if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
|
|
5483
5809
|
prevSetValue = value;
|
|
5484
5810
|
prevEmittedValue = emittedValue;
|
|
5485
5811
|
}
|
|
@@ -5512,12 +5838,14 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
|
5512
5838
|
if (instance.isUnmounted) return;
|
|
5513
5839
|
{
|
|
5514
5840
|
const { emitsOptions, propsOptions } = instance;
|
|
5515
|
-
if (emitsOptions)
|
|
5516
|
-
if (!
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
if (
|
|
5841
|
+
if (emitsOptions) {
|
|
5842
|
+
if (!(event in emitsOptions) && true) {
|
|
5843
|
+
if (!propsOptions || !propsOptions[0] || !(toHandlerKey(camelize(event)) in propsOptions[0])) warn$1(`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`);
|
|
5844
|
+
} else {
|
|
5845
|
+
const validator = emitsOptions[event];
|
|
5846
|
+
if (isFunction(validator)) {
|
|
5847
|
+
if (!validator(...rawArgs)) warn$1(`Invalid event arguments: event validation failed for event "${event}".`);
|
|
5848
|
+
}
|
|
5521
5849
|
}
|
|
5522
5850
|
}
|
|
5523
5851
|
}
|
|
@@ -5526,7 +5854,7 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
|
|
|
5526
5854
|
const modifiers = isModelListener && getModelModifiers(props, event.slice(7), getter);
|
|
5527
5855
|
if (modifiers) {
|
|
5528
5856
|
if (modifiers.trim) args = rawArgs.map((a) => isString(a) ? a.trim() : a);
|
|
5529
|
-
if (modifiers.number) args =
|
|
5857
|
+
if (modifiers.number) args = args.map(looseToNumber);
|
|
5530
5858
|
}
|
|
5531
5859
|
devtoolsComponentEmit(instance, event, args);
|
|
5532
5860
|
{
|
|
@@ -5586,7 +5914,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
5586
5914
|
*/
|
|
5587
5915
|
function isEmitListener(options, key) {
|
|
5588
5916
|
if (!options || !isOn(key)) return false;
|
|
5589
|
-
key = key.slice(2)
|
|
5917
|
+
key = key.slice(2);
|
|
5918
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
5590
5919
|
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
|
5591
5920
|
}
|
|
5592
5921
|
//#endregion
|
|
@@ -5652,8 +5981,9 @@ function renderComponentRoot(instance) {
|
|
|
5652
5981
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
5653
5982
|
}
|
|
5654
5983
|
if (vnode.transition) {
|
|
5655
|
-
|
|
5656
|
-
|
|
5984
|
+
const child = isTeleport(root.type) ? getInnerChild$1(root) || root : root;
|
|
5985
|
+
if (!isElementRoot(child)) warn$1("Component inside <Transition> renders non-element root node that cannot be animated.");
|
|
5986
|
+
setTransitionHooks(child, vnode.transition);
|
|
5657
5987
|
}
|
|
5658
5988
|
if (setRoot) setRoot(root);
|
|
5659
5989
|
else result = root;
|
|
@@ -5704,18 +6034,21 @@ function filterSingleRoot(children, recurse = true) {
|
|
|
5704
6034
|
for (let i = 0; i < children.length; i++) {
|
|
5705
6035
|
const child = children[i];
|
|
5706
6036
|
if (isVNode(child)) {
|
|
5707
|
-
if (child.type !== Comment || child.children === "v-if")
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
6037
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
6038
|
+
if (singleRoot) return;
|
|
6039
|
+
else {
|
|
6040
|
+
singleRoot = child;
|
|
6041
|
+
if (recurse && singleRoot.patchFlag > 0 && singleRoot.patchFlag & 2048) return filterSingleRoot(singleRoot.children);
|
|
6042
|
+
}
|
|
5711
6043
|
}
|
|
5712
6044
|
} else return;
|
|
5713
6045
|
}
|
|
5714
6046
|
return singleRoot;
|
|
5715
6047
|
}
|
|
6048
|
+
const isFunctionalFallthroughKey = (key) => key === "class" || key === "style" || isOn(key);
|
|
5716
6049
|
const getFunctionalFallthrough = (attrs) => {
|
|
5717
6050
|
let res;
|
|
5718
|
-
for (const key in attrs) if (
|
|
6051
|
+
for (const key in attrs) if (isFunctionalFallthroughKey(key)) (res || (res = {}))[key] = attrs[key];
|
|
5719
6052
|
return res;
|
|
5720
6053
|
};
|
|
5721
6054
|
const filterModelListeners = (attrs, props) => {
|
|
@@ -5827,16 +6160,17 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5827
6160
|
let key = propsToUpdate[i];
|
|
5828
6161
|
if (isEmitListener(instance.emitsOptions, key)) continue;
|
|
5829
6162
|
const value = rawProps[key];
|
|
5830
|
-
if (options)
|
|
5831
|
-
if (
|
|
5832
|
-
attrs[key]
|
|
5833
|
-
|
|
6163
|
+
if (options) {
|
|
6164
|
+
if (hasOwn(attrs, key)) {
|
|
6165
|
+
if (value !== attrs[key]) {
|
|
6166
|
+
attrs[key] = value;
|
|
6167
|
+
hasAttrsChanged = true;
|
|
6168
|
+
}
|
|
6169
|
+
} else {
|
|
6170
|
+
const camelizedKey = camelize(key);
|
|
6171
|
+
props[camelizedKey] = resolvePropValue(options, camelizedKey, value, instance, baseResolveDefault);
|
|
5834
6172
|
}
|
|
5835
|
-
} else {
|
|
5836
|
-
const camelizedKey = camelize(key);
|
|
5837
|
-
props[camelizedKey] = resolvePropValue(options, camelizedKey, value, instance, baseResolveDefault);
|
|
5838
|
-
}
|
|
5839
|
-
else if (value !== attrs[key]) {
|
|
6173
|
+
} else if (value !== attrs[key]) {
|
|
5840
6174
|
attrs[key] = value;
|
|
5841
6175
|
hasAttrsChanged = true;
|
|
5842
6176
|
}
|
|
@@ -5845,9 +6179,11 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5845
6179
|
} else {
|
|
5846
6180
|
if (setFullProps(instance, rawProps, props, attrs)) hasAttrsChanged = true;
|
|
5847
6181
|
let kebabKey;
|
|
5848
|
-
for (const key in rawCurrentProps) if (!rawProps || !hasOwn(rawProps, key) && ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))
|
|
5849
|
-
if (
|
|
5850
|
-
|
|
6182
|
+
for (const key in rawCurrentProps) if (!rawProps || !hasOwn(rawProps, key) && ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
|
|
6183
|
+
if (options) {
|
|
6184
|
+
if (rawPrevProps && (rawPrevProps[key] !== void 0 || rawPrevProps[kebabKey] !== void 0)) props[key] = resolvePropValue(options, key, void 0, instance, baseResolveDefault, true);
|
|
6185
|
+
} else delete props[key];
|
|
6186
|
+
}
|
|
5851
6187
|
if (attrs !== rawCurrentProps) {
|
|
5852
6188
|
for (const key in attrs) if (!rawProps || !hasOwn(rawProps, key) && true) {
|
|
5853
6189
|
delete attrs[key];
|
|
@@ -5866,9 +6202,10 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
5866
6202
|
if (isReservedProp(key)) continue;
|
|
5867
6203
|
const value = rawProps[key];
|
|
5868
6204
|
let camelKey;
|
|
5869
|
-
if (options && hasOwn(options, camelKey = camelize(key)))
|
|
5870
|
-
|
|
5871
|
-
|
|
6205
|
+
if (options && hasOwn(options, camelKey = camelize(key))) {
|
|
6206
|
+
if (!needCastKeys || !needCastKeys.includes(camelKey)) props[camelKey] = value;
|
|
6207
|
+
else (rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
|
6208
|
+
} else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
5872
6209
|
if (!(key in attrs) || value !== attrs[key]) {
|
|
5873
6210
|
attrs[key] = value;
|
|
5874
6211
|
hasAttrsChanged = true;
|
|
@@ -5915,7 +6252,7 @@ function baseResolveDefault(factory, instance, key) {
|
|
|
5915
6252
|
const prev = setCurrentInstance(instance);
|
|
5916
6253
|
const props = /* @__PURE__ */ toRaw(instance.props);
|
|
5917
6254
|
value = factory.call(null, props);
|
|
5918
|
-
|
|
6255
|
+
restoreCurrentInstance(prev);
|
|
5919
6256
|
return value;
|
|
5920
6257
|
}
|
|
5921
6258
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -6031,7 +6368,7 @@ function validateProp(key, value, propOptions, resolvedProps, isAbsent) {
|
|
|
6031
6368
|
}
|
|
6032
6369
|
if (validator && !validator(value, /* @__PURE__ */ shallowReadonly(resolvedProps))) warn$1("Invalid prop: custom validator check failed for prop \"" + key + "\".");
|
|
6033
6370
|
}
|
|
6034
|
-
const isSimpleType =
|
|
6371
|
+
const isSimpleType = /*@__PURE__*/ makeMap("String,Number,Boolean,Function,Symbol,BigInt");
|
|
6035
6372
|
/**
|
|
6036
6373
|
* dev only
|
|
6037
6374
|
*/
|
|
@@ -6061,7 +6398,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
6061
6398
|
const receivedType = toRawType(value);
|
|
6062
6399
|
const expectedValue = styleValue(value, expectedType);
|
|
6063
6400
|
const receivedValue = styleValue(value, receivedType);
|
|
6064
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) &&
|
|
6401
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
|
|
6065
6402
|
message += `, got ${receivedType} `;
|
|
6066
6403
|
if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
|
|
6067
6404
|
return message;
|
|
@@ -6070,7 +6407,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
6070
6407
|
* dev only
|
|
6071
6408
|
*/
|
|
6072
6409
|
function styleValue(value, type) {
|
|
6073
|
-
if (
|
|
6410
|
+
if (isSymbol(value)) return value.toString();
|
|
6411
|
+
else if (type === "String") return `"${value}"`;
|
|
6074
6412
|
else if (type === "Number") return `${Number(value)}`;
|
|
6075
6413
|
else return `${value}`;
|
|
6076
6414
|
}
|
|
@@ -6087,8 +6425,11 @@ function isExplicable(type) {
|
|
|
6087
6425
|
/**
|
|
6088
6426
|
* dev only
|
|
6089
6427
|
*/
|
|
6090
|
-
function
|
|
6091
|
-
return args.
|
|
6428
|
+
function isCoercible(...args) {
|
|
6429
|
+
return args.every((elem) => {
|
|
6430
|
+
const value = elem.toLowerCase();
|
|
6431
|
+
return value !== "boolean" && value !== "symbol";
|
|
6432
|
+
});
|
|
6092
6433
|
}
|
|
6093
6434
|
//#endregion
|
|
6094
6435
|
//#region packages/runtime-core/src/componentSlots.ts
|
|
@@ -6140,12 +6481,13 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6140
6481
|
let deletionComparisonTarget = EMPTY_OBJ;
|
|
6141
6482
|
if (vnode.shapeFlag & 32) {
|
|
6142
6483
|
const type = children._;
|
|
6143
|
-
if (type)
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6484
|
+
if (type) {
|
|
6485
|
+
if (isHmrUpdating) {
|
|
6486
|
+
assignSlots(slots, children, optimized);
|
|
6487
|
+
trigger(instance, "set", "$slots");
|
|
6488
|
+
} else if (optimized && type === 1) needDeletionCheck = false;
|
|
6489
|
+
else assignSlots(slots, children, optimized);
|
|
6490
|
+
} else {
|
|
6149
6491
|
needDeletionCheck = !children.$stable;
|
|
6150
6492
|
normalizeObjectSlots(children, slots, instance);
|
|
6151
6493
|
}
|
|
@@ -6163,7 +6505,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6163
6505
|
let supported;
|
|
6164
6506
|
let perf;
|
|
6165
6507
|
let cachedNow$1 = 0;
|
|
6166
|
-
const p$1 =
|
|
6508
|
+
const p$1 = /*@__PURE__*/ Promise.resolve();
|
|
6167
6509
|
const getNow$1 = () => cachedNow$1 || (p$1.then(() => cachedNow$1 = 0), cachedNow$1 = isSupported() ? perf.now() : Date.now());
|
|
6168
6510
|
/**
|
|
6169
6511
|
* @internal
|
|
@@ -6244,6 +6586,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6244
6586
|
optimized = false;
|
|
6245
6587
|
n2.dynamicChildren = null;
|
|
6246
6588
|
}
|
|
6589
|
+
if (n2.dynamicChildren && n1 && n1.dynamicChildren && n1.dynamicChildren.hasOnce) {
|
|
6590
|
+
if (n2.dynamicChildren === EMPTY_ARR) n2.dynamicChildren = [];
|
|
6591
|
+
n2.dynamicChildren.hasOnce = true;
|
|
6592
|
+
}
|
|
6247
6593
|
const { type, ref, shapeFlag } = n2;
|
|
6248
6594
|
switch (type) {
|
|
6249
6595
|
case Text:
|
|
@@ -6260,7 +6606,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6260
6606
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
6261
6607
|
break;
|
|
6262
6608
|
case VaporSlot:
|
|
6263
|
-
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor, parentComponent, parentSuspense);
|
|
6609
|
+
getVaporInterface(parentComponent, n2).slot(n1, n2, container, anchor, parentComponent, parentSuspense, slotScopeIds);
|
|
6264
6610
|
break;
|
|
6265
6611
|
default: if (shapeFlag & 1) processElement(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
6266
6612
|
else if (shapeFlag & 6) processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
@@ -6379,7 +6725,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6379
6725
|
for (let i = 0; i < inheritedScopeIds.length; i++) hostSetScopeId(el, inheritedScopeIds[i]);
|
|
6380
6726
|
};
|
|
6381
6727
|
const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
|
|
6382
|
-
for (let i = start; i < children.length; i++)
|
|
6728
|
+
for (let i = start; i < children.length; i++) {
|
|
6729
|
+
const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
|
|
6730
|
+
patch(null, child, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
6731
|
+
}
|
|
6383
6732
|
};
|
|
6384
6733
|
const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
6385
6734
|
const el = n2.el = n1.el;
|
|
@@ -6391,9 +6740,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6391
6740
|
let vnodeHook;
|
|
6392
6741
|
parentComponent && toggleRecurse(parentComponent, false);
|
|
6393
6742
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
6743
|
+
if (n2.ibu) n2.ibu();
|
|
6394
6744
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
6395
6745
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
6396
|
-
if (isHmrUpdating) {
|
|
6746
|
+
if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
6397
6747
|
patchFlag = 0;
|
|
6398
6748
|
optimized = false;
|
|
6399
6749
|
dynamicChildren = null;
|
|
@@ -6424,8 +6774,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6424
6774
|
if (n1.children !== n2.children) hostSetElementText(el, n2.children);
|
|
6425
6775
|
}
|
|
6426
6776
|
} else if (!optimized && dynamicChildren == null) patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
6427
|
-
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) queuePostRenderEffect(() => {
|
|
6777
|
+
if ((vnodeHook = newProps.onVnodeUpdated) || dirs || n2.iu) queuePostRenderEffect(() => {
|
|
6428
6778
|
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
6779
|
+
n2.iu && n2.iu();
|
|
6429
6780
|
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
6430
6781
|
}, void 0, parentSuspense);
|
|
6431
6782
|
};
|
|
@@ -6433,7 +6784,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6433
6784
|
for (let i = 0; i < newChildren.length; i++) {
|
|
6434
6785
|
const oldVNode = oldChildren[i];
|
|
6435
6786
|
const newVNode = newChildren[i];
|
|
6436
|
-
|
|
6787
|
+
const container = oldVNode.el && (oldVNode.type === Fragment || !isSameVNodeType(oldVNode, newVNode) || oldVNode.shapeFlag & 198) ? hostParentNode(oldVNode.el) : fallbackContainer;
|
|
6788
|
+
patch(oldVNode, newVNode, container, null, parentComponent, parentSuspense, namespace, slotScopeIds, true);
|
|
6437
6789
|
}
|
|
6438
6790
|
};
|
|
6439
6791
|
const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
|
|
@@ -6471,25 +6823,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6471
6823
|
};
|
|
6472
6824
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
6473
6825
|
n2.slotScopeIds = slotScopeIds;
|
|
6474
|
-
if (n2.type.__vapor)
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
}
|
|
6484
|
-
else {
|
|
6485
|
-
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
|
|
6486
|
-
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
6487
|
-
});
|
|
6488
|
-
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
|
|
6489
|
-
}
|
|
6490
|
-
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
6491
|
-
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
6492
|
-
else updateComponent(n1, n2, optimized);
|
|
6826
|
+
if (n2.type.__vapor) {
|
|
6827
|
+
if (n1 == null) {
|
|
6828
|
+
if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
|
|
6829
|
+
else getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense);
|
|
6830
|
+
} else getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized));
|
|
6831
|
+
} else if (n1 == null) {
|
|
6832
|
+
if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
6833
|
+
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
6834
|
+
} else updateComponent(n1, n2, optimized);
|
|
6493
6835
|
};
|
|
6494
6836
|
const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
|
|
6495
6837
|
const instance = initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense);
|
|
@@ -6530,16 +6872,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6530
6872
|
};
|
|
6531
6873
|
const updateComponent = (n1, n2, optimized) => {
|
|
6532
6874
|
const instance = n2.component = n1.component;
|
|
6533
|
-
if (shouldUpdateComponent(n1, n2, optimized))
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6875
|
+
if (shouldUpdateComponent(n1, n2, optimized)) {
|
|
6876
|
+
if (instance.asyncDep && !instance.asyncResolved) {
|
|
6877
|
+
pushWarningContext(n2);
|
|
6878
|
+
n2.el = n1.el;
|
|
6879
|
+
updateComponentPreRender(instance, n2, optimized);
|
|
6880
|
+
popWarningContext();
|
|
6881
|
+
return;
|
|
6882
|
+
} else {
|
|
6883
|
+
instance.next = n2;
|
|
6884
|
+
instance.effect.run();
|
|
6885
|
+
}
|
|
6538
6886
|
} else {
|
|
6539
|
-
instance.next = n2;
|
|
6540
|
-
instance.effect.run();
|
|
6541
|
-
}
|
|
6542
|
-
else {
|
|
6543
6887
|
n2.el = n1.el;
|
|
6544
6888
|
instance.vnode = n2;
|
|
6545
6889
|
}
|
|
@@ -6637,6 +6981,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6637
6981
|
} else next = vnode;
|
|
6638
6982
|
if (bu) invokeArrayFns(bu);
|
|
6639
6983
|
if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
6984
|
+
if (next.ibu) next.ibu();
|
|
6640
6985
|
toggleRecurse(instance, true);
|
|
6641
6986
|
startMeasure(instance, `render`);
|
|
6642
6987
|
const nextTree = renderComponentRoot(instance);
|
|
@@ -6649,7 +6994,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6649
6994
|
next.el = nextTree.el;
|
|
6650
6995
|
if (originNext === null) updateHOCHostEl(instance, nextTree.el);
|
|
6651
6996
|
if (u) queuePostRenderEffect(u, void 0, parentSuspense);
|
|
6652
|
-
if (vnodeHook = next.props && next.props.onVnodeUpdated) queuePostRenderEffect(() =>
|
|
6997
|
+
if ((vnodeHook = next.props && next.props.onVnodeUpdated) || next.iu) queuePostRenderEffect(() => {
|
|
6998
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
6999
|
+
next.iu && next.iu();
|
|
7000
|
+
}, void 0, parentSuspense);
|
|
6653
7001
|
devtoolsComponentUpdated(instance);
|
|
6654
7002
|
popWarningContext();
|
|
6655
7003
|
}
|
|
@@ -6689,9 +7037,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6689
7037
|
if (shapeFlag & 8) {
|
|
6690
7038
|
if (prevShapeFlag & 16) unmountChildren(c1, parentComponent, parentSuspense);
|
|
6691
7039
|
if (c2 !== c1) hostSetElementText(container, c2);
|
|
6692
|
-
} else if (prevShapeFlag & 16)
|
|
6693
|
-
|
|
6694
|
-
|
|
7040
|
+
} else if (prevShapeFlag & 16) {
|
|
7041
|
+
if (shapeFlag & 16) patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
7042
|
+
else unmountChildren(c1, parentComponent, parentSuspense, true);
|
|
7043
|
+
} else {
|
|
6695
7044
|
if (prevShapeFlag & 8) hostSetElementText(container, "");
|
|
6696
7045
|
if (shapeFlag & 16) mountChildren(c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
6697
7046
|
}
|
|
@@ -6790,15 +7139,17 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6790
7139
|
const anchorVNode = c2[nextIndex + 1];
|
|
6791
7140
|
const anchor = nextIndex + 1 < l2 ? anchorVNode.el || resolveAsyncComponentPlaceholder(anchorVNode) : parentAnchor;
|
|
6792
7141
|
if (newIndexToOldIndexMap[i] === 0) patch(null, nextChild, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
6793
|
-
else if (moved)
|
|
6794
|
-
|
|
7142
|
+
else if (moved) {
|
|
7143
|
+
if (j < 0 || i !== increasingNewIndexSequence[j]) move(nextChild, container, anchor, 2, parentComponent);
|
|
7144
|
+
else j--;
|
|
7145
|
+
}
|
|
6795
7146
|
}
|
|
6796
7147
|
}
|
|
6797
7148
|
};
|
|
6798
7149
|
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
6799
7150
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
6800
7151
|
if (isVaporComponent(type) || type === VaporSlot) {
|
|
6801
|
-
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
|
|
7152
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
|
|
6802
7153
|
return;
|
|
6803
7154
|
}
|
|
6804
7155
|
if (shapeFlag & 6) {
|
|
@@ -6823,49 +7174,37 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6823
7174
|
moveStaticNode(vnode, container, anchor);
|
|
6824
7175
|
return;
|
|
6825
7176
|
}
|
|
6826
|
-
if (moveType !== 2 && shapeFlag & 1 && transition)
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
const remove = () => {
|
|
7177
|
+
if (moveType !== 2 && shapeFlag & 1 && transition) {
|
|
7178
|
+
if (moveType === 0) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense, true);
|
|
7179
|
+
else performTransitionLeave(el, transition, () => {
|
|
6830
7180
|
if (vnode.ctx.isUnmounted) hostRemove(el);
|
|
6831
7181
|
else hostInsert(el, container, anchor);
|
|
6832
|
-
};
|
|
6833
|
-
|
|
6834
|
-
if (el._isLeaving) el[leaveCbKey](true);
|
|
6835
|
-
leave(el, () => {
|
|
6836
|
-
remove();
|
|
6837
|
-
afterLeave && afterLeave();
|
|
6838
|
-
});
|
|
6839
|
-
};
|
|
6840
|
-
if (delayLeave) delayLeave(el, remove, performLeave);
|
|
6841
|
-
else performLeave();
|
|
6842
|
-
}
|
|
6843
|
-
else hostInsert(el, container, anchor);
|
|
7182
|
+
}, true, true);
|
|
7183
|
+
} else hostInsert(el, container, anchor);
|
|
6844
7184
|
};
|
|
6845
7185
|
const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
|
6846
7186
|
const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
|
|
6847
|
-
if (patchFlag === -2) optimized = false;
|
|
7187
|
+
if (patchFlag === -2 || dynamicChildren && dynamicChildren.hasOnce) optimized = false;
|
|
6848
7188
|
if (ref != null) {
|
|
6849
7189
|
const prevSub = setActiveSub();
|
|
6850
7190
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
6851
7191
|
setActiveSub(prevSub);
|
|
6852
7192
|
}
|
|
6853
|
-
if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
|
|
7193
|
+
if (cacheIndex != null && (!vnode.ctx || vnode.ctx === parentComponent)) parentComponent.renderCache[cacheIndex] = void 0;
|
|
6854
7194
|
if (shapeFlag & 256) {
|
|
6855
|
-
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
|
|
7195
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
|
|
6856
7196
|
else parentComponent.ctx.deactivate(vnode);
|
|
6857
7197
|
return;
|
|
6858
7198
|
}
|
|
7199
|
+
if (shapeFlag & 6 && isVaporComponent(type)) {
|
|
7200
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
7201
|
+
return;
|
|
7202
|
+
}
|
|
6859
7203
|
const shouldInvokeDirs = shapeFlag & 1 && dirs;
|
|
6860
7204
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
6861
7205
|
let vnodeHook;
|
|
6862
7206
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
6863
|
-
if (shapeFlag & 6)
|
|
6864
|
-
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
6865
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
6866
|
-
if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
|
|
6867
|
-
return;
|
|
6868
|
-
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
7207
|
+
if (shapeFlag & 6) unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
6869
7208
|
else {
|
|
6870
7209
|
if (shapeFlag & 128) {
|
|
6871
7210
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
@@ -6876,7 +7215,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6876
7215
|
else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
6877
7216
|
else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
|
|
6878
7217
|
if (type === VaporSlot) {
|
|
6879
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
7218
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
6880
7219
|
return;
|
|
6881
7220
|
}
|
|
6882
7221
|
if (doRemove) remove(vnode);
|
|
@@ -6900,6 +7239,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6900
7239
|
}
|
|
6901
7240
|
if (type === Static) {
|
|
6902
7241
|
removeStaticNode(vnode);
|
|
7242
|
+
if (transition && !transition.persisted && transition.afterLeave) transition.afterLeave();
|
|
6903
7243
|
return;
|
|
6904
7244
|
}
|
|
6905
7245
|
if (transition) performTransitionLeave(el, transition, () => hostRemove(el), !!(vnode.shapeFlag & 1));
|
|
@@ -6924,6 +7264,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6924
7264
|
if (effect) {
|
|
6925
7265
|
effect.stop();
|
|
6926
7266
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
7267
|
+
} else if (instance.vnode.el && subTree) {
|
|
7268
|
+
subTree.transition = instance.vnode.transition;
|
|
7269
|
+
unmount(subTree, instance, parentSuspense, doRemove);
|
|
6927
7270
|
}
|
|
6928
7271
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
6929
7272
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
@@ -6998,12 +7341,14 @@ function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
|
6998
7341
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
6999
7342
|
}
|
|
7000
7343
|
function toggleRecurse({ effect, job, vapor }, allowed) {
|
|
7001
|
-
if (!vapor)
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7344
|
+
if (!vapor) {
|
|
7345
|
+
if (allowed) {
|
|
7346
|
+
effect.flags |= 128;
|
|
7347
|
+
job.flags |= 2;
|
|
7348
|
+
} else {
|
|
7349
|
+
effect.flags &= -129;
|
|
7350
|
+
job.flags &= -3;
|
|
7351
|
+
}
|
|
7007
7352
|
}
|
|
7008
7353
|
}
|
|
7009
7354
|
function needTransition(parentSuspense, transition) {
|
|
@@ -7043,13 +7388,19 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
7043
7388
|
}
|
|
7044
7389
|
function locateNonHydratedAsyncRoot(instance) {
|
|
7045
7390
|
const subComponent = instance.subTree && instance.subTree.component;
|
|
7046
|
-
if (subComponent)
|
|
7047
|
-
|
|
7391
|
+
if (subComponent) {
|
|
7392
|
+
if (subComponent.asyncDep && !subComponent.asyncResolved) return subComponent;
|
|
7393
|
+
else return locateNonHydratedAsyncRoot(subComponent);
|
|
7394
|
+
}
|
|
7048
7395
|
}
|
|
7049
7396
|
function invalidateMount(hooks) {
|
|
7050
7397
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
7051
7398
|
}
|
|
7052
7399
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
7400
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
7401
|
+
insert();
|
|
7402
|
+
return;
|
|
7403
|
+
}
|
|
7053
7404
|
if (force || needTransition(parentSuspense, transition)) {
|
|
7054
7405
|
transition.beforeEnter(el);
|
|
7055
7406
|
insert();
|
|
@@ -7059,13 +7410,15 @@ function performTransitionEnter(el, transition, insert, parentSuspense, force =
|
|
|
7059
7410
|
function performTransitionLeave(el, transition, remove, isElement = true, force = false) {
|
|
7060
7411
|
const performRemove = () => {
|
|
7061
7412
|
remove();
|
|
7062
|
-
if (transition && !transition.persisted && transition.afterLeave) transition.afterLeave();
|
|
7413
|
+
if (transition && (force || !transition.persisted) && transition.afterLeave) transition.afterLeave();
|
|
7063
7414
|
};
|
|
7064
7415
|
if (force || isElement && transition && !transition.persisted) {
|
|
7065
7416
|
const { leave, delayLeave } = transition;
|
|
7066
7417
|
const performLeave = () => {
|
|
7418
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
7067
7419
|
if (el._isLeaving && force) el[leaveCbKey](true);
|
|
7068
|
-
|
|
7420
|
+
if (force && transition.persisted && !wasLeaving) remove();
|
|
7421
|
+
else leave(el, performRemove);
|
|
7069
7422
|
};
|
|
7070
7423
|
if (delayLeave) delayLeave(el, performRemove, performLeave);
|
|
7071
7424
|
else performLeave();
|
|
@@ -7084,7 +7437,7 @@ function isVaporComponent(type) {
|
|
|
7084
7437
|
/**
|
|
7085
7438
|
* shared between vdom and vapor
|
|
7086
7439
|
*/
|
|
7087
|
-
function getInheritedScopeIds(vnode, parentComponent) {
|
|
7440
|
+
function getInheritedScopeIds(vnode, parentComponent, includeVaporRootIds = true) {
|
|
7088
7441
|
const inheritedScopeIds = [];
|
|
7089
7442
|
let currentParent = parentComponent;
|
|
7090
7443
|
let currentVNode = vnode;
|
|
@@ -7100,6 +7453,8 @@ function getInheritedScopeIds(vnode, parentComponent) {
|
|
|
7100
7453
|
currentParent = currentParent.parent;
|
|
7101
7454
|
} else break;
|
|
7102
7455
|
}
|
|
7456
|
+
const vaporScopeIds = includeVaporRootIds && currentVNode.vaporScopeIds;
|
|
7457
|
+
if (vaporScopeIds) inheritedScopeIds.push(...vaporScopeIds);
|
|
7103
7458
|
return inheritedScopeIds;
|
|
7104
7459
|
}
|
|
7105
7460
|
function resolveAsyncComponentPlaceholder(anchorVnode) {
|
|
@@ -7118,7 +7473,7 @@ const Suspense = {
|
|
|
7118
7473
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
|
7119
7474
|
if (n1 == null) mountSuspense(n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals);
|
|
7120
7475
|
else {
|
|
7121
|
-
if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
|
7476
|
+
if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback && !parentSuspense.isHydrating) {
|
|
7122
7477
|
n2.suspense = n1.suspense;
|
|
7123
7478
|
n2.suspense.vnode = n2;
|
|
7124
7479
|
n2.el = n1.el;
|
|
@@ -7156,10 +7511,12 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
|
|
|
7156
7511
|
if (pendingBranch) {
|
|
7157
7512
|
suspense.pendingBranch = newBranch;
|
|
7158
7513
|
if (isSameVNodeType(pendingBranch, newBranch)) {
|
|
7159
|
-
|
|
7514
|
+
suspense.deps++;
|
|
7515
|
+
patch(pendingBranch, newBranch, isHydrating ? container : suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
|
|
7516
|
+
suspense.deps--;
|
|
7160
7517
|
if (suspense.deps <= 0) suspense.resolve();
|
|
7161
7518
|
else if (isInFallback) {
|
|
7162
|
-
if (!isHydrating) {
|
|
7519
|
+
if (!isHydrating && !suspense.isFallbackMountPending) {
|
|
7163
7520
|
patch(activeBranch, newFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
7164
7521
|
setActiveBranch(suspense, newFallback);
|
|
7165
7522
|
}
|
|
@@ -7171,12 +7528,16 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
|
|
|
7171
7528
|
suspense.activeBranch = pendingBranch;
|
|
7172
7529
|
} else unmount(pendingBranch, parentComponent, suspense);
|
|
7173
7530
|
suspense.deps = 0;
|
|
7531
|
+
for (let i = 0; i < suspense.effects.length; i++) {
|
|
7532
|
+
const effect = suspense.effects[i];
|
|
7533
|
+
if (effect.flags & 8) queuePostFlushCb(effect);
|
|
7534
|
+
}
|
|
7174
7535
|
suspense.effects.length = 0;
|
|
7175
7536
|
suspense.hiddenContainer = createElement("div");
|
|
7176
7537
|
if (isInFallback) {
|
|
7177
7538
|
patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, namespace, slotScopeIds, optimized);
|
|
7178
7539
|
if (suspense.deps <= 0) suspense.resolve();
|
|
7179
|
-
else {
|
|
7540
|
+
else if (!suspense.isFallbackMountPending) {
|
|
7180
7541
|
patch(activeBranch, newFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
7181
7542
|
setActiveBranch(suspense, newFallback);
|
|
7182
7543
|
}
|
|
@@ -7252,15 +7613,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7252
7613
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
7253
7614
|
else if (!resume) {
|
|
7254
7615
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
7616
|
+
let hasUpdatedAnchor = false;
|
|
7255
7617
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
7256
7618
|
if (pendingId === suspense.pendingId) {
|
|
7257
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
7619
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
7258
7620
|
queuePostFlushCb(effects);
|
|
7259
7621
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
7260
7622
|
}
|
|
7261
7623
|
};
|
|
7262
7624
|
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
7263
|
-
if (parentNode(activeBranch.el) === container)
|
|
7625
|
+
if (parentNode(activeBranch.el) === container) {
|
|
7626
|
+
anchor = next(activeBranch);
|
|
7627
|
+
hasUpdatedAnchor = true;
|
|
7628
|
+
}
|
|
7264
7629
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
7265
7630
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
7266
7631
|
}
|
|
@@ -7274,7 +7639,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7274
7639
|
let hasUnresolvedAncestor = false;
|
|
7275
7640
|
while (parent) {
|
|
7276
7641
|
if (parent.pendingBranch) {
|
|
7277
|
-
parent.effects.push(
|
|
7642
|
+
for (let i = 0; i < effects.length; i++) parent.effects.push(effects[i]);
|
|
7278
7643
|
hasUnresolvedAncestor = true;
|
|
7279
7644
|
break;
|
|
7280
7645
|
}
|
|
@@ -7284,6 +7649,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7284
7649
|
suspense.effects = [];
|
|
7285
7650
|
if (isSuspensible) {
|
|
7286
7651
|
if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
|
7652
|
+
parentSuspenseId = void 0;
|
|
7287
7653
|
parentSuspense.deps--;
|
|
7288
7654
|
if (parentSuspense.deps === 0 && !sync) parentSuspense.resolve();
|
|
7289
7655
|
}
|
|
@@ -7298,8 +7664,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7298
7664
|
const mountFallback = () => {
|
|
7299
7665
|
suspense.isFallbackMountPending = false;
|
|
7300
7666
|
if (!suspense.isInFallback) return;
|
|
7301
|
-
|
|
7302
|
-
|
|
7667
|
+
const latestFallback = suspense.vnode.ssFallback;
|
|
7668
|
+
patch(null, latestFallback, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
7669
|
+
setActiveBranch(suspense, latestFallback);
|
|
7303
7670
|
};
|
|
7304
7671
|
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
7305
7672
|
if (delayEnter) {
|
|
@@ -7320,10 +7687,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
7320
7687
|
registerDep(instance, onResolve) {
|
|
7321
7688
|
const isInPendingSuspense = !!suspense.pendingBranch;
|
|
7322
7689
|
if (isInPendingSuspense) suspense.deps++;
|
|
7690
|
+
const hydratedEl = instance.vnode && instance.vnode.el;
|
|
7323
7691
|
instance.asyncDep.catch((err) => {
|
|
7324
7692
|
handleError(err, instance, 0);
|
|
7325
7693
|
}).then((asyncSetupResult) => {
|
|
7326
7694
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
7695
|
+
setCurrentInstance(null, void 0);
|
|
7696
|
+
if (hydratedEl && !instance.scope.active) {
|
|
7697
|
+
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
7698
|
+
return;
|
|
7699
|
+
}
|
|
7327
7700
|
instance.asyncResolved = true;
|
|
7328
7701
|
onResolve(asyncSetupResult);
|
|
7329
7702
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -7374,9 +7747,10 @@ function normalizeSuspenseSlot(s) {
|
|
|
7374
7747
|
return s;
|
|
7375
7748
|
}
|
|
7376
7749
|
function queueEffectWithSuspense(fn, id, suspense) {
|
|
7377
|
-
if (suspense && suspense.pendingBranch)
|
|
7378
|
-
|
|
7379
|
-
|
|
7750
|
+
if (suspense && suspense.pendingBranch) {
|
|
7751
|
+
if (isArray(fn)) suspense.effects.push(...fn);
|
|
7752
|
+
else suspense.effects.push(fn);
|
|
7753
|
+
} else queuePostFlushCb(fn, id);
|
|
7380
7754
|
}
|
|
7381
7755
|
function setActiveBranch(suspense, branch) {
|
|
7382
7756
|
suspense.activeBranch = branch;
|
|
@@ -7543,9 +7917,24 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
7543
7917
|
if (shapeFlag & 128) type.normalize(vnode);
|
|
7544
7918
|
} else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
7545
7919
|
if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
7920
|
+
if (props && vnode.shapeFlag & 1) {
|
|
7921
|
+
const overwritingProp = props.innerHTML != null ? "innerHTML" : props.textContent != null ? "textContent" : null;
|
|
7922
|
+
if (overwritingProp && hasContentChildren(vnode.children)) warn$1(`The \`${overwritingProp}\` prop on <${vnode.type}> will override its children. Remove either the \`${overwritingProp}\` prop or the children.`);
|
|
7923
|
+
}
|
|
7546
7924
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
|
|
7547
7925
|
return vnode;
|
|
7548
7926
|
}
|
|
7927
|
+
/**
|
|
7928
|
+
* dev only
|
|
7929
|
+
* Whether children would actually render something. Empty text and empty
|
|
7930
|
+
* arrays are ignored, mirroring the compiler's `node.children.length` check
|
|
7931
|
+
* for `v-html` / `v-text`.
|
|
7932
|
+
*/
|
|
7933
|
+
function hasContentChildren(children) {
|
|
7934
|
+
if (isString(children)) return children !== "";
|
|
7935
|
+
if (isArray(children)) return children.length > 0;
|
|
7936
|
+
return false;
|
|
7937
|
+
}
|
|
7549
7938
|
const createVNode = createVNodeWithArgsTransform;
|
|
7550
7939
|
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
7551
7940
|
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
@@ -7555,8 +7944,10 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
7555
7944
|
if (isVNode(type)) {
|
|
7556
7945
|
const cloned = cloneVNode(type, props, true);
|
|
7557
7946
|
if (children) normalizeChildren(cloned, children);
|
|
7558
|
-
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock)
|
|
7559
|
-
|
|
7947
|
+
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
7948
|
+
if (cloned.shapeFlag & 6) currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
7949
|
+
else currentBlock.push(cloned);
|
|
7950
|
+
}
|
|
7560
7951
|
cloned.patchFlag = -2;
|
|
7561
7952
|
return cloned;
|
|
7562
7953
|
}
|
|
@@ -7613,11 +8004,31 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
7613
8004
|
el: vnode.el,
|
|
7614
8005
|
anchor: vnode.anchor,
|
|
7615
8006
|
ctx: vnode.ctx,
|
|
7616
|
-
ce: vnode.ce
|
|
8007
|
+
ce: vnode.ce,
|
|
8008
|
+
vi: vnode.vi,
|
|
8009
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
8010
|
+
vb: vnode.vb,
|
|
8011
|
+
ibu: vnode.ibu,
|
|
8012
|
+
iu: vnode.iu,
|
|
8013
|
+
cacheIndex: vnode.cacheIndex
|
|
7617
8014
|
};
|
|
7618
8015
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
7619
8016
|
return cloned;
|
|
7620
8017
|
}
|
|
8018
|
+
function cloneVaporSlotMeta(vnode) {
|
|
8019
|
+
const vaporSlot = vnode.vs;
|
|
8020
|
+
if (!vaporSlot) return vaporSlot;
|
|
8021
|
+
const cloned = {
|
|
8022
|
+
slot: vaporSlot.slot,
|
|
8023
|
+
outlets: vaporSlot.outlets
|
|
8024
|
+
};
|
|
8025
|
+
if (vnode.el) {
|
|
8026
|
+
cloned.state = vaporSlot.state;
|
|
8027
|
+
cloned.ref = vaporSlot.ref;
|
|
8028
|
+
cloned.scope = vaporSlot.scope;
|
|
8029
|
+
}
|
|
8030
|
+
return cloned;
|
|
8031
|
+
}
|
|
7621
8032
|
/**
|
|
7622
8033
|
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
7623
8034
|
* https://github.com/vitejs/vite/issues/2022
|
|
@@ -7661,25 +8072,32 @@ function normalizeChildren(vnode, children) {
|
|
|
7661
8072
|
const { shapeFlag } = vnode;
|
|
7662
8073
|
if (children == null) children = null;
|
|
7663
8074
|
else if (isArray(children)) type = 16;
|
|
7664
|
-
else if (typeof children === "object")
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
8075
|
+
else if (typeof children === "object") {
|
|
8076
|
+
if (shapeFlag & 65) {
|
|
8077
|
+
const slot = children.default;
|
|
8078
|
+
if (slot) {
|
|
8079
|
+
slot._c && (slot._d = false);
|
|
8080
|
+
normalizeChildren(vnode, slot());
|
|
8081
|
+
slot._c && (slot._d = true);
|
|
8082
|
+
}
|
|
8083
|
+
return;
|
|
8084
|
+
} else {
|
|
8085
|
+
type = 32;
|
|
8086
|
+
const slotFlag = children._;
|
|
8087
|
+
if (!slotFlag && !isInternalObject(children)) children._ctx = currentRenderingInstance;
|
|
8088
|
+
else if (slotFlag === 3 && currentRenderingInstance) {
|
|
8089
|
+
if (currentRenderingInstance.slots._ === 1) children._ = 1;
|
|
8090
|
+
else {
|
|
8091
|
+
children._ = 2;
|
|
8092
|
+
vnode.patchFlag |= 1024;
|
|
8093
|
+
}
|
|
8094
|
+
}
|
|
7670
8095
|
}
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
if (!slotFlag && !isInternalObject(children)) children._ctx = currentRenderingInstance;
|
|
7676
|
-
else if (slotFlag === 3 && currentRenderingInstance) if (currentRenderingInstance.slots._ === 1) children._ = 1;
|
|
7677
|
-
else {
|
|
7678
|
-
children._ = 2;
|
|
7679
|
-
vnode.patchFlag |= 1024;
|
|
8096
|
+
} else if (isFunction(children)) {
|
|
8097
|
+
if (shapeFlag & 65) {
|
|
8098
|
+
normalizeChildren(vnode, { default: children });
|
|
8099
|
+
return;
|
|
7680
8100
|
}
|
|
7681
|
-
}
|
|
7682
|
-
else if (isFunction(children)) {
|
|
7683
8101
|
children = {
|
|
7684
8102
|
default: children,
|
|
7685
8103
|
_ctx: currentRenderingInstance
|
|
@@ -7743,6 +8161,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
|
|
|
7743
8161
|
simpleSetCurrentInstance(instance);
|
|
7744
8162
|
}
|
|
7745
8163
|
};
|
|
8164
|
+
/**
|
|
8165
|
+
* Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
|
|
8166
|
+
* `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
|
|
8167
|
+
* verbatim instead of re-triggering the `instance.scope` default.
|
|
8168
|
+
* @internal
|
|
8169
|
+
*/
|
|
8170
|
+
const restoreCurrentInstance = (prev) => {
|
|
8171
|
+
setCurrentScope(prev[1]);
|
|
8172
|
+
simpleSetCurrentInstance(prev[0]);
|
|
8173
|
+
};
|
|
7746
8174
|
const internalOptions = [
|
|
7747
8175
|
"ce",
|
|
7748
8176
|
"type",
|
|
@@ -7774,7 +8202,7 @@ const useInstanceOption = (key, silent = false) => {
|
|
|
7774
8202
|
};
|
|
7775
8203
|
//#endregion
|
|
7776
8204
|
//#region packages/runtime-core/src/component.ts
|
|
7777
|
-
const emptyAppContext =
|
|
8205
|
+
const emptyAppContext = /*@__PURE__*/ createAppContext();
|
|
7778
8206
|
let uid = 0;
|
|
7779
8207
|
function createComponentInstance(vnode, parent, suspense) {
|
|
7780
8208
|
const type = vnode.type;
|
|
@@ -7894,7 +8322,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7894
8322
|
const setupResult = callWithErrorHandling(setup, instance, 0, [/* @__PURE__ */ shallowReadonly(instance.props), setupContext]);
|
|
7895
8323
|
const isAsyncSetup = isPromise(setupResult);
|
|
7896
8324
|
setActiveSub(prevSub);
|
|
7897
|
-
|
|
8325
|
+
restoreCurrentInstance(prev);
|
|
7898
8326
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
|
|
7899
8327
|
if (isAsyncSetup) {
|
|
7900
8328
|
const unsetCurrentInstance = () => {
|
|
@@ -7902,7 +8330,12 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7902
8330
|
};
|
|
7903
8331
|
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
|
7904
8332
|
if (isSSR) return setupResult.then((resolvedResult) => {
|
|
7905
|
-
|
|
8333
|
+
setInSSRSetupState(true);
|
|
8334
|
+
try {
|
|
8335
|
+
handleSetupResult(instance, resolvedResult, isSSR);
|
|
8336
|
+
} finally {
|
|
8337
|
+
setInSSRSetupState(false);
|
|
8338
|
+
}
|
|
7906
8339
|
}).catch((e) => {
|
|
7907
8340
|
handleError(e, instance, 0);
|
|
7908
8341
|
});
|
|
@@ -7963,13 +8396,15 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
7963
8396
|
applyOptions(instance);
|
|
7964
8397
|
} finally {
|
|
7965
8398
|
setActiveSub(prevSub);
|
|
7966
|
-
|
|
8399
|
+
restoreCurrentInstance(prevInstance);
|
|
7967
8400
|
}
|
|
7968
8401
|
}
|
|
7969
|
-
if (!Component.render && instance.render === NOOP && !isSSR)
|
|
8402
|
+
if (!Component.render && instance.render === NOOP && !isSSR) {
|
|
8403
|
+
if (!compile && Component.template)
|
|
7970
8404
|
/* v8 ignore start */
|
|
7971
|
-
|
|
7972
|
-
|
|
8405
|
+
warn$1("Component provided template option but runtime compilation is not supported in this build of Vue. Use \"vue.esm-browser.js\" instead.");
|
|
8406
|
+
else warn$1(`Component is missing template or render function: `, Component);
|
|
8407
|
+
}
|
|
7973
8408
|
}
|
|
7974
8409
|
const attrsProxyHandlers = {
|
|
7975
8410
|
get(target, key) {
|
|
@@ -8032,14 +8467,13 @@ function getComponentPublicInstance(instance) {
|
|
|
8032
8467
|
if (instance.exposed) return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
8033
8468
|
get(target, key) {
|
|
8034
8469
|
if (key in target) return target[key];
|
|
8035
|
-
else {
|
|
8470
|
+
else if (!instance.vapor) {
|
|
8036
8471
|
const publicPropertiesMap = getPublicPropertiesMap();
|
|
8037
8472
|
if (key in publicPropertiesMap) return publicPropertiesMap[key](instance);
|
|
8038
8473
|
}
|
|
8039
8474
|
},
|
|
8040
8475
|
has(target, key) {
|
|
8041
|
-
|
|
8042
|
-
return key in target || key in publicPropertiesMap;
|
|
8476
|
+
return key in target || !instance.vapor && key in getPublicPropertiesMap();
|
|
8043
8477
|
}
|
|
8044
8478
|
}));
|
|
8045
8479
|
else return instance.proxy;
|
|
@@ -8077,11 +8511,12 @@ function h(type, propsOrChildren, children) {
|
|
|
8077
8511
|
try {
|
|
8078
8512
|
setBlockTracking(-1);
|
|
8079
8513
|
const l = arguments.length;
|
|
8080
|
-
if (l === 2)
|
|
8081
|
-
if (
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8514
|
+
if (l === 2) {
|
|
8515
|
+
if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
|
|
8516
|
+
if (isVNode(propsOrChildren)) return createVNode(type, null, [propsOrChildren]);
|
|
8517
|
+
return createVNode(type, propsOrChildren);
|
|
8518
|
+
} else return createVNode(type, null, propsOrChildren);
|
|
8519
|
+
} else {
|
|
8085
8520
|
if (l > 3) children = Array.prototype.slice.call(arguments, 2);
|
|
8086
8521
|
else if (l === 3 && isVNode(children)) children = [children];
|
|
8087
8522
|
return createVNode(type, propsOrChildren, children);
|
|
@@ -8273,7 +8708,7 @@ function isMemoSame(cached, memo) {
|
|
|
8273
8708
|
}
|
|
8274
8709
|
//#endregion
|
|
8275
8710
|
//#region packages/runtime-core/src/index.ts
|
|
8276
|
-
const version = "3.6.0-
|
|
8711
|
+
const version = "3.6.0-rc.10";
|
|
8277
8712
|
const warn = warn$1;
|
|
8278
8713
|
/**
|
|
8279
8714
|
* Runtime error messages. Only exposed in dev or esm builds.
|
|
@@ -8301,7 +8736,7 @@ const DeprecationTypes = null;
|
|
|
8301
8736
|
let policy = void 0;
|
|
8302
8737
|
const tt = typeof window !== "undefined" && window.trustedTypes;
|
|
8303
8738
|
if (tt) try {
|
|
8304
|
-
policy =
|
|
8739
|
+
policy = /*@__PURE__*/ tt.createPolicy("vue", { createHTML: (val) => val });
|
|
8305
8740
|
} catch (e) {
|
|
8306
8741
|
warn(`Error creating trusted types policy: ${e}`);
|
|
8307
8742
|
}
|
|
@@ -8309,7 +8744,7 @@ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) =>
|
|
|
8309
8744
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
8310
8745
|
const mathmlNS = "http://www.w3.org/1998/Math/MathML";
|
|
8311
8746
|
const doc = typeof document !== "undefined" ? document : null;
|
|
8312
|
-
const templateContainer = doc &&
|
|
8747
|
+
const templateContainer = doc && /*@__PURE__*/ doc.createElement("template");
|
|
8313
8748
|
const nodeOps = {
|
|
8314
8749
|
insert: (child, parent, anchor) => {
|
|
8315
8750
|
parent.insertBefore(child, anchor || null);
|
|
@@ -8383,7 +8818,7 @@ const DOMTransitionPropsValidators = {
|
|
|
8383
8818
|
leaveActiveClass: String,
|
|
8384
8819
|
leaveToClass: String
|
|
8385
8820
|
};
|
|
8386
|
-
const TransitionPropsValidators =
|
|
8821
|
+
const TransitionPropsValidators = /*@__PURE__*/ extend({}, BaseTransitionPropsValidators, DOMTransitionPropsValidators);
|
|
8387
8822
|
/**
|
|
8388
8823
|
* Wrap logic that attaches extra properties to Transition in a function
|
|
8389
8824
|
* so that it can be annotated as pure
|
|
@@ -8397,7 +8832,7 @@ const decorate$1 = (t) => {
|
|
|
8397
8832
|
* DOM Transition is a higher-order-component based on the platform-agnostic
|
|
8398
8833
|
* base Transition component, with DOM-specific logic.
|
|
8399
8834
|
*/
|
|
8400
|
-
const Transition =
|
|
8835
|
+
const Transition = /*@__PURE__*/ decorate$1((props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots));
|
|
8401
8836
|
/**
|
|
8402
8837
|
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
|
8403
8838
|
* with custom HOCs.
|
|
@@ -8619,14 +9054,15 @@ const vShow = {
|
|
|
8619
9054
|
},
|
|
8620
9055
|
updated(el, { value, oldValue }, { transition }) {
|
|
8621
9056
|
if (!value === !oldValue) return;
|
|
8622
|
-
if (transition)
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
9057
|
+
if (transition) {
|
|
9058
|
+
if (value) {
|
|
9059
|
+
transition.beforeEnter(el);
|
|
9060
|
+
setDisplay(el, true);
|
|
9061
|
+
transition.enter(el);
|
|
9062
|
+
} else transition.leave(el, () => {
|
|
9063
|
+
setDisplay(el, false);
|
|
9064
|
+
});
|
|
9065
|
+
} else setDisplay(el, value);
|
|
8630
9066
|
},
|
|
8631
9067
|
beforeUnmount(el, { value }) {
|
|
8632
9068
|
setDisplay(el, value);
|
|
@@ -8645,49 +9081,20 @@ const CSS_VAR_TEXT = Symbol("CSS_VAR_TEXT");
|
|
|
8645
9081
|
*/
|
|
8646
9082
|
function useCssVars(getter) {
|
|
8647
9083
|
const instance = getCurrentInstance();
|
|
8648
|
-
const getVars = () => getter(instance.proxy);
|
|
8649
|
-
const setVars = (vars) => {
|
|
8650
|
-
if (instance.ce) setVarsOnNode(instance.ce, vars);
|
|
8651
|
-
else setVarsOnVNode(instance.subTree, vars);
|
|
8652
|
-
};
|
|
8653
|
-
baseUseCssVars(instance, () => instance.subTree.el.parentNode, getVars, setVars);
|
|
8654
|
-
}
|
|
8655
|
-
function setVarsOnVNode(vnode, vars) {
|
|
8656
|
-
if (vnode.shapeFlag & 128) {
|
|
8657
|
-
const suspense = vnode.suspense;
|
|
8658
|
-
vnode = suspense.activeBranch;
|
|
8659
|
-
if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
|
|
8660
|
-
setVarsOnVNode(suspense.activeBranch, vars);
|
|
8661
|
-
});
|
|
8662
|
-
}
|
|
8663
|
-
while (vnode.component) vnode = vnode.component.subTree;
|
|
8664
|
-
if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
|
|
8665
|
-
else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
|
8666
|
-
else if (vnode.type === Static) {
|
|
8667
|
-
let { el, anchor } = vnode;
|
|
8668
|
-
while (el) {
|
|
8669
|
-
setVarsOnNode(el, vars);
|
|
8670
|
-
if (el === anchor) break;
|
|
8671
|
-
el = el.nextSibling;
|
|
8672
|
-
}
|
|
8673
|
-
}
|
|
8674
|
-
}
|
|
8675
|
-
/**
|
|
8676
|
-
* @internal
|
|
8677
|
-
* shared between vdom and vapor
|
|
8678
|
-
*/
|
|
8679
|
-
function baseUseCssVars(instance, getParentNode, getVars, setVars) {
|
|
8680
9084
|
/* v8 ignore start */
|
|
8681
9085
|
if (!instance) {
|
|
8682
9086
|
warn(`useCssVars is called without current active component instance.`);
|
|
8683
9087
|
return;
|
|
8684
9088
|
}
|
|
9089
|
+
/* v8 ignore stop */
|
|
9090
|
+
const getVars = () => getter(instance.proxy);
|
|
8685
9091
|
instance.getCssVars = getVars;
|
|
8686
9092
|
const updateTeleports = instance.ut = (vars = getVars()) => {
|
|
8687
9093
|
Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach((node) => setVarsOnNode(node, vars));
|
|
8688
9094
|
};
|
|
8689
9095
|
const applyCssVars = (vars = getVars()) => {
|
|
8690
|
-
|
|
9096
|
+
if (instance.ce) setVarsOnNode(instance.ce, vars);
|
|
9097
|
+
else setVarsOnVNode(instance.subTree, vars);
|
|
8691
9098
|
updateTeleports(vars);
|
|
8692
9099
|
};
|
|
8693
9100
|
onBeforeUpdate(() => {
|
|
@@ -8700,10 +9107,38 @@ function baseUseCssVars(instance, getParentNode, getVars, setVars) {
|
|
|
8700
9107
|
applyCssVars(vars);
|
|
8701
9108
|
}, NOOP, { flush: "post" });
|
|
8702
9109
|
const ob = new MutationObserver(() => applyCssVars());
|
|
8703
|
-
ob.observe(
|
|
9110
|
+
ob.observe(instance.subTree.el.parentNode, { childList: true });
|
|
8704
9111
|
onUnmounted(() => ob.disconnect());
|
|
8705
9112
|
});
|
|
8706
9113
|
}
|
|
9114
|
+
function setVarsOnVNode(vnode, vars) {
|
|
9115
|
+
if (vnode.shapeFlag & 128) {
|
|
9116
|
+
const suspense = vnode.suspense;
|
|
9117
|
+
vnode = suspense.activeBranch;
|
|
9118
|
+
if (suspense.pendingBranch && !suspense.isHydrating) suspense.effects.push(() => {
|
|
9119
|
+
setVarsOnVNode(suspense.activeBranch, vars);
|
|
9120
|
+
});
|
|
9121
|
+
}
|
|
9122
|
+
while (vnode.component) {
|
|
9123
|
+
const component = vnode.component;
|
|
9124
|
+
if (component.vapor) {
|
|
9125
|
+
component.appContext.vapor.applyCssVars(vnode, vars);
|
|
9126
|
+
return;
|
|
9127
|
+
}
|
|
9128
|
+
vnode = vnode.component.subTree;
|
|
9129
|
+
}
|
|
9130
|
+
if (vnode.shapeFlag & 1 && vnode.el) setVarsOnNode(vnode.el, vars);
|
|
9131
|
+
else if (vnode.vb) vnode.ctx.appContext.vapor.applyCssVars(vnode, vars);
|
|
9132
|
+
else if (vnode.type === Fragment) vnode.children.forEach((c) => setVarsOnVNode(c, vars));
|
|
9133
|
+
else if (vnode.type === Static) {
|
|
9134
|
+
let { el, anchor } = vnode;
|
|
9135
|
+
while (el) {
|
|
9136
|
+
setVarsOnNode(el, vars);
|
|
9137
|
+
if (el === anchor) break;
|
|
9138
|
+
el = el.nextSibling;
|
|
9139
|
+
}
|
|
9140
|
+
}
|
|
9141
|
+
}
|
|
8707
9142
|
/**
|
|
8708
9143
|
* @internal
|
|
8709
9144
|
* shared between vdom and vapor
|
|
@@ -8728,15 +9163,20 @@ function patchStyle(el, prev, next) {
|
|
|
8728
9163
|
const isCssString = isString(next);
|
|
8729
9164
|
let hasControlledDisplay = false;
|
|
8730
9165
|
if (next && !isCssString) {
|
|
8731
|
-
if (prev)
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
9166
|
+
if (prev) {
|
|
9167
|
+
if (!isString(prev)) {
|
|
9168
|
+
for (const key in prev) if (next[key] == null) setStyle(style, key, "");
|
|
9169
|
+
} else for (const prevStyle of prev.split(";")) {
|
|
9170
|
+
const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim();
|
|
9171
|
+
if (next[key] == null) setStyle(style, key, "");
|
|
9172
|
+
}
|
|
8736
9173
|
}
|
|
8737
9174
|
for (const key in next) {
|
|
8738
9175
|
if (key === "display") hasControlledDisplay = true;
|
|
8739
|
-
|
|
9176
|
+
const value = next[key];
|
|
9177
|
+
if (value != null) {
|
|
9178
|
+
if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
|
|
9179
|
+
} else setStyle(style, key, "");
|
|
8740
9180
|
}
|
|
8741
9181
|
} else if (isCssString) {
|
|
8742
9182
|
if (prev !== next) {
|
|
@@ -8745,7 +9185,11 @@ function patchStyle(el, prev, next) {
|
|
|
8745
9185
|
style.cssText = next;
|
|
8746
9186
|
hasControlledDisplay = displayRE.test(next);
|
|
8747
9187
|
}
|
|
8748
|
-
} else if (prev)
|
|
9188
|
+
} else if (prev) {
|
|
9189
|
+
const cssVarText = style[CSS_VAR_TEXT];
|
|
9190
|
+
if (cssVarText) style.cssText = cssVarText;
|
|
9191
|
+
else el.removeAttribute("style");
|
|
9192
|
+
}
|
|
8749
9193
|
if (vShowOriginalDisplay in el) {
|
|
8750
9194
|
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : "";
|
|
8751
9195
|
if (el[vShowHidden]) style.display = "none";
|
|
@@ -8758,8 +9202,10 @@ function setStyle(style, name, rawVal) {
|
|
|
8758
9202
|
else {
|
|
8759
9203
|
const val = rawVal == null ? "" : String(rawVal);
|
|
8760
9204
|
if (semicolonRE.test(val)) warn(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
8761
|
-
if (name.startsWith("--"))
|
|
8762
|
-
|
|
9205
|
+
if (name.startsWith("--")) {
|
|
9206
|
+
if (importantRE.test(val)) style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
9207
|
+
else style.setProperty(name, val);
|
|
9208
|
+
} else {
|
|
8763
9209
|
const prefixed = autoPrefix(style, name);
|
|
8764
9210
|
if (importantRE.test(val)) style.setProperty(hyphenate(prefixed), val.replace(importantRE, ""), "important");
|
|
8765
9211
|
else style[prefixed] = val;
|
|
@@ -8784,13 +9230,22 @@ function autoPrefix(style, rawName) {
|
|
|
8784
9230
|
}
|
|
8785
9231
|
return rawName;
|
|
8786
9232
|
}
|
|
9233
|
+
/**
|
|
9234
|
+
* Browsers update textarea width/height directly during native resize.
|
|
9235
|
+
* Only special-case this common textarea path for now; other resize scenarios
|
|
9236
|
+
* still follow normal vnode style patching.
|
|
9237
|
+
*/
|
|
9238
|
+
function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
|
|
9239
|
+
return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
|
|
9240
|
+
}
|
|
8787
9241
|
//#endregion
|
|
8788
9242
|
//#region packages/runtime-dom/src/modules/attrs.ts
|
|
8789
9243
|
const xlinkNS = "http://www.w3.org/1999/xlink";
|
|
8790
9244
|
function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
|
|
8791
|
-
if (isSVG && key.startsWith("xlink:"))
|
|
8792
|
-
|
|
8793
|
-
|
|
9245
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
9246
|
+
if (value == null) el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
9247
|
+
else el.setAttributeNS(xlinkNS, key, value);
|
|
9248
|
+
} else if (value == null || isBoolean && !includeBooleanAttr(value)) el.removeAttribute(key);
|
|
8794
9249
|
else el.setAttribute(key, isBoolean ? "" : isSymbol(value) ? String(value) : value);
|
|
8795
9250
|
}
|
|
8796
9251
|
//#endregion
|
|
@@ -8842,7 +9297,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
8842
9297
|
const existingInvoker = invokers[rawName];
|
|
8843
9298
|
if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
|
|
8844
9299
|
else {
|
|
8845
|
-
const [name, options] =
|
|
9300
|
+
const [name, options] = parseEventName(rawName);
|
|
8846
9301
|
if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
|
|
8847
9302
|
else if (existingInvoker) {
|
|
8848
9303
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -8850,27 +9305,40 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
8850
9305
|
}
|
|
8851
9306
|
}
|
|
8852
9307
|
}
|
|
8853
|
-
const optionsModifierRE = /(
|
|
8854
|
-
|
|
9308
|
+
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
9309
|
+
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
9310
|
+
function parseEventName(name) {
|
|
8855
9311
|
let options;
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
options[m[0].toLowerCase()] = true;
|
|
8862
|
-
}
|
|
9312
|
+
let m;
|
|
9313
|
+
while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
|
|
9314
|
+
if (!options) options = {};
|
|
9315
|
+
name = name.slice(0, name.length - m[1].length);
|
|
9316
|
+
options[m[1].toLowerCase()] = true;
|
|
8863
9317
|
}
|
|
8864
9318
|
return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
|
|
8865
9319
|
}
|
|
8866
9320
|
let cachedNow = 0;
|
|
8867
|
-
const p =
|
|
9321
|
+
const p = /*@__PURE__*/ Promise.resolve();
|
|
8868
9322
|
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now());
|
|
8869
9323
|
function createInvoker(initialValue, instance) {
|
|
8870
9324
|
const invoker = (e) => {
|
|
8871
9325
|
if (!e._vts) e._vts = Date.now();
|
|
8872
9326
|
else if (e._vts <= invoker.attached) return;
|
|
8873
|
-
|
|
9327
|
+
const value = invoker.value;
|
|
9328
|
+
if (isArray(value)) {
|
|
9329
|
+
const originalStop = e.stopImmediatePropagation;
|
|
9330
|
+
e.stopImmediatePropagation = () => {
|
|
9331
|
+
originalStop.call(e);
|
|
9332
|
+
e._stopped = true;
|
|
9333
|
+
};
|
|
9334
|
+
const handlers = value.slice();
|
|
9335
|
+
const args = [e];
|
|
9336
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
9337
|
+
if (e._stopped) break;
|
|
9338
|
+
const handler = handlers[i];
|
|
9339
|
+
if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
|
|
9340
|
+
}
|
|
9341
|
+
} else callWithAsyncErrorHandling(value, instance, 5, [e]);
|
|
8874
9342
|
};
|
|
8875
9343
|
invoker.value = initialValue;
|
|
8876
9344
|
invoker.attached = getNow();
|
|
@@ -8881,16 +9349,6 @@ function sanitizeEventValue(value, propName) {
|
|
|
8881
9349
|
warn(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
|
|
8882
9350
|
return NOOP;
|
|
8883
9351
|
}
|
|
8884
|
-
function patchStopImmediatePropagation(e, value) {
|
|
8885
|
-
if (isArray(value)) {
|
|
8886
|
-
const originalStop = e.stopImmediatePropagation;
|
|
8887
|
-
e.stopImmediatePropagation = () => {
|
|
8888
|
-
originalStop.call(e);
|
|
8889
|
-
e._stopped = true;
|
|
8890
|
-
};
|
|
8891
|
-
return value.map((fn) => (e) => !e._stopped && fn && fn(e));
|
|
8892
|
-
} else return value;
|
|
8893
|
-
}
|
|
8894
9352
|
//#endregion
|
|
8895
9353
|
//#region packages/runtime-dom/src/patchProp.ts
|
|
8896
9354
|
const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
|
|
@@ -8928,7 +9386,7 @@ function shouldSetAsPropForVueCE(el, key) {
|
|
|
8928
9386
|
//#endregion
|
|
8929
9387
|
//#region packages/runtime-dom/src/apiCustomElement.ts
|
|
8930
9388
|
const REMOVAL = {};
|
|
8931
|
-
|
|
9389
|
+
/*@__NO_SIDE_EFFECTS__*/
|
|
8932
9390
|
function defineCustomElement(options, extraOptions, _createApp) {
|
|
8933
9391
|
let Comp = /* @__PURE__ */ defineComponent(options, extraOptions);
|
|
8934
9392
|
if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
|
|
@@ -8977,12 +9435,14 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
8977
9435
|
this._parent = parent;
|
|
8978
9436
|
break;
|
|
8979
9437
|
}
|
|
8980
|
-
if (!this._instance)
|
|
8981
|
-
|
|
8982
|
-
this._pendingResolve =
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
9438
|
+
if (!this._instance) {
|
|
9439
|
+
if (this._resolved) this._mountComponent(this._def);
|
|
9440
|
+
else if (parent && parent._pendingResolve) this._pendingResolve = parent._pendingResolve.then(() => {
|
|
9441
|
+
this._pendingResolve = void 0;
|
|
9442
|
+
if (this.isConnected) return this._resolveDef();
|
|
9443
|
+
});
|
|
9444
|
+
else this._resolveDef();
|
|
9445
|
+
}
|
|
8986
9446
|
}
|
|
8987
9447
|
disconnectedCallback() {
|
|
8988
9448
|
this._connected = false;
|
|
@@ -9016,7 +9476,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9016
9476
|
* resolve inner component definition (handle possible async component)
|
|
9017
9477
|
*/
|
|
9018
9478
|
_resolveDef() {
|
|
9019
|
-
if (this._pendingResolve) return;
|
|
9479
|
+
if (this._pendingResolve) return this._pendingResolve;
|
|
9020
9480
|
for (let i = 0; i < this.attributes.length; i++) this._setAttr(this.attributes[i].name);
|
|
9021
9481
|
this._ob = new MutationObserver(this._processMutations.bind(this));
|
|
9022
9482
|
this._ob.observe(this, { attributes: true });
|
|
@@ -9046,6 +9506,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9046
9506
|
this._def = def;
|
|
9047
9507
|
resolve(def);
|
|
9048
9508
|
});
|
|
9509
|
+
return this._pendingResolve;
|
|
9049
9510
|
} else resolve(this._def);
|
|
9050
9511
|
}
|
|
9051
9512
|
_mountComponent(def) {
|
|
@@ -9084,14 +9545,17 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9084
9545
|
const { props } = def;
|
|
9085
9546
|
const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
|
|
9086
9547
|
for (const key of Object.keys(this)) if (key[0] !== "_" && declaredPropKeys.includes(key)) this._setProp(key, this[key]);
|
|
9087
|
-
for (const key of declaredPropKeys.map(camelize))
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9548
|
+
for (const key of declaredPropKeys.map(camelize)) {
|
|
9549
|
+
if (key in Object.getPrototypeOf(this)) warn(`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`);
|
|
9550
|
+
Object.defineProperty(this, key, {
|
|
9551
|
+
get() {
|
|
9552
|
+
return this._getProp(key);
|
|
9553
|
+
},
|
|
9554
|
+
set(val) {
|
|
9555
|
+
this._setProp(key, val, true, !this._patching);
|
|
9556
|
+
}
|
|
9557
|
+
});
|
|
9558
|
+
}
|
|
9095
9559
|
}
|
|
9096
9560
|
_setAttr(key) {
|
|
9097
9561
|
if (key.startsWith("data-v-")) return;
|
|
@@ -9194,13 +9658,11 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9194
9658
|
_renderSlots() {
|
|
9195
9659
|
const outlets = this._getSlots();
|
|
9196
9660
|
const scopeId = this._instance.type.__scopeId;
|
|
9197
|
-
const slotReplacements = /* @__PURE__ */ new Map();
|
|
9198
9661
|
for (let i = 0; i < outlets.length; i++) {
|
|
9199
9662
|
const o = outlets[i];
|
|
9200
9663
|
const slotName = o.getAttribute("name") || "default";
|
|
9201
9664
|
const content = this._slots[slotName];
|
|
9202
9665
|
const parent = o.parentNode;
|
|
9203
|
-
const replacementNodes = [];
|
|
9204
9666
|
if (content) for (const n of content) {
|
|
9205
9667
|
if (scopeId && n.nodeType === 1) {
|
|
9206
9668
|
const id = scopeId + "-s";
|
|
@@ -9210,17 +9672,10 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9210
9672
|
while (child = walker.nextNode()) child.setAttribute(id, "");
|
|
9211
9673
|
}
|
|
9212
9674
|
parent.insertBefore(n, o);
|
|
9213
|
-
replacementNodes.push(n);
|
|
9214
|
-
}
|
|
9215
|
-
else while (o.firstChild) {
|
|
9216
|
-
const child = o.firstChild;
|
|
9217
|
-
parent.insertBefore(child, o);
|
|
9218
|
-
replacementNodes.push(child);
|
|
9219
9675
|
}
|
|
9676
|
+
else while (o.firstChild) parent.insertBefore(o.firstChild, o);
|
|
9220
9677
|
parent.removeChild(o);
|
|
9221
|
-
slotReplacements.set(o, replacementNodes);
|
|
9222
9678
|
}
|
|
9223
|
-
this._updateSlotNodes(slotReplacements);
|
|
9224
9679
|
}
|
|
9225
9680
|
/**
|
|
9226
9681
|
* @internal
|
|
@@ -9259,7 +9714,7 @@ var VueElementBase = class VueElementBase extends BaseClass {
|
|
|
9259
9714
|
* @internal
|
|
9260
9715
|
*/
|
|
9261
9716
|
_hasShadowRoot() {
|
|
9262
|
-
return this.
|
|
9717
|
+
return this._root !== this;
|
|
9263
9718
|
}
|
|
9264
9719
|
/**
|
|
9265
9720
|
* @internal
|
|
@@ -9304,10 +9759,6 @@ var VueElement = class extends VueElementBase {
|
|
|
9304
9759
|
if (this._instance && this._instance.ce) this._instance.ce = void 0;
|
|
9305
9760
|
this._app = this._instance = null;
|
|
9306
9761
|
}
|
|
9307
|
-
/**
|
|
9308
|
-
* Only called when shadowRoot is false
|
|
9309
|
-
*/
|
|
9310
|
-
_updateSlotNodes(replacements) {}
|
|
9311
9762
|
_createVNode() {
|
|
9312
9763
|
const baseProps = {};
|
|
9313
9764
|
if (!this.shadowRoot) baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
|
|
@@ -9373,7 +9824,7 @@ const decorate = (t) => {
|
|
|
9373
9824
|
};
|
|
9374
9825
|
const TransitionGroup = /* @__PURE__ */ decorate({
|
|
9375
9826
|
name: "TransitionGroup",
|
|
9376
|
-
props:
|
|
9827
|
+
props: /*@__PURE__*/ extend({}, TransitionPropsValidators, {
|
|
9377
9828
|
tag: String,
|
|
9378
9829
|
moveClass: String
|
|
9379
9830
|
}),
|
|
@@ -9406,7 +9857,7 @@ const TransitionGroup = /* @__PURE__ */ decorate({
|
|
|
9406
9857
|
prevChildren = [];
|
|
9407
9858
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
9408
9859
|
const child = children[i];
|
|
9409
|
-
if (child.el && child.el instanceof Element) {
|
|
9860
|
+
if (child.el && child.el instanceof Element && !child.el[vShowHidden]) {
|
|
9410
9861
|
prevChildren.push(child);
|
|
9411
9862
|
setTransitionHooks(child, resolveTransitionHooks(child, cssTransitionProps, state, instance));
|
|
9412
9863
|
positionMap.set(child, getPosition(child.el));
|
|
@@ -9504,13 +9955,22 @@ function onCompositionEnd(e) {
|
|
|
9504
9955
|
}
|
|
9505
9956
|
}
|
|
9506
9957
|
const assignKey = Symbol("_assign");
|
|
9958
|
+
const initialValueKey = Symbol("_initialValue");
|
|
9507
9959
|
const vModelText = {
|
|
9508
9960
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
9961
|
+
if (el.parentNode) {
|
|
9962
|
+
if (el.type === "text") el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
9963
|
+
else if (el.type === "textarea") el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
9964
|
+
}
|
|
9509
9965
|
el[assignKey] = getModelAssigner(vnode);
|
|
9510
9966
|
vModelTextInit(el, trim, number || !!(vnode.props && vnode.props.type === "number"), lazy);
|
|
9511
9967
|
},
|
|
9512
|
-
mounted(el, { value }) {
|
|
9513
|
-
|
|
9968
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
9969
|
+
const newValue = value == null ? "" : value;
|
|
9970
|
+
const initialValue = el[initialValueKey];
|
|
9971
|
+
delete el[initialValueKey];
|
|
9972
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) el[assignKey](castValue(el.value, trim, number));
|
|
9973
|
+
else el.value = newValue;
|
|
9514
9974
|
},
|
|
9515
9975
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
9516
9976
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -9630,7 +10090,8 @@ const vModelSelect = {
|
|
|
9630
10090
|
mounted(el, { value }) {
|
|
9631
10091
|
vModelSetSelected(el, value);
|
|
9632
10092
|
},
|
|
9633
|
-
beforeUpdate(el,
|
|
10093
|
+
beforeUpdate(el, { value }, vnode) {
|
|
10094
|
+
el._modelValue = value;
|
|
9634
10095
|
el[assignKey] = getModelAssigner(vnode);
|
|
9635
10096
|
},
|
|
9636
10097
|
updated(el, { value }) {
|
|
@@ -9641,21 +10102,42 @@ const vModelSelect = {
|
|
|
9641
10102
|
* @internal
|
|
9642
10103
|
*/
|
|
9643
10104
|
const vModelSelectInit = (el, value, number, set) => {
|
|
9644
|
-
|
|
10105
|
+
el._modelValue = value;
|
|
9645
10106
|
addEventListener(el, "change", () => {
|
|
9646
10107
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
|
|
9647
|
-
|
|
9648
|
-
el.
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
10108
|
+
const multiple = el.multiple;
|
|
10109
|
+
const assignedValue = multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
|
|
10110
|
+
const pending = el._pendingValue = [multiple, multiple ? isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue];
|
|
10111
|
+
try {
|
|
10112
|
+
(set || el[assignKey])(assignedValue);
|
|
10113
|
+
} finally {
|
|
10114
|
+
nextTick(() => {
|
|
10115
|
+
if (el._pendingValue === pending) el._pendingValue = void 0;
|
|
10116
|
+
});
|
|
10117
|
+
}
|
|
9652
10118
|
});
|
|
9653
10119
|
};
|
|
10120
|
+
function isSameSelectValue(value, assignedValue, multiple) {
|
|
10121
|
+
if (!multiple) return looseEqual(value, assignedValue);
|
|
10122
|
+
if (isArray(value)) return looseEqual(value, assignedValue);
|
|
10123
|
+
if (isSet(value)) {
|
|
10124
|
+
if (value.size !== assignedValue.length) return false;
|
|
10125
|
+
for (const item of assignedValue) if (!value.has(item)) return false;
|
|
10126
|
+
return true;
|
|
10127
|
+
}
|
|
10128
|
+
return false;
|
|
10129
|
+
}
|
|
9654
10130
|
/**
|
|
9655
10131
|
* @internal
|
|
9656
10132
|
*/
|
|
9657
10133
|
const vModelSetSelected = (el, value) => {
|
|
9658
|
-
|
|
10134
|
+
el._modelValue = value;
|
|
10135
|
+
const pending = el._pendingValue;
|
|
10136
|
+
el._pendingValue = void 0;
|
|
10137
|
+
if (pending && pending[0] === el.multiple && isSameSelectValue(value, pending[1], pending[0])) return;
|
|
10138
|
+
setSelected(el, value);
|
|
10139
|
+
};
|
|
10140
|
+
function setSelected(el, value) {
|
|
9659
10141
|
const isMultiple = el.multiple;
|
|
9660
10142
|
const isArrayValue = isArray(value);
|
|
9661
10143
|
if (isMultiple && !isArrayValue && !isSet(value)) {
|
|
@@ -9665,18 +10147,19 @@ const vModelSetSelected = (el, value) => {
|
|
|
9665
10147
|
for (let i = 0, l = el.options.length; i < l; i++) {
|
|
9666
10148
|
const option = el.options[i];
|
|
9667
10149
|
const optionValue = getValue(option);
|
|
9668
|
-
if (isMultiple)
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
10150
|
+
if (isMultiple) {
|
|
10151
|
+
if (isArrayValue) {
|
|
10152
|
+
const optionType = typeof optionValue;
|
|
10153
|
+
if (optionType === "string" || optionType === "number") option.selected = value.some((v) => String(v) === String(optionValue));
|
|
10154
|
+
else option.selected = looseIndexOf(value, optionValue) > -1;
|
|
10155
|
+
} else option.selected = value.has(optionValue);
|
|
10156
|
+
} else if (looseEqual(getValue(option), value)) {
|
|
9674
10157
|
if (el.selectedIndex !== i) el.selectedIndex = i;
|
|
9675
10158
|
return;
|
|
9676
10159
|
}
|
|
9677
10160
|
}
|
|
9678
10161
|
if (!isMultiple && el.selectedIndex !== -1) el.selectedIndex = -1;
|
|
9679
|
-
}
|
|
10162
|
+
}
|
|
9680
10163
|
/**
|
|
9681
10164
|
* @internal retrieve raw value set via :value bindings
|
|
9682
10165
|
*/
|
|
@@ -9778,7 +10261,7 @@ const withKeys = (fn, modifiers) => {
|
|
|
9778
10261
|
};
|
|
9779
10262
|
//#endregion
|
|
9780
10263
|
//#region packages/runtime-dom/src/index.ts
|
|
9781
|
-
const rendererOptions =
|
|
10264
|
+
const rendererOptions = /*@__PURE__*/ extend({ patchProp }, nodeOps);
|
|
9782
10265
|
let renderer;
|
|
9783
10266
|
let enabledHydration = false;
|
|
9784
10267
|
function ensureRenderer() {
|