From f5361d9426bbfd81ec275366fa271d39a68fa2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Mon, 26 Jun 2023 12:10:40 +0800 Subject: [PATCH] update docs --- docs/.vitepress/cache/deps/_metadata.json | 6 +- docs/.vitepress/cache/deps/vue.js | 3605 ++++++++++++++------- docs/.vitepress/cache/deps/vue.js.map | 6 +- docs/.vitepress/theme/style.css | 15 +- docs/package.json | 2 +- 5 files changed, 2457 insertions(+), 1177 deletions(-) diff --git a/docs/.vitepress/cache/deps/_metadata.json b/docs/.vitepress/cache/deps/_metadata.json index cf9e1535..189a9873 100644 --- a/docs/.vitepress/cache/deps/_metadata.json +++ b/docs/.vitepress/cache/deps/_metadata.json @@ -1,11 +1,11 @@ { - "hash": "6f7e7a0c", - "browserHash": "e8cc6d21", + "hash": "837c5365", + "browserHash": "8541a50e", "optimized": { "vue": { "src": "../../../node_modules/vue/dist/vue.runtime.esm-bundler.js", "file": "vue.js", - "fileHash": "98aba298", + "fileHash": "4247883c", "needsInterop": false } }, diff --git a/docs/.vitepress/cache/deps/vue.js b/docs/.vitepress/cache/deps/vue.js index 1708501e..cc22c9f2 100644 --- a/docs/.vitepress/cache/deps/vue.js +++ b/docs/.vitepress/cache/deps/vue.js @@ -7,7 +7,96 @@ function makeMap(str, expectsLowerCase) { } return expectsLowerCase ? (val) => !!map2[val.toLowerCase()] : (val) => !!map2[val]; } -var GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt"; +var EMPTY_OBJ = true ? Object.freeze({}) : {}; +var EMPTY_ARR = true ? Object.freeze([]) : []; +var NOOP = () => { +}; +var NO = () => false; +var onRE = /^on[^a-z]/; +var isOn = (key) => onRE.test(key); +var isModelListener = (key) => key.startsWith("onUpdate:"); +var extend = Object.assign; +var remove = (arr, el) => { + const i = arr.indexOf(el); + if (i > -1) { + arr.splice(i, 1); + } +}; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var hasOwn = (val, key) => hasOwnProperty.call(val, key); +var isArray = Array.isArray; +var isMap = (val) => toTypeString(val) === "[object Map]"; +var isSet = (val) => toTypeString(val) === "[object Set]"; +var isDate = (val) => toTypeString(val) === "[object Date]"; +var isRegExp = (val) => toTypeString(val) === "[object RegExp]"; +var isFunction = (val) => typeof val === "function"; +var isString = (val) => typeof val === "string"; +var isSymbol = (val) => typeof val === "symbol"; +var isObject = (val) => val !== null && typeof val === "object"; +var isPromise = (val) => { + return isObject(val) && isFunction(val.then) && isFunction(val.catch); +}; +var objectToString = Object.prototype.toString; +var toTypeString = (value) => objectToString.call(value); +var toRawType = (value) => { + return toTypeString(value).slice(8, -1); +}; +var isPlainObject = (val) => toTypeString(val) === "[object Object]"; +var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; +var isReservedProp = makeMap( + // the leading comma is intentional so empty string "" is also included + ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" +); +var isBuiltInDirective = makeMap( + "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" +); +var cacheStringFunction = (fn) => { + const cache = /* @__PURE__ */ Object.create(null); + return (str) => { + const hit = cache[str]; + return hit || (cache[str] = fn(str)); + }; +}; +var camelizeRE = /-(\w)/g; +var camelize = cacheStringFunction((str) => { + return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); +}); +var hyphenateRE = /\B([A-Z])/g; +var hyphenate = cacheStringFunction( + (str) => str.replace(hyphenateRE, "-$1").toLowerCase() +); +var capitalize = cacheStringFunction( + (str) => str.charAt(0).toUpperCase() + str.slice(1) +); +var toHandlerKey = cacheStringFunction( + (str) => str ? `on${capitalize(str)}` : `` +); +var hasChanged = (value, oldValue) => !Object.is(value, oldValue); +var invokeArrayFns = (fns, arg) => { + for (let i = 0; i < fns.length; i++) { + fns[i](arg); + } +}; +var def = (obj, key, value) => { + Object.defineProperty(obj, key, { + configurable: true, + enumerable: false, + value + }); +}; +var looseToNumber = (val) => { + const n = parseFloat(val); + return isNaN(n) ? val : n; +}; +var toNumber = (val) => { + const n = isString(val) ? Number(val) : NaN; + return isNaN(n) ? val : n; +}; +var _globalThis; +var getGlobalThis = () => { + return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); +}; +var GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console"; var isGloballyWhitelisted = makeMap(GLOBALS_WHITE_LISTED); function normalizeStyle(value) { if (isArray(value)) { @@ -30,7 +119,7 @@ function normalizeStyle(value) { } var listDelimiterRE = /;(?![^(]*\))/g; var propertyDelimiterRE = /:([^]+)/; -var styleCommentRE = /\/\*.*?\*\//gs; +var styleCommentRE = /\/\*[^]*?\*\//g; function parseStringStyle(cssText) { const ret = {}; cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { @@ -81,12 +170,18 @@ var isSVGTag = makeMap(SVG_TAGS); var isVoidTag = makeMap(VOID_TAGS); var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; var isSpecialBooleanAttr = makeMap(specialBooleanAttrs); -var isBooleanAttr = makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`); +var isBooleanAttr = makeMap( + specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` +); function includeBooleanAttr(value) { return !!value || value === ""; } -var isKnownHtmlAttr = 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,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`); -var isKnownSvgAttr = 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,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`); +var isKnownHtmlAttr = 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` +); +var isKnownSvgAttr = 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,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` +); function looseCompareArrays(a, b) { if (a.length !== b.length) return false; @@ -160,87 +255,6 @@ var replacer = (_key, val) => { } return val; }; -var EMPTY_OBJ = true ? Object.freeze({}) : {}; -var EMPTY_ARR = true ? Object.freeze([]) : []; -var NOOP = () => { -}; -var NO = () => false; -var onRE = /^on[^a-z]/; -var isOn = (key) => onRE.test(key); -var isModelListener = (key) => key.startsWith("onUpdate:"); -var extend = Object.assign; -var remove = (arr, el) => { - const i = arr.indexOf(el); - if (i > -1) { - arr.splice(i, 1); - } -}; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var hasOwn = (val, key) => hasOwnProperty.call(val, key); -var isArray = Array.isArray; -var isMap = (val) => toTypeString(val) === "[object Map]"; -var isSet = (val) => toTypeString(val) === "[object Set]"; -var isDate = (val) => toTypeString(val) === "[object Date]"; -var isRegExp = (val) => toTypeString(val) === "[object RegExp]"; -var isFunction = (val) => typeof val === "function"; -var isString = (val) => typeof val === "string"; -var isSymbol = (val) => typeof val === "symbol"; -var isObject = (val) => val !== null && typeof val === "object"; -var isPromise = (val) => { - return isObject(val) && isFunction(val.then) && isFunction(val.catch); -}; -var objectToString = Object.prototype.toString; -var toTypeString = (value) => objectToString.call(value); -var toRawType = (value) => { - return toTypeString(value).slice(8, -1); -}; -var isPlainObject = (val) => toTypeString(val) === "[object Object]"; -var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; -var isReservedProp = makeMap( - // the leading comma is intentional so empty string "" is also included - ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" -); -var isBuiltInDirective = makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"); -var cacheStringFunction = (fn) => { - const cache = /* @__PURE__ */ Object.create(null); - return (str) => { - const hit = cache[str]; - return hit || (cache[str] = fn(str)); - }; -}; -var camelizeRE = /-(\w)/g; -var camelize = cacheStringFunction((str) => { - return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); -}); -var hyphenateRE = /\B([A-Z])/g; -var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); -var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1)); -var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``); -var hasChanged = (value, oldValue) => !Object.is(value, oldValue); -var invokeArrayFns = (fns, arg) => { - for (let i = 0; i < fns.length; i++) { - fns[i](arg); - } -}; -var def = (obj, key, value) => { - Object.defineProperty(obj, key, { - configurable: true, - enumerable: false, - value - }); -}; -var looseToNumber = (val) => { - const n = parseFloat(val); - return isNaN(n) ? val : n; -}; -var toNumber = (val) => { - const n = isString(val) ? Number(val) : NaN; - return isNaN(n) ? val : n; -}; -var _globalThis; -var getGlobalThis = () => { - return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); -}; // node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js function warn(msg, ...args) { @@ -255,7 +269,9 @@ var EffectScope = class { this.cleanups = []; this.parent = activeEffectScope; if (!detached && activeEffectScope) { - this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1; + this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( + this + ) - 1; } } get active() { @@ -329,7 +345,9 @@ function onScopeDispose(fn) { if (activeEffectScope) { activeEffectScope.cleanups.push(fn); } else if (true) { - warn(`onScopeDispose() is called when there is no active effect scope to be associated with.`); + warn( + `onScopeDispose() is called when there is no active effect scope to be associated with.` + ); } } var createDep = (effects) => { @@ -495,7 +513,14 @@ function trackEffects(dep, debuggerEventExtraInfo) { dep.add(activeEffect); activeEffect.deps.push(dep); if (activeEffect.onTrack) { - activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo)); + activeEffect.onTrack( + extend( + { + effect: activeEffect + }, + debuggerEventExtraInfo + ) + ); } } } @@ -593,8 +618,8 @@ function triggerEffect(effect2, debuggerEventExtraInfo) { } } function getDepFromReactive(object, key) { - var _a2; - return (_a2 = targetMap.get(object)) === null || _a2 === void 0 ? void 0 : _a2.get(key); + var _a; + return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key); } var isNonTrackableKeys = makeMap(`__proto__,__v_isRef,__isVue`); var builtInSymbols = new Set( @@ -736,31 +761,42 @@ var readonlyHandlers = { get: readonlyGet, set(target, key) { if (true) { - warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target); + warn( + `Set operation on key "${String(key)}" failed: target is readonly.`, + target + ); } return true; }, deleteProperty(target, key) { if (true) { - warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target); + warn( + `Delete operation on key "${String(key)}" failed: target is readonly.`, + target + ); } return true; } }; -var shallowReactiveHandlers = extend({}, mutableHandlers, { - get: shallowGet, - set: shallowSet -}); -var shallowReadonlyHandlers = extend({}, readonlyHandlers, { - get: shallowReadonlyGet -}); +var shallowReactiveHandlers = extend( + {}, + mutableHandlers, + { + get: shallowGet, + set: shallowSet + } +); +var shallowReadonlyHandlers = extend( + {}, + readonlyHandlers, + { + get: shallowReadonlyGet + } +); var toShallow = (value) => value; var getProto = (v) => Reflect.getPrototypeOf(v); function get(target, key, isReadonly2 = false, isShallow3 = false) { - target = target[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]; + target = target["__v_raw"]; const rawTarget = toRaw(target); const rawKey = toRaw(key); if (!isReadonly2) { @@ -780,10 +816,7 @@ function get(target, key, isReadonly2 = false, isShallow3 = false) { } } function has(key, isReadonly2 = false) { - const target = this[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]; + const target = this["__v_raw"]; const rawTarget = toRaw(target); const rawKey = toRaw(key); if (!isReadonly2) { @@ -795,10 +828,7 @@ function has(key, isReadonly2 = false) { return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); } function size(target, isReadonly2 = false) { - target = target[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]; + target = target["__v_raw"]; !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); return Reflect.get(target, "size", target); } @@ -863,10 +893,7 @@ function clear() { function createForEach(isReadonly2, isShallow3) { return function forEach(callback, thisArg) { const observed = this; - const target = observed[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]; + const target = observed["__v_raw"]; const rawTarget = toRaw(target); const wrap = isShallow3 ? toShallow : isReadonly2 ? toReadonly : toReactive; !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); @@ -877,17 +904,18 @@ function createForEach(isReadonly2, isShallow3) { } function createIterableMethod(method, isReadonly2, isShallow3) { return function(...args) { - const target = this[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]; + const target = this["__v_raw"]; const rawTarget = toRaw(target); const targetIsMap = isMap(rawTarget); const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; const isKeyOnly = method === "keys" && targetIsMap; const innerIterator = target[method](...args); const wrap = isShallow3 ? toShallow : isReadonly2 ? toReadonly : toReactive; - !isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); + !isReadonly2 && track( + rawTarget, + "iterate", + isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY + ); return { // iterator protocol next() { @@ -908,7 +936,10 @@ function createReadonlyMethod(type) { return function(...args) { if (true) { const key = args[0] ? `on key "${args[0]}" ` : ``; - console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this)); + console.warn( + `${capitalize(type)} operation ${key}failed: target is readonly.`, + toRaw(this) + ); } return type === "delete" ? false : this; }; @@ -952,22 +983,10 @@ function createInstrumentations() { has(key) { return has.call(this, key, true); }, - add: createReadonlyMethod( - "add" - /* TriggerOpTypes.ADD */ - ), - set: createReadonlyMethod( - "set" - /* TriggerOpTypes.SET */ - ), - delete: createReadonlyMethod( - "delete" - /* TriggerOpTypes.DELETE */ - ), - clear: createReadonlyMethod( - "clear" - /* TriggerOpTypes.CLEAR */ - ), + add: createReadonlyMethod("add"), + set: createReadonlyMethod("set"), + delete: createReadonlyMethod("delete"), + clear: createReadonlyMethod("clear"), forEach: createForEach(true, false) }; const shallowReadonlyInstrumentations2 = { @@ -980,30 +999,34 @@ function createInstrumentations() { has(key) { return has.call(this, key, true); }, - add: createReadonlyMethod( - "add" - /* TriggerOpTypes.ADD */ - ), - set: createReadonlyMethod( - "set" - /* TriggerOpTypes.SET */ - ), - delete: createReadonlyMethod( - "delete" - /* TriggerOpTypes.DELETE */ - ), - clear: createReadonlyMethod( - "clear" - /* TriggerOpTypes.CLEAR */ - ), + add: createReadonlyMethod("add"), + set: createReadonlyMethod("set"), + delete: createReadonlyMethod("delete"), + clear: createReadonlyMethod("clear"), forEach: createForEach(true, true) }; const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; iteratorMethods.forEach((method) => { - mutableInstrumentations2[method] = createIterableMethod(method, false, false); - readonlyInstrumentations2[method] = createIterableMethod(method, true, false); - shallowInstrumentations2[method] = createIterableMethod(method, false, true); - shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true); + mutableInstrumentations2[method] = createIterableMethod( + method, + false, + false + ); + readonlyInstrumentations2[method] = createIterableMethod( + method, + true, + false + ); + shallowInstrumentations2[method] = createIterableMethod( + method, + false, + true + ); + shallowReadonlyInstrumentations2[method] = createIterableMethod( + method, + true, + true + ); }); return [ mutableInstrumentations2, @@ -1012,7 +1035,12 @@ function createInstrumentations() { shallowReadonlyInstrumentations2 ]; } -var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = createInstrumentations(); +var [ + mutableInstrumentations, + readonlyInstrumentations, + shallowInstrumentations, + shallowReadonlyInstrumentations +] = createInstrumentations(); function createInstrumentationGetter(isReadonly2, shallow) { const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; return (target, key, receiver) => { @@ -1023,7 +1051,11 @@ function createInstrumentationGetter(isReadonly2, shallow) { } else if (key === "__v_raw") { return target; } - return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver); + return Reflect.get( + hasOwn(instrumentations, key) && key in target ? instrumentations : target, + key, + receiver + ); }; } var mutableCollectionHandlers = { @@ -1042,7 +1074,9 @@ function checkIdentityKeys(target, has2, key) { const rawKey = toRaw(key); if (rawKey !== key && has2.call(target, rawKey)) { const type = toRawType(target); - console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`); + console.warn( + `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` + ); } } var reactiveMap = /* @__PURE__ */ new WeakMap(); @@ -1064,25 +1098,46 @@ function targetTypeMap(rawType) { } } function getTargetType(value) { - return value[ - "__v_skip" - /* ReactiveFlags.SKIP */ - ] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); + return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); } function reactive(target) { if (isReadonly(target)) { return target; } - return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap); + return createReactiveObject( + target, + false, + mutableHandlers, + mutableCollectionHandlers, + reactiveMap + ); } function shallowReactive(target) { - return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap); + return createReactiveObject( + target, + false, + shallowReactiveHandlers, + shallowCollectionHandlers, + shallowReactiveMap + ); } function readonly(target) { - return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap); + return createReactiveObject( + target, + true, + readonlyHandlers, + readonlyCollectionHandlers, + readonlyMap + ); } function shallowReadonly(target) { - return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap); + return createReactiveObject( + target, + true, + shallowReadonlyHandlers, + shallowReadonlyCollectionHandlers, + shallowReadonlyMap + ); } function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { if (!isObject(target)) { @@ -1091,13 +1146,7 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl } return target; } - if (target[ - "__v_raw" - /* ReactiveFlags.RAW */ - ] && !(isReadonly2 && target[ - "__v_isReactive" - /* ReactiveFlags.IS_REACTIVE */ - ])) { + if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { return target; } const existingProxy = proxyMap.get(target); @@ -1108,42 +1157,30 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl if (targetType === 0) { return target; } - const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers); + const proxy = new Proxy( + target, + targetType === 2 ? collectionHandlers : baseHandlers + ); proxyMap.set(target, proxy); return proxy; } function isReactive(value) { if (isReadonly(value)) { - return isReactive(value[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]); + return isReactive(value["__v_raw"]); } - return !!(value && value[ - "__v_isReactive" - /* ReactiveFlags.IS_REACTIVE */ - ]); + return !!(value && value["__v_isReactive"]); } function isReadonly(value) { - return !!(value && value[ - "__v_isReadonly" - /* ReactiveFlags.IS_READONLY */ - ]); + return !!(value && value["__v_isReadonly"]); } function isShallow(value) { - return !!(value && value[ - "__v_isShallow" - /* ReactiveFlags.IS_SHALLOW */ - ]); + return !!(value && value["__v_isShallow"]); } function isProxy(value) { return isReactive(value) || isReadonly(value); } function toRaw(observed) { - const raw = observed && observed[ - "__v_raw" - /* ReactiveFlags.RAW */ - ]; + const raw = observed && observed["__v_raw"]; return raw ? toRaw(raw) : observed; } function markRaw(value) { @@ -1225,6 +1262,9 @@ function triggerRef(ref2) { function unref(ref2) { return isRef(ref2) ? ref2.value : ref2; } +function toValue(source) { + return isFunction(source) ? source() : unref(source); +} var shallowUnwrapHandlers = { get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), set: (target, key, value, receiver) => { @@ -1244,7 +1284,10 @@ var CustomRefImpl = class { constructor(factory) { this.dep = void 0; this.__v_isRef = true; - const { get: get2, set: set2 } = factory(() => trackRefValue(this), () => triggerRefValue(this)); + const { get: get2, set: set2 } = factory( + () => trackRefValue(this), + () => triggerRefValue(this) + ); this._get = get2; this._set = set2; } @@ -1264,7 +1307,7 @@ function toRefs(object) { } const ret = isArray(object) ? new Array(object.length) : {}; for (const key in object) { - ret[key] = toRef(object, key); + ret[key] = propertyToRef(object, key); } return ret; } @@ -1286,17 +1329,41 @@ var ObjectRefImpl = class { return getDepFromReactive(toRaw(this._object), this._key); } }; -function toRef(object, key, defaultValue) { - const val = object[key]; - return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue); +var GetterRefImpl = class { + constructor(_getter) { + this._getter = _getter; + this.__v_isRef = true; + this.__v_isReadonly = true; + } + get value() { + return this._getter(); + } +}; +function toRef(source, key, defaultValue) { + if (isRef(source)) { + return source; + } else if (isFunction(source)) { + return new GetterRefImpl(source); + } else if (isObject(source) && arguments.length > 1) { + return propertyToRef(source, key, defaultValue); + } else { + return ref(source); + } +} +function propertyToRef(source, key, defaultValue) { + const val = source[key]; + return isRef(val) ? val : new ObjectRefImpl( + source, + key, + defaultValue + ); } -var _a$1; var ComputedRefImpl = class { constructor(getter, _setter, isReadonly2, isSSR) { this._setter = _setter; this.dep = void 0; this.__v_isRef = true; - this[_a$1] = false; + this["__v_isReadonly"] = false; this._dirty = true; this.effect = new ReactiveEffect(getter, () => { if (!this._dirty) { @@ -1306,10 +1373,7 @@ var ComputedRefImpl = class { }); this.effect.computed = this; this.effect.active = this._cacheable = !isSSR; - this[ - "__v_isReadonly" - /* ReactiveFlags.IS_READONLY */ - ] = isReadonly2; + this["__v_isReadonly"] = isReadonly2; } get value() { const self2 = toRaw(this); @@ -1324,7 +1388,6 @@ var ComputedRefImpl = class { this._setter(newValue); } }; -_a$1 = "__v_isReadonly"; function computed(getterOrOptions, debugOptions, isSSR = false) { let getter; let setter; @@ -1345,9 +1408,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) { } return cRef; } -var _a; var tick = Promise.resolve(); -_a = "__v_isReadonly"; // node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js var stack = []; @@ -1365,12 +1426,19 @@ function warn2(msg, ...args) { const appWarnHandler = instance && instance.appContext.config.warnHandler; const trace = getComponentTrace(); if (appWarnHandler) { - callWithErrorHandling(appWarnHandler, instance, 11, [ - msg + args.join(""), - instance && instance.proxy, - trace.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`).join("\n"), - trace - ]); + callWithErrorHandling( + appWarnHandler, + instance, + 11, + [ + msg + args.join(""), + instance && instance.proxy, + trace.map( + ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>` + ).join("\n"), + trace + ] + ); } else { const warnArgs = [`[Vue warn]: ${msg}`, ...args]; if (trace.length && // avoid spamming console during tests @@ -1414,7 +1482,11 @@ function formatTrace(trace) { function formatTraceEntry({ vnode, recurseCount }) { const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``; const isRoot = vnode.component ? vnode.component.parent == null : false; - const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`; + const open = ` at <${formatComponentName( + vnode.component, + vnode.type, + isRoot + )}`; const close = `>` + postfix; return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close]; } @@ -1457,122 +1529,35 @@ function assertNumber(val, type) { } } var ErrorTypeStrings = { - [ - "sp" - /* LifecycleHooks.SERVER_PREFETCH */ - ]: "serverPrefetch hook", - [ - "bc" - /* LifecycleHooks.BEFORE_CREATE */ - ]: "beforeCreate hook", - [ - "c" - /* LifecycleHooks.CREATED */ - ]: "created hook", - [ - "bm" - /* LifecycleHooks.BEFORE_MOUNT */ - ]: "beforeMount hook", - [ - "m" - /* LifecycleHooks.MOUNTED */ - ]: "mounted hook", - [ - "bu" - /* LifecycleHooks.BEFORE_UPDATE */ - ]: "beforeUpdate hook", - [ - "u" - /* LifecycleHooks.UPDATED */ - ]: "updated", - [ - "bum" - /* LifecycleHooks.BEFORE_UNMOUNT */ - ]: "beforeUnmount hook", - [ - "um" - /* LifecycleHooks.UNMOUNTED */ - ]: "unmounted hook", - [ - "a" - /* LifecycleHooks.ACTIVATED */ - ]: "activated hook", - [ - "da" - /* LifecycleHooks.DEACTIVATED */ - ]: "deactivated hook", - [ - "ec" - /* LifecycleHooks.ERROR_CAPTURED */ - ]: "errorCaptured hook", - [ - "rtc" - /* LifecycleHooks.RENDER_TRACKED */ - ]: "renderTracked hook", - [ - "rtg" - /* LifecycleHooks.RENDER_TRIGGERED */ - ]: "renderTriggered hook", - [ - 0 - /* ErrorCodes.SETUP_FUNCTION */ - ]: "setup function", - [ - 1 - /* ErrorCodes.RENDER_FUNCTION */ - ]: "render function", - [ - 2 - /* ErrorCodes.WATCH_GETTER */ - ]: "watcher getter", - [ - 3 - /* ErrorCodes.WATCH_CALLBACK */ - ]: "watcher callback", - [ - 4 - /* ErrorCodes.WATCH_CLEANUP */ - ]: "watcher cleanup function", - [ - 5 - /* ErrorCodes.NATIVE_EVENT_HANDLER */ - ]: "native event handler", - [ - 6 - /* ErrorCodes.COMPONENT_EVENT_HANDLER */ - ]: "component event handler", - [ - 7 - /* ErrorCodes.VNODE_HOOK */ - ]: "vnode hook", - [ - 8 - /* ErrorCodes.DIRECTIVE_HOOK */ - ]: "directive hook", - [ - 9 - /* ErrorCodes.TRANSITION_HOOK */ - ]: "transition hook", - [ - 10 - /* ErrorCodes.APP_ERROR_HANDLER */ - ]: "app errorHandler", - [ - 11 - /* ErrorCodes.APP_WARN_HANDLER */ - ]: "app warnHandler", - [ - 12 - /* ErrorCodes.FUNCTION_REF */ - ]: "ref function", - [ - 13 - /* ErrorCodes.ASYNC_COMPONENT_LOADER */ - ]: "async component loader", - [ - 14 - /* ErrorCodes.SCHEDULER */ - ]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core" + ["sp"]: "serverPrefetch hook", + ["bc"]: "beforeCreate hook", + ["c"]: "created hook", + ["bm"]: "beforeMount hook", + ["m"]: "mounted hook", + ["bu"]: "beforeUpdate hook", + ["u"]: "updated", + ["bum"]: "beforeUnmount hook", + ["um"]: "unmounted hook", + ["a"]: "activated hook", + ["da"]: "deactivated hook", + ["ec"]: "errorCaptured hook", + ["rtc"]: "renderTracked hook", + ["rtg"]: "renderTriggered hook", + [0]: "setup function", + [1]: "render function", + [2]: "watcher getter", + [3]: "watcher callback", + [4]: "watcher cleanup function", + [5]: "native event handler", + [6]: "component event handler", + [7]: "vnode hook", + [8]: "directive hook", + [9]: "transition hook", + [10]: "app errorHandler", + [11]: "app warnHandler", + [12]: "ref function", + [13]: "async component loader", + [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core" }; function callWithErrorHandling(fn, instance, type, args) { let res; @@ -1618,7 +1603,12 @@ function handleError(err, instance, type, throwInDev = true) { } const appErrorHandler = instance.appContext.config.errorHandler; if (appErrorHandler) { - callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]); + callWithErrorHandling( + appErrorHandler, + null, + 10, + [err, exposedInstance, errorInfo] + ); return; } } @@ -1668,7 +1658,10 @@ function findInsertionIndex(id) { return start; } function queueJob(job) { - if (!queue.length || !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) { + if (!queue.length || !queue.includes( + job, + isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex + )) { if (job.id == null) { queue.push(job); } else { @@ -1691,7 +1684,10 @@ function invalidateJob(job) { } function queuePostFlushCb(cb) { if (!isArray(cb)) { - if (!activePostFlushCbs || !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) { + if (!activePostFlushCbs || !activePostFlushCbs.includes( + cb, + cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex + )) { pendingPostFlushCbs.push(cb); } } else { @@ -1764,12 +1760,7 @@ function flushJobs(seen) { if (check(job)) { continue; } - callWithErrorHandling( - job, - null, - 14 - /* ErrorCodes.SCHEDULER */ - ); + callWithErrorHandling(job, null, 14); } } } finally { @@ -1791,7 +1782,9 @@ function checkRecursiveUpdates(seen, fn) { if (count > RECURSION_LIMIT) { const instance = fn.ownerInstance; const componentName = instance && getComponentName(instance.type); - warn2(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`); + warn2( + `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.` + ); return true; } else { seen.set(fn, count + 1); @@ -1865,6 +1858,8 @@ function reload(id, newComp) { } hmrDirtyComponents.add(oldComp); } + instance.appContext.propsCache.delete(instance.type); + instance.appContext.emitsCache.delete(instance.type); instance.appContext.optionsCache.delete(instance.type); if (instance.ceReload) { hmrDirtyComponents.add(oldComp); @@ -1877,12 +1872,16 @@ function reload(id, newComp) { } else if (typeof window !== "undefined") { window.location.reload(); } else { - console.warn("[HMR] Root or manually mounted instance modified. Full reload required."); + console.warn( + "[HMR] Root or manually mounted instance modified. Full reload required." + ); } } queuePostFlushCb(() => { for (const instance of instances) { - hmrDirtyComponents.delete(normalizeClassComponent(instance.type)); + hmrDirtyComponents.delete( + normalizeClassComponent(instance.type) + ); } }); } @@ -1900,7 +1899,9 @@ function tryWrap(fn) { return fn(id, arg); } catch (e) { console.error(e); - console.warn(`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`); + console.warn( + `[HMR] Something went wrong during Vue component hot-reload. Full reload required.` + ); } }; } @@ -1915,7 +1916,7 @@ function emit$1(event, ...args) { } } function setDevtoolsHook(hook, target) { - var _a2, _b; + var _a, _b; devtools = hook; if (devtools) { devtools.enabled = true; @@ -1927,7 +1928,7 @@ function setDevtoolsHook(hook, target) { // (#4815) typeof window !== "undefined" && // some envs mock window but not fully window.HTMLElement && // also exclude jsdom - !((_b = (_a2 = window.navigator) === null || _a2 === void 0 ? void 0 : _a2.userAgent) === null || _b === void 0 ? void 0 : _b.includes("jsdom")) + !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) ) { const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; replay.push((newHook) => { @@ -1958,15 +1959,15 @@ function devtoolsUnmountApp(app) { } var devtoolsComponentAdded = createDevtoolsComponentHook( "component:added" - /* DevtoolsHooks.COMPONENT_ADDED */ + /* COMPONENT_ADDED */ ); var devtoolsComponentUpdated = createDevtoolsComponentHook( "component:updated" - /* DevtoolsHooks.COMPONENT_UPDATED */ + /* COMPONENT_UPDATED */ ); var _devtoolsComponentRemoved = createDevtoolsComponentHook( "component:removed" - /* DevtoolsHooks.COMPONENT_REMOVED */ + /* COMPONENT_REMOVED */ ); var devtoolsComponentRemoved = (component) => { if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered @@ -1976,16 +1977,22 @@ var devtoolsComponentRemoved = (component) => { }; function createDevtoolsComponentHook(hook) { return (component) => { - emit$1(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : void 0, component); + emit$1( + hook, + component.appContext.app, + component.uid, + component.parent ? component.parent.uid : void 0, + component + ); }; } var devtoolsPerfStart = createDevtoolsPerformanceHook( "perf:start" - /* DevtoolsHooks.PERFORMANCE_START */ + /* PERFORMANCE_START */ ); var devtoolsPerfEnd = createDevtoolsPerformanceHook( "perf:end" - /* DevtoolsHooks.PERFORMANCE_END */ + /* PERFORMANCE_END */ ); function createDevtoolsPerformanceHook(hook) { return (component, type, time) => { @@ -1993,25 +2000,38 @@ function createDevtoolsPerformanceHook(hook) { }; } function devtoolsComponentEmit(component, event, params) { - emit$1("component:emit", component.appContext.app, component, event, params); + emit$1( + "component:emit", + component.appContext.app, + component, + event, + params + ); } function emit(instance, event, ...rawArgs) { if (instance.isUnmounted) return; const props = instance.vnode.props || EMPTY_OBJ; if (true) { - const { emitsOptions, propsOptions: [propsOptions] } = instance; + const { + emitsOptions, + propsOptions: [propsOptions] + } = instance; if (emitsOptions) { if (!(event in emitsOptions) && true) { if (!propsOptions || !(toHandlerKey(event) in propsOptions)) { - warn2(`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`); + warn2( + `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.` + ); } } else { const validator = emitsOptions[event]; if (isFunction(validator)) { const isValid = validator(...rawArgs); if (!isValid) { - warn2(`Invalid event arguments: event validation failed for event "${event}".`); + warn2( + `Invalid event arguments: event validation failed for event "${event}".` + ); } } } @@ -2036,7 +2056,12 @@ function emit(instance, event, ...rawArgs) { if (true) { const lowerCaseEvent = event.toLowerCase(); if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) { - warn2(`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(event)}" instead of "${event}".`); + warn2( + `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName( + instance, + instance.type + )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(event)}" instead of "${event}".` + ); } } let handlerName; @@ -2046,7 +2071,12 @@ function emit(instance, event, ...rawArgs) { handler = props[handlerName = toHandlerKey(hyphenate(event))]; } if (handler) { - callWithAsyncErrorHandling(handler, instance, 6, args); + callWithAsyncErrorHandling( + handler, + instance, + 6, + args + ); } const onceHandler = props[handlerName + `Once`]; if (onceHandler) { @@ -2056,7 +2086,12 @@ function emit(instance, event, ...rawArgs) { return; } instance.emitted[handlerName] = true; - callWithAsyncErrorHandling(onceHandler, instance, 6, args); + callWithAsyncErrorHandling( + onceHandler, + instance, + 6, + args + ); } } function normalizeEmitsOptions(comp, appContext, asMixin = false) { @@ -2159,7 +2194,23 @@ function markAttrsAccessed() { accessedAttrs = true; } function renderComponentRoot(instance) { - const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit: emit2, render: render2, renderCache, data, setupState, ctx, inheritAttrs } = instance; + const { + type: Component, + vnode, + proxy, + withProxy, + props, + propsOptions: [propsOptions], + slots, + attrs, + emit: emit2, + render: render2, + renderCache, + data, + setupState, + ctx, + inheritAttrs + } = instance; let result; let fallthroughAttrs; const prev = setCurrentRenderingInstance(instance); @@ -2169,35 +2220,45 @@ function renderComponentRoot(instance) { try { if (vnode.shapeFlag & 4) { const proxyToUse = withProxy || proxy; - result = normalizeVNode(render2.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx)); + result = normalizeVNode( + render2.call( + proxyToUse, + proxyToUse, + renderCache, + props, + setupState, + data, + ctx + ) + ); fallthroughAttrs = attrs; } else { - const render3 = Component; + const render22 = Component; if (attrs === props) { markAttrsAccessed(); } - result = normalizeVNode(render3.length > 1 ? render3(props, true ? { - get attrs() { - markAttrsAccessed(); - return attrs; - }, - slots, - emit: emit2 - } : { attrs, slots, emit: emit2 }) : render3( - props, - null - /* we know it doesn't need it */ - )); + result = normalizeVNode( + render22.length > 1 ? render22( + props, + true ? { + get attrs() { + markAttrsAccessed(); + return attrs; + }, + slots, + emit: emit2 + } : { attrs, slots, emit: emit2 } + ) : render22( + props, + null + /* we know it doesn't need it */ + ) + ); fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); } } catch (err) { blockStack.length = 0; - handleError( - err, - instance, - 1 - /* ErrorCodes.RENDER_FUNCTION */ - ); + handleError(err, instance, 1); result = createVNode(Comment); } let root = result; @@ -2211,7 +2272,10 @@ function renderComponentRoot(instance) { if (keys.length) { if (shapeFlag & (1 | 6)) { if (propsOptions && keys.some(isModelListener)) { - fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions); + fallthroughAttrs = filterModelListeners( + fallthroughAttrs, + propsOptions + ); } root = cloneVNode(root, fallthroughAttrs); } else if (!accessedAttrs && root.type !== Comment) { @@ -2229,24 +2293,32 @@ function renderComponentRoot(instance) { } } if (extraAttrs.length) { - warn2(`Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`); + warn2( + `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.` + ); } if (eventAttrs.length) { - warn2(`Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`); + warn2( + `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.` + ); } } } } if (vnode.dirs) { if (!isElementRoot(root)) { - warn2(`Runtime directive used on component with non-element root node. The directives will not function as intended.`); + warn2( + `Runtime directive used on component with non-element root node. The directives will not function as intended.` + ); } root = cloneVNode(root); root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; } if (vnode.transition) { if (!isElementRoot(root)) { - warn2(`Component inside renders non-element root node that cannot be animated.`); + warn2( + `Component inside renders non-element root node that cannot be animated.` + ); } root.transition = vnode.transition; } @@ -2394,9 +2466,29 @@ var SuspenseImpl = { __isSuspense: true, process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) { if (n1 == null) { - mountSuspense(n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals); + mountSuspense( + n2, + container, + anchor, + parentComponent, + parentSuspense, + isSVG, + slotScopeIds, + optimized, + rendererInternals + ); } else { - patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, rendererInternals); + patchSuspense( + n1, + n2, + container, + anchor, + parentComponent, + isSVG, + slotScopeIds, + optimized, + rendererInternals + ); } }, hydrate: hydrateSuspense, @@ -2411,10 +2503,33 @@ function triggerEvent(vnode, name) { } } function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) { - const { p: patch, o: { createElement } } = rendererInternals; + const { + p: patch, + o: { createElement } + } = rendererInternals; const hiddenContainer = createElement("div"); - const suspense = vnode.suspense = createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals); - patch(null, suspense.pendingBranch = vnode.ssContent, hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds); + const suspense = vnode.suspense = createSuspenseBoundary( + vnode, + parentSuspense, + parentComponent, + container, + hiddenContainer, + anchor, + isSVG, + slotScopeIds, + optimized, + rendererInternals + ); + patch( + null, + suspense.pendingBranch = vnode.ssContent, + hiddenContainer, + null, + parentComponent, + suspense, + isSVG, + slotScopeIds + ); if (suspense.deps > 0) { triggerEvent(vnode, "onPending"); triggerEvent(vnode, "onFallback"); @@ -2431,7 +2546,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense ); setActiveBranch(suspense, vnode.ssFallback); } else { - suspense.resolve(); + suspense.resolve(false, true); } } function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) { @@ -2444,7 +2559,17 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc if (pendingBranch) { suspense.pendingBranch = newBranch; if (isSameVNodeType(newBranch, pendingBranch)) { - patch(pendingBranch, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized); + patch( + pendingBranch, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + isSVG, + slotScopeIds, + optimized + ); if (suspense.deps <= 0) { suspense.resolve(); } else if (isInFallback) { @@ -2474,7 +2599,17 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc suspense.effects.length = 0; suspense.hiddenContainer = createElement("div"); if (isInFallback) { - patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized); + patch( + null, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + isSVG, + slotScopeIds, + optimized + ); if (suspense.deps <= 0) { suspense.resolve(); } else { @@ -2493,10 +2628,30 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc setActiveBranch(suspense, newFallback); } } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { - patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized); + patch( + activeBranch, + newBranch, + container, + anchor, + parentComponent, + suspense, + isSVG, + slotScopeIds, + optimized + ); suspense.resolve(true); } else { - patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized); + patch( + null, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + isSVG, + slotScopeIds, + optimized + ); if (suspense.deps <= 0) { suspense.resolve(); } @@ -2504,13 +2659,33 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc } } else { if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { - patch(activeBranch, newBranch, container, anchor, parentComponent, suspense, isSVG, slotScopeIds, optimized); + patch( + activeBranch, + newBranch, + container, + anchor, + parentComponent, + suspense, + isSVG, + slotScopeIds, + optimized + ); setActiveBranch(suspense, newBranch); } else { triggerEvent(n2, "onPending"); suspense.pendingBranch = newBranch; suspense.pendingId++; - patch(null, newBranch, suspense.hiddenContainer, null, parentComponent, suspense, isSVG, slotScopeIds, optimized); + patch( + null, + newBranch, + suspense.hiddenContainer, + null, + parentComponent, + suspense, + isSVG, + slotScopeIds, + optimized + ); if (suspense.deps <= 0) { suspense.resolve(); } else { @@ -2529,19 +2704,35 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc } } var hasWarned = false; -function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) { +function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) { if (!hasWarned) { hasWarned = true; - console[console.info ? "info" : "log"](` is an experimental feature and its API will likely change.`); + console[console.info ? "info" : "log"]( + ` is an experimental feature and its API will likely change.` + ); + } + const { + p: patch, + m: move, + um: unmount, + n: next, + o: { parentNode, remove: remove2 } + } = rendererInternals; + let parentSuspenseId; + const isSuspensible = isVNodeSuspensible(vnode); + if (isSuspensible) { + if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) { + parentSuspenseId = parentSuspense.pendingId; + parentSuspense.deps++; + } } - const { p: patch, m: move, um: unmount, n: next, o: { parentNode, remove: remove2 } } = rendererInternals; const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; if (true) { assertNumber(timeout, `Suspense timeout`); } const suspense = { vnode, - parent, + parent: parentSuspense, parentComponent, isSVG, container, @@ -2556,16 +2747,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde isHydrating, isUnmounted: false, effects: [], - resolve(resume = false) { + resolve(resume = false, sync = false) { if (true) { if (!resume && !suspense.pendingBranch) { - throw new Error(`suspense.resolve() is called without a pending branch.`); + throw new Error( + `suspense.resolve() is called without a pending branch.` + ); } if (suspense.isUnmounted) { - throw new Error(`suspense.resolve() is called on an already unmounted suspense boundary.`); + throw new Error( + `suspense.resolve() is called on an already unmounted suspense boundary.` + ); } } - const { vnode: vnode2, activeBranch, pendingBranch, pendingId, effects, parentComponent: parentComponent2, container: container2 } = suspense; + const { + vnode: vnode2, + activeBranch, + pendingBranch, + pendingId, + effects, + parentComponent: parentComponent2, + container: container2 + } = suspense; if (suspense.isHydrating) { suspense.isHydrating = false; } else if (!resume) { @@ -2573,13 +2776,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde if (delayEnter) { activeBranch.transition.afterLeave = () => { if (pendingId === suspense.pendingId) { - move( - pendingBranch, - container2, - anchor2, - 0 - /* MoveType.ENTER */ - ); + move(pendingBranch, container2, anchor2, 0); } }; } @@ -2589,32 +2786,34 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde unmount(activeBranch, parentComponent2, suspense, true); } if (!delayEnter) { - move( - pendingBranch, - container2, - anchor2, - 0 - /* MoveType.ENTER */ - ); + move(pendingBranch, container2, anchor2, 0); } } setActiveBranch(suspense, pendingBranch); suspense.pendingBranch = null; suspense.isInFallback = false; - let parent2 = suspense.parent; + let parent = suspense.parent; let hasUnresolvedAncestor = false; - while (parent2) { - if (parent2.pendingBranch) { - parent2.effects.push(...effects); + while (parent) { + if (parent.pendingBranch) { + parent.effects.push(...effects); hasUnresolvedAncestor = true; break; } - parent2 = parent2.parent; + parent = parent.parent; } if (!hasUnresolvedAncestor) { queuePostFlushCb(effects); } suspense.effects = []; + if (isSuspensible) { + if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { + parentSuspense.deps--; + if (parentSuspense.deps === 0 && !sync) { + parentSuspense.resolve(); + } + } + } triggerEvent(vnode2, "onResolve"); }, fallback(fallbackVNode) { @@ -2673,12 +2872,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde } const hydratedEl = instance.vnode.el; instance.asyncDep.catch((err) => { - handleError( - err, - instance, - 0 - /* ErrorCodes.SETUP_FUNCTION */ - ); + handleError(err, instance, 0); }).then((asyncSetupResult) => { if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { return; @@ -2719,13 +2913,23 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde } }); }, - unmount(parentSuspense, doRemove) { + unmount(parentSuspense2, doRemove) { suspense.isUnmounted = true; if (suspense.activeBranch) { - unmount(suspense.activeBranch, parentComponent, parentSuspense, doRemove); + unmount( + suspense.activeBranch, + parentComponent, + parentSuspense2, + doRemove + ); } if (suspense.pendingBranch) { - unmount(suspense.pendingBranch, parentComponent, parentSuspense, doRemove); + unmount( + suspense.pendingBranch, + parentComponent, + parentSuspense2, + doRemove + ); } } }; @@ -2746,16 +2950,25 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl true /* hydrating */ ); - const result = hydrateNode(node, suspense.pendingBranch = vnode.ssContent, parentComponent, suspense, slotScopeIds, optimized); + const result = hydrateNode( + node, + suspense.pendingBranch = vnode.ssContent, + parentComponent, + suspense, + slotScopeIds, + optimized + ); if (suspense.deps === 0) { - suspense.resolve(); + suspense.resolve(false, true); } return result; } function normalizeSuspenseChildren(vnode) { const { shapeFlag, children } = vnode; const isSlotChildren = shapeFlag & 32; - vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children); + vnode.ssContent = normalizeSuspenseSlot( + isSlotChildren ? children.default : children + ); vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); } function normalizeSuspenseSlot(s) { @@ -2806,64 +3019,58 @@ function setActiveBranch(suspense, branch) { updateHOCHostEl(parentComponent, el); } } -function provide(key, value) { - if (!currentInstance) { - if (true) { - warn2(`provide() can only be used inside setup().`); - } - } else { - let provides = currentInstance.provides; - const parentProvides = currentInstance.parent && currentInstance.parent.provides; - if (parentProvides === provides) { - provides = currentInstance.provides = Object.create(parentProvides); - } - provides[key] = value; - } -} -function inject(key, defaultValue, treatDefaultAsFactory = false) { - const instance = currentInstance || currentRenderingInstance; - if (instance) { - const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides; - if (provides && key in provides) { - return provides[key]; - } else if (arguments.length > 1) { - return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue; - } else if (true) { - warn2(`injection "${String(key)}" not found.`); - } - } else if (true) { - warn2(`inject() can only be used inside setup() or functional components.`); - } +function isVNodeSuspensible(vnode) { + var _a; + return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false; } function watchEffect(effect2, options) { return doWatch(effect2, null, options); } function watchPostEffect(effect2, options) { - return doWatch(effect2, null, true ? Object.assign(Object.assign({}, options), { flush: "post" }) : { flush: "post" }); + return doWatch( + effect2, + null, + true ? extend({}, options, { flush: "post" }) : { flush: "post" } + ); } function watchSyncEffect(effect2, options) { - return doWatch(effect2, null, true ? Object.assign(Object.assign({}, options), { flush: "sync" }) : { flush: "sync" }); + return doWatch( + effect2, + null, + true ? extend({}, options, { flush: "sync" }) : { flush: "sync" } + ); } var INITIAL_WATCHER_VALUE = {}; function watch(source, cb, options) { if (!isFunction(cb)) { - warn2(`\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`); + warn2( + `\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.` + ); } return doWatch(source, cb, options); } function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) { + var _a; if (!cb) { if (immediate !== void 0) { - warn2(`watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`); + warn2( + `watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.` + ); } if (deep !== void 0) { - warn2(`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`); + warn2( + `watch() "deep" option is only respected when using the watch(source, callback, options?) signature.` + ); } } const warnInvalidSource = (s) => { - warn2(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`); + warn2( + `Invalid watch source: `, + s, + `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` + ); }; - const instance = getCurrentScope() === (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope) ? currentInstance : null; + const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null; let getter; let forceTrigger = false; let isMultiSource = false; @@ -2882,24 +3089,14 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM } else if (isReactive(s)) { return traverse(s); } else if (isFunction(s)) { - return callWithErrorHandling( - s, - instance, - 2 - /* ErrorCodes.WATCH_GETTER */ - ); + return callWithErrorHandling(s, instance, 2); } else { warnInvalidSource(s); } }); } else if (isFunction(source)) { if (cb) { - getter = () => callWithErrorHandling( - source, - instance, - 2 - /* ErrorCodes.WATCH_GETTER */ - ); + getter = () => callWithErrorHandling(source, instance, 2); } else { getter = () => { if (instance && instance.isUnmounted) { @@ -2908,7 +3105,12 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM if (cleanup) { cleanup(); } - return callWithAsyncErrorHandling(source, instance, 3, [onCleanup]); + return callWithAsyncErrorHandling( + source, + instance, + 3, + [onCleanup] + ); }; } } else { @@ -2922,12 +3124,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM let cleanup; let onCleanup = (fn) => { cleanup = effect2.onStop = () => { - callWithErrorHandling( - fn, - instance, - 4 - /* ErrorCodes.WATCH_CLEANUP */ - ); + callWithErrorHandling(fn, instance, 4); }; }; let ssrCleanup; @@ -2956,7 +3153,9 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM } if (cb) { const newValue = effect2.run(); - if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) { + if (deep || forceTrigger || (isMultiSource ? newValue.some( + (v, i) => hasChanged(v, oldValue[i]) + ) : hasChanged(newValue, oldValue)) || false) { if (cleanup) { cleanup(); } @@ -2996,7 +3195,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM oldValue = effect2.run(); } } else if (flush === "post") { - queuePostRenderEffect(effect2.run.bind(effect2), instance && instance.suspense); + queuePostRenderEffect( + effect2.run.bind(effect2), + instance && instance.suspense + ); } else { effect2.run(); } @@ -3041,10 +3243,7 @@ function createPathGetter(ctx, path) { }; } function traverse(value, seen) { - if (!isObject(value) || value[ - "__v_skip" - /* ReactiveFlags.SKIP */ - ]) { + if (!isObject(value) || value["__v_skip"]) { return value; } seen = seen || /* @__PURE__ */ new Set(); @@ -3069,6 +3268,64 @@ function traverse(value, seen) { } return value; } +function validateDirectiveName(name) { + if (isBuiltInDirective(name)) { + warn2("Do not use built-in directive ids as custom directive id: " + name); + } +} +function withDirectives(vnode, directives) { + const internalInstance = currentRenderingInstance; + if (internalInstance === null) { + warn2(`withDirectives can only be used inside render functions.`); + return vnode; + } + const instance = getExposeProxy(internalInstance) || internalInstance.proxy; + const bindings = vnode.dirs || (vnode.dirs = []); + for (let i = 0; i < directives.length; i++) { + let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; + if (dir) { + if (isFunction(dir)) { + dir = { + mounted: dir, + updated: dir + }; + } + if (dir.deep) { + traverse(value); + } + bindings.push({ + dir, + instance, + value, + oldValue: void 0, + arg, + modifiers + }); + } + } + return vnode; +} +function invokeDirectiveHook(vnode, prevVNode, instance, name) { + const bindings = vnode.dirs; + const oldBindings = prevVNode && prevVNode.dirs; + for (let i = 0; i < bindings.length; i++) { + const binding = bindings[i]; + if (oldBindings) { + binding.oldValue = oldBindings[i].value; + } + let hook = binding.dir[name]; + if (hook) { + pauseTracking(); + callWithAsyncErrorHandling(hook, instance, 8, [ + vnode.el, + binding, + vnode, + prevVNode + ]); + resetTracking(); + } + } +} function useTransitionState() { const state = { isMounted: false, @@ -3085,28 +3342,29 @@ function useTransitionState() { return state; } var TransitionHookValidator = [Function, Array]; +var BaseTransitionPropsValidators = { + mode: String, + appear: Boolean, + persisted: Boolean, + // enter + onBeforeEnter: TransitionHookValidator, + onEnter: TransitionHookValidator, + onAfterEnter: TransitionHookValidator, + onEnterCancelled: TransitionHookValidator, + // leave + onBeforeLeave: TransitionHookValidator, + onLeave: TransitionHookValidator, + onAfterLeave: TransitionHookValidator, + onLeaveCancelled: TransitionHookValidator, + // appear + onBeforeAppear: TransitionHookValidator, + onAppear: TransitionHookValidator, + onAfterAppear: TransitionHookValidator, + onAppearCancelled: TransitionHookValidator +}; var BaseTransitionImpl = { name: `BaseTransition`, - props: { - mode: String, - appear: Boolean, - persisted: Boolean, - // enter - onBeforeEnter: TransitionHookValidator, - onEnter: TransitionHookValidator, - onAfterEnter: TransitionHookValidator, - onEnterCancelled: TransitionHookValidator, - // leave - onBeforeLeave: TransitionHookValidator, - onLeave: TransitionHookValidator, - onAfterLeave: TransitionHookValidator, - onLeaveCancelled: TransitionHookValidator, - // appear - onBeforeAppear: TransitionHookValidator, - onAppear: TransitionHookValidator, - onAfterAppear: TransitionHookValidator, - onAppearCancelled: TransitionHookValidator - }, + props: BaseTransitionPropsValidators, setup(props, { slots }) { const instance = getCurrentInstance(); const state = useTransitionState(); @@ -3122,7 +3380,9 @@ var BaseTransitionImpl = { for (const c of children) { if (c.type !== Comment) { if (hasFound) { - warn2(" can only be used on a single element or component. Use for lists."); + warn2( + " can only be used on a single element or component. Use for lists." + ); break; } child = c; @@ -3144,7 +3404,12 @@ var BaseTransitionImpl = { if (!innerChild) { return emptyPlaceholder(child); } - const enterHooks = resolveTransitionHooks(innerChild, rawProps, state, instance); + const enterHooks = resolveTransitionHooks( + innerChild, + rawProps, + state, + instance + ); setTransitionHooks(innerChild, enterHooks); const oldChild = instance.subTree; const oldInnerChild = oldChild && getKeepAliveChild(oldChild); @@ -3160,7 +3425,12 @@ var BaseTransitionImpl = { } } if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) { - const leavingHooks = resolveTransitionHooks(oldInnerChild, rawProps, state, instance); + const leavingHooks = resolveTransitionHooks( + oldInnerChild, + rawProps, + state, + instance + ); setTransitionHooks(oldInnerChild, leavingHooks); if (mode === "out-in") { state.isLeaving = true; @@ -3173,7 +3443,10 @@ var BaseTransitionImpl = { return emptyPlaceholder(child); } else if (mode === "in-out" && innerChild.type !== Comment) { leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { - const leavingVNodesCache = getLeavingNodesForType(state, oldInnerChild); + const leavingVNodesCache = getLeavingNodesForType( + state, + oldInnerChild + ); leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; el._leaveCb = () => { earlyRemove(); @@ -3199,11 +3472,32 @@ function getLeavingNodesForType(state, vnode) { return leavingVNodesCache; } function resolveTransitionHooks(vnode, props, state, instance) { - const { appear, mode, persisted = false, onBeforeEnter, onEnter, onAfterEnter, onEnterCancelled, onBeforeLeave, onLeave, onAfterLeave, onLeaveCancelled, onBeforeAppear, onAppear, onAfterAppear, onAppearCancelled } = props; + const { + appear, + mode, + persisted = false, + onBeforeEnter, + onEnter, + onAfterEnter, + onEnterCancelled, + onBeforeLeave, + onLeave, + onAfterLeave, + onLeaveCancelled, + onBeforeAppear, + onAppear, + onAfterAppear, + onAppearCancelled + } = props; const key = String(vnode.key); const leavingVNodesCache = getLeavingNodesForType(state, vnode); const callHook3 = (hook, args) => { - hook && callWithAsyncErrorHandling(hook, instance, 9, args); + hook && callWithAsyncErrorHandling( + hook, + instance, + 9, + args + ); }; const callAsyncHook = (hook, args) => { const done = args[1]; @@ -3343,7 +3637,9 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) { if (child.type === Fragment) { if (child.patchFlag & 128) keyedFragmentCount++; - ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key)); + ret = ret.concat( + getTransitionRawChildren(child.children, keepComment, key) + ); } else if (keepComment || child.type !== Comment) { ret.push(key != null ? cloneVNode(child, { key }) : child); } @@ -3355,8 +3651,12 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) { } return ret; } -function defineComponent(options) { - return isFunction(options) ? { setup: options, name: options.name } : options; +function defineComponent(options, extraOptions) { + return isFunction(options) ? ( + // #8326: extend call and options.name access are considered side-effects + // by Rollup, so we have to wrap it in a pure-annotated IIFE. + (() => extend({ name: options.name }, extraOptions, { setup: options }))() + ) : options; } var isAsyncWrapper = (i) => !!i.type.__asyncLoader; function defineAsyncComponent(source) { @@ -3399,7 +3699,9 @@ function defineAsyncComponent(source) { return pendingRequest; } if (!comp) { - warn2(`Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`); + warn2( + `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.` + ); } if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { comp = comp.default; @@ -3453,7 +3755,9 @@ function defineAsyncComponent(source) { if (timeout != null) { setTimeout(() => { if (!loaded.value && !error.value) { - const err = new Error(`Async component timed out after ${timeout}ms.`); + const err = new Error( + `Async component timed out after ${timeout}ms.` + ); onError(err); error.value = err; } @@ -3518,12 +3822,29 @@ var KeepAliveImpl = { instance.__v_cache = cache; } const parentSuspense = instance.suspense; - const { renderer: { p: patch, m: move, um: _unmount, o: { createElement } } } = sharedContext; + const { + renderer: { + p: patch, + m: move, + um: _unmount, + o: { createElement } + } + } = sharedContext; const storageContainer = createElement("div"); sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => { const instance2 = vnode.component; move(vnode, container, anchor, 0, parentSuspense); - patch(instance2.vnode, vnode, container, anchor, instance2, parentSuspense, isSVG, vnode.slotScopeIds, optimized); + patch( + instance2.vnode, + vnode, + container, + anchor, + instance2, + parentSuspense, + isSVG, + vnode.slotScopeIds, + optimized + ); queuePostRenderEffect(() => { instance2.isDeactivated = false; if (instance2.a) { @@ -3626,7 +3947,9 @@ var KeepAliveImpl = { } let vnode = getInnerChild(rawVNode); const comp = vnode.type; - const name = getComponentName(isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp); + const name = getComponentName( + isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp + ); const { include, exclude, max } = props; if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { current = vnode; @@ -3742,116 +4065,37 @@ function injectHook(type, hook, target = currentInstance, prepend = false) { return wrappedHook; } else if (true) { const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, "")); - warn2(`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`); + warn2( + `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` + ); } } var createHook = (lifecycle) => (hook, target = currentInstance) => ( // post-create lifecycle registrations are noops during SSR (except for serverPrefetch) (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target) ); -var onBeforeMount = createHook( - "bm" - /* LifecycleHooks.BEFORE_MOUNT */ -); -var onMounted = createHook( - "m" - /* LifecycleHooks.MOUNTED */ -); -var onBeforeUpdate = createHook( - "bu" - /* LifecycleHooks.BEFORE_UPDATE */ -); -var onUpdated = createHook( - "u" - /* LifecycleHooks.UPDATED */ -); -var onBeforeUnmount = createHook( - "bum" - /* LifecycleHooks.BEFORE_UNMOUNT */ -); -var onUnmounted = createHook( - "um" - /* LifecycleHooks.UNMOUNTED */ -); -var onServerPrefetch = createHook( - "sp" - /* LifecycleHooks.SERVER_PREFETCH */ -); +var onBeforeMount = createHook("bm"); +var onMounted = createHook("m"); +var onBeforeUpdate = createHook("bu"); +var onUpdated = createHook("u"); +var onBeforeUnmount = createHook("bum"); +var onUnmounted = createHook("um"); +var onServerPrefetch = createHook("sp"); var onRenderTriggered = createHook( "rtg" - /* LifecycleHooks.RENDER_TRIGGERED */ ); var onRenderTracked = createHook( "rtc" - /* LifecycleHooks.RENDER_TRACKED */ ); function onErrorCaptured(hook, target = currentInstance) { injectHook("ec", hook, target); } -function validateDirectiveName(name) { - if (isBuiltInDirective(name)) { - warn2("Do not use built-in directive ids as custom directive id: " + name); - } -} -function withDirectives(vnode, directives) { - const internalInstance = currentRenderingInstance; - if (internalInstance === null) { - warn2(`withDirectives can only be used inside render functions.`); - return vnode; - } - const instance = getExposeProxy(internalInstance) || internalInstance.proxy; - const bindings = vnode.dirs || (vnode.dirs = []); - for (let i = 0; i < directives.length; i++) { - let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; - if (dir) { - if (isFunction(dir)) { - dir = { - mounted: dir, - updated: dir - }; - } - if (dir.deep) { - traverse(value); - } - bindings.push({ - dir, - instance, - value, - oldValue: void 0, - arg, - modifiers - }); - } - } - return vnode; -} -function invokeDirectiveHook(vnode, prevVNode, instance, name) { - const bindings = vnode.dirs; - const oldBindings = prevVNode && prevVNode.dirs; - for (let i = 0; i < bindings.length; i++) { - const binding = bindings[i]; - if (oldBindings) { - binding.oldValue = oldBindings[i].value; - } - let hook = binding.dir[name]; - if (hook) { - pauseTracking(); - callWithAsyncErrorHandling(hook, instance, 8, [ - vnode.el, - binding, - vnode, - prevVNode - ]); - resetTracking(); - } - } -} var COMPONENTS = "components"; var DIRECTIVES = "directives"; function resolveComponent(name, maybeSelfReference) { return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; } -var NULL_DYNAMIC_COMPONENT = Symbol(); +var NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); function resolveDynamicComponent(component) { if (isString(component)) { return resolveAsset(COMPONENTS, component, false) || component; @@ -3892,7 +4136,9 @@ If this is a native custom element, make sure to exclude it from component resol } return res; } else if (true) { - warn2(`resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`); + warn2( + `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().` + ); } } function resolve(registry, name) { @@ -3916,7 +4162,10 @@ function renderList(source, renderItem, cache, index) { } } else if (isObject(source)) { if (source[Symbol.iterator]) { - ret = Array.from(source, (item, i) => renderItem(item, i, void 0, cached && cached[i])); + ret = Array.from( + source, + (item, i) => renderItem(item, i, void 0, cached && cached[i]) + ); } else { const keys = Object.keys(source); ret = new Array(keys.length); @@ -3959,7 +4208,9 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) { } let slot = slots[name]; if (slot && slot.length > 1) { - warn2(`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.`); + warn2( + `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.` + ); slot = () => []; } if (slot && slot._c) { @@ -3976,7 +4227,6 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) { }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2 - /* PatchFlags.BAIL */ ); if (!noSlotted && rendered.scopeId) { rendered.slotScopeIds = [rendered.scopeId + "-s"]; @@ -4083,6 +4333,8 @@ var PublicInstanceProxyHandlers = { if (key === "$attrs") { track(instance, "get", key); markAttrsAccessed(); + } else if (key === "$slots") { + track(instance, "get", key); } return publicGetter(instance); } else if ( @@ -4104,9 +4356,15 @@ var PublicInstanceProxyHandlers = { // to infinite warning loop key.indexOf("__v") !== 0)) { if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) { - warn2(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`); + warn2( + `Property ${JSON.stringify( + key + )} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.` + ); } else if (instance === currentRenderingInstance) { - warn2(`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`); + warn2( + `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.` + ); } } }, @@ -4126,7 +4384,9 @@ var PublicInstanceProxyHandlers = { return false; } if (key[0] === "$" && key.slice(1) in instance) { - warn2(`Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`); + warn2( + `Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.` + ); return false; } else { if (key in instance.appContext.config.globalProperties) { @@ -4141,7 +4401,9 @@ var PublicInstanceProxyHandlers = { } return true; }, - has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) { + has({ + _: { data, setupState, accessCache, ctx, appContext, propsOptions } + }, key) { let normalizedProps; return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key); }, @@ -4156,25 +4418,35 @@ var PublicInstanceProxyHandlers = { }; if (true) { PublicInstanceProxyHandlers.ownKeys = (target) => { - warn2(`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`); + warn2( + `Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.` + ); return Reflect.ownKeys(target); }; } -var RuntimeCompiledPublicInstanceProxyHandlers = extend({}, PublicInstanceProxyHandlers, { - get(target, key) { - if (key === Symbol.unscopables) { - return; +var RuntimeCompiledPublicInstanceProxyHandlers = extend( + {}, + PublicInstanceProxyHandlers, + { + get(target, key) { + if (key === Symbol.unscopables) { + return; + } + return PublicInstanceProxyHandlers.get(target, key, target); + }, + has(_, key) { + const has2 = key[0] !== "_" && !isGloballyWhitelisted(key); + if (!has2 && PublicInstanceProxyHandlers.has(_, key)) { + warn2( + `Property ${JSON.stringify( + key + )} should not start with _ which is a reserved prefix for Vue internals.` + ); + } + return has2; } - return PublicInstanceProxyHandlers.get(target, key, target); - }, - has(_, key) { - const has2 = key[0] !== "_" && !isGloballyWhitelisted(key); - if (!has2 && PublicInstanceProxyHandlers.has(_, key)) { - warn2(`Property ${JSON.stringify(key)} should not start with _ which is a reserved prefix for Vue internals.`); - } - return has2; } -}); +); function createDevRenderContext(instance) { const target = {}; Object.defineProperty(target, `_`, { @@ -4195,7 +4467,10 @@ function createDevRenderContext(instance) { return target; } function exposePropsOnRenderContext(instance) { - const { ctx, propsOptions: [propsOptions] } = instance; + const { + ctx, + propsOptions: [propsOptions] + } = instance; if (propsOptions) { Object.keys(propsOptions).forEach((key) => { Object.defineProperty(ctx, key, { @@ -4212,7 +4487,11 @@ function exposeSetupStateOnRenderContext(instance) { Object.keys(toRaw(setupState)).forEach((key) => { if (!setupState.__isScriptSetup) { if (isReservedPrefix(key[0])) { - warn2(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`); + warn2( + `setup() return property ${JSON.stringify( + key + )} should not start with "$" or "_" which are reserved prefixes for Vue internals.` + ); return; } Object.defineProperty(ctx, key, { @@ -4224,6 +4503,160 @@ function exposeSetupStateOnRenderContext(instance) { } }); } +var warnRuntimeUsage = (method) => warn2( + `${method}() is a compiler-hint helper that is only usable inside