@vue/runtime-core 3.2.22 → 3.2.26
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/runtime-core.cjs.js +133 -103
- package/dist/runtime-core.cjs.prod.js +121 -95
- package/dist/runtime-core.d.ts +39 -6
- package/dist/runtime-core.esm-bundler.js +135 -104
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -1267,7 +1267,8 @@ const BaseTransitionImpl = {
|
|
|
1267
1267
|
const rawProps = reactivity.toRaw(props);
|
|
1268
1268
|
const { mode } = rawProps;
|
|
1269
1269
|
// check mode
|
|
1270
|
-
if (mode &&
|
|
1270
|
+
if (mode &&
|
|
1271
|
+
mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
|
|
1271
1272
|
warn(`invalid <transition> mode: ${mode}`);
|
|
1272
1273
|
}
|
|
1273
1274
|
// at this point children has a guaranteed length of 1.
|
|
@@ -1907,7 +1908,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
1907
1908
|
}
|
|
1908
1909
|
current = current.parent;
|
|
1909
1910
|
}
|
|
1910
|
-
hook();
|
|
1911
|
+
return hook();
|
|
1911
1912
|
});
|
|
1912
1913
|
injectHook(type, wrappedHook, target);
|
|
1913
1914
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -2569,7 +2570,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
2569
2570
|
}
|
|
2570
2571
|
}
|
|
2571
2572
|
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
2572
|
-
if (value !== attrs[key]) {
|
|
2573
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
2573
2574
|
attrs[key] = value;
|
|
2574
2575
|
hasAttrsChanged = true;
|
|
2575
2576
|
}
|
|
@@ -3209,6 +3210,102 @@ function createAppAPI(render, hydrate) {
|
|
|
3209
3210
|
};
|
|
3210
3211
|
}
|
|
3211
3212
|
|
|
3213
|
+
/**
|
|
3214
|
+
* Function for handling a template ref
|
|
3215
|
+
*/
|
|
3216
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
3217
|
+
if (shared.isArray(rawRef)) {
|
|
3218
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
3222
|
+
// when mounting async components, nothing needs to be done,
|
|
3223
|
+
// because the template ref is forwarded to inner component
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3226
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
3227
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
3228
|
+
: vnode.el;
|
|
3229
|
+
const value = isUnmount ? null : refValue;
|
|
3230
|
+
const { i: owner, r: ref } = rawRef;
|
|
3231
|
+
if (!owner) {
|
|
3232
|
+
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
3233
|
+
`A vnode with ref must be created inside the render function.`);
|
|
3234
|
+
return;
|
|
3235
|
+
}
|
|
3236
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
3237
|
+
const refs = owner.refs === shared.EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
3238
|
+
const setupState = owner.setupState;
|
|
3239
|
+
// dynamic ref changed. unset old ref
|
|
3240
|
+
if (oldRef != null && oldRef !== ref) {
|
|
3241
|
+
if (shared.isString(oldRef)) {
|
|
3242
|
+
refs[oldRef] = null;
|
|
3243
|
+
if (shared.hasOwn(setupState, oldRef)) {
|
|
3244
|
+
setupState[oldRef] = null;
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
else if (reactivity.isRef(oldRef)) {
|
|
3248
|
+
oldRef.value = null;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
if (shared.isFunction(ref)) {
|
|
3252
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
3253
|
+
}
|
|
3254
|
+
else {
|
|
3255
|
+
const _isString = shared.isString(ref);
|
|
3256
|
+
const _isRef = reactivity.isRef(ref);
|
|
3257
|
+
if (_isString || _isRef) {
|
|
3258
|
+
const doSet = () => {
|
|
3259
|
+
if (rawRef.f) {
|
|
3260
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
3261
|
+
if (isUnmount) {
|
|
3262
|
+
shared.isArray(existing) && shared.remove(existing, refValue);
|
|
3263
|
+
}
|
|
3264
|
+
else {
|
|
3265
|
+
if (!shared.isArray(existing)) {
|
|
3266
|
+
if (_isString) {
|
|
3267
|
+
refs[ref] = [refValue];
|
|
3268
|
+
}
|
|
3269
|
+
else {
|
|
3270
|
+
ref.value = [refValue];
|
|
3271
|
+
if (rawRef.k)
|
|
3272
|
+
refs[rawRef.k] = ref.value;
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
else if (!existing.includes(refValue)) {
|
|
3276
|
+
existing.push(refValue);
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
else if (_isString) {
|
|
3281
|
+
refs[ref] = value;
|
|
3282
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
3283
|
+
setupState[ref] = value;
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
else if (reactivity.isRef(ref)) {
|
|
3287
|
+
ref.value = value;
|
|
3288
|
+
if (rawRef.k)
|
|
3289
|
+
refs[rawRef.k] = value;
|
|
3290
|
+
}
|
|
3291
|
+
else {
|
|
3292
|
+
warn('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
3293
|
+
}
|
|
3294
|
+
};
|
|
3295
|
+
if (value) {
|
|
3296
|
+
doSet.id = -1;
|
|
3297
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
3298
|
+
}
|
|
3299
|
+
else {
|
|
3300
|
+
doSet();
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
else {
|
|
3304
|
+
warn('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3212
3309
|
let hasMismatch = false;
|
|
3213
3310
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
3214
3311
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -3841,12 +3938,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3841
3938
|
const oldProps = n1.props || shared.EMPTY_OBJ;
|
|
3842
3939
|
const newProps = n2.props || shared.EMPTY_OBJ;
|
|
3843
3940
|
let vnodeHook;
|
|
3941
|
+
// disable recurse in beforeUpdate hooks
|
|
3942
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
3844
3943
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
3845
3944
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3846
3945
|
}
|
|
3847
3946
|
if (dirs) {
|
|
3848
3947
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
3849
3948
|
}
|
|
3949
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
3850
3950
|
if (isHmrUpdating) {
|
|
3851
3951
|
// HMR updated, force full diff
|
|
3852
3952
|
patchFlag = 0;
|
|
@@ -4126,7 +4226,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4126
4226
|
const { el, props } = initialVNode;
|
|
4127
4227
|
const { bm, m, parent } = instance;
|
|
4128
4228
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
4129
|
-
|
|
4229
|
+
toggleRecurse(instance, false);
|
|
4130
4230
|
// beforeMount hook
|
|
4131
4231
|
if (bm) {
|
|
4132
4232
|
shared.invokeArrayFns(bm);
|
|
@@ -4136,7 +4236,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4136
4236
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
4137
4237
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
4138
4238
|
}
|
|
4139
|
-
|
|
4239
|
+
toggleRecurse(instance, true);
|
|
4140
4240
|
if (el && hydrateNode) {
|
|
4141
4241
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
4142
4242
|
const hydrateSubTree = () => {
|
|
@@ -4218,7 +4318,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4218
4318
|
pushWarningContext(next || instance.vnode);
|
|
4219
4319
|
}
|
|
4220
4320
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
4221
|
-
|
|
4321
|
+
toggleRecurse(instance, false);
|
|
4222
4322
|
if (next) {
|
|
4223
4323
|
next.el = vnode.el;
|
|
4224
4324
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -4234,7 +4334,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4234
4334
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
4235
4335
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
4236
4336
|
}
|
|
4237
|
-
|
|
4337
|
+
toggleRecurse(instance, true);
|
|
4238
4338
|
// render
|
|
4239
4339
|
{
|
|
4240
4340
|
startMeasure(instance, `render`);
|
|
@@ -4280,13 +4380,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4280
4380
|
}
|
|
4281
4381
|
};
|
|
4282
4382
|
// create reactive effect for rendering
|
|
4283
|
-
const effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4284
|
-
);
|
|
4383
|
+
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4384
|
+
));
|
|
4285
4385
|
const update = (instance.update = effect.run.bind(effect));
|
|
4286
4386
|
update.id = instance.uid;
|
|
4287
4387
|
// allowRecurse
|
|
4288
4388
|
// #1801, #2043 component render effects should allow recursive updates
|
|
4289
|
-
|
|
4389
|
+
toggleRecurse(instance, true);
|
|
4290
4390
|
{
|
|
4291
4391
|
effect.onTrack = instance.rtc
|
|
4292
4392
|
? e => shared.invokeArrayFns(instance.rtc, e)
|
|
@@ -4810,85 +4910,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4810
4910
|
createApp: createAppAPI(render, hydrate)
|
|
4811
4911
|
};
|
|
4812
4912
|
}
|
|
4813
|
-
function
|
|
4814
|
-
|
|
4815
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4816
|
-
return;
|
|
4817
|
-
}
|
|
4818
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4819
|
-
// when mounting async components, nothing needs to be done,
|
|
4820
|
-
// because the template ref is forwarded to inner component
|
|
4821
|
-
return;
|
|
4822
|
-
}
|
|
4823
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4824
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4825
|
-
: vnode.el;
|
|
4826
|
-
const value = isUnmount ? null : refValue;
|
|
4827
|
-
const { i: owner, r: ref } = rawRef;
|
|
4828
|
-
if (!owner) {
|
|
4829
|
-
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4830
|
-
`A vnode with ref must be created inside the render function.`);
|
|
4831
|
-
return;
|
|
4832
|
-
}
|
|
4833
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
4834
|
-
const refs = owner.refs === shared.EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4835
|
-
const setupState = owner.setupState;
|
|
4836
|
-
// dynamic ref changed. unset old ref
|
|
4837
|
-
if (oldRef != null && oldRef !== ref) {
|
|
4838
|
-
if (shared.isString(oldRef)) {
|
|
4839
|
-
refs[oldRef] = null;
|
|
4840
|
-
if (shared.hasOwn(setupState, oldRef)) {
|
|
4841
|
-
setupState[oldRef] = null;
|
|
4842
|
-
}
|
|
4843
|
-
}
|
|
4844
|
-
else if (reactivity.isRef(oldRef)) {
|
|
4845
|
-
oldRef.value = null;
|
|
4846
|
-
}
|
|
4847
|
-
}
|
|
4848
|
-
if (shared.isString(ref)) {
|
|
4849
|
-
const doSet = () => {
|
|
4850
|
-
{
|
|
4851
|
-
refs[ref] = value;
|
|
4852
|
-
}
|
|
4853
|
-
if (shared.hasOwn(setupState, ref)) {
|
|
4854
|
-
setupState[ref] = value;
|
|
4855
|
-
}
|
|
4856
|
-
};
|
|
4857
|
-
// #1789: for non-null values, set them after render
|
|
4858
|
-
// null values means this is unmount and it should not overwrite another
|
|
4859
|
-
// ref with the same key
|
|
4860
|
-
if (value) {
|
|
4861
|
-
doSet.id = -1;
|
|
4862
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4863
|
-
}
|
|
4864
|
-
else {
|
|
4865
|
-
doSet();
|
|
4866
|
-
}
|
|
4867
|
-
}
|
|
4868
|
-
else if (reactivity.isRef(ref)) {
|
|
4869
|
-
const doSet = () => {
|
|
4870
|
-
ref.value = value;
|
|
4871
|
-
};
|
|
4872
|
-
if (value) {
|
|
4873
|
-
doSet.id = -1;
|
|
4874
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4875
|
-
}
|
|
4876
|
-
else {
|
|
4877
|
-
doSet();
|
|
4878
|
-
}
|
|
4879
|
-
}
|
|
4880
|
-
else if (shared.isFunction(ref)) {
|
|
4881
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4882
|
-
}
|
|
4883
|
-
else {
|
|
4884
|
-
warn('Invalid template ref type:', value, `(${typeof value})`);
|
|
4885
|
-
}
|
|
4886
|
-
}
|
|
4887
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
4888
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
4889
|
-
vnode,
|
|
4890
|
-
prevVNode
|
|
4891
|
-
]);
|
|
4913
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
4914
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
4892
4915
|
}
|
|
4893
4916
|
/**
|
|
4894
4917
|
* #1156
|
|
@@ -5347,10 +5370,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
5347
5370
|
};
|
|
5348
5371
|
const InternalObjectKey = `__vInternal`;
|
|
5349
5372
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
5350
|
-
const normalizeRef = ({ ref }) => {
|
|
5373
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
5351
5374
|
return (ref != null
|
|
5352
5375
|
? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref)
|
|
5353
|
-
? { i: currentRenderingInstance, r: ref }
|
|
5376
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
5354
5377
|
: ref
|
|
5355
5378
|
: null);
|
|
5356
5379
|
};
|
|
@@ -5692,6 +5715,12 @@ function mergeProps(...args) {
|
|
|
5692
5715
|
}
|
|
5693
5716
|
}
|
|
5694
5717
|
return ret;
|
|
5718
|
+
}
|
|
5719
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5720
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5721
|
+
vnode,
|
|
5722
|
+
prevVNode
|
|
5723
|
+
]);
|
|
5695
5724
|
}
|
|
5696
5725
|
|
|
5697
5726
|
/**
|
|
@@ -5883,23 +5912,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
5883
5912
|
const n = accessCache[key];
|
|
5884
5913
|
if (n !== undefined) {
|
|
5885
5914
|
switch (n) {
|
|
5886
|
-
case
|
|
5915
|
+
case 1 /* SETUP */:
|
|
5887
5916
|
return setupState[key];
|
|
5888
|
-
case
|
|
5917
|
+
case 2 /* DATA */:
|
|
5889
5918
|
return data[key];
|
|
5890
|
-
case
|
|
5919
|
+
case 4 /* CONTEXT */:
|
|
5891
5920
|
return ctx[key];
|
|
5892
|
-
case
|
|
5921
|
+
case 3 /* PROPS */:
|
|
5893
5922
|
return props[key];
|
|
5894
5923
|
// default: just fallthrough
|
|
5895
5924
|
}
|
|
5896
5925
|
}
|
|
5897
5926
|
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
5898
|
-
accessCache[key] =
|
|
5927
|
+
accessCache[key] = 1 /* SETUP */;
|
|
5899
5928
|
return setupState[key];
|
|
5900
5929
|
}
|
|
5901
5930
|
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
5902
|
-
accessCache[key] =
|
|
5931
|
+
accessCache[key] = 2 /* DATA */;
|
|
5903
5932
|
return data[key];
|
|
5904
5933
|
}
|
|
5905
5934
|
else if (
|
|
@@ -5907,15 +5936,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
5907
5936
|
// props
|
|
5908
5937
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
5909
5938
|
shared.hasOwn(normalizedProps, key)) {
|
|
5910
|
-
accessCache[key] =
|
|
5939
|
+
accessCache[key] = 3 /* PROPS */;
|
|
5911
5940
|
return props[key];
|
|
5912
5941
|
}
|
|
5913
5942
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
5914
|
-
accessCache[key] =
|
|
5943
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
5915
5944
|
return ctx[key];
|
|
5916
5945
|
}
|
|
5917
5946
|
else if (shouldCacheAccess) {
|
|
5918
|
-
accessCache[key] =
|
|
5947
|
+
accessCache[key] = 0 /* OTHER */;
|
|
5919
5948
|
}
|
|
5920
5949
|
}
|
|
5921
5950
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -5936,7 +5965,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5936
5965
|
}
|
|
5937
5966
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
5938
5967
|
// user may set custom properties to `this` that start with `$`
|
|
5939
|
-
accessCache[key] =
|
|
5968
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
5940
5969
|
return ctx[key];
|
|
5941
5970
|
}
|
|
5942
5971
|
else if (
|
|
@@ -5997,7 +6026,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5997
6026
|
},
|
|
5998
6027
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
5999
6028
|
let normalizedProps;
|
|
6000
|
-
return (accessCache[key]
|
|
6029
|
+
return (!!accessCache[key] ||
|
|
6001
6030
|
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
6002
6031
|
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
6003
6032
|
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
@@ -6103,6 +6132,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6103
6132
|
root: null,
|
|
6104
6133
|
next: null,
|
|
6105
6134
|
subTree: null,
|
|
6135
|
+
effect: null,
|
|
6106
6136
|
update: null,
|
|
6107
6137
|
scope: new reactivity.EffectScope(true /* detached */),
|
|
6108
6138
|
render: null,
|
|
@@ -7565,7 +7595,7 @@ function isMemoSame(cached, memo) {
|
|
|
7565
7595
|
}
|
|
7566
7596
|
|
|
7567
7597
|
// Core API ------------------------------------------------------------------
|
|
7568
|
-
const version = "3.2.
|
|
7598
|
+
const version = "3.2.26";
|
|
7569
7599
|
const _ssrUtils = {
|
|
7570
7600
|
createComponentInstance,
|
|
7571
7601
|
setupComponent,
|
|
@@ -1523,7 +1523,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
1523
1523
|
}
|
|
1524
1524
|
current = current.parent;
|
|
1525
1525
|
}
|
|
1526
|
-
hook();
|
|
1526
|
+
return hook();
|
|
1527
1527
|
});
|
|
1528
1528
|
injectHook(type, wrappedHook, target);
|
|
1529
1529
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -2081,7 +2081,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
}
|
|
2083
2083
|
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
2084
|
-
if (value !== attrs[key]) {
|
|
2084
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
2085
2085
|
attrs[key] = value;
|
|
2086
2086
|
hasAttrsChanged = true;
|
|
2087
2087
|
}
|
|
@@ -2504,6 +2504,92 @@ function createAppAPI(render, hydrate) {
|
|
|
2504
2504
|
};
|
|
2505
2505
|
}
|
|
2506
2506
|
|
|
2507
|
+
/**
|
|
2508
|
+
* Function for handling a template ref
|
|
2509
|
+
*/
|
|
2510
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
2511
|
+
if (shared.isArray(rawRef)) {
|
|
2512
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
2513
|
+
return;
|
|
2514
|
+
}
|
|
2515
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
2516
|
+
// when mounting async components, nothing needs to be done,
|
|
2517
|
+
// because the template ref is forwarded to inner component
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
2521
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
2522
|
+
: vnode.el;
|
|
2523
|
+
const value = isUnmount ? null : refValue;
|
|
2524
|
+
const { i: owner, r: ref } = rawRef;
|
|
2525
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
2526
|
+
const refs = owner.refs === shared.EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
2527
|
+
const setupState = owner.setupState;
|
|
2528
|
+
// dynamic ref changed. unset old ref
|
|
2529
|
+
if (oldRef != null && oldRef !== ref) {
|
|
2530
|
+
if (shared.isString(oldRef)) {
|
|
2531
|
+
refs[oldRef] = null;
|
|
2532
|
+
if (shared.hasOwn(setupState, oldRef)) {
|
|
2533
|
+
setupState[oldRef] = null;
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
else if (reactivity.isRef(oldRef)) {
|
|
2537
|
+
oldRef.value = null;
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
if (shared.isFunction(ref)) {
|
|
2541
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
2542
|
+
}
|
|
2543
|
+
else {
|
|
2544
|
+
const _isString = shared.isString(ref);
|
|
2545
|
+
const _isRef = reactivity.isRef(ref);
|
|
2546
|
+
if (_isString || _isRef) {
|
|
2547
|
+
const doSet = () => {
|
|
2548
|
+
if (rawRef.f) {
|
|
2549
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
2550
|
+
if (isUnmount) {
|
|
2551
|
+
shared.isArray(existing) && shared.remove(existing, refValue);
|
|
2552
|
+
}
|
|
2553
|
+
else {
|
|
2554
|
+
if (!shared.isArray(existing)) {
|
|
2555
|
+
if (_isString) {
|
|
2556
|
+
refs[ref] = [refValue];
|
|
2557
|
+
}
|
|
2558
|
+
else {
|
|
2559
|
+
ref.value = [refValue];
|
|
2560
|
+
if (rawRef.k)
|
|
2561
|
+
refs[rawRef.k] = ref.value;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
else if (!existing.includes(refValue)) {
|
|
2565
|
+
existing.push(refValue);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
else if (_isString) {
|
|
2570
|
+
refs[ref] = value;
|
|
2571
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
2572
|
+
setupState[ref] = value;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
else if (reactivity.isRef(ref)) {
|
|
2576
|
+
ref.value = value;
|
|
2577
|
+
if (rawRef.k)
|
|
2578
|
+
refs[rawRef.k] = value;
|
|
2579
|
+
}
|
|
2580
|
+
else ;
|
|
2581
|
+
};
|
|
2582
|
+
if (value) {
|
|
2583
|
+
doSet.id = -1;
|
|
2584
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
2585
|
+
}
|
|
2586
|
+
else {
|
|
2587
|
+
doSet();
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2507
2593
|
let hasMismatch = false;
|
|
2508
2594
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
2509
2595
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -3040,12 +3126,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3040
3126
|
const oldProps = n1.props || shared.EMPTY_OBJ;
|
|
3041
3127
|
const newProps = n2.props || shared.EMPTY_OBJ;
|
|
3042
3128
|
let vnodeHook;
|
|
3129
|
+
// disable recurse in beforeUpdate hooks
|
|
3130
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
3043
3131
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
3044
3132
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3045
3133
|
}
|
|
3046
3134
|
if (dirs) {
|
|
3047
3135
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
3048
3136
|
}
|
|
3137
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
3049
3138
|
const areChildrenSVG = isSVG && n2.type !== 'foreignObject';
|
|
3050
3139
|
if (dynamicChildren) {
|
|
3051
3140
|
patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, areChildrenSVG, slotScopeIds);
|
|
@@ -3282,7 +3371,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3282
3371
|
const { el, props } = initialVNode;
|
|
3283
3372
|
const { bm, m, parent } = instance;
|
|
3284
3373
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
3285
|
-
|
|
3374
|
+
toggleRecurse(instance, false);
|
|
3286
3375
|
// beforeMount hook
|
|
3287
3376
|
if (bm) {
|
|
3288
3377
|
shared.invokeArrayFns(bm);
|
|
@@ -3292,7 +3381,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3292
3381
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
3293
3382
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
3294
3383
|
}
|
|
3295
|
-
|
|
3384
|
+
toggleRecurse(instance, true);
|
|
3296
3385
|
if (el && hydrateNode) {
|
|
3297
3386
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
3298
3387
|
const hydrateSubTree = () => {
|
|
@@ -3344,7 +3433,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3344
3433
|
let originNext = next;
|
|
3345
3434
|
let vnodeHook;
|
|
3346
3435
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
3347
|
-
|
|
3436
|
+
toggleRecurse(instance, false);
|
|
3348
3437
|
if (next) {
|
|
3349
3438
|
next.el = vnode.el;
|
|
3350
3439
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -3360,7 +3449,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3360
3449
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
3361
3450
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
3362
3451
|
}
|
|
3363
|
-
|
|
3452
|
+
toggleRecurse(instance, true);
|
|
3364
3453
|
const nextTree = renderComponentRoot(instance);
|
|
3365
3454
|
const prevTree = instance.subTree;
|
|
3366
3455
|
instance.subTree = nextTree;
|
|
@@ -3387,13 +3476,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3387
3476
|
}
|
|
3388
3477
|
};
|
|
3389
3478
|
// create reactive effect for rendering
|
|
3390
|
-
const effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
3391
|
-
);
|
|
3479
|
+
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
3480
|
+
));
|
|
3392
3481
|
const update = (instance.update = effect.run.bind(effect));
|
|
3393
3482
|
update.id = instance.uid;
|
|
3394
3483
|
// allowRecurse
|
|
3395
3484
|
// #1801, #2043 component render effects should allow recursive updates
|
|
3396
|
-
|
|
3485
|
+
toggleRecurse(instance, true);
|
|
3397
3486
|
update();
|
|
3398
3487
|
};
|
|
3399
3488
|
const updateComponentPreRender = (instance, nextVNode, optimized) => {
|
|
@@ -3898,78 +3987,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3898
3987
|
createApp: createAppAPI(render, hydrate)
|
|
3899
3988
|
};
|
|
3900
3989
|
}
|
|
3901
|
-
function
|
|
3902
|
-
|
|
3903
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
3904
|
-
return;
|
|
3905
|
-
}
|
|
3906
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
3907
|
-
// when mounting async components, nothing needs to be done,
|
|
3908
|
-
// because the template ref is forwarded to inner component
|
|
3909
|
-
return;
|
|
3910
|
-
}
|
|
3911
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
3912
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
3913
|
-
: vnode.el;
|
|
3914
|
-
const value = isUnmount ? null : refValue;
|
|
3915
|
-
const { i: owner, r: ref } = rawRef;
|
|
3916
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
3917
|
-
const refs = owner.refs === shared.EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
3918
|
-
const setupState = owner.setupState;
|
|
3919
|
-
// dynamic ref changed. unset old ref
|
|
3920
|
-
if (oldRef != null && oldRef !== ref) {
|
|
3921
|
-
if (shared.isString(oldRef)) {
|
|
3922
|
-
refs[oldRef] = null;
|
|
3923
|
-
if (shared.hasOwn(setupState, oldRef)) {
|
|
3924
|
-
setupState[oldRef] = null;
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
else if (reactivity.isRef(oldRef)) {
|
|
3928
|
-
oldRef.value = null;
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
|
-
if (shared.isString(ref)) {
|
|
3932
|
-
const doSet = () => {
|
|
3933
|
-
{
|
|
3934
|
-
refs[ref] = value;
|
|
3935
|
-
}
|
|
3936
|
-
if (shared.hasOwn(setupState, ref)) {
|
|
3937
|
-
setupState[ref] = value;
|
|
3938
|
-
}
|
|
3939
|
-
};
|
|
3940
|
-
// #1789: for non-null values, set them after render
|
|
3941
|
-
// null values means this is unmount and it should not overwrite another
|
|
3942
|
-
// ref with the same key
|
|
3943
|
-
if (value) {
|
|
3944
|
-
doSet.id = -1;
|
|
3945
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
3946
|
-
}
|
|
3947
|
-
else {
|
|
3948
|
-
doSet();
|
|
3949
|
-
}
|
|
3950
|
-
}
|
|
3951
|
-
else if (reactivity.isRef(ref)) {
|
|
3952
|
-
const doSet = () => {
|
|
3953
|
-
ref.value = value;
|
|
3954
|
-
};
|
|
3955
|
-
if (value) {
|
|
3956
|
-
doSet.id = -1;
|
|
3957
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
3958
|
-
}
|
|
3959
|
-
else {
|
|
3960
|
-
doSet();
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3963
|
-
else if (shared.isFunction(ref)) {
|
|
3964
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
3965
|
-
}
|
|
3966
|
-
else ;
|
|
3967
|
-
}
|
|
3968
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
3969
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
3970
|
-
vnode,
|
|
3971
|
-
prevVNode
|
|
3972
|
-
]);
|
|
3990
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
3991
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
3973
3992
|
}
|
|
3974
3993
|
/**
|
|
3975
3994
|
* #1156
|
|
@@ -4375,10 +4394,10 @@ function transformVNodeArgs(transformer) {
|
|
|
4375
4394
|
}
|
|
4376
4395
|
const InternalObjectKey = `__vInternal`;
|
|
4377
4396
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
4378
|
-
const normalizeRef = ({ ref }) => {
|
|
4397
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
4379
4398
|
return (ref != null
|
|
4380
4399
|
? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref)
|
|
4381
|
-
? { i: currentRenderingInstance, r: ref }
|
|
4400
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
4382
4401
|
: ref
|
|
4383
4402
|
: null);
|
|
4384
4403
|
};
|
|
@@ -4693,6 +4712,12 @@ function mergeProps(...args) {
|
|
|
4693
4712
|
}
|
|
4694
4713
|
}
|
|
4695
4714
|
return ret;
|
|
4715
|
+
}
|
|
4716
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
4717
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
4718
|
+
vnode,
|
|
4719
|
+
prevVNode
|
|
4720
|
+
]);
|
|
4696
4721
|
}
|
|
4697
4722
|
|
|
4698
4723
|
/**
|
|
@@ -4857,23 +4882,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
4857
4882
|
const n = accessCache[key];
|
|
4858
4883
|
if (n !== undefined) {
|
|
4859
4884
|
switch (n) {
|
|
4860
|
-
case
|
|
4885
|
+
case 1 /* SETUP */:
|
|
4861
4886
|
return setupState[key];
|
|
4862
|
-
case
|
|
4887
|
+
case 2 /* DATA */:
|
|
4863
4888
|
return data[key];
|
|
4864
|
-
case
|
|
4889
|
+
case 4 /* CONTEXT */:
|
|
4865
4890
|
return ctx[key];
|
|
4866
|
-
case
|
|
4891
|
+
case 3 /* PROPS */:
|
|
4867
4892
|
return props[key];
|
|
4868
4893
|
// default: just fallthrough
|
|
4869
4894
|
}
|
|
4870
4895
|
}
|
|
4871
4896
|
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
4872
|
-
accessCache[key] =
|
|
4897
|
+
accessCache[key] = 1 /* SETUP */;
|
|
4873
4898
|
return setupState[key];
|
|
4874
4899
|
}
|
|
4875
4900
|
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
4876
|
-
accessCache[key] =
|
|
4901
|
+
accessCache[key] = 2 /* DATA */;
|
|
4877
4902
|
return data[key];
|
|
4878
4903
|
}
|
|
4879
4904
|
else if (
|
|
@@ -4881,15 +4906,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
4881
4906
|
// props
|
|
4882
4907
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
4883
4908
|
shared.hasOwn(normalizedProps, key)) {
|
|
4884
|
-
accessCache[key] =
|
|
4909
|
+
accessCache[key] = 3 /* PROPS */;
|
|
4885
4910
|
return props[key];
|
|
4886
4911
|
}
|
|
4887
4912
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
4888
|
-
accessCache[key] =
|
|
4913
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4889
4914
|
return ctx[key];
|
|
4890
4915
|
}
|
|
4891
4916
|
else if (shouldCacheAccess) {
|
|
4892
|
-
accessCache[key] =
|
|
4917
|
+
accessCache[key] = 0 /* OTHER */;
|
|
4893
4918
|
}
|
|
4894
4919
|
}
|
|
4895
4920
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -4909,7 +4934,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4909
4934
|
}
|
|
4910
4935
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
4911
4936
|
// user may set custom properties to `this` that start with `$`
|
|
4912
|
-
accessCache[key] =
|
|
4937
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
4913
4938
|
return ctx[key];
|
|
4914
4939
|
}
|
|
4915
4940
|
else if (
|
|
@@ -4945,7 +4970,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4945
4970
|
},
|
|
4946
4971
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
4947
4972
|
let normalizedProps;
|
|
4948
|
-
return (accessCache[key]
|
|
4973
|
+
return (!!accessCache[key] ||
|
|
4949
4974
|
(data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) ||
|
|
4950
4975
|
(setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) ||
|
|
4951
4976
|
((normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key)) ||
|
|
@@ -4983,6 +5008,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
4983
5008
|
root: null,
|
|
4984
5009
|
next: null,
|
|
4985
5010
|
subTree: null,
|
|
5011
|
+
effect: null,
|
|
4986
5012
|
update: null,
|
|
4987
5013
|
scope: new reactivity.EffectScope(true /* detached */),
|
|
4988
5014
|
render: null,
|
|
@@ -6035,7 +6061,7 @@ function isMemoSame(cached, memo) {
|
|
|
6035
6061
|
}
|
|
6036
6062
|
|
|
6037
6063
|
// Core API ------------------------------------------------------------------
|
|
6038
|
-
const version = "3.2.
|
|
6064
|
+
const version = "3.2.26";
|
|
6039
6065
|
const _ssrUtils = {
|
|
6040
6066
|
createComponentInstance,
|
|
6041
6067
|
setupComponent,
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -4,11 +4,15 @@ import { ComponentPropsOptions as ComponentPropsOptions_2 } from '@vue/runtime-c
|
|
|
4
4
|
import { computed } from '@vue/reactivity';
|
|
5
5
|
import { ComputedGetter } from '@vue/reactivity';
|
|
6
6
|
import { ComputedRef } from '@vue/reactivity';
|
|
7
|
+
import { ComputedSetter } from '@vue/reactivity';
|
|
7
8
|
import { customRef } from '@vue/reactivity';
|
|
9
|
+
import { CustomRefFactory } from '@vue/reactivity';
|
|
8
10
|
import { DebuggerEvent } from '@vue/reactivity';
|
|
11
|
+
import { DebuggerEventExtraInfo } from '@vue/reactivity';
|
|
9
12
|
import { DebuggerOptions } from '@vue/reactivity';
|
|
10
13
|
import { DeepReadonly } from '@vue/reactivity';
|
|
11
14
|
import { effect } from '@vue/reactivity';
|
|
15
|
+
import { EffectScheduler } from '@vue/reactivity';
|
|
12
16
|
import { EffectScope } from '@vue/reactivity';
|
|
13
17
|
import { effectScope } from '@vue/reactivity';
|
|
14
18
|
import { getCurrentScope } from '@vue/reactivity';
|
|
@@ -25,6 +29,7 @@ import { proxyRefs } from '@vue/reactivity';
|
|
|
25
29
|
import { reactive } from '@vue/reactivity';
|
|
26
30
|
import { ReactiveEffect } from '@vue/reactivity';
|
|
27
31
|
import { ReactiveEffectOptions } from '@vue/reactivity';
|
|
32
|
+
import { ReactiveEffectRunner } from '@vue/reactivity';
|
|
28
33
|
import { ReactiveFlags } from '@vue/reactivity';
|
|
29
34
|
import { readonly } from '@vue/reactivity';
|
|
30
35
|
import { Ref } from '@vue/reactivity';
|
|
@@ -32,6 +37,7 @@ import { ref } from '@vue/reactivity';
|
|
|
32
37
|
import { ShallowReactive } from '@vue/reactivity';
|
|
33
38
|
import { shallowReactive } from '@vue/reactivity';
|
|
34
39
|
import { shallowReadonly } from '@vue/reactivity';
|
|
40
|
+
import { ShallowRef } from '@vue/reactivity';
|
|
35
41
|
import { shallowRef } from '@vue/reactivity';
|
|
36
42
|
import { ShallowUnwrapRef } from '@vue/reactivity';
|
|
37
43
|
import { ShapeFlags } from '@vue/shared';
|
|
@@ -95,7 +101,7 @@ export declare interface AppConfig {
|
|
|
95
101
|
errorHandler?: (err: unknown, instance: ComponentPublicInstance | null, info: string) => void;
|
|
96
102
|
warnHandler?: (msg: string, instance: ComponentPublicInstance | null, trace: string) => void;
|
|
97
103
|
/**
|
|
98
|
-
* Options to pass to
|
|
104
|
+
* Options to pass to `@vue/compiler-dom`.
|
|
99
105
|
* Only supported in runtime compiler build.
|
|
100
106
|
*/
|
|
101
107
|
compilerOptions: RuntimeCompilerOptions;
|
|
@@ -224,7 +230,7 @@ export declare type CompatVue = Pick<App, 'version' | 'component' | 'directive'>
|
|
|
224
230
|
directive(name: string, directive: Directive): CompatVue;
|
|
225
231
|
compile(template: string): RenderFunction;
|
|
226
232
|
/**
|
|
227
|
-
* @deprecated
|
|
233
|
+
* @deprecated Vue 3 no longer supports extending constructors.
|
|
228
234
|
*/
|
|
229
235
|
extend: (options?: ComponentOptions) => CompatVue;
|
|
230
236
|
/**
|
|
@@ -334,6 +340,10 @@ export declare interface ComponentInternalInstance {
|
|
|
334
340
|
* Root vnode of this component's own vdom tree
|
|
335
341
|
*/
|
|
336
342
|
subTree: VNode;
|
|
343
|
+
/**
|
|
344
|
+
* Render effect instance
|
|
345
|
+
*/
|
|
346
|
+
effect: ReactiveEffect;
|
|
337
347
|
/**
|
|
338
348
|
* Bound effect runner to be passed to schedulers
|
|
339
349
|
*/
|
|
@@ -491,10 +501,14 @@ declare type ComponentWatchOptions = Record<string, ComponentWatchOptionItem>;
|
|
|
491
501
|
|
|
492
502
|
export { computed }
|
|
493
503
|
|
|
504
|
+
export { ComputedGetter }
|
|
505
|
+
|
|
494
506
|
export declare type ComputedOptions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
|
|
495
507
|
|
|
496
508
|
export { ComputedRef }
|
|
497
509
|
|
|
510
|
+
export { ComputedSetter }
|
|
511
|
+
|
|
498
512
|
/**
|
|
499
513
|
* Concrete component type matches its actual value: it's either an options
|
|
500
514
|
* object, or a function. Use this where the code expects to work with actual
|
|
@@ -594,10 +608,14 @@ declare function _createVNode(type: VNodeTypes | ClassComponent | typeof NULL_DY
|
|
|
594
608
|
|
|
595
609
|
export { customRef }
|
|
596
610
|
|
|
611
|
+
export { CustomRefFactory }
|
|
612
|
+
|
|
597
613
|
declare type Data = Record<string, unknown>;
|
|
598
614
|
|
|
599
615
|
export { DebuggerEvent }
|
|
600
616
|
|
|
617
|
+
export { DebuggerEventExtraInfo }
|
|
618
|
+
|
|
601
619
|
declare type DebuggerHook = (e: DebuggerEvent) => void;
|
|
602
620
|
|
|
603
621
|
export { DebuggerOptions }
|
|
@@ -674,7 +692,7 @@ export declare function defineEmits<TypeEmit>(): TypeEmit;
|
|
|
674
692
|
* This is only usable inside `<script setup>`, is compiled away in the
|
|
675
693
|
* output and should **not** be actually called at runtime.
|
|
676
694
|
*/
|
|
677
|
-
export declare function defineExpose
|
|
695
|
+
export declare function defineExpose<Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed): void;
|
|
678
696
|
|
|
679
697
|
/**
|
|
680
698
|
* Vue `<script setup>` compiler macro for declaring component props. The
|
|
@@ -745,7 +763,6 @@ export declare const enum DeprecationTypes {
|
|
|
745
763
|
OPTIONS_DESTROYED = "OPTIONS_DESTROYED",
|
|
746
764
|
WATCH_ARRAY = "WATCH_ARRAY",
|
|
747
765
|
PROPS_DEFAULT_THIS = "PROPS_DEFAULT_THIS",
|
|
748
|
-
V_FOR_REF = "V_FOR_REF",
|
|
749
766
|
V_ON_KEYCODE_MODIFIER = "V_ON_KEYCODE_MODIFIER",
|
|
750
767
|
CUSTOM_DIR = "CUSTOM_DIR",
|
|
751
768
|
ATTR_FALSE_VALUE = "ATTR_FALSE_VALUE",
|
|
@@ -790,6 +807,8 @@ declare type DirectiveModifiers = Record<string, boolean>;
|
|
|
790
807
|
|
|
791
808
|
export { effect }
|
|
792
809
|
|
|
810
|
+
export { EffectScheduler }
|
|
811
|
+
|
|
793
812
|
export { EffectScope }
|
|
794
813
|
|
|
795
814
|
export { effectScope }
|
|
@@ -877,6 +896,7 @@ export declare interface FunctionalComponent<P = {}, E extends EmitsOptions = {}
|
|
|
877
896
|
emits?: E | (keyof E)[];
|
|
878
897
|
inheritAttrs?: boolean;
|
|
879
898
|
displayName?: string;
|
|
899
|
+
compatConfig?: CompatConfig;
|
|
880
900
|
}
|
|
881
901
|
|
|
882
902
|
export declare type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
|
|
@@ -945,7 +965,9 @@ export declare interface HydrationRenderer extends Renderer<Element | ShadowRoot
|
|
|
945
965
|
hydrate: RootHydrateFunction;
|
|
946
966
|
}
|
|
947
967
|
|
|
948
|
-
declare type
|
|
968
|
+
declare type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
|
|
969
|
+
|
|
970
|
+
declare type InferDefault<P, T> = T extends null | number | string | boolean | symbol | Function ? T : (props: P) => T;
|
|
949
971
|
|
|
950
972
|
declare type InferDefaults<T> = {
|
|
951
973
|
[K in keyof T]?: InferDefault<T, NotUndefined<T[K]>>;
|
|
@@ -961,7 +983,7 @@ declare type InferPropType<T> = [T] extends [null] ? any : [T] extends [{
|
|
|
961
983
|
type: DateConstructor;
|
|
962
984
|
}] ? Date : [T] extends [(infer U)[] | {
|
|
963
985
|
type: (infer U)[];
|
|
964
|
-
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? D : V : T;
|
|
986
|
+
}] ? U extends DateConstructor ? Date | InferPropType<U> : InferPropType<U> : [T] extends [Prop<infer V, infer D>] ? unknown extends V ? IfAny<V, V, D> : V : T;
|
|
965
987
|
|
|
966
988
|
export declare function initCustomFormatter(): void;
|
|
967
989
|
|
|
@@ -1378,6 +1400,10 @@ export { ReactiveEffect }
|
|
|
1378
1400
|
|
|
1379
1401
|
export { ReactiveEffectOptions }
|
|
1380
1402
|
|
|
1403
|
+
export { ReactiveEffectRunner }
|
|
1404
|
+
|
|
1405
|
+
export { ReactiveFlags }
|
|
1406
|
+
|
|
1381
1407
|
export { readonly }
|
|
1382
1408
|
|
|
1383
1409
|
export { Ref }
|
|
@@ -1604,6 +1630,8 @@ export { shallowReactive }
|
|
|
1604
1630
|
|
|
1605
1631
|
export { shallowReadonly }
|
|
1606
1632
|
|
|
1633
|
+
export { ShallowRef }
|
|
1634
|
+
|
|
1607
1635
|
export { shallowRef }
|
|
1608
1636
|
|
|
1609
1637
|
export { ShallowUnwrapRef }
|
|
@@ -1770,6 +1798,8 @@ export { unref }
|
|
|
1770
1798
|
|
|
1771
1799
|
declare type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
|
|
1772
1800
|
|
|
1801
|
+
export { UnwrapNestedRefs }
|
|
1802
|
+
|
|
1773
1803
|
export { UnwrapRef }
|
|
1774
1804
|
|
|
1775
1805
|
export declare function useAttrs(): SetupContext['attrs'];
|
|
@@ -1836,12 +1866,15 @@ declare type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAto
|
|
|
1836
1866
|
declare type VNodeNormalizedRefAtom = {
|
|
1837
1867
|
i: ComponentInternalInstance;
|
|
1838
1868
|
r: VNodeRef;
|
|
1869
|
+
k?: string;
|
|
1839
1870
|
f?: boolean;
|
|
1840
1871
|
};
|
|
1841
1872
|
|
|
1842
1873
|
export declare type VNodeProps = {
|
|
1843
1874
|
key?: string | number | symbol;
|
|
1844
1875
|
ref?: VNodeRef;
|
|
1876
|
+
ref_for?: boolean;
|
|
1877
|
+
ref_key?: string;
|
|
1845
1878
|
onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
|
|
1846
1879
|
onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
|
|
1847
1880
|
onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
@@ -1267,7 +1267,9 @@ const BaseTransitionImpl = {
|
|
|
1267
1267
|
const rawProps = toRaw(props);
|
|
1268
1268
|
const { mode } = rawProps;
|
|
1269
1269
|
// check mode
|
|
1270
|
-
if ((process.env.NODE_ENV !== 'production') &&
|
|
1270
|
+
if ((process.env.NODE_ENV !== 'production') &&
|
|
1271
|
+
mode &&
|
|
1272
|
+
mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
|
|
1271
1273
|
warn(`invalid <transition> mode: ${mode}`);
|
|
1272
1274
|
}
|
|
1273
1275
|
// at this point children has a guaranteed length of 1.
|
|
@@ -1907,7 +1909,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
|
1907
1909
|
}
|
|
1908
1910
|
current = current.parent;
|
|
1909
1911
|
}
|
|
1910
|
-
hook();
|
|
1912
|
+
return hook();
|
|
1911
1913
|
});
|
|
1912
1914
|
injectHook(type, wrappedHook, target);
|
|
1913
1915
|
// In addition to registering it on the target instance, we walk up the parent
|
|
@@ -2575,7 +2577,7 @@ function setFullProps(instance, rawProps, props, attrs) {
|
|
|
2575
2577
|
}
|
|
2576
2578
|
}
|
|
2577
2579
|
else if (!isEmitListener(instance.emitsOptions, key)) {
|
|
2578
|
-
if (value !== attrs[key]) {
|
|
2580
|
+
if (!(key in attrs) || value !== attrs[key]) {
|
|
2579
2581
|
attrs[key] = value;
|
|
2580
2582
|
hasAttrsChanged = true;
|
|
2581
2583
|
}
|
|
@@ -3220,6 +3222,102 @@ function createAppAPI(render, hydrate) {
|
|
|
3220
3222
|
};
|
|
3221
3223
|
}
|
|
3222
3224
|
|
|
3225
|
+
/**
|
|
3226
|
+
* Function for handling a template ref
|
|
3227
|
+
*/
|
|
3228
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
3229
|
+
if (isArray(rawRef)) {
|
|
3230
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
3231
|
+
return;
|
|
3232
|
+
}
|
|
3233
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
3234
|
+
// when mounting async components, nothing needs to be done,
|
|
3235
|
+
// because the template ref is forwarded to inner component
|
|
3236
|
+
return;
|
|
3237
|
+
}
|
|
3238
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
3239
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
3240
|
+
: vnode.el;
|
|
3241
|
+
const value = isUnmount ? null : refValue;
|
|
3242
|
+
const { i: owner, r: ref } = rawRef;
|
|
3243
|
+
if ((process.env.NODE_ENV !== 'production') && !owner) {
|
|
3244
|
+
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
3245
|
+
`A vnode with ref must be created inside the render function.`);
|
|
3246
|
+
return;
|
|
3247
|
+
}
|
|
3248
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
3249
|
+
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
3250
|
+
const setupState = owner.setupState;
|
|
3251
|
+
// dynamic ref changed. unset old ref
|
|
3252
|
+
if (oldRef != null && oldRef !== ref) {
|
|
3253
|
+
if (isString(oldRef)) {
|
|
3254
|
+
refs[oldRef] = null;
|
|
3255
|
+
if (hasOwn(setupState, oldRef)) {
|
|
3256
|
+
setupState[oldRef] = null;
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
else if (isRef(oldRef)) {
|
|
3260
|
+
oldRef.value = null;
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
if (isFunction(ref)) {
|
|
3264
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
3265
|
+
}
|
|
3266
|
+
else {
|
|
3267
|
+
const _isString = isString(ref);
|
|
3268
|
+
const _isRef = isRef(ref);
|
|
3269
|
+
if (_isString || _isRef) {
|
|
3270
|
+
const doSet = () => {
|
|
3271
|
+
if (rawRef.f) {
|
|
3272
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
3273
|
+
if (isUnmount) {
|
|
3274
|
+
isArray(existing) && remove(existing, refValue);
|
|
3275
|
+
}
|
|
3276
|
+
else {
|
|
3277
|
+
if (!isArray(existing)) {
|
|
3278
|
+
if (_isString) {
|
|
3279
|
+
refs[ref] = [refValue];
|
|
3280
|
+
}
|
|
3281
|
+
else {
|
|
3282
|
+
ref.value = [refValue];
|
|
3283
|
+
if (rawRef.k)
|
|
3284
|
+
refs[rawRef.k] = ref.value;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
else if (!existing.includes(refValue)) {
|
|
3288
|
+
existing.push(refValue);
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
else if (_isString) {
|
|
3293
|
+
refs[ref] = value;
|
|
3294
|
+
if (hasOwn(setupState, ref)) {
|
|
3295
|
+
setupState[ref] = value;
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
else if (isRef(ref)) {
|
|
3299
|
+
ref.value = value;
|
|
3300
|
+
if (rawRef.k)
|
|
3301
|
+
refs[rawRef.k] = value;
|
|
3302
|
+
}
|
|
3303
|
+
else if ((process.env.NODE_ENV !== 'production')) {
|
|
3304
|
+
warn('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
3305
|
+
}
|
|
3306
|
+
};
|
|
3307
|
+
if (value) {
|
|
3308
|
+
doSet.id = -1;
|
|
3309
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
3310
|
+
}
|
|
3311
|
+
else {
|
|
3312
|
+
doSet();
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
else if ((process.env.NODE_ENV !== 'production')) {
|
|
3316
|
+
warn('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3223
3321
|
let hasMismatch = false;
|
|
3224
3322
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
3225
3323
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -3608,7 +3706,7 @@ function initFeatureFlags() {
|
|
|
3608
3706
|
`which expects these compile-time feature flags to be globally injected ` +
|
|
3609
3707
|
`via the bundler config in order to get better tree-shaking in the ` +
|
|
3610
3708
|
`production bundle.\n\n` +
|
|
3611
|
-
`For more details, see
|
|
3709
|
+
`For more details, see https://link.vuejs.org/feature-flags.`);
|
|
3612
3710
|
}
|
|
3613
3711
|
}
|
|
3614
3712
|
|
|
@@ -3898,12 +3996,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3898
3996
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
3899
3997
|
const newProps = n2.props || EMPTY_OBJ;
|
|
3900
3998
|
let vnodeHook;
|
|
3999
|
+
// disable recurse in beforeUpdate hooks
|
|
4000
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
3901
4001
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
3902
4002
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3903
4003
|
}
|
|
3904
4004
|
if (dirs) {
|
|
3905
4005
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
3906
4006
|
}
|
|
4007
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
3907
4008
|
if ((process.env.NODE_ENV !== 'production') && isHmrUpdating) {
|
|
3908
4009
|
// HMR updated, force full diff
|
|
3909
4010
|
patchFlag = 0;
|
|
@@ -4183,7 +4284,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4183
4284
|
const { el, props } = initialVNode;
|
|
4184
4285
|
const { bm, m, parent } = instance;
|
|
4185
4286
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
4186
|
-
|
|
4287
|
+
toggleRecurse(instance, false);
|
|
4187
4288
|
// beforeMount hook
|
|
4188
4289
|
if (bm) {
|
|
4189
4290
|
invokeArrayFns(bm);
|
|
@@ -4193,7 +4294,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4193
4294
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
4194
4295
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
4195
4296
|
}
|
|
4196
|
-
|
|
4297
|
+
toggleRecurse(instance, true);
|
|
4197
4298
|
if (el && hydrateNode) {
|
|
4198
4299
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
4199
4300
|
const hydrateSubTree = () => {
|
|
@@ -4275,7 +4376,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4275
4376
|
pushWarningContext(next || instance.vnode);
|
|
4276
4377
|
}
|
|
4277
4378
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
4278
|
-
|
|
4379
|
+
toggleRecurse(instance, false);
|
|
4279
4380
|
if (next) {
|
|
4280
4381
|
next.el = vnode.el;
|
|
4281
4382
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -4291,7 +4392,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4291
4392
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
4292
4393
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
4293
4394
|
}
|
|
4294
|
-
|
|
4395
|
+
toggleRecurse(instance, true);
|
|
4295
4396
|
// render
|
|
4296
4397
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
4297
4398
|
startMeasure(instance, `render`);
|
|
@@ -4337,13 +4438,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4337
4438
|
}
|
|
4338
4439
|
};
|
|
4339
4440
|
// create reactive effect for rendering
|
|
4340
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4341
|
-
);
|
|
4441
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4442
|
+
));
|
|
4342
4443
|
const update = (instance.update = effect.run.bind(effect));
|
|
4343
4444
|
update.id = instance.uid;
|
|
4344
4445
|
// allowRecurse
|
|
4345
4446
|
// #1801, #2043 component render effects should allow recursive updates
|
|
4346
|
-
|
|
4447
|
+
toggleRecurse(instance, true);
|
|
4347
4448
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
4348
4449
|
effect.onTrack = instance.rtc
|
|
4349
4450
|
? e => invokeArrayFns(instance.rtc, e)
|
|
@@ -4867,85 +4968,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4867
4968
|
createApp: createAppAPI(render, hydrate)
|
|
4868
4969
|
};
|
|
4869
4970
|
}
|
|
4870
|
-
function
|
|
4871
|
-
|
|
4872
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4873
|
-
return;
|
|
4874
|
-
}
|
|
4875
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4876
|
-
// when mounting async components, nothing needs to be done,
|
|
4877
|
-
// because the template ref is forwarded to inner component
|
|
4878
|
-
return;
|
|
4879
|
-
}
|
|
4880
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4881
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4882
|
-
: vnode.el;
|
|
4883
|
-
const value = isUnmount ? null : refValue;
|
|
4884
|
-
const { i: owner, r: ref } = rawRef;
|
|
4885
|
-
if ((process.env.NODE_ENV !== 'production') && !owner) {
|
|
4886
|
-
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4887
|
-
`A vnode with ref must be created inside the render function.`);
|
|
4888
|
-
return;
|
|
4889
|
-
}
|
|
4890
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
4891
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4892
|
-
const setupState = owner.setupState;
|
|
4893
|
-
// dynamic ref changed. unset old ref
|
|
4894
|
-
if (oldRef != null && oldRef !== ref) {
|
|
4895
|
-
if (isString(oldRef)) {
|
|
4896
|
-
refs[oldRef] = null;
|
|
4897
|
-
if (hasOwn(setupState, oldRef)) {
|
|
4898
|
-
setupState[oldRef] = null;
|
|
4899
|
-
}
|
|
4900
|
-
}
|
|
4901
|
-
else if (isRef(oldRef)) {
|
|
4902
|
-
oldRef.value = null;
|
|
4903
|
-
}
|
|
4904
|
-
}
|
|
4905
|
-
if (isString(ref)) {
|
|
4906
|
-
const doSet = () => {
|
|
4907
|
-
{
|
|
4908
|
-
refs[ref] = value;
|
|
4909
|
-
}
|
|
4910
|
-
if (hasOwn(setupState, ref)) {
|
|
4911
|
-
setupState[ref] = value;
|
|
4912
|
-
}
|
|
4913
|
-
};
|
|
4914
|
-
// #1789: for non-null values, set them after render
|
|
4915
|
-
// null values means this is unmount and it should not overwrite another
|
|
4916
|
-
// ref with the same key
|
|
4917
|
-
if (value) {
|
|
4918
|
-
doSet.id = -1;
|
|
4919
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4920
|
-
}
|
|
4921
|
-
else {
|
|
4922
|
-
doSet();
|
|
4923
|
-
}
|
|
4924
|
-
}
|
|
4925
|
-
else if (isRef(ref)) {
|
|
4926
|
-
const doSet = () => {
|
|
4927
|
-
ref.value = value;
|
|
4928
|
-
};
|
|
4929
|
-
if (value) {
|
|
4930
|
-
doSet.id = -1;
|
|
4931
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4932
|
-
}
|
|
4933
|
-
else {
|
|
4934
|
-
doSet();
|
|
4935
|
-
}
|
|
4936
|
-
}
|
|
4937
|
-
else if (isFunction(ref)) {
|
|
4938
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4939
|
-
}
|
|
4940
|
-
else if ((process.env.NODE_ENV !== 'production')) {
|
|
4941
|
-
warn('Invalid template ref type:', value, `(${typeof value})`);
|
|
4942
|
-
}
|
|
4943
|
-
}
|
|
4944
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
4945
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
4946
|
-
vnode,
|
|
4947
|
-
prevVNode
|
|
4948
|
-
]);
|
|
4971
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
4972
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
4949
4973
|
}
|
|
4950
4974
|
/**
|
|
4951
4975
|
* #1156
|
|
@@ -5409,10 +5433,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
5409
5433
|
};
|
|
5410
5434
|
const InternalObjectKey = `__vInternal`;
|
|
5411
5435
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
5412
|
-
const normalizeRef = ({ ref }) => {
|
|
5436
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
5413
5437
|
return (ref != null
|
|
5414
5438
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
5415
|
-
? { i: currentRenderingInstance, r: ref }
|
|
5439
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
5416
5440
|
: ref
|
|
5417
5441
|
: null);
|
|
5418
5442
|
};
|
|
@@ -5754,6 +5778,12 @@ function mergeProps(...args) {
|
|
|
5754
5778
|
}
|
|
5755
5779
|
}
|
|
5756
5780
|
return ret;
|
|
5781
|
+
}
|
|
5782
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5783
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5784
|
+
vnode,
|
|
5785
|
+
prevVNode
|
|
5786
|
+
]);
|
|
5757
5787
|
}
|
|
5758
5788
|
|
|
5759
5789
|
/**
|
|
@@ -5946,23 +5976,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
5946
5976
|
const n = accessCache[key];
|
|
5947
5977
|
if (n !== undefined) {
|
|
5948
5978
|
switch (n) {
|
|
5949
|
-
case
|
|
5979
|
+
case 1 /* SETUP */:
|
|
5950
5980
|
return setupState[key];
|
|
5951
|
-
case
|
|
5981
|
+
case 2 /* DATA */:
|
|
5952
5982
|
return data[key];
|
|
5953
|
-
case
|
|
5983
|
+
case 4 /* CONTEXT */:
|
|
5954
5984
|
return ctx[key];
|
|
5955
|
-
case
|
|
5985
|
+
case 3 /* PROPS */:
|
|
5956
5986
|
return props[key];
|
|
5957
5987
|
// default: just fallthrough
|
|
5958
5988
|
}
|
|
5959
5989
|
}
|
|
5960
5990
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
5961
|
-
accessCache[key] =
|
|
5991
|
+
accessCache[key] = 1 /* SETUP */;
|
|
5962
5992
|
return setupState[key];
|
|
5963
5993
|
}
|
|
5964
5994
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
5965
|
-
accessCache[key] =
|
|
5995
|
+
accessCache[key] = 2 /* DATA */;
|
|
5966
5996
|
return data[key];
|
|
5967
5997
|
}
|
|
5968
5998
|
else if (
|
|
@@ -5970,15 +6000,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
5970
6000
|
// props
|
|
5971
6001
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
5972
6002
|
hasOwn(normalizedProps, key)) {
|
|
5973
|
-
accessCache[key] =
|
|
6003
|
+
accessCache[key] = 3 /* PROPS */;
|
|
5974
6004
|
return props[key];
|
|
5975
6005
|
}
|
|
5976
6006
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
5977
|
-
accessCache[key] =
|
|
6007
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
5978
6008
|
return ctx[key];
|
|
5979
6009
|
}
|
|
5980
6010
|
else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
|
|
5981
|
-
accessCache[key] =
|
|
6011
|
+
accessCache[key] = 0 /* OTHER */;
|
|
5982
6012
|
}
|
|
5983
6013
|
}
|
|
5984
6014
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -5999,7 +6029,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
5999
6029
|
}
|
|
6000
6030
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
6001
6031
|
// user may set custom properties to `this` that start with `$`
|
|
6002
|
-
accessCache[key] =
|
|
6032
|
+
accessCache[key] = 4 /* CONTEXT */;
|
|
6003
6033
|
return ctx[key];
|
|
6004
6034
|
}
|
|
6005
6035
|
else if (
|
|
@@ -6063,7 +6093,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
6063
6093
|
},
|
|
6064
6094
|
has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
|
|
6065
6095
|
let normalizedProps;
|
|
6066
|
-
return (accessCache[key]
|
|
6096
|
+
return (!!accessCache[key] ||
|
|
6067
6097
|
(data !== EMPTY_OBJ && hasOwn(data, key)) ||
|
|
6068
6098
|
(setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
|
|
6069
6099
|
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
|
|
@@ -6169,6 +6199,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6169
6199
|
root: null,
|
|
6170
6200
|
next: null,
|
|
6171
6201
|
subTree: null,
|
|
6202
|
+
effect: null,
|
|
6172
6203
|
update: null,
|
|
6173
6204
|
scope: new EffectScope(true /* detached */),
|
|
6174
6205
|
render: null,
|
|
@@ -7660,7 +7691,7 @@ function isMemoSame(cached, memo) {
|
|
|
7660
7691
|
}
|
|
7661
7692
|
|
|
7662
7693
|
// Core API ------------------------------------------------------------------
|
|
7663
|
-
const version = "3.2.
|
|
7694
|
+
const version = "3.2.26";
|
|
7664
7695
|
const _ssrUtils = {
|
|
7665
7696
|
createComponentInstance,
|
|
7666
7697
|
setupComponent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.26",
|
|
4
4
|
"description": "@vue/runtime-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
36
|
-
"@vue/reactivity": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.26",
|
|
36
|
+
"@vue/reactivity": "3.2.26"
|
|
37
37
|
}
|
|
38
38
|
}
|