@vue/runtime-core 3.2.39 → 3.2.40
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 +62 -53
- package/dist/runtime-core.cjs.prod.js +61 -61
- package/dist/runtime-core.d.ts +4 -2
- package/dist/runtime-core.esm-bundler.js +61 -62
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -2698,7 +2698,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2698
2698
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2699
2699
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2700
2700
|
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2701
|
-
injectHook(lifecycle, hook, target);
|
|
2701
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
2702
2702
|
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2703
2703
|
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2704
2704
|
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
@@ -2921,7 +2921,10 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2921
2921
|
slots[slot.name] = slot.key
|
|
2922
2922
|
? (...args) => {
|
|
2923
2923
|
const res = slot.fn(...args);
|
|
2924
|
-
|
|
2924
|
+
// attach branch key so each conditional branch is considered a
|
|
2925
|
+
// different fragment
|
|
2926
|
+
if (res)
|
|
2927
|
+
res.key = slot.key;
|
|
2925
2928
|
return res;
|
|
2926
2929
|
}
|
|
2927
2930
|
: slot.fn;
|
|
@@ -4573,7 +4576,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4573
4576
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
4574
4577
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
4575
4578
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
4576
|
-
|
|
4579
|
+
let domType = node.nodeType;
|
|
4577
4580
|
vnode.el = node;
|
|
4578
4581
|
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4579
4582
|
optimized = false;
|
|
@@ -4613,10 +4616,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4613
4616
|
}
|
|
4614
4617
|
break;
|
|
4615
4618
|
case Static:
|
|
4616
|
-
if (
|
|
4617
|
-
|
|
4619
|
+
if (isFragmentStart) {
|
|
4620
|
+
// entire template is static but SSRed as a fragment
|
|
4621
|
+
node = nextSibling(node);
|
|
4622
|
+
domType = node.nodeType;
|
|
4618
4623
|
}
|
|
4619
|
-
|
|
4624
|
+
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
|
|
4620
4625
|
// determine anchor, adopt content
|
|
4621
4626
|
nextNode = node;
|
|
4622
4627
|
// if the static vnode has its content stripped during build,
|
|
@@ -4633,7 +4638,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4633
4638
|
}
|
|
4634
4639
|
nextNode = nextSibling(nextNode);
|
|
4635
4640
|
}
|
|
4636
|
-
return nextNode;
|
|
4641
|
+
return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
|
4642
|
+
}
|
|
4643
|
+
else {
|
|
4644
|
+
onMismatch();
|
|
4637
4645
|
}
|
|
4638
4646
|
break;
|
|
4639
4647
|
case Fragment:
|
|
@@ -4958,7 +4966,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4958
4966
|
{
|
|
4959
4967
|
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
|
4960
4968
|
}
|
|
4961
|
-
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = shared.NOOP,
|
|
4969
|
+
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = shared.NOOP, insertStaticContent: hostInsertStaticContent } = options;
|
|
4962
4970
|
// Note: functions inside this closure should use `const xxx = () => {}`
|
|
4963
4971
|
// style in order to prevent being inlined by minifiers.
|
|
4964
4972
|
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
|
|
@@ -5085,46 +5093,44 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5085
5093
|
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5086
5094
|
let el;
|
|
5087
5095
|
let vnodeHook;
|
|
5088
|
-
const { type, props, shapeFlag, transition,
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5096
|
+
const { type, props, shapeFlag, transition, dirs } = vnode;
|
|
5097
|
+
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
5098
|
+
// mount children first, since some props may rely on child content
|
|
5099
|
+
// being already rendered, e.g. `<select value>`
|
|
5100
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5101
|
+
hostSetElementText(el, vnode.children);
|
|
5102
|
+
}
|
|
5103
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5104
|
+
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
5105
|
+
}
|
|
5106
|
+
if (dirs) {
|
|
5107
|
+
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
5108
|
+
}
|
|
5109
|
+
// props
|
|
5110
|
+
if (props) {
|
|
5111
|
+
for (const key in props) {
|
|
5112
|
+
if (key !== 'value' && !shared.isReservedProp(key)) {
|
|
5113
|
+
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5114
|
+
}
|
|
5098
5115
|
}
|
|
5099
|
-
|
|
5100
|
-
|
|
5116
|
+
/**
|
|
5117
|
+
* Special case for setting value on DOM elements:
|
|
5118
|
+
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
5119
|
+
* - it needs to be forced (#1471)
|
|
5120
|
+
* #2353 proposes adding another renderer option to configure this, but
|
|
5121
|
+
* the properties affects are so finite it is worth special casing it
|
|
5122
|
+
* here to reduce the complexity. (Special casing it also should not
|
|
5123
|
+
* affect non-DOM renderers)
|
|
5124
|
+
*/
|
|
5125
|
+
if ('value' in props) {
|
|
5126
|
+
hostPatchProp(el, 'value', null, props.value);
|
|
5101
5127
|
}
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
for (const key in props) {
|
|
5105
|
-
if (key !== 'value' && !shared.isReservedProp(key)) {
|
|
5106
|
-
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5107
|
-
}
|
|
5108
|
-
}
|
|
5109
|
-
/**
|
|
5110
|
-
* Special case for setting value on DOM elements:
|
|
5111
|
-
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
5112
|
-
* - it needs to be forced (#1471)
|
|
5113
|
-
* #2353 proposes adding another renderer option to configure this, but
|
|
5114
|
-
* the properties affects are so finite it is worth special casing it
|
|
5115
|
-
* here to reduce the complexity. (Special casing it also should not
|
|
5116
|
-
* affect non-DOM renderers)
|
|
5117
|
-
*/
|
|
5118
|
-
if ('value' in props) {
|
|
5119
|
-
hostPatchProp(el, 'value', null, props.value);
|
|
5120
|
-
}
|
|
5121
|
-
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
5122
|
-
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5123
|
-
}
|
|
5128
|
+
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
5129
|
+
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5124
5130
|
}
|
|
5125
|
-
// scopeId
|
|
5126
|
-
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
5127
5131
|
}
|
|
5132
|
+
// scopeId
|
|
5133
|
+
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
5128
5134
|
{
|
|
5129
5135
|
Object.defineProperty(el, '__vnode', {
|
|
5130
5136
|
value: vnode,
|
|
@@ -5310,6 +5316,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5310
5316
|
};
|
|
5311
5317
|
const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
|
|
5312
5318
|
if (oldProps !== newProps) {
|
|
5319
|
+
if (oldProps !== shared.EMPTY_OBJ) {
|
|
5320
|
+
for (const key in oldProps) {
|
|
5321
|
+
if (!shared.isReservedProp(key) && !(key in newProps)) {
|
|
5322
|
+
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5323
|
+
}
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5313
5326
|
for (const key in newProps) {
|
|
5314
5327
|
// empty string is not valid prop
|
|
5315
5328
|
if (shared.isReservedProp(key))
|
|
@@ -5321,13 +5334,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5321
5334
|
hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5322
5335
|
}
|
|
5323
5336
|
}
|
|
5324
|
-
if (oldProps !== shared.EMPTY_OBJ) {
|
|
5325
|
-
for (const key in oldProps) {
|
|
5326
|
-
if (!shared.isReservedProp(key) && !(key in newProps)) {
|
|
5327
|
-
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5328
|
-
}
|
|
5329
|
-
}
|
|
5330
|
-
}
|
|
5331
5337
|
if ('value' in newProps) {
|
|
5332
5338
|
hostPatchProp(el, 'value', oldProps.value, newProps.value);
|
|
5333
5339
|
}
|
|
@@ -6851,7 +6857,10 @@ function normalizeVNode(child) {
|
|
|
6851
6857
|
}
|
|
6852
6858
|
// optimized normalization for template-compiled render fns
|
|
6853
6859
|
function cloneIfMounted(child) {
|
|
6854
|
-
return child.el === null
|
|
6860
|
+
return (child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */) ||
|
|
6861
|
+
child.memo
|
|
6862
|
+
? child
|
|
6863
|
+
: cloneVNode(child);
|
|
6855
6864
|
}
|
|
6856
6865
|
function normalizeChildren(vnode, children) {
|
|
6857
6866
|
let type = 0;
|
|
@@ -7757,7 +7766,7 @@ function isMemoSame(cached, memo) {
|
|
|
7757
7766
|
}
|
|
7758
7767
|
|
|
7759
7768
|
// Core API ------------------------------------------------------------------
|
|
7760
|
-
const version = "3.2.
|
|
7769
|
+
const version = "3.2.40";
|
|
7761
7770
|
const _ssrUtils = {
|
|
7762
7771
|
createComponentInstance,
|
|
7763
7772
|
setupComponent,
|
|
@@ -2181,7 +2181,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2181
2181
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2182
2182
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2183
2183
|
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2184
|
-
injectHook(lifecycle, hook, target);
|
|
2184
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
2185
2185
|
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2186
2186
|
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2187
2187
|
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
@@ -2384,7 +2384,10 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2384
2384
|
slots[slot.name] = slot.key
|
|
2385
2385
|
? (...args) => {
|
|
2386
2386
|
const res = slot.fn(...args);
|
|
2387
|
-
|
|
2387
|
+
// attach branch key so each conditional branch is considered a
|
|
2388
|
+
// different fragment
|
|
2389
|
+
if (res)
|
|
2390
|
+
res.key = slot.key;
|
|
2388
2391
|
return res;
|
|
2389
2392
|
}
|
|
2390
2393
|
: slot.fn;
|
|
@@ -3591,7 +3594,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3591
3594
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
3592
3595
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
3593
3596
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
3594
|
-
|
|
3597
|
+
let domType = node.nodeType;
|
|
3595
3598
|
vnode.el = node;
|
|
3596
3599
|
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
3597
3600
|
optimized = false;
|
|
@@ -3628,10 +3631,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3628
3631
|
}
|
|
3629
3632
|
break;
|
|
3630
3633
|
case Static:
|
|
3631
|
-
if (
|
|
3632
|
-
|
|
3634
|
+
if (isFragmentStart) {
|
|
3635
|
+
// entire template is static but SSRed as a fragment
|
|
3636
|
+
node = nextSibling(node);
|
|
3637
|
+
domType = node.nodeType;
|
|
3633
3638
|
}
|
|
3634
|
-
|
|
3639
|
+
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
|
|
3635
3640
|
// determine anchor, adopt content
|
|
3636
3641
|
nextNode = node;
|
|
3637
3642
|
// if the static vnode has its content stripped during build,
|
|
@@ -3648,7 +3653,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3648
3653
|
}
|
|
3649
3654
|
nextNode = nextSibling(nextNode);
|
|
3650
3655
|
}
|
|
3651
|
-
return nextNode;
|
|
3656
|
+
return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
|
3657
|
+
}
|
|
3658
|
+
else {
|
|
3659
|
+
onMismatch();
|
|
3652
3660
|
}
|
|
3653
3661
|
break;
|
|
3654
3662
|
case Fragment:
|
|
@@ -3910,7 +3918,7 @@ function createHydrationRenderer(options) {
|
|
|
3910
3918
|
function baseCreateRenderer(options, createHydrationFns) {
|
|
3911
3919
|
const target = shared.getGlobalThis();
|
|
3912
3920
|
target.__VUE__ = true;
|
|
3913
|
-
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = shared.NOOP,
|
|
3921
|
+
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = shared.NOOP, insertStaticContent: hostInsertStaticContent } = options;
|
|
3914
3922
|
// Note: functions inside this closure should use `const xxx = () => {}`
|
|
3915
3923
|
// style in order to prevent being inlined by minifiers.
|
|
3916
3924
|
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => {
|
|
@@ -4016,55 +4024,44 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4016
4024
|
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
4017
4025
|
let el;
|
|
4018
4026
|
let vnodeHook;
|
|
4019
|
-
const { type, props, shapeFlag, transition,
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
// exactly the same, and we can simply do a clone here.
|
|
4026
|
-
// only do this in production since cloned trees cannot be HMR updated.
|
|
4027
|
-
el = vnode.el = hostCloneNode(vnode.el);
|
|
4027
|
+
const { type, props, shapeFlag, transition, dirs } = vnode;
|
|
4028
|
+
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
4029
|
+
// mount children first, since some props may rely on child content
|
|
4030
|
+
// being already rendered, e.g. `<select value>`
|
|
4031
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4032
|
+
hostSetElementText(el, vnode.children);
|
|
4028
4033
|
}
|
|
4029
|
-
else {
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4034
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4035
|
+
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
4036
|
+
}
|
|
4037
|
+
if (dirs) {
|
|
4038
|
+
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
4039
|
+
}
|
|
4040
|
+
// props
|
|
4041
|
+
if (props) {
|
|
4042
|
+
for (const key in props) {
|
|
4043
|
+
if (key !== 'value' && !shared.isReservedProp(key)) {
|
|
4044
|
+
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
4045
|
+
}
|
|
4035
4046
|
}
|
|
4036
|
-
|
|
4037
|
-
|
|
4047
|
+
/**
|
|
4048
|
+
* Special case for setting value on DOM elements:
|
|
4049
|
+
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
4050
|
+
* - it needs to be forced (#1471)
|
|
4051
|
+
* #2353 proposes adding another renderer option to configure this, but
|
|
4052
|
+
* the properties affects are so finite it is worth special casing it
|
|
4053
|
+
* here to reduce the complexity. (Special casing it also should not
|
|
4054
|
+
* affect non-DOM renderers)
|
|
4055
|
+
*/
|
|
4056
|
+
if ('value' in props) {
|
|
4057
|
+
hostPatchProp(el, 'value', null, props.value);
|
|
4038
4058
|
}
|
|
4039
|
-
if (
|
|
4040
|
-
|
|
4059
|
+
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
4060
|
+
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4041
4061
|
}
|
|
4042
|
-
// props
|
|
4043
|
-
if (props) {
|
|
4044
|
-
for (const key in props) {
|
|
4045
|
-
if (key !== 'value' && !shared.isReservedProp(key)) {
|
|
4046
|
-
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
4047
|
-
}
|
|
4048
|
-
}
|
|
4049
|
-
/**
|
|
4050
|
-
* Special case for setting value on DOM elements:
|
|
4051
|
-
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
4052
|
-
* - it needs to be forced (#1471)
|
|
4053
|
-
* #2353 proposes adding another renderer option to configure this, but
|
|
4054
|
-
* the properties affects are so finite it is worth special casing it
|
|
4055
|
-
* here to reduce the complexity. (Special casing it also should not
|
|
4056
|
-
* affect non-DOM renderers)
|
|
4057
|
-
*/
|
|
4058
|
-
if ('value' in props) {
|
|
4059
|
-
hostPatchProp(el, 'value', null, props.value);
|
|
4060
|
-
}
|
|
4061
|
-
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
4062
|
-
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4063
|
-
}
|
|
4064
|
-
}
|
|
4065
|
-
// scopeId
|
|
4066
|
-
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
4067
4062
|
}
|
|
4063
|
+
// scopeId
|
|
4064
|
+
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
4068
4065
|
if (dirs) {
|
|
4069
4066
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeMount');
|
|
4070
4067
|
}
|
|
@@ -4226,6 +4223,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4226
4223
|
};
|
|
4227
4224
|
const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
|
|
4228
4225
|
if (oldProps !== newProps) {
|
|
4226
|
+
if (oldProps !== shared.EMPTY_OBJ) {
|
|
4227
|
+
for (const key in oldProps) {
|
|
4228
|
+
if (!shared.isReservedProp(key) && !(key in newProps)) {
|
|
4229
|
+
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
4230
|
+
}
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4229
4233
|
for (const key in newProps) {
|
|
4230
4234
|
// empty string is not valid prop
|
|
4231
4235
|
if (shared.isReservedProp(key))
|
|
@@ -4237,13 +4241,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4237
4241
|
hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
4238
4242
|
}
|
|
4239
4243
|
}
|
|
4240
|
-
if (oldProps !== shared.EMPTY_OBJ) {
|
|
4241
|
-
for (const key in oldProps) {
|
|
4242
|
-
if (!shared.isReservedProp(key) && !(key in newProps)) {
|
|
4243
|
-
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
4244
|
-
}
|
|
4245
|
-
}
|
|
4246
|
-
}
|
|
4247
4244
|
if ('value' in newProps) {
|
|
4248
4245
|
hostPatchProp(el, 'value', oldProps.value, newProps.value);
|
|
4249
4246
|
}
|
|
@@ -5583,7 +5580,10 @@ function normalizeVNode(child) {
|
|
|
5583
5580
|
}
|
|
5584
5581
|
// optimized normalization for template-compiled render fns
|
|
5585
5582
|
function cloneIfMounted(child) {
|
|
5586
|
-
return child.el === null
|
|
5583
|
+
return (child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */) ||
|
|
5584
|
+
child.memo
|
|
5585
|
+
? child
|
|
5586
|
+
: cloneVNode(child);
|
|
5587
5587
|
}
|
|
5588
5588
|
function normalizeChildren(vnode, children) {
|
|
5589
5589
|
let type = 0;
|
|
@@ -6186,7 +6186,7 @@ function isMemoSame(cached, memo) {
|
|
|
6186
6186
|
}
|
|
6187
6187
|
|
|
6188
6188
|
// Core API ------------------------------------------------------------------
|
|
6189
|
-
const version = "3.2.
|
|
6189
|
+
const version = "3.2.40";
|
|
6190
6190
|
const _ssrUtils = {
|
|
6191
6191
|
createComponentInstance,
|
|
6192
6192
|
setupComponent,
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -261,7 +261,7 @@ export declare type CompatVue = Pick<App, 'version' | 'component' | 'directive'>
|
|
|
261
261
|
|
|
262
262
|
declare interface CompiledSlotDescriptor {
|
|
263
263
|
name: string;
|
|
264
|
-
fn:
|
|
264
|
+
fn: SSRSlot;
|
|
265
265
|
key?: string;
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -607,7 +607,7 @@ export declare function createRenderer<HostNode = RendererNode, HostElement = Re
|
|
|
607
607
|
* Compiler runtime helper for creating dynamic slots object
|
|
608
608
|
* @private
|
|
609
609
|
*/
|
|
610
|
-
export declare function createSlots(slots: Record<string,
|
|
610
|
+
export declare function createSlots(slots: Record<string, SSRSlot>, dynamicSlots: (CompiledSlotDescriptor | CompiledSlotDescriptor[] | undefined)[]): Record<string, SSRSlot>;
|
|
611
611
|
|
|
612
612
|
/**
|
|
613
613
|
* @private
|
|
@@ -1667,6 +1667,8 @@ export declare const ssrContextKey: unique symbol;
|
|
|
1667
1667
|
|
|
1668
1668
|
declare type SSRDirectiveHook = (binding: DirectiveBinding, vnode: VNode) => Data | undefined;
|
|
1669
1669
|
|
|
1670
|
+
declare type SSRSlot = (...args: any[]) => VNode[] | undefined;
|
|
1671
|
+
|
|
1670
1672
|
/* Excluded from this release type: ssrUtils */
|
|
1671
1673
|
|
|
1672
1674
|
export declare const Static: unique symbol;
|
|
@@ -2707,7 +2707,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2707
2707
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2708
2708
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2709
2709
|
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2710
|
-
injectHook(lifecycle, hook, target);
|
|
2710
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
2711
2711
|
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2712
2712
|
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2713
2713
|
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
@@ -2930,7 +2930,10 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2930
2930
|
slots[slot.name] = slot.key
|
|
2931
2931
|
? (...args) => {
|
|
2932
2932
|
const res = slot.fn(...args);
|
|
2933
|
-
|
|
2933
|
+
// attach branch key so each conditional branch is considered a
|
|
2934
|
+
// different fragment
|
|
2935
|
+
if (res)
|
|
2936
|
+
res.key = slot.key;
|
|
2934
2937
|
return res;
|
|
2935
2938
|
}
|
|
2936
2939
|
: slot.fn;
|
|
@@ -4597,7 +4600,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4597
4600
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
4598
4601
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
4599
4602
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
4600
|
-
|
|
4603
|
+
let domType = node.nodeType;
|
|
4601
4604
|
vnode.el = node;
|
|
4602
4605
|
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4603
4606
|
optimized = false;
|
|
@@ -4638,10 +4641,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4638
4641
|
}
|
|
4639
4642
|
break;
|
|
4640
4643
|
case Static:
|
|
4641
|
-
if (
|
|
4642
|
-
|
|
4644
|
+
if (isFragmentStart) {
|
|
4645
|
+
// entire template is static but SSRed as a fragment
|
|
4646
|
+
node = nextSibling(node);
|
|
4647
|
+
domType = node.nodeType;
|
|
4643
4648
|
}
|
|
4644
|
-
|
|
4649
|
+
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
|
|
4645
4650
|
// determine anchor, adopt content
|
|
4646
4651
|
nextNode = node;
|
|
4647
4652
|
// if the static vnode has its content stripped during build,
|
|
@@ -4658,7 +4663,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4658
4663
|
}
|
|
4659
4664
|
nextNode = nextSibling(nextNode);
|
|
4660
4665
|
}
|
|
4661
|
-
return nextNode;
|
|
4666
|
+
return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
|
4667
|
+
}
|
|
4668
|
+
else {
|
|
4669
|
+
onMismatch();
|
|
4662
4670
|
}
|
|
4663
4671
|
break;
|
|
4664
4672
|
case Fragment:
|
|
@@ -5016,7 +5024,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5016
5024
|
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
|
|
5017
5025
|
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
|
5018
5026
|
}
|
|
5019
|
-
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP,
|
|
5027
|
+
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, insertStaticContent: hostInsertStaticContent } = options;
|
|
5020
5028
|
// Note: functions inside this closure should use `const xxx = () => {}`
|
|
5021
5029
|
// style in order to prevent being inlined by minifiers.
|
|
5022
5030
|
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = (process.env.NODE_ENV !== 'production') && isHmrUpdating ? false : !!n2.dynamicChildren) => {
|
|
@@ -5143,56 +5151,44 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5143
5151
|
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5144
5152
|
let el;
|
|
5145
5153
|
let vnodeHook;
|
|
5146
|
-
const { type, props, shapeFlag, transition,
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
// Only static vnodes can be reused, so its mounted DOM nodes should be
|
|
5153
|
-
// exactly the same, and we can simply do a clone here.
|
|
5154
|
-
// only do this in production since cloned trees cannot be HMR updated.
|
|
5155
|
-
el = vnode.el = hostCloneNode(vnode.el);
|
|
5154
|
+
const { type, props, shapeFlag, transition, dirs } = vnode;
|
|
5155
|
+
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
5156
|
+
// mount children first, since some props may rely on child content
|
|
5157
|
+
// being already rendered, e.g. `<select value>`
|
|
5158
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5159
|
+
hostSetElementText(el, vnode.children);
|
|
5156
5160
|
}
|
|
5157
|
-
else {
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5161
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5162
|
+
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
5163
|
+
}
|
|
5164
|
+
if (dirs) {
|
|
5165
|
+
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
5166
|
+
}
|
|
5167
|
+
// props
|
|
5168
|
+
if (props) {
|
|
5169
|
+
for (const key in props) {
|
|
5170
|
+
if (key !== 'value' && !isReservedProp(key)) {
|
|
5171
|
+
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5172
|
+
}
|
|
5163
5173
|
}
|
|
5164
|
-
|
|
5165
|
-
|
|
5174
|
+
/**
|
|
5175
|
+
* Special case for setting value on DOM elements:
|
|
5176
|
+
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
5177
|
+
* - it needs to be forced (#1471)
|
|
5178
|
+
* #2353 proposes adding another renderer option to configure this, but
|
|
5179
|
+
* the properties affects are so finite it is worth special casing it
|
|
5180
|
+
* here to reduce the complexity. (Special casing it also should not
|
|
5181
|
+
* affect non-DOM renderers)
|
|
5182
|
+
*/
|
|
5183
|
+
if ('value' in props) {
|
|
5184
|
+
hostPatchProp(el, 'value', null, props.value);
|
|
5166
5185
|
}
|
|
5167
|
-
if (
|
|
5168
|
-
|
|
5186
|
+
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
5187
|
+
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5169
5188
|
}
|
|
5170
|
-
// props
|
|
5171
|
-
if (props) {
|
|
5172
|
-
for (const key in props) {
|
|
5173
|
-
if (key !== 'value' && !isReservedProp(key)) {
|
|
5174
|
-
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5175
|
-
}
|
|
5176
|
-
}
|
|
5177
|
-
/**
|
|
5178
|
-
* Special case for setting value on DOM elements:
|
|
5179
|
-
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
5180
|
-
* - it needs to be forced (#1471)
|
|
5181
|
-
* #2353 proposes adding another renderer option to configure this, but
|
|
5182
|
-
* the properties affects are so finite it is worth special casing it
|
|
5183
|
-
* here to reduce the complexity. (Special casing it also should not
|
|
5184
|
-
* affect non-DOM renderers)
|
|
5185
|
-
*/
|
|
5186
|
-
if ('value' in props) {
|
|
5187
|
-
hostPatchProp(el, 'value', null, props.value);
|
|
5188
|
-
}
|
|
5189
|
-
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
5190
|
-
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5191
|
-
}
|
|
5192
|
-
}
|
|
5193
|
-
// scopeId
|
|
5194
|
-
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
5195
5189
|
}
|
|
5190
|
+
// scopeId
|
|
5191
|
+
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
5196
5192
|
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
|
|
5197
5193
|
Object.defineProperty(el, '__vnode', {
|
|
5198
5194
|
value: vnode,
|
|
@@ -5379,6 +5375,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5379
5375
|
};
|
|
5380
5376
|
const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
|
|
5381
5377
|
if (oldProps !== newProps) {
|
|
5378
|
+
if (oldProps !== EMPTY_OBJ) {
|
|
5379
|
+
for (const key in oldProps) {
|
|
5380
|
+
if (!isReservedProp(key) && !(key in newProps)) {
|
|
5381
|
+
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5382
5385
|
for (const key in newProps) {
|
|
5383
5386
|
// empty string is not valid prop
|
|
5384
5387
|
if (isReservedProp(key))
|
|
@@ -5390,13 +5393,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5390
5393
|
hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5391
5394
|
}
|
|
5392
5395
|
}
|
|
5393
|
-
if (oldProps !== EMPTY_OBJ) {
|
|
5394
|
-
for (const key in oldProps) {
|
|
5395
|
-
if (!isReservedProp(key) && !(key in newProps)) {
|
|
5396
|
-
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
5397
|
-
}
|
|
5398
|
-
}
|
|
5399
|
-
}
|
|
5400
5396
|
if ('value' in newProps) {
|
|
5401
5397
|
hostPatchProp(el, 'value', oldProps.value, newProps.value);
|
|
5402
5398
|
}
|
|
@@ -6927,7 +6923,10 @@ function normalizeVNode(child) {
|
|
|
6927
6923
|
}
|
|
6928
6924
|
// optimized normalization for template-compiled render fns
|
|
6929
6925
|
function cloneIfMounted(child) {
|
|
6930
|
-
return child.el === null
|
|
6926
|
+
return (child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */) ||
|
|
6927
|
+
child.memo
|
|
6928
|
+
? child
|
|
6929
|
+
: cloneVNode(child);
|
|
6931
6930
|
}
|
|
6932
6931
|
function normalizeChildren(vnode, children) {
|
|
6933
6932
|
let type = 0;
|
|
@@ -7853,7 +7852,7 @@ function isMemoSame(cached, memo) {
|
|
|
7853
7852
|
}
|
|
7854
7853
|
|
|
7855
7854
|
// Core API ------------------------------------------------------------------
|
|
7856
|
-
const version = "3.2.
|
|
7855
|
+
const version = "3.2.40";
|
|
7857
7856
|
const _ssrUtils = {
|
|
7858
7857
|
createComponentInstance,
|
|
7859
7858
|
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.40",
|
|
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/core/tree/main/packages/runtime-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
36
|
-
"@vue/reactivity": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.40",
|
|
36
|
+
"@vue/reactivity": "3.2.40"
|
|
37
37
|
}
|
|
38
38
|
}
|