@vue/runtime-dom 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.
|
@@ -34,7 +34,7 @@ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomo
|
|
|
34
34
|
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
|
35
35
|
/**
|
|
36
36
|
* Boolean attributes should be included if the value is truthy or ''.
|
|
37
|
-
* e.g.
|
|
37
|
+
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
38
38
|
*/
|
|
39
39
|
function includeBooleanAttr(value) {
|
|
40
40
|
return !!value || value === '';
|
|
@@ -266,7 +266,7 @@ const isIntegerKey = (key) => isString(key) &&
|
|
|
266
266
|
'' + parseInt(key, 10) === key;
|
|
267
267
|
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
268
268
|
// the leading comma is intentional so empty string "" is also included
|
|
269
|
-
',key,ref,' +
|
|
269
|
+
',key,ref,ref_for,ref_key,' +
|
|
270
270
|
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
271
271
|
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
272
272
|
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
@@ -1361,21 +1361,25 @@ function toRefs(object) {
|
|
|
1361
1361
|
return ret;
|
|
1362
1362
|
}
|
|
1363
1363
|
class ObjectRefImpl {
|
|
1364
|
-
constructor(_object, _key) {
|
|
1364
|
+
constructor(_object, _key, _defaultValue) {
|
|
1365
1365
|
this._object = _object;
|
|
1366
1366
|
this._key = _key;
|
|
1367
|
+
this._defaultValue = _defaultValue;
|
|
1367
1368
|
this.__v_isRef = true;
|
|
1368
1369
|
}
|
|
1369
1370
|
get value() {
|
|
1370
|
-
|
|
1371
|
+
const val = this._object[this._key];
|
|
1372
|
+
return val === undefined ? this._defaultValue : val;
|
|
1371
1373
|
}
|
|
1372
1374
|
set value(newVal) {
|
|
1373
1375
|
this._object[this._key] = newVal;
|
|
1374
1376
|
}
|
|
1375
1377
|
}
|
|
1376
|
-
function toRef(object, key) {
|
|
1378
|
+
function toRef(object, key, defaultValue) {
|
|
1377
1379
|
const val = object[key];
|
|
1378
|
-
return isRef(val)
|
|
1380
|
+
return isRef(val)
|
|
1381
|
+
? val
|
|
1382
|
+
: new ObjectRefImpl(object, key, defaultValue);
|
|
1379
1383
|
}
|
|
1380
1384
|
|
|
1381
1385
|
class ComputedRefImpl {
|
|
@@ -4635,6 +4639,102 @@ function createAppAPI(render, hydrate) {
|
|
|
4635
4639
|
};
|
|
4636
4640
|
}
|
|
4637
4641
|
|
|
4642
|
+
/**
|
|
4643
|
+
* Function for handling a template ref
|
|
4644
|
+
*/
|
|
4645
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4646
|
+
if (isArray(rawRef)) {
|
|
4647
|
+
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
4648
|
+
return;
|
|
4649
|
+
}
|
|
4650
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
4651
|
+
// when mounting async components, nothing needs to be done,
|
|
4652
|
+
// because the template ref is forwarded to inner component
|
|
4653
|
+
return;
|
|
4654
|
+
}
|
|
4655
|
+
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4656
|
+
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4657
|
+
: vnode.el;
|
|
4658
|
+
const value = isUnmount ? null : refValue;
|
|
4659
|
+
const { i: owner, r: ref } = rawRef;
|
|
4660
|
+
if (!owner) {
|
|
4661
|
+
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4662
|
+
`A vnode with ref must be created inside the render function.`);
|
|
4663
|
+
return;
|
|
4664
|
+
}
|
|
4665
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
4666
|
+
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
4667
|
+
const setupState = owner.setupState;
|
|
4668
|
+
// dynamic ref changed. unset old ref
|
|
4669
|
+
if (oldRef != null && oldRef !== ref) {
|
|
4670
|
+
if (isString(oldRef)) {
|
|
4671
|
+
refs[oldRef] = null;
|
|
4672
|
+
if (hasOwn(setupState, oldRef)) {
|
|
4673
|
+
setupState[oldRef] = null;
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
else if (isRef(oldRef)) {
|
|
4677
|
+
oldRef.value = null;
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
if (isFunction(ref)) {
|
|
4681
|
+
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4682
|
+
}
|
|
4683
|
+
else {
|
|
4684
|
+
const _isString = isString(ref);
|
|
4685
|
+
const _isRef = isRef(ref);
|
|
4686
|
+
if (_isString || _isRef) {
|
|
4687
|
+
const doSet = () => {
|
|
4688
|
+
if (rawRef.f) {
|
|
4689
|
+
const existing = _isString ? refs[ref] : ref.value;
|
|
4690
|
+
if (isUnmount) {
|
|
4691
|
+
isArray(existing) && remove(existing, refValue);
|
|
4692
|
+
}
|
|
4693
|
+
else {
|
|
4694
|
+
if (!isArray(existing)) {
|
|
4695
|
+
if (_isString) {
|
|
4696
|
+
refs[ref] = [refValue];
|
|
4697
|
+
}
|
|
4698
|
+
else {
|
|
4699
|
+
ref.value = [refValue];
|
|
4700
|
+
if (rawRef.k)
|
|
4701
|
+
refs[rawRef.k] = ref.value;
|
|
4702
|
+
}
|
|
4703
|
+
}
|
|
4704
|
+
else if (!existing.includes(refValue)) {
|
|
4705
|
+
existing.push(refValue);
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
else if (_isString) {
|
|
4710
|
+
refs[ref] = value;
|
|
4711
|
+
if (hasOwn(setupState, ref)) {
|
|
4712
|
+
setupState[ref] = value;
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
else if (isRef(ref)) {
|
|
4716
|
+
ref.value = value;
|
|
4717
|
+
if (rawRef.k)
|
|
4718
|
+
refs[rawRef.k] = value;
|
|
4719
|
+
}
|
|
4720
|
+
else {
|
|
4721
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
4722
|
+
}
|
|
4723
|
+
};
|
|
4724
|
+
if (value) {
|
|
4725
|
+
doSet.id = -1;
|
|
4726
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
4727
|
+
}
|
|
4728
|
+
else {
|
|
4729
|
+
doSet();
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
else {
|
|
4733
|
+
warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
4734
|
+
}
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
|
|
4638
4738
|
let hasMismatch = false;
|
|
4639
4739
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
4640
4740
|
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
@@ -5267,12 +5367,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5267
5367
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
5268
5368
|
const newProps = n2.props || EMPTY_OBJ;
|
|
5269
5369
|
let vnodeHook;
|
|
5370
|
+
// disable recurse in beforeUpdate hooks
|
|
5371
|
+
parentComponent && toggleRecurse(parentComponent, false);
|
|
5270
5372
|
if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
|
|
5271
5373
|
invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
5272
5374
|
}
|
|
5273
5375
|
if (dirs) {
|
|
5274
5376
|
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
|
|
5275
5377
|
}
|
|
5378
|
+
parentComponent && toggleRecurse(parentComponent, true);
|
|
5276
5379
|
if (isHmrUpdating) {
|
|
5277
5380
|
// HMR updated, force full diff
|
|
5278
5381
|
patchFlag = 0;
|
|
@@ -5552,7 +5655,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5552
5655
|
const { el, props } = initialVNode;
|
|
5553
5656
|
const { bm, m, parent } = instance;
|
|
5554
5657
|
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
|
|
5555
|
-
|
|
5658
|
+
toggleRecurse(instance, false);
|
|
5556
5659
|
// beforeMount hook
|
|
5557
5660
|
if (bm) {
|
|
5558
5661
|
invokeArrayFns(bm);
|
|
@@ -5562,7 +5665,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5562
5665
|
(vnodeHook = props && props.onVnodeBeforeMount)) {
|
|
5563
5666
|
invokeVNodeHook(vnodeHook, parent, initialVNode);
|
|
5564
5667
|
}
|
|
5565
|
-
|
|
5668
|
+
toggleRecurse(instance, true);
|
|
5566
5669
|
if (el && hydrateNode) {
|
|
5567
5670
|
// vnode has adopted host node - perform hydration instead of mount.
|
|
5568
5671
|
const hydrateSubTree = () => {
|
|
@@ -5644,7 +5747,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5644
5747
|
pushWarningContext(next || instance.vnode);
|
|
5645
5748
|
}
|
|
5646
5749
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
5647
|
-
|
|
5750
|
+
toggleRecurse(instance, false);
|
|
5648
5751
|
if (next) {
|
|
5649
5752
|
next.el = vnode.el;
|
|
5650
5753
|
updateComponentPreRender(instance, next, optimized);
|
|
@@ -5660,7 +5763,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5660
5763
|
if ((vnodeHook = next.props && next.props.onVnodeBeforeUpdate)) {
|
|
5661
5764
|
invokeVNodeHook(vnodeHook, parent, next, vnode);
|
|
5662
5765
|
}
|
|
5663
|
-
|
|
5766
|
+
toggleRecurse(instance, true);
|
|
5664
5767
|
// render
|
|
5665
5768
|
{
|
|
5666
5769
|
startMeasure(instance, `render`);
|
|
@@ -5706,13 +5809,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5706
5809
|
}
|
|
5707
5810
|
};
|
|
5708
5811
|
// create reactive effect for rendering
|
|
5709
|
-
const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
5710
|
-
);
|
|
5812
|
+
const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
|
|
5813
|
+
));
|
|
5711
5814
|
const update = (instance.update = effect.run.bind(effect));
|
|
5712
5815
|
update.id = instance.uid;
|
|
5713
5816
|
// allowRecurse
|
|
5714
5817
|
// #1801, #2043 component render effects should allow recursive updates
|
|
5715
|
-
|
|
5818
|
+
toggleRecurse(instance, true);
|
|
5716
5819
|
{
|
|
5717
5820
|
effect.onTrack = instance.rtc
|
|
5718
5821
|
? e => invokeArrayFns(instance.rtc, e)
|
|
@@ -6236,85 +6339,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6236
6339
|
createApp: createAppAPI(render, hydrate)
|
|
6237
6340
|
};
|
|
6238
6341
|
}
|
|
6239
|
-
function
|
|
6240
|
-
|
|
6241
|
-
rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
|
|
6242
|
-
return;
|
|
6243
|
-
}
|
|
6244
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
6245
|
-
// when mounting async components, nothing needs to be done,
|
|
6246
|
-
// because the template ref is forwarded to inner component
|
|
6247
|
-
return;
|
|
6248
|
-
}
|
|
6249
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
6250
|
-
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
6251
|
-
: vnode.el;
|
|
6252
|
-
const value = isUnmount ? null : refValue;
|
|
6253
|
-
const { i: owner, r: ref } = rawRef;
|
|
6254
|
-
if (!owner) {
|
|
6255
|
-
warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
6256
|
-
`A vnode with ref must be created inside the render function.`);
|
|
6257
|
-
return;
|
|
6258
|
-
}
|
|
6259
|
-
const oldRef = oldRawRef && oldRawRef.r;
|
|
6260
|
-
const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
|
|
6261
|
-
const setupState = owner.setupState;
|
|
6262
|
-
// dynamic ref changed. unset old ref
|
|
6263
|
-
if (oldRef != null && oldRef !== ref) {
|
|
6264
|
-
if (isString(oldRef)) {
|
|
6265
|
-
refs[oldRef] = null;
|
|
6266
|
-
if (hasOwn(setupState, oldRef)) {
|
|
6267
|
-
setupState[oldRef] = null;
|
|
6268
|
-
}
|
|
6269
|
-
}
|
|
6270
|
-
else if (isRef(oldRef)) {
|
|
6271
|
-
oldRef.value = null;
|
|
6272
|
-
}
|
|
6273
|
-
}
|
|
6274
|
-
if (isString(ref)) {
|
|
6275
|
-
const doSet = () => {
|
|
6276
|
-
{
|
|
6277
|
-
refs[ref] = value;
|
|
6278
|
-
}
|
|
6279
|
-
if (hasOwn(setupState, ref)) {
|
|
6280
|
-
setupState[ref] = value;
|
|
6281
|
-
}
|
|
6282
|
-
};
|
|
6283
|
-
// #1789: for non-null values, set them after render
|
|
6284
|
-
// null values means this is unmount and it should not overwrite another
|
|
6285
|
-
// ref with the same key
|
|
6286
|
-
if (value) {
|
|
6287
|
-
doSet.id = -1;
|
|
6288
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
6289
|
-
}
|
|
6290
|
-
else {
|
|
6291
|
-
doSet();
|
|
6292
|
-
}
|
|
6293
|
-
}
|
|
6294
|
-
else if (isRef(ref)) {
|
|
6295
|
-
const doSet = () => {
|
|
6296
|
-
ref.value = value;
|
|
6297
|
-
};
|
|
6298
|
-
if (value) {
|
|
6299
|
-
doSet.id = -1;
|
|
6300
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
6301
|
-
}
|
|
6302
|
-
else {
|
|
6303
|
-
doSet();
|
|
6304
|
-
}
|
|
6305
|
-
}
|
|
6306
|
-
else if (isFunction(ref)) {
|
|
6307
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
6308
|
-
}
|
|
6309
|
-
else {
|
|
6310
|
-
warn$1('Invalid template ref type:', value, `(${typeof value})`);
|
|
6311
|
-
}
|
|
6312
|
-
}
|
|
6313
|
-
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6314
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
6315
|
-
vnode,
|
|
6316
|
-
prevVNode
|
|
6317
|
-
]);
|
|
6342
|
+
function toggleRecurse({ effect, update }, allowed) {
|
|
6343
|
+
effect.allowRecurse = update.allowRecurse = allowed;
|
|
6318
6344
|
}
|
|
6319
6345
|
/**
|
|
6320
6346
|
* #1156
|
|
@@ -6773,10 +6799,10 @@ const createVNodeWithArgsTransform = (...args) => {
|
|
|
6773
6799
|
};
|
|
6774
6800
|
const InternalObjectKey = `__vInternal`;
|
|
6775
6801
|
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
6776
|
-
const normalizeRef = ({ ref }) => {
|
|
6802
|
+
const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
6777
6803
|
return (ref != null
|
|
6778
6804
|
? isString(ref) || isRef(ref) || isFunction(ref)
|
|
6779
|
-
? { i: currentRenderingInstance, r: ref }
|
|
6805
|
+
? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
|
|
6780
6806
|
: ref
|
|
6781
6807
|
: null);
|
|
6782
6808
|
};
|
|
@@ -7118,6 +7144,12 @@ function mergeProps(...args) {
|
|
|
7118
7144
|
}
|
|
7119
7145
|
}
|
|
7120
7146
|
return ret;
|
|
7147
|
+
}
|
|
7148
|
+
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
7149
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7150
|
+
vnode,
|
|
7151
|
+
prevVNode
|
|
7152
|
+
]);
|
|
7121
7153
|
}
|
|
7122
7154
|
|
|
7123
7155
|
/**
|
|
@@ -7529,6 +7561,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
7529
7561
|
root: null,
|
|
7530
7562
|
next: null,
|
|
7531
7563
|
subTree: null,
|
|
7564
|
+
effect: null,
|
|
7532
7565
|
update: null,
|
|
7533
7566
|
scope: new EffectScope(true /* detached */),
|
|
7534
7567
|
render: null,
|
|
@@ -8970,7 +9003,7 @@ function isMemoSame(cached, memo) {
|
|
|
8970
9003
|
}
|
|
8971
9004
|
|
|
8972
9005
|
// Core API ------------------------------------------------------------------
|
|
8973
|
-
const version = "3.2.
|
|
9006
|
+
const version = "3.2.25";
|
|
8974
9007
|
/**
|
|
8975
9008
|
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
|
8976
9009
|
* @internal
|