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/dist/vue.esm.browser.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
|
*/
|
|
@@ -641,13 +641,13 @@ let initProxy;
|
|
|
641
641
|
'referenced during render. Make sure that this property is reactive, ' +
|
|
642
642
|
'either in the data option, or for class-based components, by ' +
|
|
643
643
|
'initializing the property. ' +
|
|
644
|
-
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
644
|
+
'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
|
|
645
645
|
};
|
|
646
646
|
const warnReservedPrefix = (target, key) => {
|
|
647
647
|
warn$2(`Property "${key}" must be accessed with "$data.${key}" because ` +
|
|
648
648
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
649
649
|
'prevent conflicts with Vue internals. ' +
|
|
650
|
-
'See: https://vuejs.org/v2/api/#data', target);
|
|
650
|
+
'See: https://v2.vuejs.org/v2/api/#data', target);
|
|
651
651
|
};
|
|
652
652
|
const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);
|
|
653
653
|
if (hasProxy) {
|
|
@@ -959,7 +959,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
|
959
959
|
// #7981: for accessor properties without setter
|
|
960
960
|
return;
|
|
961
961
|
}
|
|
962
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
962
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
963
963
|
value.value = newVal;
|
|
964
964
|
return;
|
|
965
965
|
}
|
|
@@ -2232,7 +2232,19 @@ function createSetupContext(vm) {
|
|
|
2232
2232
|
let exposeCalled = false;
|
|
2233
2233
|
return {
|
|
2234
2234
|
get attrs() {
|
|
2235
|
-
|
|
2235
|
+
if (!vm._attrsProxy) {
|
|
2236
|
+
const proxy = (vm._attrsProxy = {});
|
|
2237
|
+
def(proxy, '_v_attr_proxy', true);
|
|
2238
|
+
syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
|
|
2239
|
+
}
|
|
2240
|
+
return vm._attrsProxy;
|
|
2241
|
+
},
|
|
2242
|
+
get listeners() {
|
|
2243
|
+
if (!vm._listenersProxy) {
|
|
2244
|
+
const proxy = (vm._listenersProxy = {});
|
|
2245
|
+
syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
|
|
2246
|
+
}
|
|
2247
|
+
return vm._listenersProxy;
|
|
2236
2248
|
},
|
|
2237
2249
|
get slots() {
|
|
2238
2250
|
return initSlotsProxy(vm);
|
|
@@ -2251,20 +2263,12 @@ function createSetupContext(vm) {
|
|
|
2251
2263
|
}
|
|
2252
2264
|
};
|
|
2253
2265
|
}
|
|
2254
|
-
function
|
|
2255
|
-
if (!vm._attrsProxy) {
|
|
2256
|
-
const proxy = (vm._attrsProxy = {});
|
|
2257
|
-
def(proxy, '_v_attr_proxy', true);
|
|
2258
|
-
syncSetupAttrs(proxy, vm.$attrs, emptyObject, vm);
|
|
2259
|
-
}
|
|
2260
|
-
return vm._attrsProxy;
|
|
2261
|
-
}
|
|
2262
|
-
function syncSetupAttrs(to, from, prev, instance) {
|
|
2266
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
2263
2267
|
let changed = false;
|
|
2264
2268
|
for (const key in from) {
|
|
2265
2269
|
if (!(key in to)) {
|
|
2266
2270
|
changed = true;
|
|
2267
|
-
defineProxyAttr(to, key, instance);
|
|
2271
|
+
defineProxyAttr(to, key, instance, type);
|
|
2268
2272
|
}
|
|
2269
2273
|
else if (from[key] !== prev[key]) {
|
|
2270
2274
|
changed = true;
|
|
@@ -2278,12 +2282,12 @@ function syncSetupAttrs(to, from, prev, instance) {
|
|
|
2278
2282
|
}
|
|
2279
2283
|
return changed;
|
|
2280
2284
|
}
|
|
2281
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
2285
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
2282
2286
|
Object.defineProperty(proxy, key, {
|
|
2283
2287
|
enumerable: true,
|
|
2284
2288
|
configurable: true,
|
|
2285
2289
|
get() {
|
|
2286
|
-
return instance
|
|
2290
|
+
return instance[type][key];
|
|
2287
2291
|
}
|
|
2288
2292
|
});
|
|
2289
2293
|
}
|
|
@@ -2304,17 +2308,27 @@ function syncSetupSlots(to, from) {
|
|
|
2304
2308
|
}
|
|
2305
2309
|
}
|
|
2306
2310
|
/**
|
|
2307
|
-
* @internal use manual type def
|
|
2311
|
+
* @internal use manual type def because public setup context type relies on
|
|
2312
|
+
* legacy VNode types
|
|
2308
2313
|
*/
|
|
2309
2314
|
function useSlots() {
|
|
2310
2315
|
return getContext().slots;
|
|
2311
2316
|
}
|
|
2312
2317
|
/**
|
|
2313
|
-
* @internal use manual type def
|
|
2318
|
+
* @internal use manual type def because public setup context type relies on
|
|
2319
|
+
* legacy VNode types
|
|
2314
2320
|
*/
|
|
2315
2321
|
function useAttrs() {
|
|
2316
2322
|
return getContext().attrs;
|
|
2317
2323
|
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Vue 2 only
|
|
2326
|
+
* @internal use manual type def because public setup context type relies on
|
|
2327
|
+
* legacy VNode types
|
|
2328
|
+
*/
|
|
2329
|
+
function useListeners() {
|
|
2330
|
+
return getContext().listeners;
|
|
2331
|
+
}
|
|
2318
2332
|
function getContext() {
|
|
2319
2333
|
if (!currentInstance) {
|
|
2320
2334
|
warn$2(`useContext() called without active instance.`);
|
|
@@ -2358,7 +2372,9 @@ function initRender(vm) {
|
|
|
2358
2372
|
const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
|
|
2359
2373
|
const renderContext = parentVnode && parentVnode.context;
|
|
2360
2374
|
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
2361
|
-
vm.$scopedSlots =
|
|
2375
|
+
vm.$scopedSlots = parentVnode
|
|
2376
|
+
? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
|
|
2377
|
+
: emptyObject;
|
|
2362
2378
|
// bind the createElement fn to this instance
|
|
2363
2379
|
// so that we get proper render context inside it.
|
|
2364
2380
|
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
@@ -2392,7 +2408,7 @@ function renderMixin(Vue) {
|
|
|
2392
2408
|
Vue.prototype._render = function () {
|
|
2393
2409
|
const vm = this;
|
|
2394
2410
|
const { render, _parentVnode } = vm.$options;
|
|
2395
|
-
if (_parentVnode) {
|
|
2411
|
+
if (_parentVnode && vm._isMounted) {
|
|
2396
2412
|
vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
|
|
2397
2413
|
if (vm._slotsProxy) {
|
|
2398
2414
|
syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
|
|
@@ -2913,12 +2929,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2913
2929
|
if (vm._attrsProxy) {
|
|
2914
2930
|
// force update if attrs are accessed and has changed since it may be
|
|
2915
2931
|
// passed to a child component.
|
|
2916
|
-
if (
|
|
2932
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
2917
2933
|
needsForceUpdate = true;
|
|
2918
2934
|
}
|
|
2919
2935
|
}
|
|
2920
2936
|
vm.$attrs = attrs;
|
|
2921
|
-
|
|
2937
|
+
// update listeners
|
|
2938
|
+
listeners = listeners || emptyObject;
|
|
2939
|
+
const prevListeners = vm.$options._parentListeners;
|
|
2940
|
+
if (vm._listenersProxy) {
|
|
2941
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
2942
|
+
}
|
|
2943
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
2944
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
2922
2945
|
// update props
|
|
2923
2946
|
if (propsData && vm.$options.props) {
|
|
2924
2947
|
toggleObserving(false);
|
|
@@ -2933,11 +2956,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
2933
2956
|
// keep a copy of raw propsData
|
|
2934
2957
|
vm.$options.propsData = propsData;
|
|
2935
2958
|
}
|
|
2936
|
-
// update listeners
|
|
2937
|
-
listeners = listeners || emptyObject;
|
|
2938
|
-
const oldListeners = vm.$options._parentListeners;
|
|
2939
|
-
vm.$options._parentListeners = listeners;
|
|
2940
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
2941
2959
|
// resolve slots + force update if has children
|
|
2942
2960
|
if (needsForceUpdate) {
|
|
2943
2961
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -3051,6 +3069,16 @@ if (inBrowser && !isIE) {
|
|
|
3051
3069
|
getNow = () => performance.now();
|
|
3052
3070
|
}
|
|
3053
3071
|
}
|
|
3072
|
+
const sortCompareFn = (a, b) => {
|
|
3073
|
+
if (a.post) {
|
|
3074
|
+
if (!b.post)
|
|
3075
|
+
return 1;
|
|
3076
|
+
}
|
|
3077
|
+
else if (b.post) {
|
|
3078
|
+
return -1;
|
|
3079
|
+
}
|
|
3080
|
+
return a.id - b.id;
|
|
3081
|
+
};
|
|
3054
3082
|
/**
|
|
3055
3083
|
* Flush both queues and run the watchers.
|
|
3056
3084
|
*/
|
|
@@ -3066,7 +3094,7 @@ function flushSchedulerQueue() {
|
|
|
3066
3094
|
// user watchers are created before the render watcher)
|
|
3067
3095
|
// 3. If a component is destroyed during a parent component's watcher run,
|
|
3068
3096
|
// its watchers can be skipped.
|
|
3069
|
-
queue.sort(
|
|
3097
|
+
queue.sort(sortCompareFn);
|
|
3070
3098
|
// do not cache length because more watchers might be pushed
|
|
3071
3099
|
// as we run existing watchers
|
|
3072
3100
|
for (index$1 = 0; index$1 < queue.length; index$1++) {
|
|
@@ -3295,8 +3323,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
|
|
|
3295
3323
|
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
3296
3324
|
// overwrite default run
|
|
3297
3325
|
watcher.run = () => {
|
|
3298
|
-
if (!watcher.active
|
|
3299
|
-
!(flush === 'pre' && instance && instance._isBeingDestroyed)) {
|
|
3326
|
+
if (!watcher.active) {
|
|
3300
3327
|
return;
|
|
3301
3328
|
}
|
|
3302
3329
|
if (cb) {
|
|
@@ -3329,7 +3356,7 @@ function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigge
|
|
|
3329
3356
|
watcher.update = watcher.run;
|
|
3330
3357
|
}
|
|
3331
3358
|
else if (flush === 'post') {
|
|
3332
|
-
watcher.
|
|
3359
|
+
watcher.post = true;
|
|
3333
3360
|
watcher.update = () => queueWatcher(watcher);
|
|
3334
3361
|
}
|
|
3335
3362
|
else {
|
|
@@ -3478,18 +3505,23 @@ function provide(key, value) {
|
|
|
3478
3505
|
}
|
|
3479
3506
|
}
|
|
3480
3507
|
else {
|
|
3481
|
-
let provides = currentInstance._provided;
|
|
3482
|
-
// by default an instance inherits its parent's provides object
|
|
3483
|
-
// but when it needs to provide values of its own, it creates its
|
|
3484
|
-
// own provides object using parent provides object as prototype.
|
|
3485
|
-
// this way in `inject` we can simply look up injections from direct
|
|
3486
|
-
// parent and let the prototype chain do the work.
|
|
3487
|
-
const parentProvides = currentInstance.$parent && currentInstance.$parent._provided;
|
|
3488
|
-
if (parentProvides === provides) {
|
|
3489
|
-
provides = currentInstance._provided = Object.create(parentProvides);
|
|
3490
|
-
}
|
|
3491
3508
|
// TS doesn't allow symbol as index type
|
|
3492
|
-
|
|
3509
|
+
resolveProvided(currentInstance)[key] = value;
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
function resolveProvided(vm) {
|
|
3513
|
+
// by default an instance inherits its parent's provides object
|
|
3514
|
+
// but when it needs to provide values of its own, it creates its
|
|
3515
|
+
// own provides object using parent provides object as prototype.
|
|
3516
|
+
// this way in `inject` we can simply look up injections from direct
|
|
3517
|
+
// parent and let the prototype chain do the work.
|
|
3518
|
+
const existing = vm._provided;
|
|
3519
|
+
const parentProvides = vm.$parent && vm.$parent._provided;
|
|
3520
|
+
if (parentProvides === existing) {
|
|
3521
|
+
return (vm._provided = Object.create(parentProvides));
|
|
3522
|
+
}
|
|
3523
|
+
else {
|
|
3524
|
+
return existing;
|
|
3493
3525
|
}
|
|
3494
3526
|
}
|
|
3495
3527
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
@@ -3846,17 +3878,20 @@ const onBeforeUpdate = createLifeCycle('beforeUpdate');
|
|
|
3846
3878
|
const onUpdated = createLifeCycle('updated');
|
|
3847
3879
|
const onBeforeUnmount = createLifeCycle('beforeDestroy');
|
|
3848
3880
|
const onUnmounted = createLifeCycle('destroyed');
|
|
3849
|
-
const onErrorCaptured = createLifeCycle('errorCaptured');
|
|
3850
3881
|
const onActivated = createLifeCycle('activated');
|
|
3851
3882
|
const onDeactivated = createLifeCycle('deactivated');
|
|
3852
3883
|
const onServerPrefetch = createLifeCycle('serverPrefetch');
|
|
3853
3884
|
const onRenderTracked = createLifeCycle('renderTracked');
|
|
3854
|
-
const onRenderTriggered = createLifeCycle('renderTriggered');
|
|
3885
|
+
const onRenderTriggered = createLifeCycle('renderTriggered');
|
|
3886
|
+
const injectErrorCapturedHook = createLifeCycle('errorCaptured');
|
|
3887
|
+
function onErrorCaptured(hook, target = currentInstance) {
|
|
3888
|
+
injectErrorCapturedHook(hook, target);
|
|
3889
|
+
}
|
|
3855
3890
|
|
|
3856
3891
|
/**
|
|
3857
3892
|
* Note: also update dist/vue.runtime.mjs when adding new exports to this file.
|
|
3858
3893
|
*/
|
|
3859
|
-
const version = '2.7.
|
|
3894
|
+
const version = '2.7.9';
|
|
3860
3895
|
/**
|
|
3861
3896
|
* @internal type is manually declared in <root>/types/v3-define-component.d.ts
|
|
3862
3897
|
*/
|
|
@@ -3915,11 +3950,16 @@ let uid$1 = 0;
|
|
|
3915
3950
|
*/
|
|
3916
3951
|
class Watcher {
|
|
3917
3952
|
constructor(vm, expOrFn, cb, options, isRenderWatcher) {
|
|
3918
|
-
recordEffectScope(this,
|
|
3919
|
-
if (
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3953
|
+
recordEffectScope(this,
|
|
3954
|
+
// if the active effect scope is manually created (not a component scope),
|
|
3955
|
+
// prioritize it
|
|
3956
|
+
activeEffectScope && !activeEffectScope._vm
|
|
3957
|
+
? activeEffectScope
|
|
3958
|
+
: vm
|
|
3959
|
+
? vm._scope
|
|
3960
|
+
: undefined);
|
|
3961
|
+
if ((this.vm = vm) && isRenderWatcher) {
|
|
3962
|
+
vm._watcher = this;
|
|
3923
3963
|
}
|
|
3924
3964
|
// options
|
|
3925
3965
|
if (options) {
|
|
@@ -3939,6 +3979,7 @@ class Watcher {
|
|
|
3939
3979
|
this.cb = cb;
|
|
3940
3980
|
this.id = ++uid$1; // uid for batching
|
|
3941
3981
|
this.active = true;
|
|
3982
|
+
this.post = false;
|
|
3942
3983
|
this.dirty = this.lazy; // for lazy watchers
|
|
3943
3984
|
this.deps = [];
|
|
3944
3985
|
this.newDeps = [];
|
|
@@ -4182,7 +4223,7 @@ function initData(vm) {
|
|
|
4182
4223
|
if (!isPlainObject(data)) {
|
|
4183
4224
|
data = {};
|
|
4184
4225
|
warn$2('data functions should return an object:\n' +
|
|
4185
|
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4226
|
+
'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
|
|
4186
4227
|
}
|
|
4187
4228
|
// proxy data on instance
|
|
4188
4229
|
const keys = Object.keys(data);
|
|
@@ -4403,12 +4444,14 @@ function initProvide(vm) {
|
|
|
4403
4444
|
if (!isObject(provided)) {
|
|
4404
4445
|
return;
|
|
4405
4446
|
}
|
|
4447
|
+
const source = resolveProvided(vm);
|
|
4448
|
+
// IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
|
|
4449
|
+
// iterate the keys ourselves.
|
|
4406
4450
|
const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
|
|
4407
|
-
setCurrentInstance(vm);
|
|
4408
4451
|
for (let i = 0; i < keys.length; i++) {
|
|
4409
|
-
|
|
4452
|
+
const key = keys[i];
|
|
4453
|
+
Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
|
|
4410
4454
|
}
|
|
4411
|
-
setCurrentInstance();
|
|
4412
4455
|
}
|
|
4413
4456
|
}
|
|
4414
4457
|
function initInjections(vm) {
|
|
@@ -4476,6 +4519,7 @@ function initMixin$1(Vue) {
|
|
|
4476
4519
|
vm.__v_skip = true;
|
|
4477
4520
|
// effect scope
|
|
4478
4521
|
vm._scope = new EffectScope(true /* detached */);
|
|
4522
|
+
vm._scope._vm = true;
|
|
4479
4523
|
// merge options
|
|
4480
4524
|
if (options && options._isComponent) {
|
|
4481
4525
|
// optimize internal component instantiation
|
|
@@ -7011,7 +7055,16 @@ function normalizeDirectives(dirs, vm) {
|
|
|
7011
7055
|
}
|
|
7012
7056
|
res[getRawDirName(dir)] = dir;
|
|
7013
7057
|
if (vm._setupState && vm._setupState.__sfc) {
|
|
7014
|
-
|
|
7058
|
+
const setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
|
|
7059
|
+
if (typeof setupDef === 'function') {
|
|
7060
|
+
dir.def = {
|
|
7061
|
+
bind: setupDef,
|
|
7062
|
+
update: setupDef,
|
|
7063
|
+
};
|
|
7064
|
+
}
|
|
7065
|
+
else {
|
|
7066
|
+
dir.def = setupDef;
|
|
7067
|
+
}
|
|
7015
7068
|
}
|
|
7016
7069
|
dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
|
|
7017
7070
|
}
|
|
@@ -10741,17 +10794,15 @@ function genElement(el, state) {
|
|
|
10741
10794
|
}
|
|
10742
10795
|
else {
|
|
10743
10796
|
let data;
|
|
10744
|
-
|
|
10797
|
+
const maybeComponent = state.maybeComponent(el);
|
|
10798
|
+
if (!el.plain || (el.pre && maybeComponent)) {
|
|
10745
10799
|
data = genData(el, state);
|
|
10746
10800
|
}
|
|
10747
10801
|
let tag;
|
|
10748
10802
|
// check if this is a component in <script setup>
|
|
10749
10803
|
const bindings = state.options.bindings;
|
|
10750
|
-
if (bindings && bindings.__isScriptSetup !== false) {
|
|
10751
|
-
tag =
|
|
10752
|
-
checkBindingType(bindings, el.tag) ||
|
|
10753
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
10754
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
10804
|
+
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
10805
|
+
tag = checkBindingType(bindings, el.tag);
|
|
10755
10806
|
}
|
|
10756
10807
|
if (!tag)
|
|
10757
10808
|
tag = `'${el.tag}'`;
|
|
@@ -10768,9 +10819,29 @@ function genElement(el, state) {
|
|
|
10768
10819
|
}
|
|
10769
10820
|
}
|
|
10770
10821
|
function checkBindingType(bindings, key) {
|
|
10771
|
-
const
|
|
10772
|
-
|
|
10773
|
-
|
|
10822
|
+
const camelName = camelize(key);
|
|
10823
|
+
const PascalName = capitalize(camelName);
|
|
10824
|
+
const checkType = (type) => {
|
|
10825
|
+
if (bindings[key] === type) {
|
|
10826
|
+
return key;
|
|
10827
|
+
}
|
|
10828
|
+
if (bindings[camelName] === type) {
|
|
10829
|
+
return camelName;
|
|
10830
|
+
}
|
|
10831
|
+
if (bindings[PascalName] === type) {
|
|
10832
|
+
return PascalName;
|
|
10833
|
+
}
|
|
10834
|
+
};
|
|
10835
|
+
const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
10836
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
10837
|
+
if (fromConst) {
|
|
10838
|
+
return fromConst;
|
|
10839
|
+
}
|
|
10840
|
+
const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
10841
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
10842
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
10843
|
+
if (fromMaybeRef) {
|
|
10844
|
+
return fromMaybeRef;
|
|
10774
10845
|
}
|
|
10775
10846
|
}
|
|
10776
10847
|
// hoist static sub-trees out
|
|
@@ -11589,4 +11660,4 @@ function getOuterHTML(el) {
|
|
|
11589
11660
|
}
|
|
11590
11661
|
Vue.compile = compileToFunctions;
|
|
11591
11662
|
|
|
11592
|
-
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 };
|
|
11663
|
+
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 };
|