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.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
|
*/
|
|
@@ -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.");
|
|
@@ -2438,7 +2452,9 @@ function initRender(vm) {
|
|
|
2438
2452
|
var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
|
|
2439
2453
|
var renderContext = parentVnode && parentVnode.context;
|
|
2440
2454
|
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
2441
|
-
vm.$scopedSlots =
|
|
2455
|
+
vm.$scopedSlots = parentVnode
|
|
2456
|
+
? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
|
2457
|
+
: emptyObject;
|
|
2442
2458
|
// bind the createElement fn to this instance
|
|
2443
2459
|
// so that we get proper render context inside it.
|
|
2444
2460
|
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
@@ -2476,7 +2492,7 @@ function renderMixin(Vue) {
|
|
|
2476
2492
|
Vue.prototype._render = function () {
|
|
2477
2493
|
var vm = this;
|
|
2478
2494
|
var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
|
|
2479
|
-
if (_parentVnode) {
|
|
2495
|
+
if (_parentVnode && vm._isMounted) {
|
|
2480
2496
|
vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
|
2481
2497
|
if (vm._slotsProxy) {
|
|
2482
2498
|
syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
|
@@ -2998,12 +3014,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2998
3014
|
if (vm._attrsProxy) {
|
|
2999
3015
|
// force update if attrs are accessed and has changed since it may be
|
|
3000
3016
|
// passed to a child component.
|
|
3001
|
-
if (
|
|
3017
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
3002
3018
|
needsForceUpdate = true;
|
|
3003
3019
|
}
|
|
3004
3020
|
}
|
|
3005
3021
|
vm.$attrs = attrs;
|
|
3006
|
-
|
|
3022
|
+
// update listeners
|
|
3023
|
+
listeners = listeners || emptyObject;
|
|
3024
|
+
var prevListeners = vm.$options._parentListeners;
|
|
3025
|
+
if (vm._listenersProxy) {
|
|
3026
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
3027
|
+
}
|
|
3028
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
3029
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
3007
3030
|
// update props
|
|
3008
3031
|
if (propsData && vm.$options.props) {
|
|
3009
3032
|
toggleObserving(false);
|
|
@@ -3018,11 +3041,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
3018
3041
|
// keep a copy of raw propsData
|
|
3019
3042
|
vm.$options.propsData = propsData;
|
|
3020
3043
|
}
|
|
3021
|
-
// update listeners
|
|
3022
|
-
listeners = listeners || emptyObject;
|
|
3023
|
-
var oldListeners = vm.$options._parentListeners;
|
|
3024
|
-
vm.$options._parentListeners = listeners;
|
|
3025
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
3026
3044
|
// resolve slots + force update if has children
|
|
3027
3045
|
if (needsForceUpdate) {
|
|
3028
3046
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3137,6 +3155,16 @@ if (inBrowser && !isIE) {
|
|
|
3137
3155
|
getNow = function () { return performance_1.now(); };
|
|
3138
3156
|
}
|
|
3139
3157
|
}
|
|
3158
|
+
var sortCompareFn = function (a, b) {
|
|
3159
|
+
if (a.post) {
|
|
3160
|
+
if (!b.post)
|
|
3161
|
+
return 1;
|
|
3162
|
+
}
|
|
3163
|
+
else if (b.post) {
|
|
3164
|
+
return -1;
|
|
3165
|
+
}
|
|
3166
|
+
return a.id - b.id;
|
|
3167
|
+
};
|
|
3140
3168
|
/**
|
|
3141
3169
|
* Flush both queues and run the watchers.
|
|
3142
3170
|
*/
|
|
@@ -3152,7 +3180,7 @@ function flushSchedulerQueue() {
|
|
|
3152
3180
|
// user watchers are created before the render watcher)
|
|
3153
3181
|
// 3. If a component is destroyed during a parent component's watcher run,
|
|
3154
3182
|
// its watchers can be skipped.
|
|
3155
|
-
queue.sort(
|
|
3183
|
+
queue.sort(sortCompareFn);
|
|
3156
3184
|
// do not cache length because more watchers might be pushed
|
|
3157
3185
|
// as we run existing watchers
|
|
3158
3186
|
for (index$1 = 0; index$1 < queue.length; index$1++) {
|
|
@@ -3425,7 +3453,7 @@ function doWatch(source, cb, _a) {
|
|
|
3425
3453
|
watcher.update = watcher.run;
|
|
3426
3454
|
}
|
|
3427
3455
|
else if (flush === 'post') {
|
|
3428
|
-
watcher.
|
|
3456
|
+
watcher.post = true;
|
|
3429
3457
|
watcher.update = function () { return queueWatcher(watcher); };
|
|
3430
3458
|
}
|
|
3431
3459
|
else {
|
|
@@ -3577,18 +3605,23 @@ function provide(key, value) {
|
|
|
3577
3605
|
}
|
|
3578
3606
|
}
|
|
3579
3607
|
else {
|
|
3580
|
-
var provides = currentInstance._provided;
|
|
3581
|
-
// by default an instance inherits its parent's provides object
|
|
3582
|
-
// but when it needs to provide values of its own, it creates its
|
|
3583
|
-
// own provides object using parent provides object as prototype.
|
|
3584
|
-
// this way in `inject` we can simply look up injections from direct
|
|
3585
|
-
// parent and let the prototype chain do the work.
|
|
3586
|
-
var parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
|
|
3587
|
-
if (parentProvides === provides) {
|
|
3588
|
-
provides = currentInstance._provided = Object.create(parentProvides);
|
|
3589
|
-
}
|
|
3590
3608
|
// TS doesn't allow symbol as index type
|
|
3591
|
-
|
|
3609
|
+
resolveProvided(currentInstance)[key] = value;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
function resolveProvided(vm) {
|
|
3613
|
+
// by default an instance inherits its parent's provides object
|
|
3614
|
+
// but when it needs to provide values of its own, it creates its
|
|
3615
|
+
// own provides object using parent provides object as prototype.
|
|
3616
|
+
// this way in `inject` we can simply look up injections from direct
|
|
3617
|
+
// parent and let the prototype chain do the work.
|
|
3618
|
+
var existing = vm._provided;
|
|
3619
|
+
var parentProvides = vm.$parent && vm.$parent._provided;
|
|
3620
|
+
if (parentProvides === existing) {
|
|
3621
|
+
return (vm._provided = Object.create(parentProvides));
|
|
3622
|
+
}
|
|
3623
|
+
else {
|
|
3624
|
+
return existing;
|
|
3592
3625
|
}
|
|
3593
3626
|
}
|
|
3594
3627
|
function inject(key, defaultValue, treatDefaultAsFactory) {
|
|
@@ -3969,7 +4002,7 @@ var onRenderTriggered = createLifeCycle('renderTriggered');
|
|
|
3969
4002
|
/**
|
|
3970
4003
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3971
4004
|
*/
|
|
3972
|
-
var version = '2.7.
|
|
4005
|
+
var version = '2.7.8';
|
|
3973
4006
|
/**
|
|
3974
4007
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3975
4008
|
*/
|
|
@@ -4052,6 +4085,7 @@ var Watcher = /** @class */ (function () {
|
|
|
4052
4085
|
this.cb = cb;
|
|
4053
4086
|
this.id = ++uid$1; // uid for batching
|
|
4054
4087
|
this.active = true;
|
|
4088
|
+
this.post = false;
|
|
4055
4089
|
this.dirty = this.lazy; // for lazy watchers
|
|
4056
4090
|
this.deps = [];
|
|
4057
4091
|
this.newDeps = [];
|
|
@@ -4526,12 +4560,14 @@ function initProvide(vm) {
|
|
|
4526
4560
|
if (!isObject(provided)) {
|
|
4527
4561
|
return;
|
|
4528
4562
|
}
|
|
4563
|
+
var source = resolveProvided(vm);
|
|
4564
|
+
// IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
|
|
4565
|
+
// iterate the keys ourselves.
|
|
4529
4566
|
var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
|
4530
|
-
setCurrentInstance(vm);
|
|
4531
4567
|
for (var i = 0; i < keys.length; i++) {
|
|
4532
|
-
|
|
4568
|
+
var key = keys[i];
|
|
4569
|
+
Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
|
4533
4570
|
}
|
|
4534
|
-
setCurrentInstance();
|
|
4535
4571
|
}
|
|
4536
4572
|
}
|
|
4537
4573
|
function initInjections(vm) {
|
|
@@ -10912,7 +10948,8 @@ function genElement(el, state) {
|
|
|
10912
10948
|
}
|
|
10913
10949
|
else {
|
|
10914
10950
|
var data = void 0;
|
|
10915
|
-
|
|
10951
|
+
var maybeComponent = state.maybeComponent(el);
|
|
10952
|
+
if (!el.plain || (el.pre && maybeComponent)) {
|
|
10916
10953
|
data = genData(el, state);
|
|
10917
10954
|
}
|
|
10918
10955
|
var tag
|
|
@@ -10920,11 +10957,8 @@ function genElement(el, state) {
|
|
|
10920
10957
|
= void 0;
|
|
10921
10958
|
// check if this is a component in <script setup>
|
|
10922
10959
|
var bindings = state.options.bindings;
|
|
10923
|
-
if (bindings && bindings.__isScriptSetup !== false) {
|
|
10924
|
-
tag =
|
|
10925
|
-
checkBindingType(bindings, el.tag) ||
|
|
10926
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10927
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10960
|
+
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10961
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10928
10962
|
}
|
|
10929
10963
|
if (!tag)
|
|
10930
10964
|
tag = "'".concat(el.tag, "'");
|
|
@@ -10941,9 +10975,29 @@ function genElement(el, state) {
|
|
|
10941
10975
|
}
|
|
10942
10976
|
}
|
|
10943
10977
|
function checkBindingType(bindings, key) {
|
|
10944
|
-
var
|
|
10945
|
-
|
|
10946
|
-
|
|
10978
|
+
var camelName = camelize(key);
|
|
10979
|
+
var PascalName = capitalize(camelName);
|
|
10980
|
+
var checkType = function (type) {
|
|
10981
|
+
if (bindings[key] === type) {
|
|
10982
|
+
return key;
|
|
10983
|
+
}
|
|
10984
|
+
if (bindings[camelName] === type) {
|
|
10985
|
+
return camelName;
|
|
10986
|
+
}
|
|
10987
|
+
if (bindings[PascalName] === type) {
|
|
10988
|
+
return PascalName;
|
|
10989
|
+
}
|
|
10990
|
+
};
|
|
10991
|
+
var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
10992
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
10993
|
+
if (fromConst) {
|
|
10994
|
+
return fromConst;
|
|
10995
|
+
}
|
|
10996
|
+
var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
10997
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
10998
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
10999
|
+
if (fromMaybeRef) {
|
|
11000
|
+
return fromMaybeRef;
|
|
10947
11001
|
}
|
|
10948
11002
|
}
|
|
10949
11003
|
// hoist static sub-trees out
|
|
@@ -11770,4 +11824,4 @@ function getOuterHTML(el) {
|
|
|
11770
11824
|
}
|
|
11771
11825
|
Vue.compile = compileToFunctions;
|
|
11772
11826
|
|
|
11773
|
-
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 };
|
|
11827
|
+
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.8
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -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.");
|
|
@@ -2411,7 +2425,9 @@
|
|
|
2411
2425
|
var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
|
|
2412
2426
|
var renderContext = parentVnode && parentVnode.context;
|
|
2413
2427
|
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
2414
|
-
vm.$scopedSlots =
|
|
2428
|
+
vm.$scopedSlots = parentVnode
|
|
2429
|
+
? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
|
2430
|
+
: emptyObject;
|
|
2415
2431
|
// bind the createElement fn to this instance
|
|
2416
2432
|
// so that we get proper render context inside it.
|
|
2417
2433
|
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
@@ -2445,7 +2461,7 @@
|
|
|
2445
2461
|
Vue.prototype._render = function () {
|
|
2446
2462
|
var vm = this;
|
|
2447
2463
|
var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
|
|
2448
|
-
if (_parentVnode) {
|
|
2464
|
+
if (_parentVnode && vm._isMounted) {
|
|
2449
2465
|
vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
|
2450
2466
|
if (vm._slotsProxy) {
|
|
2451
2467
|
syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
|
@@ -2966,12 +2982,19 @@
|
|
|
2966
2982
|
if (vm._attrsProxy) {
|
|
2967
2983
|
// force update if attrs are accessed and has changed since it may be
|
|
2968
2984
|
// passed to a child component.
|
|
2969
|
-
if (
|
|
2985
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
2970
2986
|
needsForceUpdate = true;
|
|
2971
2987
|
}
|
|
2972
2988
|
}
|
|
2973
2989
|
vm.$attrs = attrs;
|
|
2974
|
-
|
|
2990
|
+
// update listeners
|
|
2991
|
+
listeners = listeners || emptyObject;
|
|
2992
|
+
var prevListeners = vm.$options._parentListeners;
|
|
2993
|
+
if (vm._listenersProxy) {
|
|
2994
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
2995
|
+
}
|
|
2996
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
2997
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
2975
2998
|
// update props
|
|
2976
2999
|
if (propsData && vm.$options.props) {
|
|
2977
3000
|
toggleObserving(false);
|
|
@@ -2986,11 +3009,6 @@
|
|
|
2986
3009
|
// keep a copy of raw propsData
|
|
2987
3010
|
vm.$options.propsData = propsData;
|
|
2988
3011
|
}
|
|
2989
|
-
// update listeners
|
|
2990
|
-
listeners = listeners || emptyObject;
|
|
2991
|
-
var oldListeners = vm.$options._parentListeners;
|
|
2992
|
-
vm.$options._parentListeners = listeners;
|
|
2993
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
2994
3012
|
// resolve slots + force update if has children
|
|
2995
3013
|
if (needsForceUpdate) {
|
|
2996
3014
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3105,6 +3123,16 @@
|
|
|
3105
3123
|
getNow = function () { return performance_1.now(); };
|
|
3106
3124
|
}
|
|
3107
3125
|
}
|
|
3126
|
+
var sortCompareFn = function (a, b) {
|
|
3127
|
+
if (a.post) {
|
|
3128
|
+
if (!b.post)
|
|
3129
|
+
return 1;
|
|
3130
|
+
}
|
|
3131
|
+
else if (b.post) {
|
|
3132
|
+
return -1;
|
|
3133
|
+
}
|
|
3134
|
+
return a.id - b.id;
|
|
3135
|
+
};
|
|
3108
3136
|
/**
|
|
3109
3137
|
* Flush both queues and run the watchers.
|
|
3110
3138
|
*/
|
|
@@ -3120,7 +3148,7 @@
|
|
|
3120
3148
|
// user watchers are created before the render watcher)
|
|
3121
3149
|
// 3. If a component is destroyed during a parent component's watcher run,
|
|
3122
3150
|
// its watchers can be skipped.
|
|
3123
|
-
queue.sort(
|
|
3151
|
+
queue.sort(sortCompareFn);
|
|
3124
3152
|
// do not cache length because more watchers might be pushed
|
|
3125
3153
|
// as we run existing watchers
|
|
3126
3154
|
for (index$1 = 0; index$1 < queue.length; index$1++) {
|
|
@@ -3391,7 +3419,7 @@
|
|
|
3391
3419
|
watcher.update = watcher.run;
|
|
3392
3420
|
}
|
|
3393
3421
|
else if (flush === 'post') {
|
|
3394
|
-
watcher.
|
|
3422
|
+
watcher.post = true;
|
|
3395
3423
|
watcher.update = function () { return queueWatcher(watcher); };
|
|
3396
3424
|
}
|
|
3397
3425
|
else {
|
|
@@ -3543,18 +3571,23 @@
|
|
|
3543
3571
|
}
|
|
3544
3572
|
}
|
|
3545
3573
|
else {
|
|
3546
|
-
var provides = currentInstance._provided;
|
|
3547
|
-
// by default an instance inherits its parent's provides object
|
|
3548
|
-
// but when it needs to provide values of its own, it creates its
|
|
3549
|
-
// own provides object using parent provides object as prototype.
|
|
3550
|
-
// this way in `inject` we can simply look up injections from direct
|
|
3551
|
-
// parent and let the prototype chain do the work.
|
|
3552
|
-
var parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
|
|
3553
|
-
if (parentProvides === provides) {
|
|
3554
|
-
provides = currentInstance._provided = Object.create(parentProvides);
|
|
3555
|
-
}
|
|
3556
3574
|
// TS doesn't allow symbol as index type
|
|
3557
|
-
|
|
3575
|
+
resolveProvided(currentInstance)[key] = value;
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
function resolveProvided(vm) {
|
|
3579
|
+
// by default an instance inherits its parent's provides object
|
|
3580
|
+
// but when it needs to provide values of its own, it creates its
|
|
3581
|
+
// own provides object using parent provides object as prototype.
|
|
3582
|
+
// this way in `inject` we can simply look up injections from direct
|
|
3583
|
+
// parent and let the prototype chain do the work.
|
|
3584
|
+
var existing = vm._provided;
|
|
3585
|
+
var parentProvides = vm.$parent && vm.$parent._provided;
|
|
3586
|
+
if (parentProvides === existing) {
|
|
3587
|
+
return (vm._provided = Object.create(parentProvides));
|
|
3588
|
+
}
|
|
3589
|
+
else {
|
|
3590
|
+
return existing;
|
|
3558
3591
|
}
|
|
3559
3592
|
}
|
|
3560
3593
|
function inject(key, defaultValue, treatDefaultAsFactory) {
|
|
@@ -3924,7 +3957,7 @@
|
|
|
3924
3957
|
/**
|
|
3925
3958
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3926
3959
|
*/
|
|
3927
|
-
var version = '2.7.
|
|
3960
|
+
var version = '2.7.8';
|
|
3928
3961
|
/**
|
|
3929
3962
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3930
3963
|
*/
|
|
@@ -3970,6 +4003,7 @@
|
|
|
3970
4003
|
getCurrentInstance: getCurrentInstance,
|
|
3971
4004
|
useSlots: useSlots,
|
|
3972
4005
|
useAttrs: useAttrs,
|
|
4006
|
+
useListeners: useListeners,
|
|
3973
4007
|
mergeDefaults: mergeDefaults,
|
|
3974
4008
|
nextTick: nextTick,
|
|
3975
4009
|
set: set,
|
|
@@ -4066,6 +4100,7 @@
|
|
|
4066
4100
|
this.cb = cb;
|
|
4067
4101
|
this.id = ++uid$1; // uid for batching
|
|
4068
4102
|
this.active = true;
|
|
4103
|
+
this.post = false;
|
|
4069
4104
|
this.dirty = this.lazy; // for lazy watchers
|
|
4070
4105
|
this.deps = [];
|
|
4071
4106
|
this.newDeps = [];
|
|
@@ -4534,12 +4569,14 @@
|
|
|
4534
4569
|
if (!isObject(provided)) {
|
|
4535
4570
|
return;
|
|
4536
4571
|
}
|
|
4572
|
+
var source = resolveProvided(vm);
|
|
4573
|
+
// IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
|
|
4574
|
+
// iterate the keys ourselves.
|
|
4537
4575
|
var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
|
4538
|
-
setCurrentInstance(vm);
|
|
4539
4576
|
for (var i = 0; i < keys.length; i++) {
|
|
4540
|
-
|
|
4577
|
+
var key = keys[i];
|
|
4578
|
+
Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
|
4541
4579
|
}
|
|
4542
|
-
setCurrentInstance();
|
|
4543
4580
|
}
|
|
4544
4581
|
}
|
|
4545
4582
|
function initInjections(vm) {
|
|
@@ -10907,7 +10944,8 @@
|
|
|
10907
10944
|
}
|
|
10908
10945
|
else {
|
|
10909
10946
|
var data = void 0;
|
|
10910
|
-
|
|
10947
|
+
var maybeComponent = state.maybeComponent(el);
|
|
10948
|
+
if (!el.plain || (el.pre && maybeComponent)) {
|
|
10911
10949
|
data = genData(el, state);
|
|
10912
10950
|
}
|
|
10913
10951
|
var tag
|
|
@@ -10915,11 +10953,8 @@
|
|
|
10915
10953
|
= void 0;
|
|
10916
10954
|
// check if this is a component in <script setup>
|
|
10917
10955
|
var bindings = state.options.bindings;
|
|
10918
|
-
if (bindings && bindings.__isScriptSetup !== false) {
|
|
10919
|
-
tag =
|
|
10920
|
-
checkBindingType(bindings, el.tag) ||
|
|
10921
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10922
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10956
|
+
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10957
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10923
10958
|
}
|
|
10924
10959
|
if (!tag)
|
|
10925
10960
|
tag = "'".concat(el.tag, "'");
|
|
@@ -10936,9 +10971,29 @@
|
|
|
10936
10971
|
}
|
|
10937
10972
|
}
|
|
10938
10973
|
function checkBindingType(bindings, key) {
|
|
10939
|
-
var
|
|
10940
|
-
|
|
10941
|
-
|
|
10974
|
+
var camelName = camelize(key);
|
|
10975
|
+
var PascalName = capitalize(camelName);
|
|
10976
|
+
var checkType = function (type) {
|
|
10977
|
+
if (bindings[key] === type) {
|
|
10978
|
+
return key;
|
|
10979
|
+
}
|
|
10980
|
+
if (bindings[camelName] === type) {
|
|
10981
|
+
return camelName;
|
|
10982
|
+
}
|
|
10983
|
+
if (bindings[PascalName] === type) {
|
|
10984
|
+
return PascalName;
|
|
10985
|
+
}
|
|
10986
|
+
};
|
|
10987
|
+
var fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
10988
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
10989
|
+
if (fromConst) {
|
|
10990
|
+
return fromConst;
|
|
10991
|
+
}
|
|
10992
|
+
var fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
10993
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
10994
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
10995
|
+
if (fromMaybeRef) {
|
|
10996
|
+
return fromMaybeRef;
|
|
10942
10997
|
}
|
|
10943
10998
|
}
|
|
10944
10999
|
// hoist static sub-trees out
|