vue 2.7.5 → 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 +107 -52
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +107 -53
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +107 -53
- package/dist/vue.js +107 -52
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +80 -43
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +80 -44
- package/dist/vue.runtime.js +80 -43
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +42 -23
- package/packages/compiler-sfc/package.json +2 -3
- package/packages/compiler-sfc/src/compileTemplate.ts +1 -2
- package/src/compiler/codegen/index.ts +31 -10
- package/src/core/instance/inject.ts +10 -5
- package/src/core/instance/lifecycle.ts +18 -10
- package/src/core/instance/render.ts +8 -2
- package/src/core/observer/index.ts +1 -1
- package/src/core/observer/scheduler.ts +10 -1
- package/src/core/observer/watcher.ts +2 -0
- package/src/types/component.ts +1 -0
- package/src/v3/apiInject.ts +17 -12
- package/src/v3/apiSetup.ts +38 -17
- package/src/v3/apiWatch.ts +1 -1
- 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 +5 -0
- package/types/vue.d.ts +13 -8
package/dist/vue.runtime.esm.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
|
*/
|
|
@@ -920,7 +920,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
|
920
920
|
// #7981: for accessor properties without setter
|
|
921
921
|
return;
|
|
922
922
|
}
|
|
923
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
923
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
924
924
|
value.value = newVal;
|
|
925
925
|
return;
|
|
926
926
|
}
|
|
@@ -1559,7 +1559,7 @@ function doWatch(source, cb, _a) {
|
|
|
1559
1559
|
watcher.update = watcher.run;
|
|
1560
1560
|
}
|
|
1561
1561
|
else if (flush === 'post') {
|
|
1562
|
-
watcher.
|
|
1562
|
+
watcher.post = true;
|
|
1563
1563
|
watcher.update = function () { return queueWatcher(watcher); };
|
|
1564
1564
|
}
|
|
1565
1565
|
else {
|
|
@@ -1711,18 +1711,23 @@ function provide(key, value) {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
1713
1713
|
else {
|
|
1714
|
-
var provides = currentInstance._provided;
|
|
1715
|
-
// by default an instance inherits its parent's provides object
|
|
1716
|
-
// but when it needs to provide values of its own, it creates its
|
|
1717
|
-
// own provides object using parent provides object as prototype.
|
|
1718
|
-
// this way in `inject` we can simply look up injections from direct
|
|
1719
|
-
// parent and let the prototype chain do the work.
|
|
1720
|
-
var parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
|
|
1721
|
-
if (parentProvides === provides) {
|
|
1722
|
-
provides = currentInstance._provided = Object.create(parentProvides);
|
|
1723
|
-
}
|
|
1724
1714
|
// TS doesn't allow symbol as index type
|
|
1725
|
-
|
|
1715
|
+
resolveProvided(currentInstance)[key] = value;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
function resolveProvided(vm) {
|
|
1719
|
+
// by default an instance inherits its parent's provides object
|
|
1720
|
+
// but when it needs to provide values of its own, it creates its
|
|
1721
|
+
// own provides object using parent provides object as prototype.
|
|
1722
|
+
// this way in `inject` we can simply look up injections from direct
|
|
1723
|
+
// parent and let the prototype chain do the work.
|
|
1724
|
+
var existing = vm._provided;
|
|
1725
|
+
var parentProvides = vm.$parent && vm.$parent._provided;
|
|
1726
|
+
if (parentProvides === existing) {
|
|
1727
|
+
return (vm._provided = Object.create(parentProvides));
|
|
1728
|
+
}
|
|
1729
|
+
else {
|
|
1730
|
+
return existing;
|
|
1726
1731
|
}
|
|
1727
1732
|
}
|
|
1728
1733
|
function inject(key, defaultValue, treatDefaultAsFactory) {
|
|
@@ -2448,7 +2453,19 @@ function createSetupContext(vm) {
|
|
|
2448
2453
|
var exposeCalled = false;
|
|
2449
2454
|
return {
|
|
2450
2455
|
get attrs() {
|
|
2451
|
-
|
|
2456
|
+
if (!vm._attrsProxy) {
|
|
2457
|
+
var proxy = (vm._attrsProxy = {});
|
|
2458
|
+
def(proxy, '_v_attr_proxy', true);
|
|
2459
|
+
syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
|
2460
|
+
}
|
|
2461
|
+
return vm._attrsProxy;
|
|
2462
|
+
},
|
|
2463
|
+
get listeners() {
|
|
2464
|
+
if (!vm._listenersProxy) {
|
|
2465
|
+
var proxy = (vm._listenersProxy = {});
|
|
2466
|
+
syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
|
2467
|
+
}
|
|
2468
|
+
return vm._listenersProxy;
|
|
2452
2469
|
},
|
|
2453
2470
|
get slots() {
|
|
2454
2471
|
return initSlotsProxy(vm);
|
|
@@ -2469,20 +2486,12 @@ function createSetupContext(vm) {
|
|
|
2469
2486
|
}
|
|
2470
2487
|
};
|
|
2471
2488
|
}
|
|
2472
|
-
function
|
|
2473
|
-
if (!vm._attrsProxy) {
|
|
2474
|
-
var proxy = (vm._attrsProxy = {});
|
|
2475
|
-
def(proxy, '_v_attr_proxy', true);
|
|
2476
|
-
syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
|
|
2477
|
-
}
|
|
2478
|
-
return vm._attrsProxy;
|
|
2479
|
-
}
|
|
2480
|
-
function syncSetupAttrs(to, from, prev, instance) {
|
|
2489
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
2481
2490
|
var changed = false;
|
|
2482
2491
|
for (var key in from) {
|
|
2483
2492
|
if (!(key in to)) {
|
|
2484
2493
|
changed = true;
|
|
2485
|
-
defineProxyAttr(to, key, instance);
|
|
2494
|
+
defineProxyAttr(to, key, instance, type);
|
|
2486
2495
|
}
|
|
2487
2496
|
else if (from[key] !== prev[key]) {
|
|
2488
2497
|
changed = true;
|
|
@@ -2496,12 +2505,12 @@ function syncSetupAttrs(to, from, prev, instance) {
|
|
|
2496
2505
|
}
|
|
2497
2506
|
return changed;
|
|
2498
2507
|
}
|
|
2499
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
2508
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
2500
2509
|
Object.defineProperty(proxy, key, {
|
|
2501
2510
|
enumerable: true,
|
|
2502
2511
|
configurable: true,
|
|
2503
2512
|
get: function () {
|
|
2504
|
-
return instance
|
|
2513
|
+
return instance[type][key];
|
|
2505
2514
|
}
|
|
2506
2515
|
});
|
|
2507
2516
|
}
|
|
@@ -2522,17 +2531,27 @@ function syncSetupSlots(to, from) {
|
|
|
2522
2531
|
}
|
|
2523
2532
|
}
|
|
2524
2533
|
/**
|
|
2525
|
-
* @internal use manual type def
|
|
2534
|
+
* @internal use manual type def because public setup context type relies on
|
|
2535
|
+
* legacy VNode types
|
|
2526
2536
|
*/
|
|
2527
2537
|
function useSlots() {
|
|
2528
2538
|
return getContext().slots;
|
|
2529
2539
|
}
|
|
2530
2540
|
/**
|
|
2531
|
-
* @internal use manual type def
|
|
2541
|
+
* @internal use manual type def because public setup context type relies on
|
|
2542
|
+
* legacy VNode types
|
|
2532
2543
|
*/
|
|
2533
2544
|
function useAttrs() {
|
|
2534
2545
|
return getContext().attrs;
|
|
2535
2546
|
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Vue 2 only
|
|
2549
|
+
* @internal use manual type def because public setup context type relies on
|
|
2550
|
+
* legacy VNode types
|
|
2551
|
+
*/
|
|
2552
|
+
function useListeners() {
|
|
2553
|
+
return getContext().listeners;
|
|
2554
|
+
}
|
|
2536
2555
|
function getContext() {
|
|
2537
2556
|
if (process.env.NODE_ENV !== 'production' && !currentInstance) {
|
|
2538
2557
|
warn("useContext() called without active instance.");
|
|
@@ -2576,7 +2595,9 @@ function initRender(vm) {
|
|
|
2576
2595
|
var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
|
|
2577
2596
|
var renderContext = parentVnode && parentVnode.context;
|
|
2578
2597
|
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
2579
|
-
vm.$scopedSlots =
|
|
2598
|
+
vm.$scopedSlots = parentVnode
|
|
2599
|
+
? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
|
2600
|
+
: emptyObject;
|
|
2580
2601
|
// bind the createElement fn to this instance
|
|
2581
2602
|
// so that we get proper render context inside it.
|
|
2582
2603
|
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
@@ -2614,7 +2635,7 @@ function renderMixin(Vue) {
|
|
|
2614
2635
|
Vue.prototype._render = function () {
|
|
2615
2636
|
var vm = this;
|
|
2616
2637
|
var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
|
|
2617
|
-
if (_parentVnode) {
|
|
2638
|
+
if (_parentVnode && vm._isMounted) {
|
|
2618
2639
|
vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
|
2619
2640
|
if (vm._slotsProxy) {
|
|
2620
2641
|
syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
|
@@ -3269,7 +3290,7 @@ var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
|
3269
3290
|
/**
|
|
3270
3291
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3271
3292
|
*/
|
|
3272
|
-
var version = '2.7.
|
|
3293
|
+
var version = '2.7.8';
|
|
3273
3294
|
/**
|
|
3274
3295
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3275
3296
|
*/
|
|
@@ -3352,6 +3373,7 @@ var Watcher = /** @class */ (function () {
|
|
|
3352
3373
|
this.cb = cb;
|
|
3353
3374
|
this.id = ++uid$1; // uid for batching
|
|
3354
3375
|
this.active = true;
|
|
3376
|
+
this.post = false;
|
|
3355
3377
|
this.dirty = this.lazy; // for lazy watchers
|
|
3356
3378
|
this.deps = [];
|
|
3357
3379
|
this.newDeps = [];
|
|
@@ -3876,12 +3898,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
3876
3898
|
if (vm._attrsProxy) {
|
|
3877
3899
|
// force update if attrs are accessed and has changed since it may be
|
|
3878
3900
|
// passed to a child component.
|
|
3879
|
-
if (
|
|
3901
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
3880
3902
|
needsForceUpdate = true;
|
|
3881
3903
|
}
|
|
3882
3904
|
}
|
|
3883
3905
|
vm.$attrs = attrs;
|
|
3884
|
-
|
|
3906
|
+
// update listeners
|
|
3907
|
+
listeners = listeners || emptyObject;
|
|
3908
|
+
var prevListeners = vm.$options._parentListeners;
|
|
3909
|
+
if (vm._listenersProxy) {
|
|
3910
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
3911
|
+
}
|
|
3912
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
3913
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
3885
3914
|
// update props
|
|
3886
3915
|
if (propsData && vm.$options.props) {
|
|
3887
3916
|
toggleObserving(false);
|
|
@@ -3896,11 +3925,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
3896
3925
|
// keep a copy of raw propsData
|
|
3897
3926
|
vm.$options.propsData = propsData;
|
|
3898
3927
|
}
|
|
3899
|
-
// update listeners
|
|
3900
|
-
listeners = listeners || emptyObject;
|
|
3901
|
-
var oldListeners = vm.$options._parentListeners;
|
|
3902
|
-
vm.$options._parentListeners = listeners;
|
|
3903
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
3904
3928
|
// resolve slots + force update if has children
|
|
3905
3929
|
if (needsForceUpdate) {
|
|
3906
3930
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -4015,6 +4039,16 @@ if (inBrowser && !isIE) {
|
|
|
4015
4039
|
getNow = function () { return performance_1.now(); };
|
|
4016
4040
|
}
|
|
4017
4041
|
}
|
|
4042
|
+
var sortCompareFn = function (a, b) {
|
|
4043
|
+
if (a.post) {
|
|
4044
|
+
if (!b.post)
|
|
4045
|
+
return 1;
|
|
4046
|
+
}
|
|
4047
|
+
else if (b.post) {
|
|
4048
|
+
return -1;
|
|
4049
|
+
}
|
|
4050
|
+
return a.id - b.id;
|
|
4051
|
+
};
|
|
4018
4052
|
/**
|
|
4019
4053
|
* Flush both queues and run the watchers.
|
|
4020
4054
|
*/
|
|
@@ -4030,7 +4064,7 @@ function flushSchedulerQueue() {
|
|
|
4030
4064
|
// user watchers are created before the render watcher)
|
|
4031
4065
|
// 3. If a component is destroyed during a parent component's watcher run,
|
|
4032
4066
|
// its watchers can be skipped.
|
|
4033
|
-
queue.sort(
|
|
4067
|
+
queue.sort(sortCompareFn);
|
|
4034
4068
|
// do not cache length because more watchers might be pushed
|
|
4035
4069
|
// as we run existing watchers
|
|
4036
4070
|
for (index = 0; index < queue.length; index++) {
|
|
@@ -4138,12 +4172,14 @@ function initProvide(vm) {
|
|
|
4138
4172
|
if (!isObject(provided)) {
|
|
4139
4173
|
return;
|
|
4140
4174
|
}
|
|
4175
|
+
var source = resolveProvided(vm);
|
|
4176
|
+
// IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
|
|
4177
|
+
// iterate the keys ourselves.
|
|
4141
4178
|
var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
|
4142
|
-
setCurrentInstance(vm);
|
|
4143
4179
|
for (var i = 0; i < keys.length; i++) {
|
|
4144
|
-
|
|
4180
|
+
var key = keys[i];
|
|
4181
|
+
Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
|
4145
4182
|
}
|
|
4146
|
-
setCurrentInstance();
|
|
4147
4183
|
}
|
|
4148
4184
|
}
|
|
4149
4185
|
function initInjections(vm) {
|
|
@@ -8693,4 +8729,4 @@ if (inBrowser) {
|
|
|
8693
8729
|
}, 0);
|
|
8694
8730
|
}
|
|
8695
8731
|
|
|
8696
|
-
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 };
|
|
8732
|
+
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.runtime.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
|
*/
|
|
@@ -920,7 +920,7 @@
|
|
|
920
920
|
// #7981: for accessor properties without setter
|
|
921
921
|
return;
|
|
922
922
|
}
|
|
923
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
923
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
924
924
|
value.value = newVal;
|
|
925
925
|
return;
|
|
926
926
|
}
|
|
@@ -1534,7 +1534,7 @@
|
|
|
1534
1534
|
watcher.update = watcher.run;
|
|
1535
1535
|
}
|
|
1536
1536
|
else if (flush === 'post') {
|
|
1537
|
-
watcher.
|
|
1537
|
+
watcher.post = true;
|
|
1538
1538
|
watcher.update = function () { return queueWatcher(watcher); };
|
|
1539
1539
|
}
|
|
1540
1540
|
else {
|
|
@@ -1686,18 +1686,23 @@
|
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
else {
|
|
1689
|
-
var provides = currentInstance._provided;
|
|
1690
|
-
// by default an instance inherits its parent's provides object
|
|
1691
|
-
// but when it needs to provide values of its own, it creates its
|
|
1692
|
-
// own provides object using parent provides object as prototype.
|
|
1693
|
-
// this way in `inject` we can simply look up injections from direct
|
|
1694
|
-
// parent and let the prototype chain do the work.
|
|
1695
|
-
var parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
|
|
1696
|
-
if (parentProvides === provides) {
|
|
1697
|
-
provides = currentInstance._provided = Object.create(parentProvides);
|
|
1698
|
-
}
|
|
1699
1689
|
// TS doesn't allow symbol as index type
|
|
1700
|
-
|
|
1690
|
+
resolveProvided(currentInstance)[key] = value;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
function resolveProvided(vm) {
|
|
1694
|
+
// by default an instance inherits its parent's provides object
|
|
1695
|
+
// but when it needs to provide values of its own, it creates its
|
|
1696
|
+
// own provides object using parent provides object as prototype.
|
|
1697
|
+
// this way in `inject` we can simply look up injections from direct
|
|
1698
|
+
// parent and let the prototype chain do the work.
|
|
1699
|
+
var existing = vm._provided;
|
|
1700
|
+
var parentProvides = vm.$parent && vm.$parent._provided;
|
|
1701
|
+
if (parentProvides === existing) {
|
|
1702
|
+
return (vm._provided = Object.create(parentProvides));
|
|
1703
|
+
}
|
|
1704
|
+
else {
|
|
1705
|
+
return existing;
|
|
1701
1706
|
}
|
|
1702
1707
|
}
|
|
1703
1708
|
function inject(key, defaultValue, treatDefaultAsFactory) {
|
|
@@ -2421,7 +2426,19 @@
|
|
|
2421
2426
|
var exposeCalled = false;
|
|
2422
2427
|
return {
|
|
2423
2428
|
get attrs() {
|
|
2424
|
-
|
|
2429
|
+
if (!vm._attrsProxy) {
|
|
2430
|
+
var proxy = (vm._attrsProxy = {});
|
|
2431
|
+
def(proxy, '_v_attr_proxy', true);
|
|
2432
|
+
syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
|
2433
|
+
}
|
|
2434
|
+
return vm._attrsProxy;
|
|
2435
|
+
},
|
|
2436
|
+
get listeners() {
|
|
2437
|
+
if (!vm._listenersProxy) {
|
|
2438
|
+
var proxy = (vm._listenersProxy = {});
|
|
2439
|
+
syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
|
2440
|
+
}
|
|
2441
|
+
return vm._listenersProxy;
|
|
2425
2442
|
},
|
|
2426
2443
|
get slots() {
|
|
2427
2444
|
return initSlotsProxy(vm);
|
|
@@ -2442,20 +2459,12 @@
|
|
|
2442
2459
|
}
|
|
2443
2460
|
};
|
|
2444
2461
|
}
|
|
2445
|
-
function
|
|
2446
|
-
if (!vm._attrsProxy) {
|
|
2447
|
-
var proxy = (vm._attrsProxy = {});
|
|
2448
|
-
def(proxy, '_v_attr_proxy', true);
|
|
2449
|
-
syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
|
|
2450
|
-
}
|
|
2451
|
-
return vm._attrsProxy;
|
|
2452
|
-
}
|
|
2453
|
-
function syncSetupAttrs(to, from, prev, instance) {
|
|
2462
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
2454
2463
|
var changed = false;
|
|
2455
2464
|
for (var key in from) {
|
|
2456
2465
|
if (!(key in to)) {
|
|
2457
2466
|
changed = true;
|
|
2458
|
-
defineProxyAttr(to, key, instance);
|
|
2467
|
+
defineProxyAttr(to, key, instance, type);
|
|
2459
2468
|
}
|
|
2460
2469
|
else if (from[key] !== prev[key]) {
|
|
2461
2470
|
changed = true;
|
|
@@ -2469,12 +2478,12 @@
|
|
|
2469
2478
|
}
|
|
2470
2479
|
return changed;
|
|
2471
2480
|
}
|
|
2472
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
2481
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
2473
2482
|
Object.defineProperty(proxy, key, {
|
|
2474
2483
|
enumerable: true,
|
|
2475
2484
|
configurable: true,
|
|
2476
2485
|
get: function () {
|
|
2477
|
-
return instance
|
|
2486
|
+
return instance[type][key];
|
|
2478
2487
|
}
|
|
2479
2488
|
});
|
|
2480
2489
|
}
|
|
@@ -2495,17 +2504,27 @@
|
|
|
2495
2504
|
}
|
|
2496
2505
|
}
|
|
2497
2506
|
/**
|
|
2498
|
-
* @internal use manual type def
|
|
2507
|
+
* @internal use manual type def because public setup context type relies on
|
|
2508
|
+
* legacy VNode types
|
|
2499
2509
|
*/
|
|
2500
2510
|
function useSlots() {
|
|
2501
2511
|
return getContext().slots;
|
|
2502
2512
|
}
|
|
2503
2513
|
/**
|
|
2504
|
-
* @internal use manual type def
|
|
2514
|
+
* @internal use manual type def because public setup context type relies on
|
|
2515
|
+
* legacy VNode types
|
|
2505
2516
|
*/
|
|
2506
2517
|
function useAttrs() {
|
|
2507
2518
|
return getContext().attrs;
|
|
2508
2519
|
}
|
|
2520
|
+
/**
|
|
2521
|
+
* Vue 2 only
|
|
2522
|
+
* @internal use manual type def because public setup context type relies on
|
|
2523
|
+
* legacy VNode types
|
|
2524
|
+
*/
|
|
2525
|
+
function useListeners() {
|
|
2526
|
+
return getContext().listeners;
|
|
2527
|
+
}
|
|
2509
2528
|
function getContext() {
|
|
2510
2529
|
if (!currentInstance) {
|
|
2511
2530
|
warn("useContext() called without active instance.");
|
|
@@ -2549,7 +2568,9 @@
|
|
|
2549
2568
|
var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
|
|
2550
2569
|
var renderContext = parentVnode && parentVnode.context;
|
|
2551
2570
|
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
2552
|
-
vm.$scopedSlots =
|
|
2571
|
+
vm.$scopedSlots = parentVnode
|
|
2572
|
+
? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
|
2573
|
+
: emptyObject;
|
|
2553
2574
|
// bind the createElement fn to this instance
|
|
2554
2575
|
// so that we get proper render context inside it.
|
|
2555
2576
|
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
@@ -2583,7 +2604,7 @@
|
|
|
2583
2604
|
Vue.prototype._render = function () {
|
|
2584
2605
|
var vm = this;
|
|
2585
2606
|
var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
|
|
2586
|
-
if (_parentVnode) {
|
|
2607
|
+
if (_parentVnode && vm._isMounted) {
|
|
2587
2608
|
vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
|
2588
2609
|
if (vm._slotsProxy) {
|
|
2589
2610
|
syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
|
@@ -3224,7 +3245,7 @@
|
|
|
3224
3245
|
/**
|
|
3225
3246
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3226
3247
|
*/
|
|
3227
|
-
var version = '2.7.
|
|
3248
|
+
var version = '2.7.8';
|
|
3228
3249
|
/**
|
|
3229
3250
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3230
3251
|
*/
|
|
@@ -3270,6 +3291,7 @@
|
|
|
3270
3291
|
getCurrentInstance: getCurrentInstance,
|
|
3271
3292
|
useSlots: useSlots,
|
|
3272
3293
|
useAttrs: useAttrs,
|
|
3294
|
+
useListeners: useListeners,
|
|
3273
3295
|
mergeDefaults: mergeDefaults,
|
|
3274
3296
|
nextTick: nextTick,
|
|
3275
3297
|
set: set,
|
|
@@ -3366,6 +3388,7 @@
|
|
|
3366
3388
|
this.cb = cb;
|
|
3367
3389
|
this.id = ++uid$1; // uid for batching
|
|
3368
3390
|
this.active = true;
|
|
3391
|
+
this.post = false;
|
|
3369
3392
|
this.dirty = this.lazy; // for lazy watchers
|
|
3370
3393
|
this.deps = [];
|
|
3371
3394
|
this.newDeps = [];
|
|
@@ -3889,12 +3912,19 @@
|
|
|
3889
3912
|
if (vm._attrsProxy) {
|
|
3890
3913
|
// force update if attrs are accessed and has changed since it may be
|
|
3891
3914
|
// passed to a child component.
|
|
3892
|
-
if (
|
|
3915
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
3893
3916
|
needsForceUpdate = true;
|
|
3894
3917
|
}
|
|
3895
3918
|
}
|
|
3896
3919
|
vm.$attrs = attrs;
|
|
3897
|
-
|
|
3920
|
+
// update listeners
|
|
3921
|
+
listeners = listeners || emptyObject;
|
|
3922
|
+
var prevListeners = vm.$options._parentListeners;
|
|
3923
|
+
if (vm._listenersProxy) {
|
|
3924
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
3925
|
+
}
|
|
3926
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
3927
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
3898
3928
|
// update props
|
|
3899
3929
|
if (propsData && vm.$options.props) {
|
|
3900
3930
|
toggleObserving(false);
|
|
@@ -3909,11 +3939,6 @@
|
|
|
3909
3939
|
// keep a copy of raw propsData
|
|
3910
3940
|
vm.$options.propsData = propsData;
|
|
3911
3941
|
}
|
|
3912
|
-
// update listeners
|
|
3913
|
-
listeners = listeners || emptyObject;
|
|
3914
|
-
var oldListeners = vm.$options._parentListeners;
|
|
3915
|
-
vm.$options._parentListeners = listeners;
|
|
3916
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
3917
3942
|
// resolve slots + force update if has children
|
|
3918
3943
|
if (needsForceUpdate) {
|
|
3919
3944
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -4028,6 +4053,16 @@
|
|
|
4028
4053
|
getNow = function () { return performance_1.now(); };
|
|
4029
4054
|
}
|
|
4030
4055
|
}
|
|
4056
|
+
var sortCompareFn = function (a, b) {
|
|
4057
|
+
if (a.post) {
|
|
4058
|
+
if (!b.post)
|
|
4059
|
+
return 1;
|
|
4060
|
+
}
|
|
4061
|
+
else if (b.post) {
|
|
4062
|
+
return -1;
|
|
4063
|
+
}
|
|
4064
|
+
return a.id - b.id;
|
|
4065
|
+
};
|
|
4031
4066
|
/**
|
|
4032
4067
|
* Flush both queues and run the watchers.
|
|
4033
4068
|
*/
|
|
@@ -4043,7 +4078,7 @@
|
|
|
4043
4078
|
// user watchers are created before the render watcher)
|
|
4044
4079
|
// 3. If a component is destroyed during a parent component's watcher run,
|
|
4045
4080
|
// its watchers can be skipped.
|
|
4046
|
-
queue.sort(
|
|
4081
|
+
queue.sort(sortCompareFn);
|
|
4047
4082
|
// do not cache length because more watchers might be pushed
|
|
4048
4083
|
// as we run existing watchers
|
|
4049
4084
|
for (index = 0; index < queue.length; index++) {
|
|
@@ -4151,12 +4186,14 @@
|
|
|
4151
4186
|
if (!isObject(provided)) {
|
|
4152
4187
|
return;
|
|
4153
4188
|
}
|
|
4189
|
+
var source = resolveProvided(vm);
|
|
4190
|
+
// IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
|
|
4191
|
+
// iterate the keys ourselves.
|
|
4154
4192
|
var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
|
4155
|
-
setCurrentInstance(vm);
|
|
4156
4193
|
for (var i = 0; i < keys.length; i++) {
|
|
4157
|
-
|
|
4194
|
+
var key = keys[i];
|
|
4195
|
+
Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
|
4158
4196
|
}
|
|
4159
|
-
setCurrentInstance();
|
|
4160
4197
|
}
|
|
4161
4198
|
}
|
|
4162
4199
|
function initInjections(vm) {
|