vue 2.7.6 → 2.7.9
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 +139 -67
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +137 -66
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +138 -66
- package/dist/vue.js +140 -67
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +112 -58
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +111 -57
- package/dist/vue.runtime.js +113 -58
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +2 -2
- package/packages/compiler-sfc/dist/compiler-sfc.js +56 -26
- package/packages/compiler-sfc/package.json +2 -3
- package/packages/compiler-sfc/src/compileTemplate.ts +1 -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 +31 -10
- package/src/core/instance/init.ts +1 -0
- package/src/core/instance/inject.ts +10 -5
- package/src/core/instance/lifecycle.ts +18 -10
- package/src/core/instance/proxy.ts +2 -2
- package/src/core/instance/render.ts +8 -2
- package/src/core/instance/state.ts +1 -1
- package/src/core/observer/index.ts +1 -1
- package/src/core/observer/scheduler.ts +10 -1
- package/src/core/observer/watcher.ts +14 -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/apiInject.ts +17 -12
- package/src/v3/apiLifecycle.ts +16 -1
- package/src/v3/apiSetup.ts +38 -17
- package/src/v3/apiWatch.ts +2 -5
- 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/README.md
CHANGED
|
@@ -73,7 +73,7 @@ Vue.js supports all browsers that are [ES5-compliant](https://kangax.github.io/c
|
|
|
73
73
|
|
|
74
74
|
## Documentation
|
|
75
75
|
|
|
76
|
-
To check out [live examples](https://vuejs.org/v2/examples/) and docs, visit [vuejs.org](https://vuejs.org).
|
|
76
|
+
To check out [live examples](https://v2.vuejs.org/v2/examples/) and docs, visit [vuejs.org](https://v2.vuejs.org).
|
|
77
77
|
|
|
78
78
|
## Questions
|
|
79
79
|
|
package/dist/vue.common.dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.7.
|
|
2
|
+
* Vue.js v2.7.9
|
|
3
3
|
* (c) 2014-2022 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -643,13 +643,13 @@ let initProxy;
|
|
|
643
643
|
'referenced during render. Make sure that this property is reactive, ' +
|
|
644
644
|
'either in the data option, or for class-based components, by ' +
|
|
645
645
|
'initializing the property. ' +
|
|
646
|
-
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
646
|
+
'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
647
647
|
};
|
|
648
648
|
const warnReservedPrefix = (target, key) => {
|
|
649
649
|
warn$2(`Property "${key}" must be accessed with "$data.${key}" because ` +
|
|
650
650
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
651
651
|
'prevent conflicts with Vue internals. ' +
|
|
652
|
-
'See: https://vuejs.org/v2/api/#data', target);
|
|
652
|
+
'See: https://v2.vuejs.org/v2/api/#data', target);
|
|
653
653
|
};
|
|
654
654
|
const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);
|
|
655
655
|
if (hasProxy) {
|
|
@@ -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.`);
|
|
@@ -2360,7 +2374,9 @@ function initRender(vm) {
|
|
|
2360
2374
|
const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
|
|
2361
2375
|
const renderContext = parentVnode && parentVnode.context;
|
|
2362
2376
|
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
2363
|
-
vm.$scopedSlots =
|
|
2377
|
+
vm.$scopedSlots = parentVnode
|
|
2378
|
+
? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
|
2379
|
+
: emptyObject;
|
|
2364
2380
|
// bind the createElement fn to this instance
|
|
2365
2381
|
// so that we get proper render context inside it.
|
|
2366
2382
|
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
@@ -2394,7 +2410,7 @@ function renderMixin(Vue) {
|
|
|
2394
2410
|
Vue.prototype._render = function () {
|
|
2395
2411
|
const vm = this;
|
|
2396
2412
|
const { render, _parentVnode } = vm.$options;
|
|
2397
|
-
if (_parentVnode) {
|
|
2413
|
+
if (_parentVnode && vm._isMounted) {
|
|
2398
2414
|
vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
|
2399
2415
|
if (vm._slotsProxy) {
|
|
2400
2416
|
syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
|
@@ -2915,12 +2931,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2915
2931
|
if (vm._attrsProxy) {
|
|
2916
2932
|
// force update if attrs are accessed and has changed since it may be
|
|
2917
2933
|
// passed to a child component.
|
|
2918
|
-
if (
|
|
2934
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
2919
2935
|
needsForceUpdate = true;
|
|
2920
2936
|
}
|
|
2921
2937
|
}
|
|
2922
2938
|
vm.$attrs = attrs;
|
|
2923
|
-
|
|
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);
|
|
2924
2947
|
// update props
|
|
2925
2948
|
if (propsData && vm.$options.props) {
|
|
2926
2949
|
toggleObserving(false);
|
|
@@ -2935,11 +2958,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2935
2958
|
// keep a copy of raw propsData
|
|
2936
2959
|
vm.$options.propsData = propsData;
|
|
2937
2960
|
}
|
|
2938
|
-
// update listeners
|
|
2939
|
-
listeners = listeners || emptyObject;
|
|
2940
|
-
const oldListeners = vm.$options._parentListeners;
|
|
2941
|
-
vm.$options._parentListeners = listeners;
|
|
2942
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
2943
2961
|
// resolve slots + force update if has children
|
|
2944
2962
|
if (needsForceUpdate) {
|
|
2945
2963
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3053,6 +3071,16 @@ if (inBrowser && !isIE) {
|
|
|
3053
3071
|
getNow = () => performance.now();
|
|
3054
3072
|
}
|
|
3055
3073
|
}
|
|
3074
|
+
const sortCompareFn = (a, b) => {
|
|
3075
|
+
if (a.post) {
|
|
3076
|
+
if (!b.post)
|
|
3077
|
+
return 1;
|
|
3078
|
+
}
|
|
3079
|
+
else if (b.post) {
|
|
3080
|
+
return -1;
|
|
3081
|
+
}
|
|
3082
|
+
return a.id - b.id;
|
|
3083
|
+
};
|
|
3056
3084
|
/**
|
|
3057
3085
|
* Flush both queues and run the watchers.
|
|
3058
3086
|
*/
|
|
@@ -3068,7 +3096,7 @@ function flushSchedulerQueue() {
|
|
|
3068
3096
|
// user watchers are created before the render watcher)
|
|
3069
3097
|
// 3. If a component is destroyed during a parent component's watcher run,
|
|
3070
3098
|
// its watchers can be skipped.
|
|
3071
|
-
queue.sort(
|
|
3099
|
+
queue.sort(sortCompareFn);
|
|
3072
3100
|
// do not cache length because more watchers might be pushed
|
|
3073
3101
|
// as we run existing watchers
|
|
3074
3102
|
for (index$1 = 0; index$1 < queue.length; index$1++) {
|
|
@@ -3297,8 +3325,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
|
|
|
3297
3325
|
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
3298
3326
|
// overwrite default run
|
|
3299
3327
|
watcher.run = () => {
|
|
3300
|
-
if (!watcher.active
|
|
3301
|
-
!(flush === 'pre' && instance && instance._isBeingDestroyed)) {
|
|
3328
|
+
if (!watcher.active) {
|
|
3302
3329
|
return;
|
|
3303
3330
|
}
|
|
3304
3331
|
if (cb) {
|
|
@@ -3331,7 +3358,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
|
|
|
3331
3358
|
watcher.update = watcher.run;
|
|
3332
3359
|
}
|
|
3333
3360
|
else if (flush === 'post') {
|
|
3334
|
-
watcher.
|
|
3361
|
+
watcher.post = true;
|
|
3335
3362
|
watcher.update = () => queueWatcher(watcher);
|
|
3336
3363
|
}
|
|
3337
3364
|
else {
|
|
@@ -3480,18 +3507,23 @@ function provide(key, value) {
|
|
|
3480
3507
|
}
|
|
3481
3508
|
}
|
|
3482
3509
|
else {
|
|
3483
|
-
let provides = currentInstance._provided;
|
|
3484
|
-
// by default an instance inherits its parent's provides object
|
|
3485
|
-
// but when it needs to provide values of its own, it creates its
|
|
3486
|
-
// own provides object using parent provides object as prototype.
|
|
3487
|
-
// this way in `inject` we can simply look up injections from direct
|
|
3488
|
-
// parent and let the prototype chain do the work.
|
|
3489
|
-
const parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
|
|
3490
|
-
if (parentProvides === provides) {
|
|
3491
|
-
provides = currentInstance._provided = Object.create(parentProvides);
|
|
3492
|
-
}
|
|
3493
3510
|
// TS doesn't allow symbol as index type
|
|
3494
|
-
|
|
3511
|
+
resolveProvided(currentInstance)[key] = value;
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
function resolveProvided(vm) {
|
|
3515
|
+
// by default an instance inherits its parent's provides object
|
|
3516
|
+
// but when it needs to provide values of its own, it creates its
|
|
3517
|
+
// own provides object using parent provides object as prototype.
|
|
3518
|
+
// this way in `inject` we can simply look up injections from direct
|
|
3519
|
+
// parent and let the prototype chain do the work.
|
|
3520
|
+
const existing = vm._provided;
|
|
3521
|
+
const parentProvides = vm.$parent && vm.$parent._provided;
|
|
3522
|
+
if (parentProvides === existing) {
|
|
3523
|
+
return (vm._provided = Object.create(parentProvides));
|
|
3524
|
+
}
|
|
3525
|
+
else {
|
|
3526
|
+
return existing;
|
|
3495
3527
|
}
|
|
3496
3528
|
}
|
|
3497
3529
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
@@ -3854,17 +3886,20 @@ const onBeforeUpdate = createLifeCycle('beforeUpdate');
|
|
|
3854
3886
|
const onUpdated = createLifeCycle('updated');
|
|
3855
3887
|
const onBeforeUnmount = createLifeCycle('beforeDestroy');
|
|
3856
3888
|
const onUnmounted = createLifeCycle('destroyed');
|
|
3857
|
-
const onErrorCaptured = createLifeCycle('errorCaptured');
|
|
3858
3889
|
const onActivated = createLifeCycle('activated');
|
|
3859
3890
|
const onDeactivated = createLifeCycle('deactivated');
|
|
3860
3891
|
const onServerPrefetch = createLifeCycle('serverPrefetch');
|
|
3861
3892
|
const onRenderTracked = createLifeCycle('renderTracked');
|
|
3862
|
-
const onRenderTriggered = createLifeCycle('renderTriggered');
|
|
3893
|
+
const onRenderTriggered = createLifeCycle('renderTriggered');
|
|
3894
|
+
const injectErrorCapturedHook = createLifeCycle('errorCaptured');
|
|
3895
|
+
function onErrorCaptured(hook, target = currentInstance) {
|
|
3896
|
+
injectErrorCapturedHook(hook, target);
|
|
3897
|
+
}
|
|
3863
3898
|
|
|
3864
3899
|
/**
|
|
3865
3900
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3866
3901
|
*/
|
|
3867
|
-
const version = '2.7.
|
|
3902
|
+
const version = '2.7.9';
|
|
3868
3903
|
/**
|
|
3869
3904
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3870
3905
|
*/
|
|
@@ -3910,6 +3945,7 @@ var vca = /*#__PURE__*/Object.freeze({
|
|
|
3910
3945
|
getCurrentInstance: getCurrentInstance,
|
|
3911
3946
|
useSlots: useSlots,
|
|
3912
3947
|
useAttrs: useAttrs,
|
|
3948
|
+
useListeners: useListeners,
|
|
3913
3949
|
mergeDefaults: mergeDefaults,
|
|
3914
3950
|
nextTick: nextTick,
|
|
3915
3951
|
set: set,
|
|
@@ -3923,12 +3959,12 @@ var vca = /*#__PURE__*/Object.freeze({
|
|
|
3923
3959
|
onUpdated: onUpdated,
|
|
3924
3960
|
onBeforeUnmount: onBeforeUnmount,
|
|
3925
3961
|
onUnmounted: onUnmounted,
|
|
3926
|
-
onErrorCaptured: onErrorCaptured,
|
|
3927
3962
|
onActivated: onActivated,
|
|
3928
3963
|
onDeactivated: onDeactivated,
|
|
3929
3964
|
onServerPrefetch: onServerPrefetch,
|
|
3930
3965
|
onRenderTracked: onRenderTracked,
|
|
3931
|
-
onRenderTriggered: onRenderTriggered
|
|
3966
|
+
onRenderTriggered: onRenderTriggered,
|
|
3967
|
+
onErrorCaptured: onErrorCaptured
|
|
3932
3968
|
});
|
|
3933
3969
|
|
|
3934
3970
|
const seenObjects = new _Set();
|
|
@@ -3982,11 +4018,16 @@ let uid$1 = 0;
|
|
|
3982
4018
|
*/
|
|
3983
4019
|
class Watcher {
|
|
3984
4020
|
constructor(vm, expOrFn, cb, options, isRenderWatcher) {
|
|
3985
|
-
recordEffectScope(this,
|
|
3986
|
-
if (
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4021
|
+
recordEffectScope(this,
|
|
4022
|
+
// if the active effect scope is manually created (not a component scope),
|
|
4023
|
+
// prioritize it
|
|
4024
|
+
activeEffectScope && !activeEffectScope._vm
|
|
4025
|
+
? activeEffectScope
|
|
4026
|
+
: vm
|
|
4027
|
+
? vm._scope
|
|
4028
|
+
: undefined);
|
|
4029
|
+
if ((this.vm = vm) && isRenderWatcher) {
|
|
4030
|
+
vm._watcher = this;
|
|
3990
4031
|
}
|
|
3991
4032
|
// options
|
|
3992
4033
|
if (options) {
|
|
@@ -4006,6 +4047,7 @@ class Watcher {
|
|
|
4006
4047
|
this.cb = cb;
|
|
4007
4048
|
this.id = ++uid$1; // uid for batching
|
|
4008
4049
|
this.active = true;
|
|
4050
|
+
this.post = false;
|
|
4009
4051
|
this.dirty = this.lazy; // for lazy watchers
|
|
4010
4052
|
this.deps = [];
|
|
4011
4053
|
this.newDeps = [];
|
|
@@ -4249,7 +4291,7 @@ function initData(vm) {
|
|
|
4249
4291
|
if (!isPlainObject(data)) {
|
|
4250
4292
|
data = {};
|
|
4251
4293
|
warn$2('data functions should return an object:\n' +
|
|
4252
|
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4294
|
+
'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4253
4295
|
}
|
|
4254
4296
|
// proxy data on instance
|
|
4255
4297
|
const keys = Object.keys(data);
|
|
@@ -4470,12 +4512,14 @@ function initProvide(vm) {
|
|
|
4470
4512
|
if (!isObject(provided)) {
|
|
4471
4513
|
return;
|
|
4472
4514
|
}
|
|
4515
|
+
const source = resolveProvided(vm);
|
|
4516
|
+
// IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
|
|
4517
|
+
// iterate the keys ourselves.
|
|
4473
4518
|
const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
|
4474
|
-
setCurrentInstance(vm);
|
|
4475
4519
|
for (let i = 0; i < keys.length; i++) {
|
|
4476
|
-
|
|
4520
|
+
const key = keys[i];
|
|
4521
|
+
Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
|
4477
4522
|
}
|
|
4478
|
-
setCurrentInstance();
|
|
4479
4523
|
}
|
|
4480
4524
|
}
|
|
4481
4525
|
function initInjections(vm) {
|
|
@@ -4543,6 +4587,7 @@ function initMixin$1(Vue) {
|
|
|
4543
4587
|
vm.__v_skip = true;
|
|
4544
4588
|
// effect scope
|
|
4545
4589
|
vm._scope = new EffectScope(true /* detached */);
|
|
4590
|
+
vm._scope._vm = true;
|
|
4546
4591
|
// merge options
|
|
4547
4592
|
if (options && options._isComponent) {
|
|
4548
4593
|
// optimize internal component instantiation
|
|
@@ -7078,7 +7123,16 @@ function normalizeDirectives(dirs, vm) {
|
|
|
7078
7123
|
}
|
|
7079
7124
|
res[getRawDirName(dir)] = dir;
|
|
7080
7125
|
if (vm._setupState && vm._setupState.__sfc) {
|
|
7081
|
-
|
|
7126
|
+
const setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
|
|
7127
|
+
if (typeof setupDef === 'function') {
|
|
7128
|
+
dir.def = {
|
|
7129
|
+
bind: setupDef,
|
|
7130
|
+
update: setupDef,
|
|
7131
|
+
};
|
|
7132
|
+
}
|
|
7133
|
+
else {
|
|
7134
|
+
dir.def = setupDef;
|
|
7135
|
+
}
|
|
7082
7136
|
}
|
|
7083
7137
|
dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
|
|
7084
7138
|
}
|
|
@@ -10808,17 +10862,15 @@ function genElement(el, state) {
|
|
|
10808
10862
|
}
|
|
10809
10863
|
else {
|
|
10810
10864
|
let data;
|
|
10811
|
-
|
|
10865
|
+
const maybeComponent = state.maybeComponent(el);
|
|
10866
|
+
if (!el.plain || (el.pre && maybeComponent)) {
|
|
10812
10867
|
data = genData(el, state);
|
|
10813
10868
|
}
|
|
10814
10869
|
let tag;
|
|
10815
10870
|
// check if this is a component in <script setup>
|
|
10816
10871
|
const bindings = state.options.bindings;
|
|
10817
|
-
if (bindings && bindings.__isScriptSetup !== false) {
|
|
10818
|
-
tag =
|
|
10819
|
-
checkBindingType(bindings, el.tag) ||
|
|
10820
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10821
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10872
|
+
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10873
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10822
10874
|
}
|
|
10823
10875
|
if (!tag)
|
|
10824
10876
|
tag = `'${el.tag}'`;
|
|
@@ -10835,9 +10887,29 @@ function genElement(el, state) {
|
|
|
10835
10887
|
}
|
|
10836
10888
|
}
|
|
10837
10889
|
function checkBindingType(bindings, key) {
|
|
10838
|
-
const
|
|
10839
|
-
|
|
10840
|
-
|
|
10890
|
+
const camelName = camelize(key);
|
|
10891
|
+
const PascalName = capitalize(camelName);
|
|
10892
|
+
const checkType = (type) => {
|
|
10893
|
+
if (bindings[key] === type) {
|
|
10894
|
+
return key;
|
|
10895
|
+
}
|
|
10896
|
+
if (bindings[camelName] === type) {
|
|
10897
|
+
return camelName;
|
|
10898
|
+
}
|
|
10899
|
+
if (bindings[PascalName] === type) {
|
|
10900
|
+
return PascalName;
|
|
10901
|
+
}
|
|
10902
|
+
};
|
|
10903
|
+
const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
10904
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
10905
|
+
if (fromConst) {
|
|
10906
|
+
return fromConst;
|
|
10907
|
+
}
|
|
10908
|
+
const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
10909
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
10910
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
10911
|
+
if (fromMaybeRef) {
|
|
10912
|
+
return fromMaybeRef;
|
|
10841
10913
|
}
|
|
10842
10914
|
}
|
|
10843
10915
|
// hoist static sub-trees out
|