@vue/runtime-core 3.2.24 → 3.2.25
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 +118 -89
- package/dist/runtime-core.cjs.prod.js +108 -82
- package/dist/runtime-core.d.ts +33 -3
- package/dist/runtime-core.esm-bundler.js +119 -90
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -3210,6 +3210,102 @@ function createAppAPI(render, hydrate) {
|
|
|
3210
3210
|
};
|
|
3211
3211
|
}
|
|
3212
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
|
+
|
|
3213
3309
|
let hasMismatch = false;
|
|
3214
3310
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
3215
3311
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -3842,12 +3938,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3842
3938
|
const oldProps = n1.props || shared.EMPTY_OBJ;
|
|
3843
3939
|
const newProps = n2.props || shared.EMPTY_OBJ;
|
|
3844
3940
|
let vnodeHook;
|
|
3941
|
+
// disable recurse in beforeUpdate hooks
|
|
3942
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
3845
3943
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
3846
3944
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3847
3945
|
}
|
|
3848
3946
|
if (dirs) {
|
|
3849
3947
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
3850
3948
|
}
|
|
3949
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
3851
3950
|
if (isHmrUpdating) {
|
|
3852
3951
|
// HMR updated, force full diff
|
|
3853
3952
|
patchFlag = 0;
|
|
@@ -4127,7 +4226,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4127
4226
|
const { el, props } = initialVNode;
|
|
4128
4227
|
const { bm, m, parent } = instance;
|
|
4129
4228
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
4130
|
-
|
|
4229
|
+
toggleRecurse(instance, false);
|
|
4131
4230
|
// beforeMount hook
|
|
4132
4231
|
if (bm) {
|
|
4133
4232
|
shared.invokeArrayFns(bm);
|
|
@@ -4137,7 +4236,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4137
4236
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
4138
4237
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
4139
4238
|
}
|
|
4140
|
-
|
|
4239
|
+
toggleRecurse(instance, true);
|
|
4141
4240
|
if (el && hydrateNode) {
|
|
4142
4241
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
4143
4242
|
const hydrateSubTree = () => {
|
|
@@ -4219,7 +4318,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4219
4318
|
pushWarningContext(next || instance.vnode);
|
|
4220
4319
|
}
|
|
4221
4320
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
4222
|
-
|
|
4321
|
+
toggleRecurse(instance, false);
|
|
4223
4322
|
if (next) {
|
|
4224
4323
|
next.el = vnode.el;
|
|
4225
4324
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -4235,7 +4334,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4235
4334
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
4236
4335
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
4237
4336
|
}
|
|
4238
|
-
|
|
4337
|
+
toggleRecurse(instance, true);
|
|
4239
4338
|
// render
|
|
4240
4339
|
{
|
|
4241
4340
|
startMeasure(instance, `render`);
|
|
@@ -4281,13 +4380,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4281
4380
|
}
|
|
4282
4381
|
};
|
|
4283
4382
|
// create reactive effect for rendering
|
|
4284
|
-
const effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4285
|
-
);
|
|
4383
|
+
const effect = (instance.effect = new reactivity.ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4384
|
+
));
|
|
4286
4385
|
const update = (instance.update = effect.run.bind(effect));
|
|
4287
4386
|
update.id = instance.uid;
|
|
4288
4387
|
// allowRecurse
|
|
4289
4388
|
// #1801, #2043 component render effects should allow recursive updates
|
|
4290
|
-
|
|
4389
|
+
toggleRecurse(instance, true);
|
|
4291
4390
|
{
|
|
4292
4391
|
effect.onTrack = instance.rtc
|
|
4293
4392
|
? e => shared.invokeArrayFns(instance.rtc, e)
|
|
@@ -4811,85 +4910,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4811
4910
|
createApp: createAppAPI(render, hydrate)
|
|
4812
4911
|
};
|
|
4813
4912
|
}
|
|
4814
|
-
function
|
|
4815
|
-
|
|
4816
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4817
|
-
return;
|
|
4818
|
-
}
|
|
4819
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4820
|
-
// when mounting async components, nothing needs to be done,
|
|
4821
|
-
// because the template ref is forwarded to inner component
|
|
4822
|
-
return;
|
|
4823
|
-
}
|
|
4824
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4825
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4826
|
-
: vnode.el;
|
|
4827
|
-
const value = isUnmount ? null : refValue;
|
|
4828
|
-
const { i: owner, r: ref } = rawRef;
|
|
4829
|
-
if (!owner) {
|
|
4830
|
-
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4831
|
-
`A vnode with ref must be created inside the render function.`);
|
|
4832
|
-
return;
|
|
4833
|
-
}
|
|
4834
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
4835
|
-
const refs = owner.refs === shared.EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4836
|
-
const setupState = owner.setupState;
|
|
4837
|
-
// dynamic ref changed. unset old ref
|
|
4838
|
-
if (oldRef != null && oldRef !== ref) {
|
|
4839
|
-
if (shared.isString(oldRef)) {
|
|
4840
|
-
refs[oldRef] = null;
|
|
4841
|
-
if (shared.hasOwn(setupState, oldRef)) {
|
|
4842
|
-
setupState[oldRef] = null;
|
|
4843
|
-
}
|
|
4844
|
-
}
|
|
4845
|
-
else if (reactivity.isRef(oldRef)) {
|
|
4846
|
-
oldRef.value = null;
|
|
4847
|
-
}
|
|
4848
|
-
}
|
|
4849
|
-
if (shared.isString(ref)) {
|
|
4850
|
-
const doSet = () => {
|
|
4851
|
-
{
|
|
4852
|
-
refs[ref] = value;
|
|
4853
|
-
}
|
|
4854
|
-
if (shared.hasOwn(setupState, ref)) {
|
|
4855
|
-
setupState[ref] = value;
|
|
4856
|
-
}
|
|
4857
|
-
};
|
|
4858
|
-
// #1789: for non-null values, set them after render
|
|
4859
|
-
// null values means this is unmount and it should not overwrite another
|
|
4860
|
-
// ref with the same key
|
|
4861
|
-
if (value) {
|
|
4862
|
-
doSet.id = -1;
|
|
4863
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4864
|
-
}
|
|
4865
|
-
else {
|
|
4866
|
-
doSet();
|
|
4867
|
-
}
|
|
4868
|
-
}
|
|
4869
|
-
else if (reactivity.isRef(ref)) {
|
|
4870
|
-
const doSet = () => {
|
|
4871
|
-
ref.value = value;
|
|
4872
|
-
};
|
|
4873
|
-
if (value) {
|
|
4874
|
-
doSet.id = -1;
|
|
4875
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4876
|
-
}
|
|
4877
|
-
else {
|
|
4878
|
-
doSet();
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
|
-
else if (shared.isFunction(ref)) {
|
|
4882
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4883
|
-
}
|
|
4884
|
-
else {
|
|
4885
|
-
warn('Invalid template ref type:', value, `(${typeof value})`);
|
|
4886
|
-
}
|
|
4887
|
-
}
|
|
4888
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
4889
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
4890
|
-
vnode,
|
|
4891
|
-
prevVNode
|
|
4892
|
-
]);
|
|
4913
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
4914
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
4893
4915
|
}
|
|
4894
4916
|
/**
|
|
4895
4917
|
* #1156
|
|
@@ -5348,10 +5370,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
5348
5370
|
};
|
|
5349
5371
|
const InternalObjectKey = `__vInternal`;
|
|
5350
5372
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
5351
|
-
const normalizeRef = ({ ref }) => {
|
|
5373
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
5352
5374
|
return (ref != null
|
|
5353
5375
|
? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref)
|
|
5354
|
-
? { i: currentRenderingInstance, r: ref }
|
|
5376
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
5355
5377
|
: ref
|
|
5356
5378
|
: null);
|
|
5357
5379
|
};
|
|
@@ -5693,6 +5715,12 @@ function mergeProps(...args) {
|
|
|
5693
5715
|
}
|
|
5694
5716
|
}
|
|
5695
5717
|
return ret;
|
|
5718
|
+
}
|
|
5719
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5720
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5721
|
+
vnode,
|
|
5722
|
+
prevVNode
|
|
5723
|
+
]);
|
|
5696
5724
|
}
|
|
5697
5725
|
|
|
5698
5726
|
/**
|
|
@@ -6104,6 +6132,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6104
6132
|
root: null,
|
|
6105
6133
|
next: null,
|
|
6106
6134
|
subTree: null,
|
|
6135
|
+
effect: null,
|
|
6107
6136
|
update: null,
|
|
6108
6137
|
scope: new reactivity.EffectScope(true /* detached */),
|
|
6109
6138
|
render: null,
|
|
@@ -7566,7 +7595,7 @@ function isMemoSame(cached, memo) {
|
|
|
7566
7595
|
}
|
|
7567
7596
|
|
|
7568
7597
|
// Core API ------------------------------------------------------------------
|
|
7569
|
-
const version = "3.2.
|
|
7598
|
+
const version = "3.2.25";
|
|
7570
7599
|
const _ssrUtils = {
|
|
7571
7600
|
createComponentInstance,
|
|
7572
7601
|
setupComponent,
|
|
@@ -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
|
/**
|
|
@@ -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.25";
|
|
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 }
|
|
@@ -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 }
|
|
@@ -1381,6 +1400,10 @@ export { ReactiveEffect }
|
|
|
1381
1400
|
|
|
1382
1401
|
export { ReactiveEffectOptions }
|
|
1383
1402
|
|
|
1403
|
+
export { ReactiveEffectRunner }
|
|
1404
|
+
|
|
1405
|
+
export { ReactiveFlags }
|
|
1406
|
+
|
|
1384
1407
|
export { readonly }
|
|
1385
1408
|
|
|
1386
1409
|
export { Ref }
|
|
@@ -1607,6 +1630,8 @@ export { shallowReactive }
|
|
|
1607
1630
|
|
|
1608
1631
|
export { shallowReadonly }
|
|
1609
1632
|
|
|
1633
|
+
export { ShallowRef }
|
|
1634
|
+
|
|
1610
1635
|
export { shallowRef }
|
|
1611
1636
|
|
|
1612
1637
|
export { ShallowUnwrapRef }
|
|
@@ -1773,6 +1798,8 @@ export { unref }
|
|
|
1773
1798
|
|
|
1774
1799
|
declare type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
|
|
1775
1800
|
|
|
1801
|
+
export { UnwrapNestedRefs }
|
|
1802
|
+
|
|
1776
1803
|
export { UnwrapRef }
|
|
1777
1804
|
|
|
1778
1805
|
export declare function useAttrs(): SetupContext['attrs'];
|
|
@@ -1839,12 +1866,15 @@ declare type VNodeNormalizedRef = VNodeNormalizedRefAtom | VNodeNormalizedRefAto
|
|
|
1839
1866
|
declare type VNodeNormalizedRefAtom = {
|
|
1840
1867
|
i: ComponentInternalInstance;
|
|
1841
1868
|
r: VNodeRef;
|
|
1869
|
+
k?: string;
|
|
1842
1870
|
f?: boolean;
|
|
1843
1871
|
};
|
|
1844
1872
|
|
|
1845
1873
|
export declare type VNodeProps = {
|
|
1846
1874
|
key?: string | number | symbol;
|
|
1847
1875
|
ref?: VNodeRef;
|
|
1876
|
+
ref_for?: boolean;
|
|
1877
|
+
ref_key?: string;
|
|
1848
1878
|
onVnodeBeforeMount?: VNodeMountHook | VNodeMountHook[];
|
|
1849
1879
|
onVnodeMounted?: VNodeMountHook | VNodeMountHook[];
|
|
1850
1880
|
onVnodeBeforeUpdate?: VNodeUpdateHook | VNodeUpdateHook[];
|
|
@@ -3222,6 +3222,102 @@ function createAppAPI(render, hydrate) {
|
|
|
3222
3222
|
};
|
|
3223
3223
|
}
|
|
3224
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
|
+
|
|
3225
3321
|
let hasMismatch = false;
|
|
3226
3322
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
3227
3323
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -3610,7 +3706,7 @@ function initFeatureFlags() {
|
|
|
3610
3706
|
`which expects these compile-time feature flags to be globally injected ` +
|
|
3611
3707
|
`via the bundler config in order to get better tree-shaking in the ` +
|
|
3612
3708
|
`production bundle.\n\n` +
|
|
3613
|
-
`For more details, see
|
|
3709
|
+
`For more details, see https://link.vuejs.org/feature-flags.`);
|
|
3614
3710
|
}
|
|
3615
3711
|
}
|
|
3616
3712
|
|
|
@@ -3900,12 +3996,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3900
3996
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
3901
3997
|
const newProps = n2.props || EMPTY_OBJ;
|
|
3902
3998
|
let vnodeHook;
|
|
3999
|
+
// disable recurse in beforeUpdate hooks
|
|
4000
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
3903
4001
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
3904
4002
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3905
4003
|
}
|
|
3906
4004
|
if (dirs) {
|
|
3907
4005
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
3908
4006
|
}
|
|
4007
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
3909
4008
|
if ((process.env.NODE_ENV !== 'production') && isHmrUpdating) {
|
|
3910
4009
|
// HMR updated, force full diff
|
|
3911
4010
|
patchFlag = 0;
|
|
@@ -4185,7 +4284,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4185
4284
|
const { el, props } = initialVNode;
|
|
4186
4285
|
const { bm, m, parent } = instance;
|
|
4187
4286
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
4188
|
-
|
|
4287
|
+
toggleRecurse(instance, false);
|
|
4189
4288
|
// beforeMount hook
|
|
4190
4289
|
if (bm) {
|
|
4191
4290
|
invokeArrayFns(bm);
|
|
@@ -4195,7 +4294,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4195
4294
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
4196
4295
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
4197
4296
|
}
|
|
4198
|
-
|
|
4297
|
+
toggleRecurse(instance, true);
|
|
4199
4298
|
if (el && hydrateNode) {
|
|
4200
4299
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
4201
4300
|
const hydrateSubTree = () => {
|
|
@@ -4277,7 +4376,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4277
4376
|
pushWarningContext(next || instance.vnode);
|
|
4278
4377
|
}
|
|
4279
4378
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
4280
|
-
|
|
4379
|
+
toggleRecurse(instance, false);
|
|
4281
4380
|
if (next) {
|
|
4282
4381
|
next.el = vnode.el;
|
|
4283
4382
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -4293,7 +4392,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4293
4392
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
4294
4393
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
4295
4394
|
}
|
|
4296
|
-
|
|
4395
|
+
toggleRecurse(instance, true);
|
|
4297
4396
|
// render
|
|
4298
4397
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
4299
4398
|
startMeasure(instance, `render`);
|
|
@@ -4339,13 +4438,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4339
4438
|
}
|
|
4340
4439
|
};
|
|
4341
4440
|
// create reactive effect for rendering
|
|
4342
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4343
|
-
);
|
|
4441
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
4442
|
+
));
|
|
4344
4443
|
const update = (instance.update = effect.run.bind(effect));
|
|
4345
4444
|
update.id = instance.uid;
|
|
4346
4445
|
// allowRecurse
|
|
4347
4446
|
// #1801, #2043 component render effects should allow recursive updates
|
|
4348
|
-
|
|
4447
|
+
toggleRecurse(instance, true);
|
|
4349
4448
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
4350
4449
|
effect.onTrack = instance.rtc
|
|
4351
4450
|
? e => invokeArrayFns(instance.rtc, e)
|
|
@@ -4869,85 +4968,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4869
4968
|
createApp: createAppAPI(render, hydrate)
|
|
4870
4969
|
};
|
|
4871
4970
|
}
|
|
4872
|
-
function
|
|
4873
|
-
|
|
4874
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4875
|
-
return;
|
|
4876
|
-
}
|
|
4877
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4878
|
-
// when mounting async components, nothing needs to be done,
|
|
4879
|
-
// because the template ref is forwarded to inner component
|
|
4880
|
-
return;
|
|
4881
|
-
}
|
|
4882
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4883
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4884
|
-
: vnode.el;
|
|
4885
|
-
const value = isUnmount ? null : refValue;
|
|
4886
|
-
const { i: owner, r: ref } = rawRef;
|
|
4887
|
-
if ((process.env.NODE_ENV !== 'production') && !owner) {
|
|
4888
|
-
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4889
|
-
`A vnode with ref must be created inside the render function.`);
|
|
4890
|
-
return;
|
|
4891
|
-
}
|
|
4892
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
4893
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4894
|
-
const setupState = owner.setupState;
|
|
4895
|
-
// dynamic ref changed. unset old ref
|
|
4896
|
-
if (oldRef != null && oldRef !== ref) {
|
|
4897
|
-
if (isString(oldRef)) {
|
|
4898
|
-
refs[oldRef] = null;
|
|
4899
|
-
if (hasOwn(setupState, oldRef)) {
|
|
4900
|
-
setupState[oldRef] = null;
|
|
4901
|
-
}
|
|
4902
|
-
}
|
|
4903
|
-
else if (isRef(oldRef)) {
|
|
4904
|
-
oldRef.value = null;
|
|
4905
|
-
}
|
|
4906
|
-
}
|
|
4907
|
-
if (isString(ref)) {
|
|
4908
|
-
const doSet = () => {
|
|
4909
|
-
{
|
|
4910
|
-
refs[ref] = value;
|
|
4911
|
-
}
|
|
4912
|
-
if (hasOwn(setupState, ref)) {
|
|
4913
|
-
setupState[ref] = value;
|
|
4914
|
-
}
|
|
4915
|
-
};
|
|
4916
|
-
// #1789: for non-null values, set them after render
|
|
4917
|
-
// null values means this is unmount and it should not overwrite another
|
|
4918
|
-
// ref with the same key
|
|
4919
|
-
if (value) {
|
|
4920
|
-
doSet.id = -1;
|
|
4921
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4922
|
-
}
|
|
4923
|
-
else {
|
|
4924
|
-
doSet();
|
|
4925
|
-
}
|
|
4926
|
-
}
|
|
4927
|
-
else if (isRef(ref)) {
|
|
4928
|
-
const doSet = () => {
|
|
4929
|
-
ref.value = value;
|
|
4930
|
-
};
|
|
4931
|
-
if (value) {
|
|
4932
|
-
doSet.id = -1;
|
|
4933
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
4934
|
-
}
|
|
4935
|
-
else {
|
|
4936
|
-
doSet();
|
|
4937
|
-
}
|
|
4938
|
-
}
|
|
4939
|
-
else if (isFunction(ref)) {
|
|
4940
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4941
|
-
}
|
|
4942
|
-
else if ((process.env.NODE_ENV !== 'production')) {
|
|
4943
|
-
warn('Invalid template ref type:', value, `(${typeof value})`);
|
|
4944
|
-
}
|
|
4945
|
-
}
|
|
4946
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
4947
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
4948
|
-
vnode,
|
|
4949
|
-
prevVNode
|
|
4950
|
-
]);
|
|
4971
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
4972
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
4951
4973
|
}
|
|
4952
4974
|
/**
|
|
4953
4975
|
* #1156
|
|
@@ -5411,10 +5433,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
5411
5433
|
};
|
|
5412
5434
|
const InternalObjectKey = `__vInternal`;
|
|
5413
5435
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
5414
|
-
const normalizeRef = ({ ref }) => {
|
|
5436
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
5415
5437
|
return (ref != null
|
|
5416
5438
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
5417
|
-
? { i: currentRenderingInstance, r: ref }
|
|
5439
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
5418
5440
|
: ref
|
|
5419
5441
|
: null);
|
|
5420
5442
|
};
|
|
@@ -5756,6 +5778,12 @@ function mergeProps(...args) {
|
|
|
5756
5778
|
}
|
|
5757
5779
|
}
|
|
5758
5780
|
return ret;
|
|
5781
|
+
}
|
|
5782
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5783
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5784
|
+
vnode,
|
|
5785
|
+
prevVNode
|
|
5786
|
+
]);
|
|
5759
5787
|
}
|
|
5760
5788
|
|
|
5761
5789
|
/**
|
|
@@ -6171,6 +6199,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6171
6199
|
root: null,
|
|
6172
6200
|
next: null,
|
|
6173
6201
|
subTree: null,
|
|
6202
|
+
effect: null,
|
|
6174
6203
|
update: null,
|
|
6175
6204
|
scope: new EffectScope(true /* detached */),
|
|
6176
6205
|
render: null,
|
|
@@ -7662,7 +7691,7 @@ function isMemoSame(cached, memo) {
|
|
|
7662
7691
|
}
|
|
7663
7692
|
|
|
7664
7693
|
// Core API ------------------------------------------------------------------
|
|
7665
|
-
const version = "3.2.
|
|
7694
|
+
const version = "3.2.25";
|
|
7666
7695
|
const _ssrUtils = {
|
|
7667
7696
|
createComponentInstance,
|
|
7668
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.25",
|
|
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.25",
|
|
36
|
+
"@vue/reactivity": "3.2.25"
|
|
37
37
|
}
|
|
38
38
|
}
|