vue 2.7.7 → 2.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.common.dev.js +66 -32
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +66 -33
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +66 -33
- package/dist/vue.js +66 -32
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +42 -25
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +42 -26
- package/dist/vue.runtime.js +42 -25
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +39 -21
- package/packages/compiler-sfc/package.json +2 -3
- package/packages/compiler-sfc/src/compileTemplate.ts +1 -2
- package/src/compiler/codegen/index.ts +28 -8
- package/src/core/instance/lifecycle.ts +18 -10
- package/src/core/observer/index.ts +1 -1
- package/src/types/component.ts +1 -0
- package/src/v3/apiSetup.ts +38 -17
- package/src/v3/index.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/v3-component-public-instance.d.ts +0 -2
- package/types/v3-generated.d.ts +2 -0
- package/types/v3-manual-apis.d.ts +2 -2
- package/types/v3-setup-context.d.ts +4 -0
- package/types/vue.d.ts +6 -9
package/dist/vue.common.dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.8
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -961,7 +961,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
|
961
961
|
// #7981: for accessor properties without setter
|
|
962
962
|
return;
|
|
963
963
|
}
|
|
964
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
964
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
965
965
|
value.value = newVal;
|
|
966
966
|
return;
|
|
967
967
|
}
|
|
@@ -2234,7 +2234,19 @@ function createSetupContext(vm) {
|
|
|
2234
2234
|
let exposeCalled = false;
|
|
2235
2235
|
return {
|
|
2236
2236
|
get attrs() {
|
|
2237
|
-
|
|
2237
|
+
if (!vm._attrsProxy) {
|
|
2238
|
+
const proxy = (vm._attrsProxy = {});
|
|
2239
|
+
def(proxy, '_v_attr_proxy', true);
|
|
2240
|
+
syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
|
2241
|
+
}
|
|
2242
|
+
return vm._attrsProxy;
|
|
2243
|
+
},
|
|
2244
|
+
get listeners() {
|
|
2245
|
+
if (!vm._listenersProxy) {
|
|
2246
|
+
const proxy = (vm._listenersProxy = {});
|
|
2247
|
+
syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
|
2248
|
+
}
|
|
2249
|
+
return vm._listenersProxy;
|
|
2238
2250
|
},
|
|
2239
2251
|
get slots() {
|
|
2240
2252
|
return initSlotsProxy(vm);
|
|
@@ -2253,20 +2265,12 @@ function createSetupContext(vm) {
|
|
|
2253
2265
|
}
|
|
2254
2266
|
};
|
|
2255
2267
|
}
|
|
2256
|
-
function
|
|
2257
|
-
if (!vm._attrsProxy) {
|
|
2258
|
-
const proxy = (vm._attrsProxy = {});
|
|
2259
|
-
def(proxy, '_v_attr_proxy', true);
|
|
2260
|
-
syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
|
|
2261
|
-
}
|
|
2262
|
-
return vm._attrsProxy;
|
|
2263
|
-
}
|
|
2264
|
-
function syncSetupAttrs(to, from, prev, instance) {
|
|
2268
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
2265
2269
|
let changed = false;
|
|
2266
2270
|
for (const key in from) {
|
|
2267
2271
|
if (!(key in to)) {
|
|
2268
2272
|
changed = true;
|
|
2269
|
-
defineProxyAttr(to, key, instance);
|
|
2273
|
+
defineProxyAttr(to, key, instance, type);
|
|
2270
2274
|
}
|
|
2271
2275
|
else if (from[key] !== prev[key]) {
|
|
2272
2276
|
changed = true;
|
|
@@ -2280,12 +2284,12 @@ function syncSetupAttrs(to, from, prev, instance) {
|
|
|
2280
2284
|
}
|
|
2281
2285
|
return changed;
|
|
2282
2286
|
}
|
|
2283
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
2287
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
2284
2288
|
Object.defineProperty(proxy, key, {
|
|
2285
2289
|
enumerable: true,
|
|
2286
2290
|
configurable: true,
|
|
2287
2291
|
get() {
|
|
2288
|
-
return instance
|
|
2292
|
+
return instance[type][key];
|
|
2289
2293
|
}
|
|
2290
2294
|
});
|
|
2291
2295
|
}
|
|
@@ -2306,17 +2310,27 @@ function syncSetupSlots(to, from) {
|
|
|
2306
2310
|
}
|
|
2307
2311
|
}
|
|
2308
2312
|
/**
|
|
2309
|
-
* @internal use manual type def
|
|
2313
|
+
* @internal use manual type def because public setup context type relies on
|
|
2314
|
+
* legacy VNode types
|
|
2310
2315
|
*/
|
|
2311
2316
|
function useSlots() {
|
|
2312
2317
|
return getContext().slots;
|
|
2313
2318
|
}
|
|
2314
2319
|
/**
|
|
2315
|
-
* @internal use manual type def
|
|
2320
|
+
* @internal use manual type def because public setup context type relies on
|
|
2321
|
+
* legacy VNode types
|
|
2316
2322
|
*/
|
|
2317
2323
|
function useAttrs() {
|
|
2318
2324
|
return getContext().attrs;
|
|
2319
2325
|
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Vue 2 only
|
|
2328
|
+
* @internal use manual type def because public setup context type relies on
|
|
2329
|
+
* legacy VNode types
|
|
2330
|
+
*/
|
|
2331
|
+
function useListeners() {
|
|
2332
|
+
return getContext().listeners;
|
|
2333
|
+
}
|
|
2320
2334
|
function getContext() {
|
|
2321
2335
|
if (!currentInstance) {
|
|
2322
2336
|
warn$2(`useContext() called without active instance.`);
|
|
@@ -2917,12 +2931,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2917
2931
|
if (vm._attrsProxy) {
|
|
2918
2932
|
// force update if attrs are accessed and has changed since it may be
|
|
2919
2933
|
// passed to a child component.
|
|
2920
|
-
if (
|
|
2934
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
2921
2935
|
needsForceUpdate = true;
|
|
2922
2936
|
}
|
|
2923
2937
|
}
|
|
2924
2938
|
vm.$attrs = attrs;
|
|
2925
|
-
|
|
2939
|
+
// update listeners
|
|
2940
|
+
listeners = listeners || emptyObject;
|
|
2941
|
+
const prevListeners = vm.$options._parentListeners;
|
|
2942
|
+
if (vm._listenersProxy) {
|
|
2943
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
2944
|
+
}
|
|
2945
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
2946
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
2926
2947
|
// update props
|
|
2927
2948
|
if (propsData && vm.$options.props) {
|
|
2928
2949
|
toggleObserving(false);
|
|
@@ -2937,11 +2958,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2937
2958
|
// keep a copy of raw propsData
|
|
2938
2959
|
vm.$options.propsData = propsData;
|
|
2939
2960
|
}
|
|
2940
|
-
// update listeners
|
|
2941
|
-
listeners = listeners || emptyObject;
|
|
2942
|
-
const oldListeners = vm.$options._parentListeners;
|
|
2943
|
-
vm.$options._parentListeners = listeners;
|
|
2944
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
2945
2961
|
// resolve slots + force update if has children
|
|
2946
2962
|
if (needsForceUpdate) {
|
|
2947
2963
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3881,7 +3897,7 @@ const onRenderTriggered = createLifeCycle('renderTriggered');
|
|
|
3881
3897
|
/**
|
|
3882
3898
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3883
3899
|
*/
|
|
3884
|
-
const version = '2.7.
|
|
3900
|
+
const version = '2.7.8';
|
|
3885
3901
|
/**
|
|
3886
3902
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3887
3903
|
*/
|
|
@@ -3927,6 +3943,7 @@ var vca = /*#__PURE__*/Object.freeze({
|
|
|
3927
3943
|
getCurrentInstance: getCurrentInstance,
|
|
3928
3944
|
useSlots: useSlots,
|
|
3929
3945
|
useAttrs: useAttrs,
|
|
3946
|
+
useListeners: useListeners,
|
|
3930
3947
|
mergeDefaults: mergeDefaults,
|
|
3931
3948
|
nextTick: nextTick,
|
|
3932
3949
|
set: set,
|
|
@@ -10836,10 +10853,7 @@ function genElement(el, state) {
|
|
|
10836
10853
|
// check if this is a component in <script setup>
|
|
10837
10854
|
const bindings = state.options.bindings;
|
|
10838
10855
|
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10839
|
-
tag =
|
|
10840
|
-
checkBindingType(bindings, el.tag) ||
|
|
10841
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10842
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10856
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10843
10857
|
}
|
|
10844
10858
|
if (!tag)
|
|
10845
10859
|
tag = `'${el.tag}'`;
|
|
@@ -10856,9 +10870,29 @@ function genElement(el, state) {
|
|
|
10856
10870
|
}
|
|
10857
10871
|
}
|
|
10858
10872
|
function checkBindingType(bindings, key) {
|
|
10859
|
-
const
|
|
10860
|
-
|
|
10861
|
-
|
|
10873
|
+
const camelName = camelize(key);
|
|
10874
|
+
const PascalName = capitalize(camelName);
|
|
10875
|
+
const checkType = (type) => {
|
|
10876
|
+
if (bindings[key] === type) {
|
|
10877
|
+
return key;
|
|
10878
|
+
}
|
|
10879
|
+
if (bindings[camelName] === type) {
|
|
10880
|
+
return camelName;
|
|
10881
|
+
}
|
|
10882
|
+
if (bindings[PascalName] === type) {
|
|
10883
|
+
return PascalName;
|
|
10884
|
+
}
|
|
10885
|
+
};
|
|
10886
|
+
const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
10887
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
10888
|
+
if (fromConst) {
|
|
10889
|
+
return fromConst;
|
|
10890
|
+
}
|
|
10891
|
+
const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
10892
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
10893
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
10894
|
+
if (fromMaybeRef) {
|
|
10895
|
+
return fromMaybeRef;
|
|
10862
10896
|
}
|
|
10863
10897
|
}
|
|
10864
10898
|
// hoist static sub-trees out
|