@vue/runtime-core 3.4.0-alpha.4 → 3.4.0-beta.1

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.
@@ -1,6 +1,6 @@
1
- import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
1
+ import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, customRef, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
2
2
  export { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
3
- import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, normalizeStyle } from '@vue/shared';
3
+ import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, capitalize, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, isGloballyAllowed, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr } from '@vue/shared';
4
4
  export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
5
5
 
6
6
  const stack = [];
@@ -326,13 +326,16 @@ function queuePostFlushCb(cb) {
326
326
  }
327
327
  queueFlush();
328
328
  }
329
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
329
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
330
330
  if (!!(process.env.NODE_ENV !== "production")) {
331
331
  seen = seen || /* @__PURE__ */ new Map();
332
332
  }
333
333
  for (; i < queue.length; i++) {
334
334
  const cb = queue[i];
335
335
  if (cb && cb.pre) {
336
+ if (instance && cb.id !== instance.uid) {
337
+ continue;
338
+ }
336
339
  if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
337
340
  continue;
338
341
  }
@@ -1092,9 +1095,17 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
1092
1095
  return false;
1093
1096
  }
1094
1097
  function updateHOCHostEl({ vnode, parent }, el) {
1095
- while (parent && parent.subTree === vnode) {
1096
- (vnode = parent.vnode).el = el;
1097
- parent = parent.parent;
1098
+ while (parent) {
1099
+ const root = parent.subTree;
1100
+ if (root.suspense && root.suspense.activeBranch === vnode) {
1101
+ root.el = vnode.el;
1102
+ }
1103
+ if (root === vnode) {
1104
+ (vnode = parent.vnode).el = el;
1105
+ parent = parent.parent;
1106
+ } else {
1107
+ break;
1108
+ }
1098
1109
  }
1099
1110
  }
1100
1111
 
@@ -1154,6 +1165,7 @@ function resolve(registry, name) {
1154
1165
  }
1155
1166
 
1156
1167
  const isSuspense = (type) => type.__isSuspense;
1168
+ let suspenseId = 0;
1157
1169
  const SuspenseImpl = {
1158
1170
  name: "Suspense",
1159
1171
  // In order to make Suspense tree-shakable, we need to avoid importing it
@@ -1161,7 +1173,7 @@ const SuspenseImpl = {
1161
1173
  // on a vnode's type and calls the `process` method, passing in renderer
1162
1174
  // internals.
1163
1175
  __isSuspense: true,
1164
- process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
1176
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
1165
1177
  if (n1 == null) {
1166
1178
  mountSuspense(
1167
1179
  n2,
@@ -1169,7 +1181,7 @@ const SuspenseImpl = {
1169
1181
  anchor,
1170
1182
  parentComponent,
1171
1183
  parentSuspense,
1172
- isSVG,
1184
+ namespace,
1173
1185
  slotScopeIds,
1174
1186
  optimized,
1175
1187
  rendererInternals
@@ -1181,7 +1193,7 @@ const SuspenseImpl = {
1181
1193
  container,
1182
1194
  anchor,
1183
1195
  parentComponent,
1184
- isSVG,
1196
+ namespace,
1185
1197
  slotScopeIds,
1186
1198
  optimized,
1187
1199
  rendererInternals
@@ -1199,7 +1211,7 @@ function triggerEvent(vnode, name) {
1199
1211
  eventListener();
1200
1212
  }
1201
1213
  }
1202
- function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
1214
+ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
1203
1215
  const {
1204
1216
  p: patch,
1205
1217
  o: { createElement }
@@ -1212,7 +1224,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1212
1224
  container,
1213
1225
  hiddenContainer,
1214
1226
  anchor,
1215
- isSVG,
1227
+ namespace,
1216
1228
  slotScopeIds,
1217
1229
  optimized,
1218
1230
  rendererInternals
@@ -1224,7 +1236,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1224
1236
  null,
1225
1237
  parentComponent,
1226
1238
  suspense,
1227
- isSVG,
1239
+ namespace,
1228
1240
  slotScopeIds
1229
1241
  );
1230
1242
  if (suspense.deps > 0) {
@@ -1238,7 +1250,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1238
1250
  parentComponent,
1239
1251
  null,
1240
1252
  // fallback tree will not have suspense context
1241
- isSVG,
1253
+ namespace,
1242
1254
  slotScopeIds
1243
1255
  );
1244
1256
  setActiveBranch(suspense, vnode.ssFallback);
@@ -1246,7 +1258,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1246
1258
  suspense.resolve(false, true);
1247
1259
  }
1248
1260
  }
1249
- function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
1261
+ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
1250
1262
  const suspense = n2.suspense = n1.suspense;
1251
1263
  suspense.vnode = n2;
1252
1264
  n2.el = n1.el;
@@ -1263,29 +1275,31 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1263
1275
  null,
1264
1276
  parentComponent,
1265
1277
  suspense,
1266
- isSVG,
1278
+ namespace,
1267
1279
  slotScopeIds,
1268
1280
  optimized
1269
1281
  );
1270
1282
  if (suspense.deps <= 0) {
1271
1283
  suspense.resolve();
1272
1284
  } else if (isInFallback) {
1273
- patch(
1274
- activeBranch,
1275
- newFallback,
1276
- container,
1277
- anchor,
1278
- parentComponent,
1279
- null,
1280
- // fallback tree will not have suspense context
1281
- isSVG,
1282
- slotScopeIds,
1283
- optimized
1284
- );
1285
- setActiveBranch(suspense, newFallback);
1285
+ if (!isHydrating) {
1286
+ patch(
1287
+ activeBranch,
1288
+ newFallback,
1289
+ container,
1290
+ anchor,
1291
+ parentComponent,
1292
+ null,
1293
+ // fallback tree will not have suspense context
1294
+ namespace,
1295
+ slotScopeIds,
1296
+ optimized
1297
+ );
1298
+ setActiveBranch(suspense, newFallback);
1299
+ }
1286
1300
  }
1287
1301
  } else {
1288
- suspense.pendingId++;
1302
+ suspense.pendingId = suspenseId++;
1289
1303
  if (isHydrating) {
1290
1304
  suspense.isHydrating = false;
1291
1305
  suspense.activeBranch = pendingBranch;
@@ -1303,7 +1317,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1303
1317
  null,
1304
1318
  parentComponent,
1305
1319
  suspense,
1306
- isSVG,
1320
+ namespace,
1307
1321
  slotScopeIds,
1308
1322
  optimized
1309
1323
  );
@@ -1318,7 +1332,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1318
1332
  parentComponent,
1319
1333
  null,
1320
1334
  // fallback tree will not have suspense context
1321
- isSVG,
1335
+ namespace,
1322
1336
  slotScopeIds,
1323
1337
  optimized
1324
1338
  );
@@ -1332,7 +1346,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1332
1346
  anchor,
1333
1347
  parentComponent,
1334
1348
  suspense,
1335
- isSVG,
1349
+ namespace,
1336
1350
  slotScopeIds,
1337
1351
  optimized
1338
1352
  );
@@ -1345,7 +1359,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1345
1359
  null,
1346
1360
  parentComponent,
1347
1361
  suspense,
1348
- isSVG,
1362
+ namespace,
1349
1363
  slotScopeIds,
1350
1364
  optimized
1351
1365
  );
@@ -1363,7 +1377,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1363
1377
  anchor,
1364
1378
  parentComponent,
1365
1379
  suspense,
1366
- isSVG,
1380
+ namespace,
1367
1381
  slotScopeIds,
1368
1382
  optimized
1369
1383
  );
@@ -1371,7 +1385,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1371
1385
  } else {
1372
1386
  triggerEvent(n2, "onPending");
1373
1387
  suspense.pendingBranch = newBranch;
1374
- suspense.pendingId++;
1388
+ if (newBranch.shapeFlag & 512) {
1389
+ suspense.pendingId = newBranch.component.suspenseId;
1390
+ } else {
1391
+ suspense.pendingId = suspenseId++;
1392
+ }
1375
1393
  patch(
1376
1394
  null,
1377
1395
  newBranch,
@@ -1379,7 +1397,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1379
1397
  null,
1380
1398
  parentComponent,
1381
1399
  suspense,
1382
- isSVG,
1400
+ namespace,
1383
1401
  slotScopeIds,
1384
1402
  optimized
1385
1403
  );
@@ -1401,7 +1419,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1401
1419
  }
1402
1420
  }
1403
1421
  let hasWarned = false;
1404
- function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1422
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1405
1423
  if (!!(process.env.NODE_ENV !== "production") && true && !hasWarned) {
1406
1424
  hasWarned = true;
1407
1425
  console[console.info ? "info" : "log"](
@@ -1431,7 +1449,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1431
1449
  vnode,
1432
1450
  parent: parentSuspense,
1433
1451
  parentComponent,
1434
- isSVG,
1452
+ namespace,
1435
1453
  container,
1436
1454
  hiddenContainer,
1437
1455
  anchor,
@@ -1440,7 +1458,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1440
1458
  timeout: typeof timeout === "number" ? timeout : -1,
1441
1459
  activeBranch: null,
1442
1460
  pendingBranch: null,
1443
- isInFallback: true,
1461
+ isInFallback: !isHydrating,
1444
1462
  isHydrating,
1445
1463
  isUnmounted: false,
1446
1464
  effects: [],
@@ -1524,8 +1542,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1524
1542
  if (!suspense.pendingBranch) {
1525
1543
  return;
1526
1544
  }
1527
- const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
1545
+ const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
1528
1546
  triggerEvent(vnode2, "onFallback");
1547
+ const anchor2 = next(activeBranch);
1529
1548
  const mountFallback = () => {
1530
1549
  if (!suspense.isInFallback) {
1531
1550
  return;
@@ -1534,11 +1553,11 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1534
1553
  null,
1535
1554
  fallbackVNode,
1536
1555
  container2,
1537
- next(activeBranch),
1556
+ anchor2,
1538
1557
  parentComponent2,
1539
1558
  null,
1540
1559
  // fallback tree will not have suspense context
1541
- isSVG2,
1560
+ namespace2,
1542
1561
  slotScopeIds,
1543
1562
  optimized
1544
1563
  );
@@ -1601,7 +1620,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1601
1620
  // consider the comment placeholder case.
1602
1621
  hydratedEl ? null : next(instance.subTree),
1603
1622
  suspense,
1604
- isSVG,
1623
+ namespace,
1605
1624
  optimized
1606
1625
  );
1607
1626
  if (placeholder) {
@@ -1638,7 +1657,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1638
1657
  };
1639
1658
  return suspense;
1640
1659
  }
1641
- function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
1660
+ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
1642
1661
  const suspense = vnode.suspense = createSuspenseBoundary(
1643
1662
  vnode,
1644
1663
  parentSuspense,
@@ -1646,7 +1665,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
1646
1665
  node.parentNode,
1647
1666
  document.createElement("div"),
1648
1667
  null,
1649
- isSVG,
1668
+ namespace,
1650
1669
  slotScopeIds,
1651
1670
  optimized,
1652
1671
  rendererInternals,
@@ -2563,7 +2582,7 @@ const KeepAliveImpl = {
2563
2582
  }
2564
2583
  } = sharedContext;
2565
2584
  const storageContainer = createElement("div");
2566
- sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
2585
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2567
2586
  const instance2 = vnode.component;
2568
2587
  move(vnode, container, anchor, 0, parentSuspense);
2569
2588
  patch(
@@ -2573,7 +2592,7 @@ const KeepAliveImpl = {
2573
2592
  anchor,
2574
2593
  instance2,
2575
2594
  parentSuspense,
2576
- isSVG,
2595
+ namespace,
2577
2596
  vnode.slotScopeIds,
2578
2597
  optimized
2579
2598
  );
@@ -3239,7 +3258,7 @@ function useSlots() {
3239
3258
  function useAttrs() {
3240
3259
  return getContext().attrs;
3241
3260
  }
3242
- function useModel(props, name, options) {
3261
+ function useModel(props, name) {
3243
3262
  const i = getCurrentInstance();
3244
3263
  if (!!(process.env.NODE_ENV !== "production") && !i) {
3245
3264
  warn(`useModel() called without active instance.`);
@@ -3249,29 +3268,24 @@ function useModel(props, name, options) {
3249
3268
  warn(`useModel() called with prop "${name}" which is not declared.`);
3250
3269
  return ref();
3251
3270
  }
3252
- if (options && options.local) {
3253
- const proxy = ref(props[name]);
3254
- watch(
3255
- () => props[name],
3256
- (v) => proxy.value = v
3257
- );
3258
- watch(proxy, (value) => {
3259
- if (value !== props[name]) {
3260
- i.emit(`update:${name}`, value);
3261
- }
3262
- });
3263
- return proxy;
3264
- } else {
3265
- return {
3266
- __v_isRef: true,
3267
- get value() {
3268
- return props[name];
3269
- },
3270
- set value(value) {
3271
- i.emit(`update:${name}`, value);
3271
+ let localValue;
3272
+ watchSyncEffect(() => {
3273
+ localValue = props[name];
3274
+ });
3275
+ return customRef((track, trigger) => ({
3276
+ get() {
3277
+ track();
3278
+ return localValue;
3279
+ },
3280
+ set(value) {
3281
+ const rawProps = i.vnode.props;
3282
+ if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
3283
+ localValue = value;
3284
+ trigger();
3272
3285
  }
3273
- };
3274
- }
3286
+ i.emit(`update:${name}`, value);
3287
+ }
3288
+ }));
3275
3289
  }
3276
3290
  function getContext() {
3277
3291
  const i = getCurrentInstance();
@@ -3869,7 +3883,7 @@ function createAppAPI(render, hydrate) {
3869
3883
  context.directives[name] = directive;
3870
3884
  return app;
3871
3885
  },
3872
- mount(rootContainer, isHydrate, isSVG) {
3886
+ mount(rootContainer, isHydrate, namespace) {
3873
3887
  if (!isMounted) {
3874
3888
  if (!!(process.env.NODE_ENV !== "production") && rootContainer.__vue_app__) {
3875
3889
  warn(
@@ -3879,15 +3893,24 @@ function createAppAPI(render, hydrate) {
3879
3893
  }
3880
3894
  const vnode = createVNode(rootComponent, rootProps);
3881
3895
  vnode.appContext = context;
3896
+ if (namespace === true) {
3897
+ namespace = "svg";
3898
+ } else if (namespace === false) {
3899
+ namespace = void 0;
3900
+ }
3882
3901
  if (!!(process.env.NODE_ENV !== "production")) {
3883
3902
  context.reload = () => {
3884
- render(cloneVNode(vnode), rootContainer, isSVG);
3903
+ render(
3904
+ cloneVNode(vnode),
3905
+ rootContainer,
3906
+ namespace
3907
+ );
3885
3908
  };
3886
3909
  }
3887
3910
  if (isHydrate && hydrate) {
3888
3911
  hydrate(vnode, rootContainer);
3889
3912
  } else {
3890
- render(vnode, rootContainer, isSVG);
3913
+ render(vnode, rootContainer, namespace);
3891
3914
  }
3892
3915
  isMounted = true;
3893
3916
  app._container = rootContainer;
@@ -4277,11 +4300,12 @@ function validateProps(rawProps, props, instance) {
4277
4300
  key,
4278
4301
  resolvedValues[key],
4279
4302
  opt,
4303
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(resolvedValues) : resolvedValues,
4280
4304
  !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
4281
4305
  );
4282
4306
  }
4283
4307
  }
4284
- function validateProp(name, value, prop, isAbsent) {
4308
+ function validateProp(name, value, prop, props, isAbsent) {
4285
4309
  const { type, required, validator, skipCheck } = prop;
4286
4310
  if (required && isAbsent) {
4287
4311
  warn('Missing required prop: "' + name + '"');
@@ -4304,7 +4328,7 @@ function validateProp(name, value, prop, isAbsent) {
4304
4328
  return;
4305
4329
  }
4306
4330
  }
4307
- if (validator && !validator(value)) {
4331
+ if (validator && !validator(value, props)) {
4308
4332
  warn('Invalid prop: custom validator check failed for prop "' + name + '".');
4309
4333
  }
4310
4334
  }
@@ -4560,7 +4584,15 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4560
4584
  }
4561
4585
 
4562
4586
  let hasMismatch = false;
4563
- const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
4587
+ const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4588
+ const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4589
+ const getContainerType = (container) => {
4590
+ if (isSVGContainer(container))
4591
+ return "svg";
4592
+ if (isMathMLContainer(container))
4593
+ return "mathml";
4594
+ return void 0;
4595
+ };
4564
4596
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
4565
4597
  function createHydrationFunctions(rendererInternals) {
4566
4598
  const {
@@ -4578,7 +4610,7 @@ function createHydrationFunctions(rendererInternals) {
4578
4610
  } = rendererInternals;
4579
4611
  const hydrate = (vnode, container) => {
4580
4612
  if (!container.hasChildNodes()) {
4581
- !!(process.env.NODE_ENV !== "production") && warn(
4613
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
4582
4614
  `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`
4583
4615
  );
4584
4616
  patch(null, vnode, container);
@@ -4638,12 +4670,14 @@ function createHydrationFunctions(rendererInternals) {
4638
4670
  } else {
4639
4671
  if (node.data !== vnode.children) {
4640
4672
  hasMismatch = true;
4641
- !!(process.env.NODE_ENV !== "production") && warn(
4642
- `Hydration text mismatch:
4643
- - Server rendered: ${JSON.stringify(
4673
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
4674
+ `Hydration text mismatch in`,
4675
+ node.parentNode,
4676
+ `
4677
+ - rendered on server: ${JSON.stringify(
4644
4678
  node.data
4645
4679
  )}
4646
- - Client rendered: ${JSON.stringify(vnode.children)}`
4680
+ - expected on client: ${JSON.stringify(vnode.children)}`
4647
4681
  );
4648
4682
  node.data = vnode.children;
4649
4683
  }
@@ -4729,7 +4763,7 @@ function createHydrationFunctions(rendererInternals) {
4729
4763
  null,
4730
4764
  parentComponent,
4731
4765
  parentSuspense,
4732
- isSVGContainer(container),
4766
+ getContainerType(container),
4733
4767
  optimized
4734
4768
  );
4735
4769
  if (isAsyncWrapper(vnode)) {
@@ -4764,13 +4798,13 @@ function createHydrationFunctions(rendererInternals) {
4764
4798
  vnode,
4765
4799
  parentComponent,
4766
4800
  parentSuspense,
4767
- isSVGContainer(parentNode(node)),
4801
+ getContainerType(parentNode(node)),
4768
4802
  slotScopeIds,
4769
4803
  optimized,
4770
4804
  rendererInternals,
4771
4805
  hydrateNode
4772
4806
  );
4773
- } else if (!!(process.env.NODE_ENV !== "production")) {
4807
+ } else if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) {
4774
4808
  warn("Invalid HostVNode type:", type, `(${typeof type})`);
4775
4809
  }
4776
4810
  }
@@ -4787,38 +4821,6 @@ function createHydrationFunctions(rendererInternals) {
4787
4821
  if (dirs) {
4788
4822
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4789
4823
  }
4790
- if (props) {
4791
- if (forcePatch || !optimized || patchFlag & (16 | 32)) {
4792
- for (const key in props) {
4793
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4794
- key[0] === ".") {
4795
- patchProp(
4796
- el,
4797
- key,
4798
- null,
4799
- props[key],
4800
- false,
4801
- void 0,
4802
- parentComponent
4803
- );
4804
- }
4805
- }
4806
- } else if (props.onClick) {
4807
- patchProp(
4808
- el,
4809
- "onClick",
4810
- null,
4811
- props.onClick,
4812
- false,
4813
- void 0,
4814
- parentComponent
4815
- );
4816
- }
4817
- }
4818
- let vnodeHooks;
4819
- if (vnodeHooks = props && props.onVnodeBeforeMount) {
4820
- invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4821
- }
4822
4824
  let needCallTransitionHooks = false;
4823
4825
  if (isTemplateNode(el)) {
4824
4826
  needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
@@ -4829,16 +4831,6 @@ function createHydrationFunctions(rendererInternals) {
4829
4831
  replaceNode(content, el, parentComponent);
4830
4832
  vnode.el = el = content;
4831
4833
  }
4832
- if (dirs) {
4833
- invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4834
- }
4835
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4836
- queueEffectWithSuspense(() => {
4837
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4838
- needCallTransitionHooks && transition.enter(el);
4839
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4840
- }, parentSuspense);
4841
- }
4842
4834
  if (shapeFlag & 16 && // skip if element has innerHTML / textContent
4843
4835
  !(props && (props.innerHTML || props.textContent))) {
4844
4836
  let next = hydrateChildren(
@@ -4853,9 +4845,12 @@ function createHydrationFunctions(rendererInternals) {
4853
4845
  let hasWarned = false;
4854
4846
  while (next) {
4855
4847
  hasMismatch = true;
4856
- if (!!(process.env.NODE_ENV !== "production") && !hasWarned) {
4848
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4857
4849
  warn(
4858
- `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
4850
+ `Hydration children mismatch on`,
4851
+ el,
4852
+ `
4853
+ Server rendered element contains more child nodes than client vdom.`
4859
4854
  );
4860
4855
  hasWarned = true;
4861
4856
  }
@@ -4866,14 +4861,61 @@ function createHydrationFunctions(rendererInternals) {
4866
4861
  } else if (shapeFlag & 8) {
4867
4862
  if (el.textContent !== vnode.children) {
4868
4863
  hasMismatch = true;
4869
- !!(process.env.NODE_ENV !== "production") && warn(
4870
- `Hydration text content mismatch in <${vnode.type}>:
4871
- - Server rendered: ${el.textContent}
4872
- - Client rendered: ${vnode.children}`
4864
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
4865
+ `Hydration text content mismatch on`,
4866
+ el,
4867
+ `
4868
+ - rendered on server: ${el.textContent}
4869
+ - expected on client: ${vnode.children}`
4873
4870
  );
4874
4871
  el.textContent = vnode.children;
4875
4872
  }
4876
4873
  }
4874
+ if (props) {
4875
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
4876
+ for (const key in props) {
4877
+ if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key])) {
4878
+ hasMismatch = true;
4879
+ }
4880
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4881
+ key[0] === ".") {
4882
+ patchProp(
4883
+ el,
4884
+ key,
4885
+ null,
4886
+ props[key],
4887
+ void 0,
4888
+ void 0,
4889
+ parentComponent
4890
+ );
4891
+ }
4892
+ }
4893
+ } else if (props.onClick) {
4894
+ patchProp(
4895
+ el,
4896
+ "onClick",
4897
+ null,
4898
+ props.onClick,
4899
+ void 0,
4900
+ void 0,
4901
+ parentComponent
4902
+ );
4903
+ }
4904
+ }
4905
+ let vnodeHooks;
4906
+ if (vnodeHooks = props && props.onVnodeBeforeMount) {
4907
+ invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4908
+ }
4909
+ if (dirs) {
4910
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4911
+ }
4912
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4913
+ queueEffectWithSuspense(() => {
4914
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4915
+ needCallTransitionHooks && transition.enter(el);
4916
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4917
+ }, parentSuspense);
4918
+ }
4877
4919
  }
4878
4920
  return el.nextSibling;
4879
4921
  };
@@ -4897,9 +4939,12 @@ function createHydrationFunctions(rendererInternals) {
4897
4939
  continue;
4898
4940
  } else {
4899
4941
  hasMismatch = true;
4900
- if (!!(process.env.NODE_ENV !== "production") && !hasWarned) {
4942
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
4901
4943
  warn(
4902
- `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
4944
+ `Hydration children mismatch on`,
4945
+ container,
4946
+ `
4947
+ Server rendered element contains fewer child nodes than client vdom.`
4903
4948
  );
4904
4949
  hasWarned = true;
4905
4950
  }
@@ -4910,7 +4955,7 @@ function createHydrationFunctions(rendererInternals) {
4910
4955
  null,
4911
4956
  parentComponent,
4912
4957
  parentSuspense,
4913
- isSVGContainer(container),
4958
+ getContainerType(container),
4914
4959
  slotScopeIds
4915
4960
  );
4916
4961
  }
@@ -4942,14 +4987,14 @@ function createHydrationFunctions(rendererInternals) {
4942
4987
  };
4943
4988
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4944
4989
  hasMismatch = true;
4945
- !!(process.env.NODE_ENV !== "production") && warn(
4990
+ (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
4946
4991
  `Hydration node mismatch:
4947
- - Client vnode:`,
4948
- vnode.type,
4949
- `
4950
- - Server rendered DOM:`,
4992
+ - rendered on server:`,
4951
4993
  node,
4952
- node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
4994
+ node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
4995
+ `
4996
+ - expected on client:`,
4997
+ vnode.type
4953
4998
  );
4954
4999
  vnode.el = null;
4955
5000
  if (isFragment) {
@@ -4973,7 +5018,7 @@ function createHydrationFunctions(rendererInternals) {
4973
5018
  next,
4974
5019
  parentComponent,
4975
5020
  parentSuspense,
4976
- isSVGContainer(container),
5021
+ getContainerType(container),
4977
5022
  slotScopeIds
4978
5023
  );
4979
5024
  return next;
@@ -5014,6 +5059,46 @@ function createHydrationFunctions(rendererInternals) {
5014
5059
  };
5015
5060
  return [hydrate, hydrateNode];
5016
5061
  }
5062
+ function propHasMismatch(el, key, clientValue) {
5063
+ let mismatchType;
5064
+ let mismatchKey;
5065
+ let actual;
5066
+ let expected;
5067
+ if (key === "class") {
5068
+ actual = el.className;
5069
+ expected = normalizeClass(clientValue);
5070
+ if (actual !== expected) {
5071
+ mismatchType = mismatchKey = `class`;
5072
+ }
5073
+ } else if (key === "style") {
5074
+ actual = el.getAttribute("style");
5075
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
5076
+ if (actual !== expected) {
5077
+ mismatchType = mismatchKey = "style";
5078
+ }
5079
+ } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5080
+ actual = el.hasAttribute(key) && el.getAttribute(key);
5081
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
5082
+ if (actual !== expected) {
5083
+ mismatchType = `attribute`;
5084
+ mismatchKey = key;
5085
+ }
5086
+ }
5087
+ if (mismatchType) {
5088
+ const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
5089
+ warn(
5090
+ `Hydration ${mismatchType} mismatch on`,
5091
+ el,
5092
+ `
5093
+ - rendered on server: ${format(actual)}
5094
+ - expected on client: ${format(expected)}
5095
+ Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
5096
+ You should fix the source of the mismatch.`
5097
+ );
5098
+ return true;
5099
+ }
5100
+ return false;
5101
+ }
5017
5102
 
5018
5103
  let supported;
5019
5104
  let perf;
@@ -5065,6 +5150,10 @@ function initFeatureFlags() {
5065
5150
  !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
5066
5151
  getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
5067
5152
  }
5153
+ if (typeof __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ !== "boolean") {
5154
+ !!(process.env.NODE_ENV !== "production") && needWarn.push(`__VUE_PROD_HYDRATION_MISMATCH_DETAILS__`);
5155
+ getGlobalThis().__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = false;
5156
+ }
5068
5157
  if (!!(process.env.NODE_ENV !== "production") && needWarn.length) {
5069
5158
  const multi = needWarn.length > 1;
5070
5159
  console.warn(
@@ -5105,7 +5194,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5105
5194
  setScopeId: hostSetScopeId = NOOP,
5106
5195
  insertStaticContent: hostInsertStaticContent
5107
5196
  } = options;
5108
- 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) => {
5197
+ const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = !!(process.env.NODE_ENV !== "production") && isHmrUpdating ? false : !!n2.dynamicChildren) => {
5109
5198
  if (n1 === n2) {
5110
5199
  return;
5111
5200
  }
@@ -5128,9 +5217,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5128
5217
  break;
5129
5218
  case Static:
5130
5219
  if (n1 == null) {
5131
- mountStaticNode(n2, container, anchor, isSVG);
5220
+ mountStaticNode(n2, container, anchor, namespace);
5132
5221
  } else if (!!(process.env.NODE_ENV !== "production")) {
5133
- patchStaticNode(n1, n2, container, isSVG);
5222
+ patchStaticNode(n1, n2, container, namespace);
5134
5223
  }
5135
5224
  break;
5136
5225
  case Fragment:
@@ -5141,7 +5230,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5141
5230
  anchor,
5142
5231
  parentComponent,
5143
5232
  parentSuspense,
5144
- isSVG,
5233
+ namespace,
5145
5234
  slotScopeIds,
5146
5235
  optimized
5147
5236
  );
@@ -5155,7 +5244,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5155
5244
  anchor,
5156
5245
  parentComponent,
5157
5246
  parentSuspense,
5158
- isSVG,
5247
+ namespace,
5159
5248
  slotScopeIds,
5160
5249
  optimized
5161
5250
  );
@@ -5167,7 +5256,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5167
5256
  anchor,
5168
5257
  parentComponent,
5169
5258
  parentSuspense,
5170
- isSVG,
5259
+ namespace,
5171
5260
  slotScopeIds,
5172
5261
  optimized
5173
5262
  );
@@ -5179,7 +5268,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5179
5268
  anchor,
5180
5269
  parentComponent,
5181
5270
  parentSuspense,
5182
- isSVG,
5271
+ namespace,
5183
5272
  slotScopeIds,
5184
5273
  optimized,
5185
5274
  internals
@@ -5192,7 +5281,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5192
5281
  anchor,
5193
5282
  parentComponent,
5194
5283
  parentSuspense,
5195
- isSVG,
5284
+ namespace,
5196
5285
  slotScopeIds,
5197
5286
  optimized,
5198
5287
  internals
@@ -5230,17 +5319,17 @@ function baseCreateRenderer(options, createHydrationFns) {
5230
5319
  n2.el = n1.el;
5231
5320
  }
5232
5321
  };
5233
- const mountStaticNode = (n2, container, anchor, isSVG) => {
5322
+ const mountStaticNode = (n2, container, anchor, namespace) => {
5234
5323
  [n2.el, n2.anchor] = hostInsertStaticContent(
5235
5324
  n2.children,
5236
5325
  container,
5237
5326
  anchor,
5238
- isSVG,
5327
+ namespace,
5239
5328
  n2.el,
5240
5329
  n2.anchor
5241
5330
  );
5242
5331
  };
5243
- const patchStaticNode = (n1, n2, container, isSVG) => {
5332
+ const patchStaticNode = (n1, n2, container, namespace) => {
5244
5333
  if (n2.children !== n1.children) {
5245
5334
  const anchor = hostNextSibling(n1.anchor);
5246
5335
  removeStaticNode(n1);
@@ -5248,7 +5337,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5248
5337
  n2.children,
5249
5338
  container,
5250
5339
  anchor,
5251
- isSVG
5340
+ namespace
5252
5341
  );
5253
5342
  } else {
5254
5343
  n2.el = n1.el;
@@ -5273,8 +5362,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5273
5362
  }
5274
5363
  hostRemove(anchor);
5275
5364
  };
5276
- const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5277
- isSVG = isSVG || n2.type === "svg";
5365
+ const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5366
+ if (n2.type === "svg") {
5367
+ namespace = "svg";
5368
+ } else if (n2.type === "math") {
5369
+ namespace = "mathml";
5370
+ }
5278
5371
  if (n1 == null) {
5279
5372
  mountElement(
5280
5373
  n2,
@@ -5282,7 +5375,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5282
5375
  anchor,
5283
5376
  parentComponent,
5284
5377
  parentSuspense,
5285
- isSVG,
5378
+ namespace,
5286
5379
  slotScopeIds,
5287
5380
  optimized
5288
5381
  );
@@ -5292,19 +5385,19 @@ function baseCreateRenderer(options, createHydrationFns) {
5292
5385
  n2,
5293
5386
  parentComponent,
5294
5387
  parentSuspense,
5295
- isSVG,
5388
+ namespace,
5296
5389
  slotScopeIds,
5297
5390
  optimized
5298
5391
  );
5299
5392
  }
5300
5393
  };
5301
- const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5394
+ const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5302
5395
  let el;
5303
5396
  let vnodeHook;
5304
- const { type, props, shapeFlag, transition, dirs } = vnode;
5397
+ const { props, shapeFlag, transition, dirs } = vnode;
5305
5398
  el = vnode.el = hostCreateElement(
5306
5399
  vnode.type,
5307
- isSVG,
5400
+ namespace,
5308
5401
  props && props.is,
5309
5402
  props
5310
5403
  );
@@ -5317,7 +5410,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5317
5410
  null,
5318
5411
  parentComponent,
5319
5412
  parentSuspense,
5320
- isSVG && type !== "foreignObject",
5413
+ resolveChildrenNamespace(vnode, namespace),
5321
5414
  slotScopeIds,
5322
5415
  optimized
5323
5416
  );
@@ -5334,7 +5427,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5334
5427
  key,
5335
5428
  null,
5336
5429
  props[key],
5337
- isSVG,
5430
+ namespace,
5338
5431
  vnode.children,
5339
5432
  parentComponent,
5340
5433
  parentSuspense,
@@ -5343,7 +5436,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5343
5436
  }
5344
5437
  }
5345
5438
  if ("value" in props) {
5346
- hostPatchProp(el, "value", null, props.value);
5439
+ hostPatchProp(el, "value", null, props.value, namespace);
5347
5440
  }
5348
5441
  if (vnodeHook = props.onVnodeBeforeMount) {
5349
5442
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -5401,7 +5494,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5401
5494
  }
5402
5495
  }
5403
5496
  };
5404
- const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
5497
+ const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
5405
5498
  for (let i = start; i < children.length; i++) {
5406
5499
  const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
5407
5500
  patch(
@@ -5411,13 +5504,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5411
5504
  anchor,
5412
5505
  parentComponent,
5413
5506
  parentSuspense,
5414
- isSVG,
5507
+ namespace,
5415
5508
  slotScopeIds,
5416
5509
  optimized
5417
5510
  );
5418
5511
  }
5419
5512
  };
5420
- const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5513
+ const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5421
5514
  const el = n2.el = n1.el;
5422
5515
  let { patchFlag, dynamicChildren, dirs } = n2;
5423
5516
  patchFlag |= n1.patchFlag & 16;
@@ -5437,7 +5530,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5437
5530
  optimized = false;
5438
5531
  dynamicChildren = null;
5439
5532
  }
5440
- const areChildrenSVG = isSVG && n2.type !== "foreignObject";
5441
5533
  if (dynamicChildren) {
5442
5534
  patchBlockChildren(
5443
5535
  n1.dynamicChildren,
@@ -5445,7 +5537,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5445
5537
  el,
5446
5538
  parentComponent,
5447
5539
  parentSuspense,
5448
- areChildrenSVG,
5540
+ resolveChildrenNamespace(n2, namespace),
5449
5541
  slotScopeIds
5450
5542
  );
5451
5543
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -5459,7 +5551,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5459
5551
  null,
5460
5552
  parentComponent,
5461
5553
  parentSuspense,
5462
- areChildrenSVG,
5554
+ resolveChildrenNamespace(n2, namespace),
5463
5555
  slotScopeIds,
5464
5556
  false
5465
5557
  );
@@ -5473,16 +5565,16 @@ function baseCreateRenderer(options, createHydrationFns) {
5473
5565
  newProps,
5474
5566
  parentComponent,
5475
5567
  parentSuspense,
5476
- isSVG
5568
+ namespace
5477
5569
  );
5478
5570
  } else {
5479
5571
  if (patchFlag & 2) {
5480
5572
  if (oldProps.class !== newProps.class) {
5481
- hostPatchProp(el, "class", null, newProps.class, isSVG);
5573
+ hostPatchProp(el, "class", null, newProps.class, namespace);
5482
5574
  }
5483
5575
  }
5484
5576
  if (patchFlag & 4) {
5485
- hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
5577
+ hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
5486
5578
  }
5487
5579
  if (patchFlag & 8) {
5488
5580
  const propsToUpdate = n2.dynamicProps;
@@ -5496,7 +5588,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5496
5588
  key,
5497
5589
  prev,
5498
5590
  next,
5499
- isSVG,
5591
+ namespace,
5500
5592
  n1.children,
5501
5593
  parentComponent,
5502
5594
  parentSuspense,
@@ -5519,7 +5611,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5519
5611
  newProps,
5520
5612
  parentComponent,
5521
5613
  parentSuspense,
5522
- isSVG
5614
+ namespace
5523
5615
  );
5524
5616
  }
5525
5617
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
@@ -5529,7 +5621,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5529
5621
  }, parentSuspense);
5530
5622
  }
5531
5623
  };
5532
- const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
5624
+ const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
5533
5625
  for (let i = 0; i < newChildren.length; i++) {
5534
5626
  const oldVNode = oldChildren[i];
5535
5627
  const newVNode = newChildren[i];
@@ -5554,13 +5646,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5554
5646
  null,
5555
5647
  parentComponent,
5556
5648
  parentSuspense,
5557
- isSVG,
5649
+ namespace,
5558
5650
  slotScopeIds,
5559
5651
  true
5560
5652
  );
5561
5653
  }
5562
5654
  };
5563
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
5655
+ const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
5564
5656
  if (oldProps !== newProps) {
5565
5657
  if (oldProps !== EMPTY_OBJ) {
5566
5658
  for (const key in oldProps) {
@@ -5570,7 +5662,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5570
5662
  key,
5571
5663
  oldProps[key],
5572
5664
  null,
5573
- isSVG,
5665
+ namespace,
5574
5666
  vnode.children,
5575
5667
  parentComponent,
5576
5668
  parentSuspense,
@@ -5590,7 +5682,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5590
5682
  key,
5591
5683
  prev,
5592
5684
  next,
5593
- isSVG,
5685
+ namespace,
5594
5686
  vnode.children,
5595
5687
  parentComponent,
5596
5688
  parentSuspense,
@@ -5599,11 +5691,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5599
5691
  }
5600
5692
  }
5601
5693
  if ("value" in newProps) {
5602
- hostPatchProp(el, "value", oldProps.value, newProps.value);
5694
+ hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
5603
5695
  }
5604
5696
  }
5605
5697
  };
5606
- const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5698
+ const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5607
5699
  const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
5608
5700
  const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
5609
5701
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
@@ -5625,7 +5717,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5625
5717
  fragmentEndAnchor,
5626
5718
  parentComponent,
5627
5719
  parentSuspense,
5628
- isSVG,
5720
+ namespace,
5629
5721
  slotScopeIds,
5630
5722
  optimized
5631
5723
  );
@@ -5639,7 +5731,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5639
5731
  container,
5640
5732
  parentComponent,
5641
5733
  parentSuspense,
5642
- isSVG,
5734
+ namespace,
5643
5735
  slotScopeIds
5644
5736
  );
5645
5737
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -5666,14 +5758,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5666
5758
  fragmentEndAnchor,
5667
5759
  parentComponent,
5668
5760
  parentSuspense,
5669
- isSVG,
5761
+ namespace,
5670
5762
  slotScopeIds,
5671
5763
  optimized
5672
5764
  );
5673
5765
  }
5674
5766
  }
5675
5767
  };
5676
- const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5768
+ const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5677
5769
  n2.slotScopeIds = slotScopeIds;
5678
5770
  if (n1 == null) {
5679
5771
  if (n2.shapeFlag & 512) {
@@ -5681,7 +5773,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5681
5773
  n2,
5682
5774
  container,
5683
5775
  anchor,
5684
- isSVG,
5776
+ namespace,
5685
5777
  optimized
5686
5778
  );
5687
5779
  } else {
@@ -5691,7 +5783,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5691
5783
  anchor,
5692
5784
  parentComponent,
5693
5785
  parentSuspense,
5694
- isSVG,
5786
+ namespace,
5695
5787
  optimized
5696
5788
  );
5697
5789
  }
@@ -5699,7 +5791,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5699
5791
  updateComponent(n1, n2, optimized);
5700
5792
  }
5701
5793
  };
5702
- const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
5794
+ const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
5703
5795
  const instance = (initialVNode.component = createComponentInstance(
5704
5796
  initialVNode,
5705
5797
  parentComponent,
@@ -5730,17 +5822,17 @@ function baseCreateRenderer(options, createHydrationFns) {
5730
5822
  const placeholder = instance.subTree = createVNode(Comment);
5731
5823
  processCommentNode(null, placeholder, container, anchor);
5732
5824
  }
5733
- return;
5825
+ } else {
5826
+ setupRenderEffect(
5827
+ instance,
5828
+ initialVNode,
5829
+ container,
5830
+ anchor,
5831
+ parentSuspense,
5832
+ namespace,
5833
+ optimized
5834
+ );
5734
5835
  }
5735
- setupRenderEffect(
5736
- instance,
5737
- initialVNode,
5738
- container,
5739
- anchor,
5740
- parentSuspense,
5741
- isSVG,
5742
- optimized
5743
- );
5744
5836
  if (!!(process.env.NODE_ENV !== "production")) {
5745
5837
  popWarningContext();
5746
5838
  endMeasure(instance, `mount`);
@@ -5769,7 +5861,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5769
5861
  instance.vnode = n2;
5770
5862
  }
5771
5863
  };
5772
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
5864
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
5773
5865
  const componentUpdateFn = () => {
5774
5866
  if (!instance.isMounted) {
5775
5867
  let vnodeHook;
@@ -5836,7 +5928,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5836
5928
  anchor,
5837
5929
  instance,
5838
5930
  parentSuspense,
5839
- isSVG
5931
+ namespace
5840
5932
  );
5841
5933
  if (!!(process.env.NODE_ENV !== "production")) {
5842
5934
  endMeasure(instance, `patch`);
@@ -5863,6 +5955,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5863
5955
  initialVNode = container = anchor = null;
5864
5956
  } else {
5865
5957
  let { next, bu, u, parent, vnode } = instance;
5958
+ {
5959
+ const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
5960
+ if (nonHydratedAsyncRoot) {
5961
+ if (next) {
5962
+ next.el = vnode.el;
5963
+ updateComponentPreRender(instance, next, optimized);
5964
+ }
5965
+ nonHydratedAsyncRoot.asyncDep.then(() => {
5966
+ if (!instance.isUnmounted) {
5967
+ componentUpdateFn();
5968
+ }
5969
+ });
5970
+ return;
5971
+ }
5972
+ }
5866
5973
  let originNext = next;
5867
5974
  let vnodeHook;
5868
5975
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -5903,7 +6010,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5903
6010
  getNextHostNode(prevTree),
5904
6011
  instance,
5905
6012
  parentSuspense,
5906
- isSVG
6013
+ namespace
5907
6014
  );
5908
6015
  if (!!(process.env.NODE_ENV !== "production")) {
5909
6016
  endMeasure(instance, `patch`);
@@ -5958,10 +6065,10 @@ function baseCreateRenderer(options, createHydrationFns) {
5958
6065
  updateProps(instance, nextVNode.props, prevProps, optimized);
5959
6066
  updateSlots(instance, nextVNode.children, optimized);
5960
6067
  pauseTracking();
5961
- flushPreFlushCbs();
6068
+ flushPreFlushCbs(instance);
5962
6069
  resetTracking();
5963
6070
  };
5964
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
6071
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5965
6072
  const c1 = n1 && n1.children;
5966
6073
  const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5967
6074
  const c2 = n2.children;
@@ -5975,7 +6082,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5975
6082
  anchor,
5976
6083
  parentComponent,
5977
6084
  parentSuspense,
5978
- isSVG,
6085
+ namespace,
5979
6086
  slotScopeIds,
5980
6087
  optimized
5981
6088
  );
@@ -5988,7 +6095,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5988
6095
  anchor,
5989
6096
  parentComponent,
5990
6097
  parentSuspense,
5991
- isSVG,
6098
+ namespace,
5992
6099
  slotScopeIds,
5993
6100
  optimized
5994
6101
  );
@@ -6012,7 +6119,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6012
6119
  anchor,
6013
6120
  parentComponent,
6014
6121
  parentSuspense,
6015
- isSVG,
6122
+ namespace,
6016
6123
  slotScopeIds,
6017
6124
  optimized
6018
6125
  );
@@ -6030,7 +6137,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6030
6137
  anchor,
6031
6138
  parentComponent,
6032
6139
  parentSuspense,
6033
- isSVG,
6140
+ namespace,
6034
6141
  slotScopeIds,
6035
6142
  optimized
6036
6143
  );
@@ -6038,7 +6145,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6038
6145
  }
6039
6146
  }
6040
6147
  };
6041
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6148
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6042
6149
  c1 = c1 || EMPTY_ARR;
6043
6150
  c2 = c2 || EMPTY_ARR;
6044
6151
  const oldLength = c1.length;
@@ -6054,7 +6161,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6054
6161
  null,
6055
6162
  parentComponent,
6056
6163
  parentSuspense,
6057
- isSVG,
6164
+ namespace,
6058
6165
  slotScopeIds,
6059
6166
  optimized
6060
6167
  );
@@ -6075,14 +6182,14 @@ function baseCreateRenderer(options, createHydrationFns) {
6075
6182
  anchor,
6076
6183
  parentComponent,
6077
6184
  parentSuspense,
6078
- isSVG,
6185
+ namespace,
6079
6186
  slotScopeIds,
6080
6187
  optimized,
6081
6188
  commonLength
6082
6189
  );
6083
6190
  }
6084
6191
  };
6085
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6192
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6086
6193
  let i = 0;
6087
6194
  const l2 = c2.length;
6088
6195
  let e1 = c1.length - 1;
@@ -6098,7 +6205,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6098
6205
  null,
6099
6206
  parentComponent,
6100
6207
  parentSuspense,
6101
- isSVG,
6208
+ namespace,
6102
6209
  slotScopeIds,
6103
6210
  optimized
6104
6211
  );
@@ -6118,7 +6225,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6118
6225
  null,
6119
6226
  parentComponent,
6120
6227
  parentSuspense,
6121
- isSVG,
6228
+ namespace,
6122
6229
  slotScopeIds,
6123
6230
  optimized
6124
6231
  );
@@ -6140,7 +6247,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6140
6247
  anchor,
6141
6248
  parentComponent,
6142
6249
  parentSuspense,
6143
- isSVG,
6250
+ namespace,
6144
6251
  slotScopeIds,
6145
6252
  optimized
6146
6253
  );
@@ -6210,7 +6317,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6210
6317
  null,
6211
6318
  parentComponent,
6212
6319
  parentSuspense,
6213
- isSVG,
6320
+ namespace,
6214
6321
  slotScopeIds,
6215
6322
  optimized
6216
6323
  );
@@ -6231,7 +6338,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6231
6338
  anchor,
6232
6339
  parentComponent,
6233
6340
  parentSuspense,
6234
- isSVG,
6341
+ namespace,
6235
6342
  slotScopeIds,
6236
6343
  optimized
6237
6344
  );
@@ -6452,13 +6559,21 @@ function baseCreateRenderer(options, createHydrationFns) {
6452
6559
  }
6453
6560
  return hostNextSibling(vnode.anchor || vnode.el);
6454
6561
  };
6455
- const render = (vnode, container, isSVG) => {
6562
+ const render = (vnode, container, namespace) => {
6456
6563
  if (vnode == null) {
6457
6564
  if (container._vnode) {
6458
6565
  unmount(container._vnode, null, null, true);
6459
6566
  }
6460
6567
  } else {
6461
- patch(container._vnode || null, vnode, container, null, null, null, isSVG);
6568
+ patch(
6569
+ container._vnode || null,
6570
+ vnode,
6571
+ container,
6572
+ null,
6573
+ null,
6574
+ null,
6575
+ namespace
6576
+ );
6462
6577
  }
6463
6578
  flushPreFlushCbs();
6464
6579
  flushPostFlushCbs();
@@ -6489,6 +6604,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6489
6604
  createApp: createAppAPI(render, hydrate)
6490
6605
  };
6491
6606
  }
6607
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
6608
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6609
+ }
6492
6610
  function toggleRecurse({ effect, update }, allowed) {
6493
6611
  effect.allowRecurse = update.allowRecurse = allowed;
6494
6612
  }
@@ -6559,10 +6677,21 @@ function getSequence(arr) {
6559
6677
  }
6560
6678
  return result;
6561
6679
  }
6680
+ function locateNonHydratedAsyncRoot(instance) {
6681
+ const subComponent = instance.subTree.component;
6682
+ if (subComponent) {
6683
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
6684
+ return subComponent;
6685
+ } else {
6686
+ return locateNonHydratedAsyncRoot(subComponent);
6687
+ }
6688
+ }
6689
+ }
6562
6690
 
6563
6691
  const isTeleport = (type) => type.__isTeleport;
6564
6692
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
6565
6693
  const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
6694
+ const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
6566
6695
  const resolveTarget = (props, select) => {
6567
6696
  const targetSelector = props && props.to;
6568
6697
  if (isString(targetSelector)) {
@@ -6590,7 +6719,7 @@ const resolveTarget = (props, select) => {
6590
6719
  const TeleportImpl = {
6591
6720
  name: "Teleport",
6592
6721
  __isTeleport: true,
6593
- process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
6722
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
6594
6723
  const {
6595
6724
  mc: mountChildren,
6596
6725
  pc: patchChildren,
@@ -6612,7 +6741,11 @@ const TeleportImpl = {
6612
6741
  const targetAnchor = n2.targetAnchor = createText("");
6613
6742
  if (target) {
6614
6743
  insert(targetAnchor, target);
6615
- isSVG = isSVG || isTargetSVG(target);
6744
+ if (namespace === "svg" || isTargetSVG(target)) {
6745
+ namespace = "svg";
6746
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
6747
+ namespace = "mathml";
6748
+ }
6616
6749
  } else if (!!(process.env.NODE_ENV !== "production") && !disabled) {
6617
6750
  warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
6618
6751
  }
@@ -6624,7 +6757,7 @@ const TeleportImpl = {
6624
6757
  anchor2,
6625
6758
  parentComponent,
6626
6759
  parentSuspense,
6627
- isSVG,
6760
+ namespace,
6628
6761
  slotScopeIds,
6629
6762
  optimized
6630
6763
  );
@@ -6643,7 +6776,11 @@ const TeleportImpl = {
6643
6776
  const wasDisabled = isTeleportDisabled(n1.props);
6644
6777
  const currentContainer = wasDisabled ? container : target;
6645
6778
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
6646
- isSVG = isSVG || isTargetSVG(target);
6779
+ if (namespace === "svg" || isTargetSVG(target)) {
6780
+ namespace = "svg";
6781
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
6782
+ namespace = "mathml";
6783
+ }
6647
6784
  if (dynamicChildren) {
6648
6785
  patchBlockChildren(
6649
6786
  n1.dynamicChildren,
@@ -6651,7 +6788,7 @@ const TeleportImpl = {
6651
6788
  currentContainer,
6652
6789
  parentComponent,
6653
6790
  parentSuspense,
6654
- isSVG,
6791
+ namespace,
6655
6792
  slotScopeIds
6656
6793
  );
6657
6794
  traverseStaticChildren(n1, n2, true);
@@ -6663,7 +6800,7 @@ const TeleportImpl = {
6663
6800
  currentAnchor,
6664
6801
  parentComponent,
6665
6802
  parentSuspense,
6666
- isSVG,
6803
+ namespace,
6667
6804
  slotScopeIds,
6668
6805
  false
6669
6806
  );
@@ -7288,20 +7425,29 @@ function createComponentInstance(vnode, parent, suspense) {
7288
7425
  let currentInstance = null;
7289
7426
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
7290
7427
  let internalSetCurrentInstance;
7291
- let globalCurrentInstanceSetters;
7292
- let settersKey = "__VUE_INSTANCE_SETTERS__";
7428
+ let setInSSRSetupState;
7293
7429
  {
7294
- if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
7295
- globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
7296
- }
7297
- globalCurrentInstanceSetters.push((i) => currentInstance = i);
7298
- internalSetCurrentInstance = (instance) => {
7299
- if (globalCurrentInstanceSetters.length > 1) {
7300
- globalCurrentInstanceSetters.forEach((s) => s(instance));
7301
- } else {
7302
- globalCurrentInstanceSetters[0](instance);
7303
- }
7430
+ const g = getGlobalThis();
7431
+ const registerGlobalSetter = (key, setter) => {
7432
+ let setters;
7433
+ if (!(setters = g[key]))
7434
+ setters = g[key] = [];
7435
+ setters.push(setter);
7436
+ return (v) => {
7437
+ if (setters.length > 1)
7438
+ setters.forEach((set) => set(v));
7439
+ else
7440
+ setters[0](v);
7441
+ };
7304
7442
  };
7443
+ internalSetCurrentInstance = registerGlobalSetter(
7444
+ `__VUE_INSTANCE_SETTERS__`,
7445
+ (v) => currentInstance = v
7446
+ );
7447
+ setInSSRSetupState = registerGlobalSetter(
7448
+ `__VUE_SSR_SETTERS__`,
7449
+ (v) => isInSSRComponentSetup = v
7450
+ );
7305
7451
  }
7306
7452
  const setCurrentInstance = (instance) => {
7307
7453
  internalSetCurrentInstance(instance);
@@ -7325,13 +7471,13 @@ function isStatefulComponent(instance) {
7325
7471
  }
7326
7472
  let isInSSRComponentSetup = false;
7327
7473
  function setupComponent(instance, isSSR = false) {
7328
- isInSSRComponentSetup = isSSR;
7474
+ isSSR && setInSSRSetupState(isSSR);
7329
7475
  const { props, children } = instance.vnode;
7330
7476
  const isStateful = isStatefulComponent(instance);
7331
7477
  initProps(instance, props, isStateful, isSSR);
7332
7478
  initSlots(instance, children);
7333
7479
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
7334
- isInSSRComponentSetup = false;
7480
+ isSSR && setInSSRSetupState(false);
7335
7481
  return setupResult;
7336
7482
  }
7337
7483
  function setupStatefulComponent(instance, isSSR) {
@@ -7863,7 +8009,7 @@ function isMemoSame(cached, memo) {
7863
8009
  return true;
7864
8010
  }
7865
8011
 
7866
- const version = "3.4.0-alpha.4";
8012
+ const version = "3.4.0-beta.1";
7867
8013
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
7868
8014
  const _ssrUtils = {
7869
8015
  createComponentInstance,