vue 2.7.7 → 2.7.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/README.md +1 -1
- package/dist/vue.common.dev.js +105 -49
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +103 -48
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +104 -48
- package/dist/vue.js +106 -49
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +81 -42
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +80 -41
- package/dist/vue.runtime.js +82 -42
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +55 -26
- package/packages/compiler-sfc/package.json +2 -3
- package/packages/compiler-sfc/src/compileTemplate.ts +1 -2
- package/packages/compiler-sfc/src/parseComponent.ts +2 -2
- package/packages/compiler-sfc/src/rewriteDefault.ts +6 -1
- package/packages/compiler-sfc/src/templateCompilerModules/utils.ts +8 -3
- package/packages/compiler-sfc/test/rewriteDefault.spec.ts +245 -0
- package/src/compiler/codegen/index.ts +28 -8
- package/src/core/instance/init.ts +1 -0
- package/src/core/instance/lifecycle.ts +27 -12
- package/src/core/instance/proxy.ts +2 -2
- package/src/core/instance/state.ts +1 -1
- package/src/core/observer/index.ts +1 -1
- package/src/core/observer/watcher.ts +12 -5
- package/src/core/vdom/modules/directives.ts +9 -1
- package/src/core/vdom/vnode.ts +1 -0
- package/src/types/component.ts +1 -0
- package/src/v3/apiLifecycle.ts +16 -1
- package/src/v3/apiSetup.ts +38 -17
- package/src/v3/apiWatch.ts +1 -4
- package/src/v3/index.ts +1 -1
- package/src/v3/reactivity/effectScope.ts +5 -1
- package/types/index.d.ts +2 -2
- package/types/options.d.ts +24 -9
- package/types/v3-component-options.d.ts +3 -0
- package/types/v3-component-public-instance.d.ts +2 -4
- package/types/v3-define-component.d.ts +34 -34
- package/types/v3-generated.d.ts +11 -2
- package/types/v3-manual-apis.d.ts +2 -2
- package/types/v3-setup-context.d.ts +4 -0
- package/types/vue.d.ts +108 -31
package/dist/vue.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.10
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -649,13 +649,13 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
649
649
|
'referenced during render. Make sure that this property is reactive, ' +
|
|
650
650
|
'either in the data option, or for class-based components, by ' +
|
|
651
651
|
'initializing the property. ' +
|
|
652
|
-
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
652
|
+
'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
653
653
|
};
|
|
654
654
|
var warnReservedPrefix_1 = function (target, key) {
|
|
655
655
|
warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
|
|
656
656
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
657
657
|
'prevent conflicts with Vue internals. ' +
|
|
658
|
-
'See: https://vuejs.org/v2/api/#data', target);
|
|
658
|
+
'See: https://v2.vuejs.org/v2/api/#data', target);
|
|
659
659
|
};
|
|
660
660
|
var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
|
|
661
661
|
if (hasProxy_1) {
|
|
@@ -1007,7 +1007,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
|
1007
1007
|
// #7981: for accessor properties without setter
|
|
1008
1008
|
return;
|
|
1009
1009
|
}
|
|
1010
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
1010
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
1011
1011
|
value.value = newVal;
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
@@ -2310,7 +2310,19 @@ function createSetupContext(vm) {
|
|
|
2310
2310
|
var exposeCalled = false;
|
|
2311
2311
|
return {
|
|
2312
2312
|
get attrs() {
|
|
2313
|
-
|
|
2313
|
+
if (!vm._attrsProxy) {
|
|
2314
|
+
var proxy = (vm._attrsProxy = {});
|
|
2315
|
+
def(proxy, '_v_attr_proxy', true);
|
|
2316
|
+
syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
|
2317
|
+
}
|
|
2318
|
+
return vm._attrsProxy;
|
|
2319
|
+
},
|
|
2320
|
+
get listeners() {
|
|
2321
|
+
if (!vm._listenersProxy) {
|
|
2322
|
+
var proxy = (vm._listenersProxy = {});
|
|
2323
|
+
syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
|
2324
|
+
}
|
|
2325
|
+
return vm._listenersProxy;
|
|
2314
2326
|
},
|
|
2315
2327
|
get slots() {
|
|
2316
2328
|
return initSlotsProxy(vm);
|
|
@@ -2331,20 +2343,12 @@ function createSetupContext(vm) {
|
|
|
2331
2343
|
}
|
|
2332
2344
|
};
|
|
2333
2345
|
}
|
|
2334
|
-
function
|
|
2335
|
-
if (!vm._attrsProxy) {
|
|
2336
|
-
var proxy = (vm._attrsProxy = {});
|
|
2337
|
-
def(proxy, '_v_attr_proxy', true);
|
|
2338
|
-
syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
|
|
2339
|
-
}
|
|
2340
|
-
return vm._attrsProxy;
|
|
2341
|
-
}
|
|
2342
|
-
function syncSetupAttrs(to, from, prev, instance) {
|
|
2346
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
2343
2347
|
var changed = false;
|
|
2344
2348
|
for (var key in from) {
|
|
2345
2349
|
if (!(key in to)) {
|
|
2346
2350
|
changed = true;
|
|
2347
|
-
defineProxyAttr(to, key, instance);
|
|
2351
|
+
defineProxyAttr(to, key, instance, type);
|
|
2348
2352
|
}
|
|
2349
2353
|
else if (from[key] !== prev[key]) {
|
|
2350
2354
|
changed = true;
|
|
@@ -2358,12 +2362,12 @@ function syncSetupAttrs(to, from, prev, instance) {
|
|
|
2358
2362
|
}
|
|
2359
2363
|
return changed;
|
|
2360
2364
|
}
|
|
2361
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
2365
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
2362
2366
|
Object.defineProperty(proxy, key, {
|
|
2363
2367
|
enumerable: true,
|
|
2364
2368
|
configurable: true,
|
|
2365
2369
|
get: function () {
|
|
2366
|
-
return instance
|
|
2370
|
+
return instance[type][key];
|
|
2367
2371
|
}
|
|
2368
2372
|
});
|
|
2369
2373
|
}
|
|
@@ -2384,17 +2388,27 @@ function syncSetupSlots(to, from) {
|
|
|
2384
2388
|
}
|
|
2385
2389
|
}
|
|
2386
2390
|
/**
|
|
2387
|
-
* @internal use manual type def
|
|
2391
|
+
* @internal use manual type def because public setup context type relies on
|
|
2392
|
+
* legacy VNode types
|
|
2388
2393
|
*/
|
|
2389
2394
|
function useSlots() {
|
|
2390
2395
|
return getContext().slots;
|
|
2391
2396
|
}
|
|
2392
2397
|
/**
|
|
2393
|
-
* @internal use manual type def
|
|
2398
|
+
* @internal use manual type def because public setup context type relies on
|
|
2399
|
+
* legacy VNode types
|
|
2394
2400
|
*/
|
|
2395
2401
|
function useAttrs() {
|
|
2396
2402
|
return getContext().attrs;
|
|
2397
2403
|
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Vue 2 only
|
|
2406
|
+
* @internal use manual type def because public setup context type relies on
|
|
2407
|
+
* legacy VNode types
|
|
2408
|
+
*/
|
|
2409
|
+
function useListeners() {
|
|
2410
|
+
return getContext().listeners;
|
|
2411
|
+
}
|
|
2398
2412
|
function getContext() {
|
|
2399
2413
|
if (process.env.NODE_ENV !== 'production' && !currentInstance) {
|
|
2400
2414
|
warn$2("useContext() called without active instance.");
|
|
@@ -2840,8 +2854,13 @@ function lifecycleMixin(Vue) {
|
|
|
2840
2854
|
vm.$el.__vue__ = vm;
|
|
2841
2855
|
}
|
|
2842
2856
|
// if parent is an HOC, update its $el as well
|
|
2843
|
-
|
|
2844
|
-
|
|
2857
|
+
var wrapper = vm;
|
|
2858
|
+
while (wrapper &&
|
|
2859
|
+
wrapper.$vnode &&
|
|
2860
|
+
wrapper.$parent &&
|
|
2861
|
+
wrapper.$vnode === wrapper.$parent._vnode) {
|
|
2862
|
+
wrapper.$parent.$el = wrapper.$el;
|
|
2863
|
+
wrapper = wrapper.$parent;
|
|
2845
2864
|
}
|
|
2846
2865
|
// updated hook is called by the scheduler to ensure that children are
|
|
2847
2866
|
// updated in a parent's updated hook.
|
|
@@ -3000,12 +3019,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
3000
3019
|
if (vm._attrsProxy) {
|
|
3001
3020
|
// force update if attrs are accessed and has changed since it may be
|
|
3002
3021
|
// passed to a child component.
|
|
3003
|
-
if (
|
|
3022
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
3004
3023
|
needsForceUpdate = true;
|
|
3005
3024
|
}
|
|
3006
3025
|
}
|
|
3007
3026
|
vm.$attrs = attrs;
|
|
3008
|
-
|
|
3027
|
+
// update listeners
|
|
3028
|
+
listeners = listeners || emptyObject;
|
|
3029
|
+
var prevListeners = vm.$options._parentListeners;
|
|
3030
|
+
if (vm._listenersProxy) {
|
|
3031
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
3032
|
+
}
|
|
3033
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
3034
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
3009
3035
|
// update props
|
|
3010
3036
|
if (propsData && vm.$options.props) {
|
|
3011
3037
|
toggleObserving(false);
|
|
@@ -3020,11 +3046,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
3020
3046
|
// keep a copy of raw propsData
|
|
3021
3047
|
vm.$options.propsData = propsData;
|
|
3022
3048
|
}
|
|
3023
|
-
// update listeners
|
|
3024
|
-
listeners = listeners || emptyObject;
|
|
3025
|
-
var oldListeners = vm.$options._parentListeners;
|
|
3026
|
-
vm.$options._parentListeners = listeners;
|
|
3027
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
3028
3049
|
// resolve slots + force update if has children
|
|
3029
3050
|
if (needsForceUpdate) {
|
|
3030
3051
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3401,8 +3422,7 @@ function doWatch(source, cb, _a) {
|
|
|
3401
3422
|
var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
3402
3423
|
// overwrite default run
|
|
3403
3424
|
watcher.run = function () {
|
|
3404
|
-
if (!watcher.active
|
|
3405
|
-
!(flush === 'pre' && instance && instance._isBeingDestroyed)) {
|
|
3425
|
+
if (!watcher.active) {
|
|
3406
3426
|
return;
|
|
3407
3427
|
}
|
|
3408
3428
|
if (cb) {
|
|
@@ -3976,17 +3996,21 @@ var onBeforeUpdate = createLifeCycle('beforeUpdate');
|
|
|
3976
3996
|
var onUpdated = createLifeCycle('updated');
|
|
3977
3997
|
var onBeforeUnmount = createLifeCycle('beforeDestroy');
|
|
3978
3998
|
var onUnmounted = createLifeCycle('destroyed');
|
|
3979
|
-
var onErrorCaptured = createLifeCycle('errorCaptured');
|
|
3980
3999
|
var onActivated = createLifeCycle('activated');
|
|
3981
4000
|
var onDeactivated = createLifeCycle('deactivated');
|
|
3982
4001
|
var onServerPrefetch = createLifeCycle('serverPrefetch');
|
|
3983
4002
|
var onRenderTracked = createLifeCycle('renderTracked');
|
|
3984
|
-
var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
4003
|
+
var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
4004
|
+
var injectErrorCapturedHook = createLifeCycle('errorCaptured');
|
|
4005
|
+
function onErrorCaptured(hook, target) {
|
|
4006
|
+
if (target === void 0) { target = currentInstance; }
|
|
4007
|
+
injectErrorCapturedHook(hook, target);
|
|
4008
|
+
}
|
|
3985
4009
|
|
|
3986
4010
|
/**
|
|
3987
4011
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3988
4012
|
*/
|
|
3989
|
-
var version = '2.7.
|
|
4013
|
+
var version = '2.7.10';
|
|
3990
4014
|
/**
|
|
3991
4015
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3992
4016
|
*/
|
|
@@ -4045,11 +4069,16 @@ var uid$1 = 0;
|
|
|
4045
4069
|
*/
|
|
4046
4070
|
var Watcher = /** @class */ (function () {
|
|
4047
4071
|
function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
|
|
4048
|
-
recordEffectScope(this,
|
|
4049
|
-
if (
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4072
|
+
recordEffectScope(this,
|
|
4073
|
+
// if the active effect scope is manually created (not a component scope),
|
|
4074
|
+
// prioritize it
|
|
4075
|
+
activeEffectScope && !activeEffectScope._vm
|
|
4076
|
+
? activeEffectScope
|
|
4077
|
+
: vm
|
|
4078
|
+
? vm._scope
|
|
4079
|
+
: undefined);
|
|
4080
|
+
if ((this.vm = vm) && isRenderWatcher) {
|
|
4081
|
+
vm._watcher = this;
|
|
4053
4082
|
}
|
|
4054
4083
|
// options
|
|
4055
4084
|
if (options) {
|
|
@@ -4322,7 +4351,7 @@ function initData(vm) {
|
|
|
4322
4351
|
data = {};
|
|
4323
4352
|
process.env.NODE_ENV !== 'production' &&
|
|
4324
4353
|
warn$2('data functions should return an object:\n' +
|
|
4325
|
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4354
|
+
'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4326
4355
|
}
|
|
4327
4356
|
// proxy data on instance
|
|
4328
4357
|
var keys = Object.keys(data);
|
|
@@ -4622,6 +4651,7 @@ function initMixin$1(Vue) {
|
|
|
4622
4651
|
vm.__v_skip = true;
|
|
4623
4652
|
// effect scope
|
|
4624
4653
|
vm._scope = new EffectScope(true /* detached */);
|
|
4654
|
+
vm._scope._vm = true;
|
|
4625
4655
|
// merge options
|
|
4626
4656
|
if (options && options._isComponent) {
|
|
4627
4657
|
// optimize internal component instantiation
|
|
@@ -7177,7 +7207,16 @@ function normalizeDirectives(dirs, vm) {
|
|
|
7177
7207
|
}
|
|
7178
7208
|
res[getRawDirName(dir)] = dir;
|
|
7179
7209
|
if (vm._setupState && vm._setupState.__sfc) {
|
|
7180
|
-
|
|
7210
|
+
var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
|
|
7211
|
+
if (typeof setupDef === 'function') {
|
|
7212
|
+
dir.def = {
|
|
7213
|
+
bind: setupDef,
|
|
7214
|
+
update: setupDef,
|
|
7215
|
+
};
|
|
7216
|
+
}
|
|
7217
|
+
else {
|
|
7218
|
+
dir.def = setupDef;
|
|
7219
|
+
}
|
|
7181
7220
|
}
|
|
7182
7221
|
dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
|
|
7183
7222
|
}
|
|
@@ -10942,10 +10981,7 @@ function genElement(el, state) {
|
|
|
10942
10981
|
// check if this is a component in <script setup>
|
|
10943
10982
|
var bindings = state.options.bindings;
|
|
10944
10983
|
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10945
|
-
tag =
|
|
10946
|
-
checkBindingType(bindings, el.tag) ||
|
|
10947
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10948
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10984
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10949
10985
|
}
|
|
10950
10986
|
if (!tag)
|
|
10951
10987
|
tag = "'".concat(el.tag, "'");
|
|
@@ -10962,9 +10998,29 @@ function genElement(el, state) {
|
|
|
10962
10998
|
}
|
|
10963
10999
|
}
|
|
10964
11000
|
function checkBindingType(bindings, key) {
|
|
10965
|
-
var
|
|
10966
|
-
|
|
10967
|
-
|
|
11001
|
+
var camelName = camelize(key);
|
|
11002
|
+
var PascalName = capitalize(camelName);
|
|
11003
|
+
var checkType = function (type) {
|
|
11004
|
+
if (bindings[key] === type) {
|
|
11005
|
+
return key;
|
|
11006
|
+
}
|
|
11007
|
+
if (bindings[camelName] === type) {
|
|
11008
|
+
return camelName;
|
|
11009
|
+
}
|
|
11010
|
+
if (bindings[PascalName] === type) {
|
|
11011
|
+
return PascalName;
|
|
11012
|
+
}
|
|
11013
|
+
};
|
|
11014
|
+
var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
11015
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
11016
|
+
if (fromConst) {
|
|
11017
|
+
return fromConst;
|
|
11018
|
+
}
|
|
11019
|
+
var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
11020
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
11021
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
11022
|
+
if (fromMaybeRef) {
|
|
11023
|
+
return fromMaybeRef;
|
|
10968
11024
|
}
|
|
10969
11025
|
}
|
|
10970
11026
|
// hoist static sub-trees out
|
|
@@ -11791,4 +11847,4 @@ function getOuterHTML(el) {
|
|
|
11791
11847
|
}
|
|
11792
11848
|
Vue.compile = compileToFunctions;
|
|
11793
11849
|
|
|
11794
|
-
export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };
|
|
11850
|
+
export { EffectScope, computed, customRef, Vue as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref$1 as ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useListeners, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect };
|
package/dist/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.10
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -655,13 +655,13 @@
|
|
|
655
655
|
'referenced during render. Make sure that this property is reactive, ' +
|
|
656
656
|
'either in the data option, or for class-based components, by ' +
|
|
657
657
|
'initializing the property. ' +
|
|
658
|
-
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
658
|
+
'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
659
659
|
};
|
|
660
660
|
var warnReservedPrefix_1 = function (target, key) {
|
|
661
661
|
warn$2("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
|
|
662
662
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
663
663
|
'prevent conflicts with Vue internals. ' +
|
|
664
|
-
'See: https://vuejs.org/v2/api/#data', target);
|
|
664
|
+
'See: https://v2.vuejs.org/v2/api/#data', target);
|
|
665
665
|
};
|
|
666
666
|
var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
|
|
667
667
|
if (hasProxy_1) {
|
|
@@ -1007,7 +1007,7 @@
|
|
|
1007
1007
|
// #7981: for accessor properties without setter
|
|
1008
1008
|
return;
|
|
1009
1009
|
}
|
|
1010
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
1010
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
1011
1011
|
value.value = newVal;
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
@@ -2283,7 +2283,19 @@
|
|
|
2283
2283
|
var exposeCalled = false;
|
|
2284
2284
|
return {
|
|
2285
2285
|
get attrs() {
|
|
2286
|
-
|
|
2286
|
+
if (!vm._attrsProxy) {
|
|
2287
|
+
var proxy = (vm._attrsProxy = {});
|
|
2288
|
+
def(proxy, '_v_attr_proxy', true);
|
|
2289
|
+
syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
|
2290
|
+
}
|
|
2291
|
+
return vm._attrsProxy;
|
|
2292
|
+
},
|
|
2293
|
+
get listeners() {
|
|
2294
|
+
if (!vm._listenersProxy) {
|
|
2295
|
+
var proxy = (vm._listenersProxy = {});
|
|
2296
|
+
syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
|
2297
|
+
}
|
|
2298
|
+
return vm._listenersProxy;
|
|
2287
2299
|
},
|
|
2288
2300
|
get slots() {
|
|
2289
2301
|
return initSlotsProxy(vm);
|
|
@@ -2304,20 +2316,12 @@
|
|
|
2304
2316
|
}
|
|
2305
2317
|
};
|
|
2306
2318
|
}
|
|
2307
|
-
function
|
|
2308
|
-
if (!vm._attrsProxy) {
|
|
2309
|
-
var proxy = (vm._attrsProxy = {});
|
|
2310
|
-
def(proxy, '_v_attr_proxy', true);
|
|
2311
|
-
syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
|
|
2312
|
-
}
|
|
2313
|
-
return vm._attrsProxy;
|
|
2314
|
-
}
|
|
2315
|
-
function syncSetupAttrs(to, from, prev, instance) {
|
|
2319
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
2316
2320
|
var changed = false;
|
|
2317
2321
|
for (var key in from) {
|
|
2318
2322
|
if (!(key in to)) {
|
|
2319
2323
|
changed = true;
|
|
2320
|
-
defineProxyAttr(to, key, instance);
|
|
2324
|
+
defineProxyAttr(to, key, instance, type);
|
|
2321
2325
|
}
|
|
2322
2326
|
else if (from[key] !== prev[key]) {
|
|
2323
2327
|
changed = true;
|
|
@@ -2331,12 +2335,12 @@
|
|
|
2331
2335
|
}
|
|
2332
2336
|
return changed;
|
|
2333
2337
|
}
|
|
2334
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
2338
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
2335
2339
|
Object.defineProperty(proxy, key, {
|
|
2336
2340
|
enumerable: true,
|
|
2337
2341
|
configurable: true,
|
|
2338
2342
|
get: function () {
|
|
2339
|
-
return instance
|
|
2343
|
+
return instance[type][key];
|
|
2340
2344
|
}
|
|
2341
2345
|
});
|
|
2342
2346
|
}
|
|
@@ -2357,17 +2361,27 @@
|
|
|
2357
2361
|
}
|
|
2358
2362
|
}
|
|
2359
2363
|
/**
|
|
2360
|
-
* @internal use manual type def
|
|
2364
|
+
* @internal use manual type def because public setup context type relies on
|
|
2365
|
+
* legacy VNode types
|
|
2361
2366
|
*/
|
|
2362
2367
|
function useSlots() {
|
|
2363
2368
|
return getContext().slots;
|
|
2364
2369
|
}
|
|
2365
2370
|
/**
|
|
2366
|
-
* @internal use manual type def
|
|
2371
|
+
* @internal use manual type def because public setup context type relies on
|
|
2372
|
+
* legacy VNode types
|
|
2367
2373
|
*/
|
|
2368
2374
|
function useAttrs() {
|
|
2369
2375
|
return getContext().attrs;
|
|
2370
2376
|
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Vue 2 only
|
|
2379
|
+
* @internal use manual type def because public setup context type relies on
|
|
2380
|
+
* legacy VNode types
|
|
2381
|
+
*/
|
|
2382
|
+
function useListeners() {
|
|
2383
|
+
return getContext().listeners;
|
|
2384
|
+
}
|
|
2371
2385
|
function getContext() {
|
|
2372
2386
|
if (!currentInstance) {
|
|
2373
2387
|
warn$2("useContext() called without active instance.");
|
|
@@ -2808,8 +2822,13 @@
|
|
|
2808
2822
|
vm.$el.__vue__ = vm;
|
|
2809
2823
|
}
|
|
2810
2824
|
// if parent is an HOC, update its $el as well
|
|
2811
|
-
|
|
2812
|
-
|
|
2825
|
+
var wrapper = vm;
|
|
2826
|
+
while (wrapper &&
|
|
2827
|
+
wrapper.$vnode &&
|
|
2828
|
+
wrapper.$parent &&
|
|
2829
|
+
wrapper.$vnode === wrapper.$parent._vnode) {
|
|
2830
|
+
wrapper.$parent.$el = wrapper.$el;
|
|
2831
|
+
wrapper = wrapper.$parent;
|
|
2813
2832
|
}
|
|
2814
2833
|
// updated hook is called by the scheduler to ensure that children are
|
|
2815
2834
|
// updated in a parent's updated hook.
|
|
@@ -2968,12 +2987,19 @@
|
|
|
2968
2987
|
if (vm._attrsProxy) {
|
|
2969
2988
|
// force update if attrs are accessed and has changed since it may be
|
|
2970
2989
|
// passed to a child component.
|
|
2971
|
-
if (
|
|
2990
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
2972
2991
|
needsForceUpdate = true;
|
|
2973
2992
|
}
|
|
2974
2993
|
}
|
|
2975
2994
|
vm.$attrs = attrs;
|
|
2976
|
-
|
|
2995
|
+
// update listeners
|
|
2996
|
+
listeners = listeners || emptyObject;
|
|
2997
|
+
var prevListeners = vm.$options._parentListeners;
|
|
2998
|
+
if (vm._listenersProxy) {
|
|
2999
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
3000
|
+
}
|
|
3001
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
3002
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
2977
3003
|
// update props
|
|
2978
3004
|
if (propsData && vm.$options.props) {
|
|
2979
3005
|
toggleObserving(false);
|
|
@@ -2988,11 +3014,6 @@
|
|
|
2988
3014
|
// keep a copy of raw propsData
|
|
2989
3015
|
vm.$options.propsData = propsData;
|
|
2990
3016
|
}
|
|
2991
|
-
// update listeners
|
|
2992
|
-
listeners = listeners || emptyObject;
|
|
2993
|
-
var oldListeners = vm.$options._parentListeners;
|
|
2994
|
-
vm.$options._parentListeners = listeners;
|
|
2995
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
2996
3017
|
// resolve slots + force update if has children
|
|
2997
3018
|
if (needsForceUpdate) {
|
|
2998
3019
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3367,8 +3388,7 @@
|
|
|
3367
3388
|
var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
3368
3389
|
// overwrite default run
|
|
3369
3390
|
watcher.run = function () {
|
|
3370
|
-
if (!watcher.active
|
|
3371
|
-
!(flush === 'pre' && instance && instance._isBeingDestroyed)) {
|
|
3391
|
+
if (!watcher.active) {
|
|
3372
3392
|
return;
|
|
3373
3393
|
}
|
|
3374
3394
|
if (cb) {
|
|
@@ -3931,17 +3951,21 @@
|
|
|
3931
3951
|
var onUpdated = createLifeCycle('updated');
|
|
3932
3952
|
var onBeforeUnmount = createLifeCycle('beforeDestroy');
|
|
3933
3953
|
var onUnmounted = createLifeCycle('destroyed');
|
|
3934
|
-
var onErrorCaptured = createLifeCycle('errorCaptured');
|
|
3935
3954
|
var onActivated = createLifeCycle('activated');
|
|
3936
3955
|
var onDeactivated = createLifeCycle('deactivated');
|
|
3937
3956
|
var onServerPrefetch = createLifeCycle('serverPrefetch');
|
|
3938
3957
|
var onRenderTracked = createLifeCycle('renderTracked');
|
|
3939
|
-
var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
3958
|
+
var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
3959
|
+
var injectErrorCapturedHook = createLifeCycle('errorCaptured');
|
|
3960
|
+
function onErrorCaptured(hook, target) {
|
|
3961
|
+
if (target === void 0) { target = currentInstance; }
|
|
3962
|
+
injectErrorCapturedHook(hook, target);
|
|
3963
|
+
}
|
|
3940
3964
|
|
|
3941
3965
|
/**
|
|
3942
3966
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3943
3967
|
*/
|
|
3944
|
-
var version = '2.7.
|
|
3968
|
+
var version = '2.7.10';
|
|
3945
3969
|
/**
|
|
3946
3970
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3947
3971
|
*/
|
|
@@ -3987,6 +4011,7 @@
|
|
|
3987
4011
|
getCurrentInstance: getCurrentInstance,
|
|
3988
4012
|
useSlots: useSlots,
|
|
3989
4013
|
useAttrs: useAttrs,
|
|
4014
|
+
useListeners: useListeners,
|
|
3990
4015
|
mergeDefaults: mergeDefaults,
|
|
3991
4016
|
nextTick: nextTick,
|
|
3992
4017
|
set: set,
|
|
@@ -4000,12 +4025,12 @@
|
|
|
4000
4025
|
onUpdated: onUpdated,
|
|
4001
4026
|
onBeforeUnmount: onBeforeUnmount,
|
|
4002
4027
|
onUnmounted: onUnmounted,
|
|
4003
|
-
onErrorCaptured: onErrorCaptured,
|
|
4004
4028
|
onActivated: onActivated,
|
|
4005
4029
|
onDeactivated: onDeactivated,
|
|
4006
4030
|
onServerPrefetch: onServerPrefetch,
|
|
4007
4031
|
onRenderTracked: onRenderTracked,
|
|
4008
|
-
onRenderTriggered: onRenderTriggered
|
|
4032
|
+
onRenderTriggered: onRenderTriggered,
|
|
4033
|
+
onErrorCaptured: onErrorCaptured
|
|
4009
4034
|
});
|
|
4010
4035
|
|
|
4011
4036
|
var seenObjects = new _Set();
|
|
@@ -4059,11 +4084,16 @@
|
|
|
4059
4084
|
*/
|
|
4060
4085
|
var Watcher = /** @class */ (function () {
|
|
4061
4086
|
function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
|
|
4062
|
-
recordEffectScope(this,
|
|
4063
|
-
if (
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4087
|
+
recordEffectScope(this,
|
|
4088
|
+
// if the active effect scope is manually created (not a component scope),
|
|
4089
|
+
// prioritize it
|
|
4090
|
+
activeEffectScope && !activeEffectScope._vm
|
|
4091
|
+
? activeEffectScope
|
|
4092
|
+
: vm
|
|
4093
|
+
? vm._scope
|
|
4094
|
+
: undefined);
|
|
4095
|
+
if ((this.vm = vm) && isRenderWatcher) {
|
|
4096
|
+
vm._watcher = this;
|
|
4067
4097
|
}
|
|
4068
4098
|
// options
|
|
4069
4099
|
if (options) {
|
|
@@ -4331,7 +4361,7 @@
|
|
|
4331
4361
|
if (!isPlainObject(data)) {
|
|
4332
4362
|
data = {};
|
|
4333
4363
|
warn$2('data functions should return an object:\n' +
|
|
4334
|
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4364
|
+
'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4335
4365
|
}
|
|
4336
4366
|
// proxy data on instance
|
|
4337
4367
|
var keys = Object.keys(data);
|
|
@@ -4627,6 +4657,7 @@
|
|
|
4627
4657
|
vm.__v_skip = true;
|
|
4628
4658
|
// effect scope
|
|
4629
4659
|
vm._scope = new EffectScope(true /* detached */);
|
|
4660
|
+
vm._scope._vm = true;
|
|
4630
4661
|
// merge options
|
|
4631
4662
|
if (options && options._isComponent) {
|
|
4632
4663
|
// optimize internal component instantiation
|
|
@@ -7176,7 +7207,16 @@
|
|
|
7176
7207
|
}
|
|
7177
7208
|
res[getRawDirName(dir)] = dir;
|
|
7178
7209
|
if (vm._setupState && vm._setupState.__sfc) {
|
|
7179
|
-
|
|
7210
|
+
var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
|
|
7211
|
+
if (typeof setupDef === 'function') {
|
|
7212
|
+
dir.def = {
|
|
7213
|
+
bind: setupDef,
|
|
7214
|
+
update: setupDef,
|
|
7215
|
+
};
|
|
7216
|
+
}
|
|
7217
|
+
else {
|
|
7218
|
+
dir.def = setupDef;
|
|
7219
|
+
}
|
|
7180
7220
|
}
|
|
7181
7221
|
dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
|
|
7182
7222
|
}
|
|
@@ -10937,10 +10977,7 @@
|
|
|
10937
10977
|
// check if this is a component in <script setup>
|
|
10938
10978
|
var bindings = state.options.bindings;
|
|
10939
10979
|
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10940
|
-
tag =
|
|
10941
|
-
checkBindingType(bindings, el.tag) ||
|
|
10942
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10943
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10980
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10944
10981
|
}
|
|
10945
10982
|
if (!tag)
|
|
10946
10983
|
tag = "'".concat(el.tag, "'");
|
|
@@ -10957,9 +10994,29 @@
|
|
|
10957
10994
|
}
|
|
10958
10995
|
}
|
|
10959
10996
|
function checkBindingType(bindings, key) {
|
|
10960
|
-
var
|
|
10961
|
-
|
|
10962
|
-
|
|
10997
|
+
var camelName = camelize(key);
|
|
10998
|
+
var PascalName = capitalize(camelName);
|
|
10999
|
+
var checkType = function (type) {
|
|
11000
|
+
if (bindings[key] === type) {
|
|
11001
|
+
return key;
|
|
11002
|
+
}
|
|
11003
|
+
if (bindings[camelName] === type) {
|
|
11004
|
+
return camelName;
|
|
11005
|
+
}
|
|
11006
|
+
if (bindings[PascalName] === type) {
|
|
11007
|
+
return PascalName;
|
|
11008
|
+
}
|
|
11009
|
+
};
|
|
11010
|
+
var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
11011
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
11012
|
+
if (fromConst) {
|
|
11013
|
+
return fromConst;
|
|
11014
|
+
}
|
|
11015
|
+
var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
11016
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
11017
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
11018
|
+
if (fromMaybeRef) {
|
|
11019
|
+
return fromMaybeRef;
|
|
10963
11020
|
}
|
|
10964
11021
|
}
|
|
10965
11022
|
// hoist static sub-trees out
|