@vue/runtime-core 3.4.0-alpha.3 → 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.
@@ -119,6 +119,38 @@ function assertNumber(val, type) {
119
119
  }
120
120
  }
121
121
 
122
+ const ErrorCodes = {
123
+ "SETUP_FUNCTION": 0,
124
+ "0": "SETUP_FUNCTION",
125
+ "RENDER_FUNCTION": 1,
126
+ "1": "RENDER_FUNCTION",
127
+ "WATCH_GETTER": 2,
128
+ "2": "WATCH_GETTER",
129
+ "WATCH_CALLBACK": 3,
130
+ "3": "WATCH_CALLBACK",
131
+ "WATCH_CLEANUP": 4,
132
+ "4": "WATCH_CLEANUP",
133
+ "NATIVE_EVENT_HANDLER": 5,
134
+ "5": "NATIVE_EVENT_HANDLER",
135
+ "COMPONENT_EVENT_HANDLER": 6,
136
+ "6": "COMPONENT_EVENT_HANDLER",
137
+ "VNODE_HOOK": 7,
138
+ "7": "VNODE_HOOK",
139
+ "DIRECTIVE_HOOK": 8,
140
+ "8": "DIRECTIVE_HOOK",
141
+ "TRANSITION_HOOK": 9,
142
+ "9": "TRANSITION_HOOK",
143
+ "APP_ERROR_HANDLER": 10,
144
+ "10": "APP_ERROR_HANDLER",
145
+ "APP_WARN_HANDLER": 11,
146
+ "11": "APP_WARN_HANDLER",
147
+ "FUNCTION_REF": 12,
148
+ "12": "FUNCTION_REF",
149
+ "ASYNC_COMPONENT_LOADER": 13,
150
+ "13": "ASYNC_COMPONENT_LOADER",
151
+ "SCHEDULER": 14,
152
+ "14": "SCHEDULER"
153
+ };
122
154
  const ErrorTypeStrings$1 = {
123
155
  ["sp"]: "serverPrefetch hook",
124
156
  ["bc"]: "beforeCreate hook",
@@ -290,13 +322,16 @@ function queuePostFlushCb(cb) {
290
322
  }
291
323
  queueFlush();
292
324
  }
293
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
325
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
294
326
  {
295
327
  seen = seen || /* @__PURE__ */ new Map();
296
328
  }
297
329
  for (; i < queue.length; i++) {
298
330
  const cb = queue[i];
299
331
  if (cb && cb.pre) {
332
+ if (instance && cb.id !== instance.uid) {
333
+ continue;
334
+ }
300
335
  if (checkRecursiveUpdates(seen, cb)) {
301
336
  continue;
302
337
  }
@@ -1056,9 +1091,17 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
1056
1091
  return false;
1057
1092
  }
1058
1093
  function updateHOCHostEl({ vnode, parent }, el) {
1059
- while (parent && parent.subTree === vnode) {
1060
- (vnode = parent.vnode).el = el;
1061
- parent = parent.parent;
1094
+ while (parent) {
1095
+ const root = parent.subTree;
1096
+ if (root.suspense && root.suspense.activeBranch === vnode) {
1097
+ root.el = vnode.el;
1098
+ }
1099
+ if (root === vnode) {
1100
+ (vnode = parent.vnode).el = el;
1101
+ parent = parent.parent;
1102
+ } else {
1103
+ break;
1104
+ }
1062
1105
  }
1063
1106
  }
1064
1107
 
@@ -1118,6 +1161,7 @@ function resolve(registry, name) {
1118
1161
  }
1119
1162
 
1120
1163
  const isSuspense = (type) => type.__isSuspense;
1164
+ let suspenseId = 0;
1121
1165
  const SuspenseImpl = {
1122
1166
  name: "Suspense",
1123
1167
  // In order to make Suspense tree-shakable, we need to avoid importing it
@@ -1125,7 +1169,7 @@ const SuspenseImpl = {
1125
1169
  // on a vnode's type and calls the `process` method, passing in renderer
1126
1170
  // internals.
1127
1171
  __isSuspense: true,
1128
- process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
1172
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
1129
1173
  if (n1 == null) {
1130
1174
  mountSuspense(
1131
1175
  n2,
@@ -1133,7 +1177,7 @@ const SuspenseImpl = {
1133
1177
  anchor,
1134
1178
  parentComponent,
1135
1179
  parentSuspense,
1136
- isSVG,
1180
+ namespace,
1137
1181
  slotScopeIds,
1138
1182
  optimized,
1139
1183
  rendererInternals
@@ -1145,7 +1189,7 @@ const SuspenseImpl = {
1145
1189
  container,
1146
1190
  anchor,
1147
1191
  parentComponent,
1148
- isSVG,
1192
+ namespace,
1149
1193
  slotScopeIds,
1150
1194
  optimized,
1151
1195
  rendererInternals
@@ -1163,7 +1207,7 @@ function triggerEvent(vnode, name) {
1163
1207
  eventListener();
1164
1208
  }
1165
1209
  }
1166
- function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
1210
+ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
1167
1211
  const {
1168
1212
  p: patch,
1169
1213
  o: { createElement }
@@ -1176,7 +1220,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1176
1220
  container,
1177
1221
  hiddenContainer,
1178
1222
  anchor,
1179
- isSVG,
1223
+ namespace,
1180
1224
  slotScopeIds,
1181
1225
  optimized,
1182
1226
  rendererInternals
@@ -1188,7 +1232,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1188
1232
  null,
1189
1233
  parentComponent,
1190
1234
  suspense,
1191
- isSVG,
1235
+ namespace,
1192
1236
  slotScopeIds
1193
1237
  );
1194
1238
  if (suspense.deps > 0) {
@@ -1202,7 +1246,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1202
1246
  parentComponent,
1203
1247
  null,
1204
1248
  // fallback tree will not have suspense context
1205
- isSVG,
1249
+ namespace,
1206
1250
  slotScopeIds
1207
1251
  );
1208
1252
  setActiveBranch(suspense, vnode.ssFallback);
@@ -1210,7 +1254,7 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1210
1254
  suspense.resolve(false, true);
1211
1255
  }
1212
1256
  }
1213
- function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
1257
+ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
1214
1258
  const suspense = n2.suspense = n1.suspense;
1215
1259
  suspense.vnode = n2;
1216
1260
  n2.el = n1.el;
@@ -1227,29 +1271,31 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1227
1271
  null,
1228
1272
  parentComponent,
1229
1273
  suspense,
1230
- isSVG,
1274
+ namespace,
1231
1275
  slotScopeIds,
1232
1276
  optimized
1233
1277
  );
1234
1278
  if (suspense.deps <= 0) {
1235
1279
  suspense.resolve();
1236
1280
  } else if (isInFallback) {
1237
- patch(
1238
- activeBranch,
1239
- newFallback,
1240
- container,
1241
- anchor,
1242
- parentComponent,
1243
- null,
1244
- // fallback tree will not have suspense context
1245
- isSVG,
1246
- slotScopeIds,
1247
- optimized
1248
- );
1249
- setActiveBranch(suspense, newFallback);
1281
+ if (!isHydrating) {
1282
+ patch(
1283
+ activeBranch,
1284
+ newFallback,
1285
+ container,
1286
+ anchor,
1287
+ parentComponent,
1288
+ null,
1289
+ // fallback tree will not have suspense context
1290
+ namespace,
1291
+ slotScopeIds,
1292
+ optimized
1293
+ );
1294
+ setActiveBranch(suspense, newFallback);
1295
+ }
1250
1296
  }
1251
1297
  } else {
1252
- suspense.pendingId++;
1298
+ suspense.pendingId = suspenseId++;
1253
1299
  if (isHydrating) {
1254
1300
  suspense.isHydrating = false;
1255
1301
  suspense.activeBranch = pendingBranch;
@@ -1267,7 +1313,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1267
1313
  null,
1268
1314
  parentComponent,
1269
1315
  suspense,
1270
- isSVG,
1316
+ namespace,
1271
1317
  slotScopeIds,
1272
1318
  optimized
1273
1319
  );
@@ -1282,7 +1328,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1282
1328
  parentComponent,
1283
1329
  null,
1284
1330
  // fallback tree will not have suspense context
1285
- isSVG,
1331
+ namespace,
1286
1332
  slotScopeIds,
1287
1333
  optimized
1288
1334
  );
@@ -1296,7 +1342,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1296
1342
  anchor,
1297
1343
  parentComponent,
1298
1344
  suspense,
1299
- isSVG,
1345
+ namespace,
1300
1346
  slotScopeIds,
1301
1347
  optimized
1302
1348
  );
@@ -1309,7 +1355,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1309
1355
  null,
1310
1356
  parentComponent,
1311
1357
  suspense,
1312
- isSVG,
1358
+ namespace,
1313
1359
  slotScopeIds,
1314
1360
  optimized
1315
1361
  );
@@ -1327,7 +1373,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1327
1373
  anchor,
1328
1374
  parentComponent,
1329
1375
  suspense,
1330
- isSVG,
1376
+ namespace,
1331
1377
  slotScopeIds,
1332
1378
  optimized
1333
1379
  );
@@ -1335,7 +1381,11 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1335
1381
  } else {
1336
1382
  triggerEvent(n2, "onPending");
1337
1383
  suspense.pendingBranch = newBranch;
1338
- suspense.pendingId++;
1384
+ if (newBranch.shapeFlag & 512) {
1385
+ suspense.pendingId = newBranch.component.suspenseId;
1386
+ } else {
1387
+ suspense.pendingId = suspenseId++;
1388
+ }
1339
1389
  patch(
1340
1390
  null,
1341
1391
  newBranch,
@@ -1343,7 +1393,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1343
1393
  null,
1344
1394
  parentComponent,
1345
1395
  suspense,
1346
- isSVG,
1396
+ namespace,
1347
1397
  slotScopeIds,
1348
1398
  optimized
1349
1399
  );
@@ -1365,7 +1415,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1365
1415
  }
1366
1416
  }
1367
1417
  let hasWarned = false;
1368
- function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1418
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
1369
1419
  if (!hasWarned) {
1370
1420
  hasWarned = true;
1371
1421
  console[console.info ? "info" : "log"](
@@ -1395,7 +1445,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1395
1445
  vnode,
1396
1446
  parent: parentSuspense,
1397
1447
  parentComponent,
1398
- isSVG,
1448
+ namespace,
1399
1449
  container,
1400
1450
  hiddenContainer,
1401
1451
  anchor,
@@ -1404,7 +1454,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1404
1454
  timeout: typeof timeout === "number" ? timeout : -1,
1405
1455
  activeBranch: null,
1406
1456
  pendingBranch: null,
1407
- isInFallback: true,
1457
+ isInFallback: !isHydrating,
1408
1458
  isHydrating,
1409
1459
  isUnmounted: false,
1410
1460
  effects: [],
@@ -1438,7 +1488,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1438
1488
  if (delayEnter) {
1439
1489
  activeBranch.transition.afterLeave = () => {
1440
1490
  if (pendingId === suspense.pendingId) {
1441
- move(pendingBranch, container2, anchor2, 0);
1491
+ move(
1492
+ pendingBranch,
1493
+ container2,
1494
+ next(activeBranch),
1495
+ 0
1496
+ );
1442
1497
  queuePostFlushCb(effects);
1443
1498
  }
1444
1499
  };
@@ -1483,7 +1538,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1483
1538
  if (!suspense.pendingBranch) {
1484
1539
  return;
1485
1540
  }
1486
- const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
1541
+ const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
1487
1542
  triggerEvent(vnode2, "onFallback");
1488
1543
  const anchor2 = next(activeBranch);
1489
1544
  const mountFallback = () => {
@@ -1498,7 +1553,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1498
1553
  parentComponent2,
1499
1554
  null,
1500
1555
  // fallback tree will not have suspense context
1501
- isSVG2,
1556
+ namespace2,
1502
1557
  slotScopeIds,
1503
1558
  optimized
1504
1559
  );
@@ -1561,7 +1616,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1561
1616
  // consider the comment placeholder case.
1562
1617
  hydratedEl ? null : next(instance.subTree),
1563
1618
  suspense,
1564
- isSVG,
1619
+ namespace,
1565
1620
  optimized
1566
1621
  );
1567
1622
  if (placeholder) {
@@ -1598,7 +1653,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1598
1653
  };
1599
1654
  return suspense;
1600
1655
  }
1601
- function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {
1656
+ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
1602
1657
  const suspense = vnode.suspense = createSuspenseBoundary(
1603
1658
  vnode,
1604
1659
  parentSuspense,
@@ -1606,7 +1661,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
1606
1661
  node.parentNode,
1607
1662
  document.createElement("div"),
1608
1663
  null,
1609
- isSVG,
1664
+ namespace,
1610
1665
  slotScopeIds,
1611
1666
  optimized,
1612
1667
  rendererInternals,
@@ -2521,7 +2576,7 @@ const KeepAliveImpl = {
2521
2576
  }
2522
2577
  } = sharedContext;
2523
2578
  const storageContainer = createElement("div");
2524
- sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
2579
+ sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2525
2580
  const instance2 = vnode.component;
2526
2581
  move(vnode, container, anchor, 0, parentSuspense);
2527
2582
  patch(
@@ -2531,7 +2586,7 @@ const KeepAliveImpl = {
2531
2586
  anchor,
2532
2587
  instance2,
2533
2588
  parentSuspense,
2534
- isSVG,
2589
+ namespace,
2535
2590
  vnode.slotScopeIds,
2536
2591
  optimized
2537
2592
  );
@@ -3197,7 +3252,7 @@ function useSlots() {
3197
3252
  function useAttrs() {
3198
3253
  return getContext().attrs;
3199
3254
  }
3200
- function useModel(props, name, options) {
3255
+ function useModel(props, name) {
3201
3256
  const i = getCurrentInstance();
3202
3257
  if (!i) {
3203
3258
  warn(`useModel() called without active instance.`);
@@ -3207,29 +3262,24 @@ function useModel(props, name, options) {
3207
3262
  warn(`useModel() called with prop "${name}" which is not declared.`);
3208
3263
  return reactivity.ref();
3209
3264
  }
3210
- if (options && options.local) {
3211
- const proxy = reactivity.ref(props[name]);
3212
- watch(
3213
- () => props[name],
3214
- (v) => proxy.value = v
3215
- );
3216
- watch(proxy, (value) => {
3217
- if (value !== props[name]) {
3218
- i.emit(`update:${name}`, value);
3219
- }
3220
- });
3221
- return proxy;
3222
- } else {
3223
- return {
3224
- __v_isRef: true,
3225
- get value() {
3226
- return props[name];
3227
- },
3228
- set value(value) {
3229
- i.emit(`update:${name}`, value);
3265
+ let localValue;
3266
+ watchSyncEffect(() => {
3267
+ localValue = props[name];
3268
+ });
3269
+ return reactivity.customRef((track, trigger) => ({
3270
+ get() {
3271
+ track();
3272
+ return localValue;
3273
+ },
3274
+ set(value) {
3275
+ const rawProps = i.vnode.props;
3276
+ if (!(rawProps && name in rawProps) && shared.hasChanged(value, localValue)) {
3277
+ localValue = value;
3278
+ trigger();
3230
3279
  }
3231
- };
3232
- }
3280
+ i.emit(`update:${name}`, value);
3281
+ }
3282
+ }));
3233
3283
  }
3234
3284
  function getContext() {
3235
3285
  const i = getCurrentInstance();
@@ -3749,18 +3799,6 @@ function createAppAPI(render, hydrate) {
3749
3799
  rootProps = null;
3750
3800
  }
3751
3801
  const context = createAppContext();
3752
- {
3753
- Object.defineProperty(context.config, "unwrapInjectedRef", {
3754
- get() {
3755
- return true;
3756
- },
3757
- set() {
3758
- warn(
3759
- `app.config.unwrapInjectedRef has been deprecated. 3.3 now always unwraps injected refs in Options API.`
3760
- );
3761
- }
3762
- });
3763
- }
3764
3802
  const installedPlugins = /* @__PURE__ */ new WeakSet();
3765
3803
  let isMounted = false;
3766
3804
  const app = context.app = {
@@ -3835,7 +3873,7 @@ function createAppAPI(render, hydrate) {
3835
3873
  context.directives[name] = directive;
3836
3874
  return app;
3837
3875
  },
3838
- mount(rootContainer, isHydrate, isSVG) {
3876
+ mount(rootContainer, isHydrate, namespace) {
3839
3877
  if (!isMounted) {
3840
3878
  if (rootContainer.__vue_app__) {
3841
3879
  warn(
@@ -3845,15 +3883,24 @@ function createAppAPI(render, hydrate) {
3845
3883
  }
3846
3884
  const vnode = createVNode(rootComponent, rootProps);
3847
3885
  vnode.appContext = context;
3886
+ if (namespace === true) {
3887
+ namespace = "svg";
3888
+ } else if (namespace === false) {
3889
+ namespace = void 0;
3890
+ }
3848
3891
  {
3849
3892
  context.reload = () => {
3850
- render(cloneVNode(vnode), rootContainer, isSVG);
3893
+ render(
3894
+ cloneVNode(vnode),
3895
+ rootContainer,
3896
+ namespace
3897
+ );
3851
3898
  };
3852
3899
  }
3853
3900
  if (isHydrate && hydrate) {
3854
3901
  hydrate(vnode, rootContainer);
3855
3902
  } else {
3856
- render(vnode, rootContainer, isSVG);
3903
+ render(vnode, rootContainer, namespace);
3857
3904
  }
3858
3905
  isMounted = true;
3859
3906
  app._container = rootContainer;
@@ -4243,11 +4290,12 @@ function validateProps(rawProps, props, instance) {
4243
4290
  key,
4244
4291
  resolvedValues[key],
4245
4292
  opt,
4293
+ reactivity.shallowReadonly(resolvedValues) ,
4246
4294
  !shared.hasOwn(rawProps, key) && !shared.hasOwn(rawProps, shared.hyphenate(key))
4247
4295
  );
4248
4296
  }
4249
4297
  }
4250
- function validateProp(name, value, prop, isAbsent) {
4298
+ function validateProp(name, value, prop, props, isAbsent) {
4251
4299
  const { type, required, validator, skipCheck } = prop;
4252
4300
  if (required && isAbsent) {
4253
4301
  warn('Missing required prop: "' + name + '"');
@@ -4270,7 +4318,7 @@ function validateProp(name, value, prop, isAbsent) {
4270
4318
  return;
4271
4319
  }
4272
4320
  }
4273
- if (validator && !validator(value)) {
4321
+ if (validator && !validator(value, props)) {
4274
4322
  warn('Invalid prop: custom validator check failed for prop "' + name + '".');
4275
4323
  }
4276
4324
  }
@@ -4526,7 +4574,15 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4526
4574
  }
4527
4575
 
4528
4576
  let hasMismatch = false;
4529
- const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject";
4577
+ const isSVGContainer = (container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject";
4578
+ const isMathMLContainer = (container) => container.namespaceURI.includes("MathML");
4579
+ const getContainerType = (container) => {
4580
+ if (isSVGContainer(container))
4581
+ return "svg";
4582
+ if (isMathMLContainer(container))
4583
+ return "mathml";
4584
+ return void 0;
4585
+ };
4530
4586
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
4531
4587
  function createHydrationFunctions(rendererInternals) {
4532
4588
  const {
@@ -4605,11 +4661,13 @@ function createHydrationFunctions(rendererInternals) {
4605
4661
  if (node.data !== vnode.children) {
4606
4662
  hasMismatch = true;
4607
4663
  warn(
4608
- `Hydration text mismatch:
4609
- - Server rendered: ${JSON.stringify(
4664
+ `Hydration text mismatch in`,
4665
+ node.parentNode,
4666
+ `
4667
+ - rendered on server: ${JSON.stringify(
4610
4668
  node.data
4611
4669
  )}
4612
- - Client rendered: ${JSON.stringify(vnode.children)}`
4670
+ - expected on client: ${JSON.stringify(vnode.children)}`
4613
4671
  );
4614
4672
  node.data = vnode.children;
4615
4673
  }
@@ -4695,7 +4753,7 @@ function createHydrationFunctions(rendererInternals) {
4695
4753
  null,
4696
4754
  parentComponent,
4697
4755
  parentSuspense,
4698
- isSVGContainer(container),
4756
+ getContainerType(container),
4699
4757
  optimized
4700
4758
  );
4701
4759
  if (isAsyncWrapper(vnode)) {
@@ -4730,7 +4788,7 @@ function createHydrationFunctions(rendererInternals) {
4730
4788
  vnode,
4731
4789
  parentComponent,
4732
4790
  parentSuspense,
4733
- isSVGContainer(parentNode(node)),
4791
+ getContainerType(parentNode(node)),
4734
4792
  slotScopeIds,
4735
4793
  optimized,
4736
4794
  rendererInternals,
@@ -4753,38 +4811,6 @@ function createHydrationFunctions(rendererInternals) {
4753
4811
  if (dirs) {
4754
4812
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4755
4813
  }
4756
- if (props) {
4757
- if (forcePatch || !optimized || patchFlag & (16 | 32)) {
4758
- for (const key in props) {
4759
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4760
- key[0] === ".") {
4761
- patchProp(
4762
- el,
4763
- key,
4764
- null,
4765
- props[key],
4766
- false,
4767
- void 0,
4768
- parentComponent
4769
- );
4770
- }
4771
- }
4772
- } else if (props.onClick) {
4773
- patchProp(
4774
- el,
4775
- "onClick",
4776
- null,
4777
- props.onClick,
4778
- false,
4779
- void 0,
4780
- parentComponent
4781
- );
4782
- }
4783
- }
4784
- let vnodeHooks;
4785
- if (vnodeHooks = props && props.onVnodeBeforeMount) {
4786
- invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4787
- }
4788
4814
  let needCallTransitionHooks = false;
4789
4815
  if (isTemplateNode(el)) {
4790
4816
  needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
@@ -4795,16 +4821,6 @@ function createHydrationFunctions(rendererInternals) {
4795
4821
  replaceNode(content, el, parentComponent);
4796
4822
  vnode.el = el = content;
4797
4823
  }
4798
- if (dirs) {
4799
- invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4800
- }
4801
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4802
- queueEffectWithSuspense(() => {
4803
- vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4804
- needCallTransitionHooks && transition.enter(el);
4805
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4806
- }, parentSuspense);
4807
- }
4808
4824
  if (shapeFlag & 16 && // skip if element has innerHTML / textContent
4809
4825
  !(props && (props.innerHTML || props.textContent))) {
4810
4826
  let next = hydrateChildren(
@@ -4821,7 +4837,10 @@ function createHydrationFunctions(rendererInternals) {
4821
4837
  hasMismatch = true;
4822
4838
  if (!hasWarned) {
4823
4839
  warn(
4824
- `Hydration children mismatch in <${vnode.type}>: server rendered element contains more child nodes than client vdom.`
4840
+ `Hydration children mismatch on`,
4841
+ el,
4842
+ `
4843
+ Server rendered element contains more child nodes than client vdom.`
4825
4844
  );
4826
4845
  hasWarned = true;
4827
4846
  }
@@ -4833,13 +4852,50 @@ function createHydrationFunctions(rendererInternals) {
4833
4852
  if (el.textContent !== vnode.children) {
4834
4853
  hasMismatch = true;
4835
4854
  warn(
4836
- `Hydration text content mismatch in <${vnode.type}>:
4837
- - Server rendered: ${el.textContent}
4838
- - Client rendered: ${vnode.children}`
4855
+ `Hydration text content mismatch on`,
4856
+ el,
4857
+ `
4858
+ - rendered on server: ${el.textContent}
4859
+ - expected on client: ${vnode.children}`
4839
4860
  );
4840
4861
  el.textContent = vnode.children;
4841
4862
  }
4842
4863
  }
4864
+ if (props) {
4865
+ {
4866
+ for (const key in props) {
4867
+ if (propHasMismatch(el, key, props[key])) {
4868
+ hasMismatch = true;
4869
+ }
4870
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
4871
+ key[0] === ".") {
4872
+ patchProp(
4873
+ el,
4874
+ key,
4875
+ null,
4876
+ props[key],
4877
+ void 0,
4878
+ void 0,
4879
+ parentComponent
4880
+ );
4881
+ }
4882
+ }
4883
+ }
4884
+ }
4885
+ let vnodeHooks;
4886
+ if (vnodeHooks = props && props.onVnodeBeforeMount) {
4887
+ invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4888
+ }
4889
+ if (dirs) {
4890
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4891
+ }
4892
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
4893
+ queueEffectWithSuspense(() => {
4894
+ vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
4895
+ needCallTransitionHooks && transition.enter(el);
4896
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4897
+ }, parentSuspense);
4898
+ }
4843
4899
  }
4844
4900
  return el.nextSibling;
4845
4901
  };
@@ -4865,7 +4921,10 @@ function createHydrationFunctions(rendererInternals) {
4865
4921
  hasMismatch = true;
4866
4922
  if (!hasWarned) {
4867
4923
  warn(
4868
- `Hydration children mismatch in <${container.tagName.toLowerCase()}>: server rendered element contains fewer child nodes than client vdom.`
4924
+ `Hydration children mismatch on`,
4925
+ container,
4926
+ `
4927
+ Server rendered element contains fewer child nodes than client vdom.`
4869
4928
  );
4870
4929
  hasWarned = true;
4871
4930
  }
@@ -4876,7 +4935,7 @@ function createHydrationFunctions(rendererInternals) {
4876
4935
  null,
4877
4936
  parentComponent,
4878
4937
  parentSuspense,
4879
- isSVGContainer(container),
4938
+ getContainerType(container),
4880
4939
  slotScopeIds
4881
4940
  );
4882
4941
  }
@@ -4910,12 +4969,12 @@ function createHydrationFunctions(rendererInternals) {
4910
4969
  hasMismatch = true;
4911
4970
  warn(
4912
4971
  `Hydration node mismatch:
4913
- - Client vnode:`,
4914
- vnode.type,
4915
- `
4916
- - Server rendered DOM:`,
4972
+ - rendered on server:`,
4917
4973
  node,
4918
- node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``
4974
+ node.nodeType === 3 /* TEXT */ ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``,
4975
+ `
4976
+ - expected on client:`,
4977
+ vnode.type
4919
4978
  );
4920
4979
  vnode.el = null;
4921
4980
  if (isFragment) {
@@ -4939,7 +4998,7 @@ function createHydrationFunctions(rendererInternals) {
4939
4998
  next,
4940
4999
  parentComponent,
4941
5000
  parentSuspense,
4942
- isSVGContainer(container),
5001
+ getContainerType(container),
4943
5002
  slotScopeIds
4944
5003
  );
4945
5004
  return next;
@@ -4980,6 +5039,46 @@ function createHydrationFunctions(rendererInternals) {
4980
5039
  };
4981
5040
  return [hydrate, hydrateNode];
4982
5041
  }
5042
+ function propHasMismatch(el, key, clientValue) {
5043
+ let mismatchType;
5044
+ let mismatchKey;
5045
+ let actual;
5046
+ let expected;
5047
+ if (key === "class") {
5048
+ actual = el.className;
5049
+ expected = shared.normalizeClass(clientValue);
5050
+ if (actual !== expected) {
5051
+ mismatchType = mismatchKey = `class`;
5052
+ }
5053
+ } else if (key === "style") {
5054
+ actual = el.getAttribute("style");
5055
+ expected = shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue));
5056
+ if (actual !== expected) {
5057
+ mismatchType = mismatchKey = "style";
5058
+ }
5059
+ } else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
5060
+ actual = el.hasAttribute(key) && el.getAttribute(key);
5061
+ expected = shared.isBooleanAttr(key) ? shared.includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
5062
+ if (actual !== expected) {
5063
+ mismatchType = `attribute`;
5064
+ mismatchKey = key;
5065
+ }
5066
+ }
5067
+ if (mismatchType) {
5068
+ const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
5069
+ warn(
5070
+ `Hydration ${mismatchType} mismatch on`,
5071
+ el,
5072
+ `
5073
+ - rendered on server: ${format(actual)}
5074
+ - expected on client: ${format(expected)}
5075
+ Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
5076
+ You should fix the source of the mismatch.`
5077
+ );
5078
+ return true;
5079
+ }
5080
+ return false;
5081
+ }
4983
5082
 
4984
5083
  let supported;
4985
5084
  let perf;
@@ -5048,7 +5147,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5048
5147
  setScopeId: hostSetScopeId = shared.NOOP,
5049
5148
  insertStaticContent: hostInsertStaticContent
5050
5149
  } = options;
5051
- const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
5150
+ const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
5052
5151
  if (n1 === n2) {
5053
5152
  return;
5054
5153
  }
@@ -5071,9 +5170,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5071
5170
  break;
5072
5171
  case Static:
5073
5172
  if (n1 == null) {
5074
- mountStaticNode(n2, container, anchor, isSVG);
5173
+ mountStaticNode(n2, container, anchor, namespace);
5075
5174
  } else {
5076
- patchStaticNode(n1, n2, container, isSVG);
5175
+ patchStaticNode(n1, n2, container, namespace);
5077
5176
  }
5078
5177
  break;
5079
5178
  case Fragment:
@@ -5084,7 +5183,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5084
5183
  anchor,
5085
5184
  parentComponent,
5086
5185
  parentSuspense,
5087
- isSVG,
5186
+ namespace,
5088
5187
  slotScopeIds,
5089
5188
  optimized
5090
5189
  );
@@ -5098,7 +5197,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5098
5197
  anchor,
5099
5198
  parentComponent,
5100
5199
  parentSuspense,
5101
- isSVG,
5200
+ namespace,
5102
5201
  slotScopeIds,
5103
5202
  optimized
5104
5203
  );
@@ -5110,7 +5209,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5110
5209
  anchor,
5111
5210
  parentComponent,
5112
5211
  parentSuspense,
5113
- isSVG,
5212
+ namespace,
5114
5213
  slotScopeIds,
5115
5214
  optimized
5116
5215
  );
@@ -5122,7 +5221,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5122
5221
  anchor,
5123
5222
  parentComponent,
5124
5223
  parentSuspense,
5125
- isSVG,
5224
+ namespace,
5126
5225
  slotScopeIds,
5127
5226
  optimized,
5128
5227
  internals
@@ -5135,7 +5234,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5135
5234
  anchor,
5136
5235
  parentComponent,
5137
5236
  parentSuspense,
5138
- isSVG,
5237
+ namespace,
5139
5238
  slotScopeIds,
5140
5239
  optimized,
5141
5240
  internals
@@ -5173,17 +5272,17 @@ function baseCreateRenderer(options, createHydrationFns) {
5173
5272
  n2.el = n1.el;
5174
5273
  }
5175
5274
  };
5176
- const mountStaticNode = (n2, container, anchor, isSVG) => {
5275
+ const mountStaticNode = (n2, container, anchor, namespace) => {
5177
5276
  [n2.el, n2.anchor] = hostInsertStaticContent(
5178
5277
  n2.children,
5179
5278
  container,
5180
5279
  anchor,
5181
- isSVG,
5280
+ namespace,
5182
5281
  n2.el,
5183
5282
  n2.anchor
5184
5283
  );
5185
5284
  };
5186
- const patchStaticNode = (n1, n2, container, isSVG) => {
5285
+ const patchStaticNode = (n1, n2, container, namespace) => {
5187
5286
  if (n2.children !== n1.children) {
5188
5287
  const anchor = hostNextSibling(n1.anchor);
5189
5288
  removeStaticNode(n1);
@@ -5191,7 +5290,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5191
5290
  n2.children,
5192
5291
  container,
5193
5292
  anchor,
5194
- isSVG
5293
+ namespace
5195
5294
  );
5196
5295
  } else {
5197
5296
  n2.el = n1.el;
@@ -5216,8 +5315,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5216
5315
  }
5217
5316
  hostRemove(anchor);
5218
5317
  };
5219
- const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5220
- isSVG = isSVG || n2.type === "svg";
5318
+ const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5319
+ if (n2.type === "svg") {
5320
+ namespace = "svg";
5321
+ } else if (n2.type === "math") {
5322
+ namespace = "mathml";
5323
+ }
5221
5324
  if (n1 == null) {
5222
5325
  mountElement(
5223
5326
  n2,
@@ -5225,7 +5328,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5225
5328
  anchor,
5226
5329
  parentComponent,
5227
5330
  parentSuspense,
5228
- isSVG,
5331
+ namespace,
5229
5332
  slotScopeIds,
5230
5333
  optimized
5231
5334
  );
@@ -5235,19 +5338,19 @@ function baseCreateRenderer(options, createHydrationFns) {
5235
5338
  n2,
5236
5339
  parentComponent,
5237
5340
  parentSuspense,
5238
- isSVG,
5341
+ namespace,
5239
5342
  slotScopeIds,
5240
5343
  optimized
5241
5344
  );
5242
5345
  }
5243
5346
  };
5244
- const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5347
+ const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5245
5348
  let el;
5246
5349
  let vnodeHook;
5247
- const { type, props, shapeFlag, transition, dirs } = vnode;
5350
+ const { props, shapeFlag, transition, dirs } = vnode;
5248
5351
  el = vnode.el = hostCreateElement(
5249
5352
  vnode.type,
5250
- isSVG,
5353
+ namespace,
5251
5354
  props && props.is,
5252
5355
  props
5253
5356
  );
@@ -5260,7 +5363,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5260
5363
  null,
5261
5364
  parentComponent,
5262
5365
  parentSuspense,
5263
- isSVG && type !== "foreignObject",
5366
+ resolveChildrenNamespace(vnode, namespace),
5264
5367
  slotScopeIds,
5265
5368
  optimized
5266
5369
  );
@@ -5277,7 +5380,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5277
5380
  key,
5278
5381
  null,
5279
5382
  props[key],
5280
- isSVG,
5383
+ namespace,
5281
5384
  vnode.children,
5282
5385
  parentComponent,
5283
5386
  parentSuspense,
@@ -5286,7 +5389,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5286
5389
  }
5287
5390
  }
5288
5391
  if ("value" in props) {
5289
- hostPatchProp(el, "value", null, props.value);
5392
+ hostPatchProp(el, "value", null, props.value, namespace);
5290
5393
  }
5291
5394
  if (vnodeHook = props.onVnodeBeforeMount) {
5292
5395
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -5344,7 +5447,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5344
5447
  }
5345
5448
  }
5346
5449
  };
5347
- const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
5450
+ const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
5348
5451
  for (let i = start; i < children.length; i++) {
5349
5452
  const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]);
5350
5453
  patch(
@@ -5354,13 +5457,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5354
5457
  anchor,
5355
5458
  parentComponent,
5356
5459
  parentSuspense,
5357
- isSVG,
5460
+ namespace,
5358
5461
  slotScopeIds,
5359
5462
  optimized
5360
5463
  );
5361
5464
  }
5362
5465
  };
5363
- const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5466
+ const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5364
5467
  const el = n2.el = n1.el;
5365
5468
  let { patchFlag, dynamicChildren, dirs } = n2;
5366
5469
  patchFlag |= n1.patchFlag & 16;
@@ -5380,7 +5483,6 @@ function baseCreateRenderer(options, createHydrationFns) {
5380
5483
  optimized = false;
5381
5484
  dynamicChildren = null;
5382
5485
  }
5383
- const areChildrenSVG = isSVG && n2.type !== "foreignObject";
5384
5486
  if (dynamicChildren) {
5385
5487
  patchBlockChildren(
5386
5488
  n1.dynamicChildren,
@@ -5388,7 +5490,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5388
5490
  el,
5389
5491
  parentComponent,
5390
5492
  parentSuspense,
5391
- areChildrenSVG,
5493
+ resolveChildrenNamespace(n2, namespace),
5392
5494
  slotScopeIds
5393
5495
  );
5394
5496
  {
@@ -5402,7 +5504,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5402
5504
  null,
5403
5505
  parentComponent,
5404
5506
  parentSuspense,
5405
- areChildrenSVG,
5507
+ resolveChildrenNamespace(n2, namespace),
5406
5508
  slotScopeIds,
5407
5509
  false
5408
5510
  );
@@ -5416,16 +5518,16 @@ function baseCreateRenderer(options, createHydrationFns) {
5416
5518
  newProps,
5417
5519
  parentComponent,
5418
5520
  parentSuspense,
5419
- isSVG
5521
+ namespace
5420
5522
  );
5421
5523
  } else {
5422
5524
  if (patchFlag & 2) {
5423
5525
  if (oldProps.class !== newProps.class) {
5424
- hostPatchProp(el, "class", null, newProps.class, isSVG);
5526
+ hostPatchProp(el, "class", null, newProps.class, namespace);
5425
5527
  }
5426
5528
  }
5427
5529
  if (patchFlag & 4) {
5428
- hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
5530
+ hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
5429
5531
  }
5430
5532
  if (patchFlag & 8) {
5431
5533
  const propsToUpdate = n2.dynamicProps;
@@ -5439,7 +5541,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5439
5541
  key,
5440
5542
  prev,
5441
5543
  next,
5442
- isSVG,
5544
+ namespace,
5443
5545
  n1.children,
5444
5546
  parentComponent,
5445
5547
  parentSuspense,
@@ -5462,7 +5564,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5462
5564
  newProps,
5463
5565
  parentComponent,
5464
5566
  parentSuspense,
5465
- isSVG
5567
+ namespace
5466
5568
  );
5467
5569
  }
5468
5570
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
@@ -5472,7 +5574,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5472
5574
  }, parentSuspense);
5473
5575
  }
5474
5576
  };
5475
- const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
5577
+ const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
5476
5578
  for (let i = 0; i < newChildren.length; i++) {
5477
5579
  const oldVNode = oldChildren[i];
5478
5580
  const newVNode = newChildren[i];
@@ -5497,13 +5599,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5497
5599
  null,
5498
5600
  parentComponent,
5499
5601
  parentSuspense,
5500
- isSVG,
5602
+ namespace,
5501
5603
  slotScopeIds,
5502
5604
  true
5503
5605
  );
5504
5606
  }
5505
5607
  };
5506
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
5608
+ const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
5507
5609
  if (oldProps !== newProps) {
5508
5610
  if (oldProps !== shared.EMPTY_OBJ) {
5509
5611
  for (const key in oldProps) {
@@ -5513,7 +5615,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5513
5615
  key,
5514
5616
  oldProps[key],
5515
5617
  null,
5516
- isSVG,
5618
+ namespace,
5517
5619
  vnode.children,
5518
5620
  parentComponent,
5519
5621
  parentSuspense,
@@ -5533,7 +5635,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5533
5635
  key,
5534
5636
  prev,
5535
5637
  next,
5536
- isSVG,
5638
+ namespace,
5537
5639
  vnode.children,
5538
5640
  parentComponent,
5539
5641
  parentSuspense,
@@ -5542,11 +5644,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5542
5644
  }
5543
5645
  }
5544
5646
  if ("value" in newProps) {
5545
- hostPatchProp(el, "value", oldProps.value, newProps.value);
5647
+ hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
5546
5648
  }
5547
5649
  }
5548
5650
  };
5549
- const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5651
+ const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5550
5652
  const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
5551
5653
  const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
5552
5654
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
@@ -5570,7 +5672,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5570
5672
  fragmentEndAnchor,
5571
5673
  parentComponent,
5572
5674
  parentSuspense,
5573
- isSVG,
5675
+ namespace,
5574
5676
  slotScopeIds,
5575
5677
  optimized
5576
5678
  );
@@ -5584,7 +5686,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5584
5686
  container,
5585
5687
  parentComponent,
5586
5688
  parentSuspense,
5587
- isSVG,
5689
+ namespace,
5588
5690
  slotScopeIds
5589
5691
  );
5590
5692
  {
@@ -5598,14 +5700,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5598
5700
  fragmentEndAnchor,
5599
5701
  parentComponent,
5600
5702
  parentSuspense,
5601
- isSVG,
5703
+ namespace,
5602
5704
  slotScopeIds,
5603
5705
  optimized
5604
5706
  );
5605
5707
  }
5606
5708
  }
5607
5709
  };
5608
- const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5710
+ const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5609
5711
  n2.slotScopeIds = slotScopeIds;
5610
5712
  if (n1 == null) {
5611
5713
  if (n2.shapeFlag & 512) {
@@ -5613,7 +5715,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5613
5715
  n2,
5614
5716
  container,
5615
5717
  anchor,
5616
- isSVG,
5718
+ namespace,
5617
5719
  optimized
5618
5720
  );
5619
5721
  } else {
@@ -5623,7 +5725,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5623
5725
  anchor,
5624
5726
  parentComponent,
5625
5727
  parentSuspense,
5626
- isSVG,
5728
+ namespace,
5627
5729
  optimized
5628
5730
  );
5629
5731
  }
@@ -5631,7 +5733,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5631
5733
  updateComponent(n1, n2, optimized);
5632
5734
  }
5633
5735
  };
5634
- const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
5736
+ const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
5635
5737
  const instance = (initialVNode.component = createComponentInstance(
5636
5738
  initialVNode,
5637
5739
  parentComponent,
@@ -5662,17 +5764,17 @@ function baseCreateRenderer(options, createHydrationFns) {
5662
5764
  const placeholder = instance.subTree = createVNode(Comment);
5663
5765
  processCommentNode(null, placeholder, container, anchor);
5664
5766
  }
5665
- return;
5767
+ } else {
5768
+ setupRenderEffect(
5769
+ instance,
5770
+ initialVNode,
5771
+ container,
5772
+ anchor,
5773
+ parentSuspense,
5774
+ namespace,
5775
+ optimized
5776
+ );
5666
5777
  }
5667
- setupRenderEffect(
5668
- instance,
5669
- initialVNode,
5670
- container,
5671
- anchor,
5672
- parentSuspense,
5673
- isSVG,
5674
- optimized
5675
- );
5676
5778
  {
5677
5779
  popWarningContext();
5678
5780
  endMeasure(instance, `mount`);
@@ -5701,7 +5803,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5701
5803
  instance.vnode = n2;
5702
5804
  }
5703
5805
  };
5704
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
5806
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
5705
5807
  const componentUpdateFn = () => {
5706
5808
  if (!instance.isMounted) {
5707
5809
  let vnodeHook;
@@ -5768,7 +5870,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5768
5870
  anchor,
5769
5871
  instance,
5770
5872
  parentSuspense,
5771
- isSVG
5873
+ namespace
5772
5874
  );
5773
5875
  {
5774
5876
  endMeasure(instance, `patch`);
@@ -5795,6 +5897,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5795
5897
  initialVNode = container = anchor = null;
5796
5898
  } else {
5797
5899
  let { next, bu, u, parent, vnode } = instance;
5900
+ {
5901
+ const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
5902
+ if (nonHydratedAsyncRoot) {
5903
+ if (next) {
5904
+ next.el = vnode.el;
5905
+ updateComponentPreRender(instance, next, optimized);
5906
+ }
5907
+ nonHydratedAsyncRoot.asyncDep.then(() => {
5908
+ if (!instance.isUnmounted) {
5909
+ componentUpdateFn();
5910
+ }
5911
+ });
5912
+ return;
5913
+ }
5914
+ }
5798
5915
  let originNext = next;
5799
5916
  let vnodeHook;
5800
5917
  {
@@ -5835,7 +5952,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5835
5952
  getNextHostNode(prevTree),
5836
5953
  instance,
5837
5954
  parentSuspense,
5838
- isSVG
5955
+ namespace
5839
5956
  );
5840
5957
  {
5841
5958
  endMeasure(instance, `patch`);
@@ -5890,10 +6007,10 @@ function baseCreateRenderer(options, createHydrationFns) {
5890
6007
  updateProps(instance, nextVNode.props, prevProps, optimized);
5891
6008
  updateSlots(instance, nextVNode.children, optimized);
5892
6009
  reactivity.pauseTracking();
5893
- flushPreFlushCbs();
6010
+ flushPreFlushCbs(instance);
5894
6011
  reactivity.resetTracking();
5895
6012
  };
5896
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
6013
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5897
6014
  const c1 = n1 && n1.children;
5898
6015
  const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5899
6016
  const c2 = n2.children;
@@ -5907,7 +6024,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5907
6024
  anchor,
5908
6025
  parentComponent,
5909
6026
  parentSuspense,
5910
- isSVG,
6027
+ namespace,
5911
6028
  slotScopeIds,
5912
6029
  optimized
5913
6030
  );
@@ -5920,7 +6037,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5920
6037
  anchor,
5921
6038
  parentComponent,
5922
6039
  parentSuspense,
5923
- isSVG,
6040
+ namespace,
5924
6041
  slotScopeIds,
5925
6042
  optimized
5926
6043
  );
@@ -5944,7 +6061,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5944
6061
  anchor,
5945
6062
  parentComponent,
5946
6063
  parentSuspense,
5947
- isSVG,
6064
+ namespace,
5948
6065
  slotScopeIds,
5949
6066
  optimized
5950
6067
  );
@@ -5962,7 +6079,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5962
6079
  anchor,
5963
6080
  parentComponent,
5964
6081
  parentSuspense,
5965
- isSVG,
6082
+ namespace,
5966
6083
  slotScopeIds,
5967
6084
  optimized
5968
6085
  );
@@ -5970,7 +6087,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5970
6087
  }
5971
6088
  }
5972
6089
  };
5973
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6090
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5974
6091
  c1 = c1 || shared.EMPTY_ARR;
5975
6092
  c2 = c2 || shared.EMPTY_ARR;
5976
6093
  const oldLength = c1.length;
@@ -5986,7 +6103,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5986
6103
  null,
5987
6104
  parentComponent,
5988
6105
  parentSuspense,
5989
- isSVG,
6106
+ namespace,
5990
6107
  slotScopeIds,
5991
6108
  optimized
5992
6109
  );
@@ -6007,14 +6124,14 @@ function baseCreateRenderer(options, createHydrationFns) {
6007
6124
  anchor,
6008
6125
  parentComponent,
6009
6126
  parentSuspense,
6010
- isSVG,
6127
+ namespace,
6011
6128
  slotScopeIds,
6012
6129
  optimized,
6013
6130
  commonLength
6014
6131
  );
6015
6132
  }
6016
6133
  };
6017
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
6134
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
6018
6135
  let i = 0;
6019
6136
  const l2 = c2.length;
6020
6137
  let e1 = c1.length - 1;
@@ -6030,7 +6147,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6030
6147
  null,
6031
6148
  parentComponent,
6032
6149
  parentSuspense,
6033
- isSVG,
6150
+ namespace,
6034
6151
  slotScopeIds,
6035
6152
  optimized
6036
6153
  );
@@ -6050,7 +6167,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6050
6167
  null,
6051
6168
  parentComponent,
6052
6169
  parentSuspense,
6053
- isSVG,
6170
+ namespace,
6054
6171
  slotScopeIds,
6055
6172
  optimized
6056
6173
  );
@@ -6072,7 +6189,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6072
6189
  anchor,
6073
6190
  parentComponent,
6074
6191
  parentSuspense,
6075
- isSVG,
6192
+ namespace,
6076
6193
  slotScopeIds,
6077
6194
  optimized
6078
6195
  );
@@ -6142,7 +6259,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6142
6259
  null,
6143
6260
  parentComponent,
6144
6261
  parentSuspense,
6145
- isSVG,
6262
+ namespace,
6146
6263
  slotScopeIds,
6147
6264
  optimized
6148
6265
  );
@@ -6163,7 +6280,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6163
6280
  anchor,
6164
6281
  parentComponent,
6165
6282
  parentSuspense,
6166
- isSVG,
6283
+ namespace,
6167
6284
  slotScopeIds,
6168
6285
  optimized
6169
6286
  );
@@ -6384,13 +6501,21 @@ function baseCreateRenderer(options, createHydrationFns) {
6384
6501
  }
6385
6502
  return hostNextSibling(vnode.anchor || vnode.el);
6386
6503
  };
6387
- const render = (vnode, container, isSVG) => {
6504
+ const render = (vnode, container, namespace) => {
6388
6505
  if (vnode == null) {
6389
6506
  if (container._vnode) {
6390
6507
  unmount(container._vnode, null, null, true);
6391
6508
  }
6392
6509
  } else {
6393
- patch(container._vnode || null, vnode, container, null, null, null, isSVG);
6510
+ patch(
6511
+ container._vnode || null,
6512
+ vnode,
6513
+ container,
6514
+ null,
6515
+ null,
6516
+ null,
6517
+ namespace
6518
+ );
6394
6519
  }
6395
6520
  flushPreFlushCbs();
6396
6521
  flushPostFlushCbs();
@@ -6421,6 +6546,9 @@ function baseCreateRenderer(options, createHydrationFns) {
6421
6546
  createApp: createAppAPI(render, hydrate)
6422
6547
  };
6423
6548
  }
6549
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
6550
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
6551
+ }
6424
6552
  function toggleRecurse({ effect, update }, allowed) {
6425
6553
  effect.allowRecurse = update.allowRecurse = allowed;
6426
6554
  }
@@ -6491,10 +6619,21 @@ function getSequence(arr) {
6491
6619
  }
6492
6620
  return result;
6493
6621
  }
6622
+ function locateNonHydratedAsyncRoot(instance) {
6623
+ const subComponent = instance.subTree.component;
6624
+ if (subComponent) {
6625
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
6626
+ return subComponent;
6627
+ } else {
6628
+ return locateNonHydratedAsyncRoot(subComponent);
6629
+ }
6630
+ }
6631
+ }
6494
6632
 
6495
6633
  const isTeleport = (type) => type.__isTeleport;
6496
6634
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
6497
6635
  const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
6636
+ const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
6498
6637
  const resolveTarget = (props, select) => {
6499
6638
  const targetSelector = props && props.to;
6500
6639
  if (shared.isString(targetSelector)) {
@@ -6522,7 +6661,7 @@ const resolveTarget = (props, select) => {
6522
6661
  const TeleportImpl = {
6523
6662
  name: "Teleport",
6524
6663
  __isTeleport: true,
6525
- process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
6664
+ process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
6526
6665
  const {
6527
6666
  mc: mountChildren,
6528
6667
  pc: patchChildren,
@@ -6544,7 +6683,11 @@ const TeleportImpl = {
6544
6683
  const targetAnchor = n2.targetAnchor = createText("");
6545
6684
  if (target) {
6546
6685
  insert(targetAnchor, target);
6547
- isSVG = isSVG || isTargetSVG(target);
6686
+ if (namespace === "svg" || isTargetSVG(target)) {
6687
+ namespace = "svg";
6688
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
6689
+ namespace = "mathml";
6690
+ }
6548
6691
  } else if (!disabled) {
6549
6692
  warn("Invalid Teleport target on mount:", target, `(${typeof target})`);
6550
6693
  }
@@ -6556,7 +6699,7 @@ const TeleportImpl = {
6556
6699
  anchor2,
6557
6700
  parentComponent,
6558
6701
  parentSuspense,
6559
- isSVG,
6702
+ namespace,
6560
6703
  slotScopeIds,
6561
6704
  optimized
6562
6705
  );
@@ -6575,7 +6718,11 @@ const TeleportImpl = {
6575
6718
  const wasDisabled = isTeleportDisabled(n1.props);
6576
6719
  const currentContainer = wasDisabled ? container : target;
6577
6720
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
6578
- isSVG = isSVG || isTargetSVG(target);
6721
+ if (namespace === "svg" || isTargetSVG(target)) {
6722
+ namespace = "svg";
6723
+ } else if (namespace === "mathml" || isTargetMathML(target)) {
6724
+ namespace = "mathml";
6725
+ }
6579
6726
  if (dynamicChildren) {
6580
6727
  patchBlockChildren(
6581
6728
  n1.dynamicChildren,
@@ -6583,7 +6730,7 @@ const TeleportImpl = {
6583
6730
  currentContainer,
6584
6731
  parentComponent,
6585
6732
  parentSuspense,
6586
- isSVG,
6733
+ namespace,
6587
6734
  slotScopeIds
6588
6735
  );
6589
6736
  traverseStaticChildren(n1, n2, true);
@@ -6595,7 +6742,7 @@ const TeleportImpl = {
6595
6742
  currentAnchor,
6596
6743
  parentComponent,
6597
6744
  parentSuspense,
6598
- isSVG,
6745
+ namespace,
6599
6746
  slotScopeIds,
6600
6747
  false
6601
6748
  );
@@ -7218,20 +7365,29 @@ function createComponentInstance(vnode, parent, suspense) {
7218
7365
  let currentInstance = null;
7219
7366
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
7220
7367
  let internalSetCurrentInstance;
7221
- let globalCurrentInstanceSetters;
7222
- let settersKey = "__VUE_INSTANCE_SETTERS__";
7368
+ let setInSSRSetupState;
7223
7369
  {
7224
- if (!(globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey])) {
7225
- globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey] = [];
7226
- }
7227
- globalCurrentInstanceSetters.push((i) => currentInstance = i);
7228
- internalSetCurrentInstance = (instance) => {
7229
- if (globalCurrentInstanceSetters.length > 1) {
7230
- globalCurrentInstanceSetters.forEach((s) => s(instance));
7231
- } else {
7232
- globalCurrentInstanceSetters[0](instance);
7233
- }
7370
+ const g = shared.getGlobalThis();
7371
+ const registerGlobalSetter = (key, setter) => {
7372
+ let setters;
7373
+ if (!(setters = g[key]))
7374
+ setters = g[key] = [];
7375
+ setters.push(setter);
7376
+ return (v) => {
7377
+ if (setters.length > 1)
7378
+ setters.forEach((set) => set(v));
7379
+ else
7380
+ setters[0](v);
7381
+ };
7234
7382
  };
7383
+ internalSetCurrentInstance = registerGlobalSetter(
7384
+ `__VUE_INSTANCE_SETTERS__`,
7385
+ (v) => currentInstance = v
7386
+ );
7387
+ setInSSRSetupState = registerGlobalSetter(
7388
+ `__VUE_SSR_SETTERS__`,
7389
+ (v) => isInSSRComponentSetup = v
7390
+ );
7235
7391
  }
7236
7392
  const setCurrentInstance = (instance) => {
7237
7393
  internalSetCurrentInstance(instance);
@@ -7255,13 +7411,13 @@ function isStatefulComponent(instance) {
7255
7411
  }
7256
7412
  let isInSSRComponentSetup = false;
7257
7413
  function setupComponent(instance, isSSR = false) {
7258
- isInSSRComponentSetup = isSSR;
7414
+ isSSR && setInSSRSetupState(isSSR);
7259
7415
  const { props, children } = instance.vnode;
7260
7416
  const isStateful = isStatefulComponent(instance);
7261
7417
  initProps(instance, props, isStateful, isSSR);
7262
7418
  initSlots(instance, children);
7263
7419
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
7264
- isInSSRComponentSetup = false;
7420
+ isSSR && setInSSRSetupState(false);
7265
7421
  return setupResult;
7266
7422
  }
7267
7423
  function setupStatefulComponent(instance, isSSR) {
@@ -7583,9 +7739,9 @@ function initCustomFormatter() {
7583
7739
  return;
7584
7740
  }
7585
7741
  const vueStyle = { style: "color:#3ba776" };
7586
- const numberStyle = { style: "color:#0b1bc9" };
7587
- const stringStyle = { style: "color:#b62e24" };
7588
- const keywordStyle = { style: "color:#9d288c" };
7742
+ const numberStyle = { style: "color:#1677ff" };
7743
+ const stringStyle = { style: "color:#f5222d" };
7744
+ const keywordStyle = { style: "color:#eb2f96" };
7589
7745
  const formatter = {
7590
7746
  header(obj) {
7591
7747
  if (!shared.isObject(obj)) {
@@ -7779,7 +7935,7 @@ function isMemoSame(cached, memo) {
7779
7935
  return true;
7780
7936
  }
7781
7937
 
7782
- const version = "3.4.0-alpha.3";
7938
+ const version = "3.4.0-beta.1";
7783
7939
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
7784
7940
  const _ssrUtils = {
7785
7941
  createComponentInstance,
@@ -7792,9 +7948,12 @@ const _ssrUtils = {
7792
7948
  const ssrUtils = _ssrUtils ;
7793
7949
  const resolveFilter = null;
7794
7950
  const compatUtils = null;
7951
+ const DeprecationTypes = null;
7795
7952
 
7796
7953
  exports.EffectScope = reactivity.EffectScope;
7797
7954
  exports.ReactiveEffect = reactivity.ReactiveEffect;
7955
+ exports.TrackOpTypes = reactivity.TrackOpTypes;
7956
+ exports.TriggerOpTypes = reactivity.TriggerOpTypes;
7798
7957
  exports.customRef = reactivity.customRef;
7799
7958
  exports.effect = reactivity.effect;
7800
7959
  exports.effectScope = reactivity.effectScope;
@@ -7830,6 +7989,8 @@ exports.toHandlerKey = shared.toHandlerKey;
7830
7989
  exports.BaseTransition = BaseTransition;
7831
7990
  exports.BaseTransitionPropsValidators = BaseTransitionPropsValidators;
7832
7991
  exports.Comment = Comment;
7992
+ exports.DeprecationTypes = DeprecationTypes;
7993
+ exports.ErrorCodes = ErrorCodes;
7833
7994
  exports.ErrorTypeStrings = ErrorTypeStrings;
7834
7995
  exports.Fragment = Fragment;
7835
7996
  exports.KeepAlive = KeepAlive;