@vue/server-renderer 3.4.0-alpha.4 → 3.4.0-beta.2

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.
@@ -156,9 +156,11 @@ function normalizeClass(value) {
156
156
 
157
157
  const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
158
158
  const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
159
+ const MATH_TAGS = "math,maction,annotation,annotation-xml,menclose,merror,mfenced,mfrac,mi,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,semantics,mspace,msqrt,mstyle,msub,msup,msubsup,mtable,mtd,mtext,mtr,munder,munderover";
159
160
  const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
160
161
  const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
161
162
  const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
163
+ const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
162
164
  const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
163
165
 
164
166
  const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
@@ -292,20 +294,29 @@ const replacer = (_key, val) => {
292
294
  return replacer(_key, val.value);
293
295
  } else if (isMap(val)) {
294
296
  return {
295
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
296
- entries[`${key} =>`] = val2;
297
- return entries;
298
- }, {})
297
+ [`Map(${val.size})`]: [...val.entries()].reduce(
298
+ (entries, [key, val2], i) => {
299
+ entries[stringifySymbol(key, i) + " =>"] = val2;
300
+ return entries;
301
+ },
302
+ {}
303
+ )
299
304
  };
300
305
  } else if (isSet(val)) {
301
306
  return {
302
- [`Set(${val.size})`]: [...val.values()]
307
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
303
308
  };
309
+ } else if (isSymbol(val)) {
310
+ return stringifySymbol(val);
304
311
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
305
312
  return String(val);
306
313
  }
307
314
  return val;
308
315
  };
316
+ const stringifySymbol = (v, i = "") => {
317
+ var _a;
318
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
319
+ };
309
320
 
310
321
  function warn$1(msg, ...args) {
311
322
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -714,8 +725,13 @@ class BaseReactiveHandler {
714
725
  return isReadonly2;
715
726
  } else if (key === "__v_isShallow") {
716
727
  return shallow;
717
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
718
- return target;
728
+ } else if (key === "__v_raw") {
729
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
730
+ // this means the reciever is a user proxy of the reactive proxy
731
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
732
+ return target;
733
+ }
734
+ return;
719
735
  }
720
736
  const targetIsArray = isArray(target);
721
737
  if (!isReadonly2) {
@@ -751,17 +767,19 @@ class MutableReactiveHandler extends BaseReactiveHandler {
751
767
  }
752
768
  set(target, key, value, receiver) {
753
769
  let oldValue = target[key];
754
- if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
755
- return false;
756
- }
757
770
  if (!this._shallow) {
771
+ const isOldValueReadonly = isReadonly(oldValue);
758
772
  if (!isShallow(value) && !isReadonly(value)) {
759
773
  oldValue = toRaw(oldValue);
760
774
  value = toRaw(value);
761
775
  }
762
776
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
763
- oldValue.value = value;
764
- return true;
777
+ if (isOldValueReadonly) {
778
+ return false;
779
+ } else {
780
+ oldValue.value = value;
781
+ return true;
782
+ }
765
783
  }
766
784
  }
767
785
  const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
@@ -1616,13 +1634,16 @@ function queuePostFlushCb(cb) {
1616
1634
  }
1617
1635
  queueFlush();
1618
1636
  }
1619
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1637
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1620
1638
  {
1621
1639
  seen = seen || /* @__PURE__ */ new Map();
1622
1640
  }
1623
1641
  for (; i < queue.length; i++) {
1624
1642
  const cb = queue[i];
1625
1643
  if (cb && cb.pre) {
1644
+ if (instance && cb.id !== instance.uid) {
1645
+ continue;
1646
+ }
1626
1647
  if (checkRecursiveUpdates(seen, cb)) {
1627
1648
  continue;
1628
1649
  }
@@ -2374,9 +2395,17 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2374
2395
  return false;
2375
2396
  }
2376
2397
  function updateHOCHostEl({ vnode, parent }, el) {
2377
- while (parent && parent.subTree === vnode) {
2378
- (vnode = parent.vnode).el = el;
2379
- parent = parent.parent;
2398
+ while (parent) {
2399
+ const root = parent.subTree;
2400
+ if (root.suspense && root.suspense.activeBranch === vnode) {
2401
+ root.el = vnode.el;
2402
+ }
2403
+ if (root === vnode) {
2404
+ (vnode = parent.vnode).el = el;
2405
+ parent = parent.parent;
2406
+ } else {
2407
+ break;
2408
+ }
2380
2409
  }
2381
2410
  }
2382
2411
 
@@ -3506,7 +3535,7 @@ function createAppAPI(render, hydrate) {
3506
3535
  context.directives[name] = directive;
3507
3536
  return app;
3508
3537
  },
3509
- mount(rootContainer, isHydrate, isSVG) {
3538
+ mount(rootContainer, isHydrate, namespace) {
3510
3539
  if (!isMounted) {
3511
3540
  if (rootContainer.__vue_app__) {
3512
3541
  warn(
@@ -3516,15 +3545,24 @@ function createAppAPI(render, hydrate) {
3516
3545
  }
3517
3546
  const vnode = createVNode(rootComponent, rootProps);
3518
3547
  vnode.appContext = context;
3548
+ if (namespace === true) {
3549
+ namespace = "svg";
3550
+ } else if (namespace === false) {
3551
+ namespace = void 0;
3552
+ }
3519
3553
  {
3520
3554
  context.reload = () => {
3521
- render(cloneVNode(vnode), rootContainer, isSVG);
3555
+ render(
3556
+ cloneVNode(vnode),
3557
+ rootContainer,
3558
+ namespace
3559
+ );
3522
3560
  };
3523
3561
  }
3524
3562
  if (isHydrate && hydrate) {
3525
3563
  hydrate(vnode, rootContainer);
3526
3564
  } else {
3527
- render(vnode, rootContainer, isSVG);
3565
+ render(vnode, rootContainer, namespace);
3528
3566
  }
3529
3567
  isMounted = true;
3530
3568
  app._container = rootContainer;
@@ -3911,11 +3949,12 @@ function validateProps(rawProps, props, instance) {
3911
3949
  key,
3912
3950
  resolvedValues[key],
3913
3951
  opt,
3952
+ shallowReadonly(resolvedValues) ,
3914
3953
  !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
3915
3954
  );
3916
3955
  }
3917
3956
  }
3918
- function validateProp(name, value, prop, isAbsent) {
3957
+ function validateProp(name, value, prop, props, isAbsent) {
3919
3958
  const { type, required, validator, skipCheck } = prop;
3920
3959
  if (required && isAbsent) {
3921
3960
  warn('Missing required prop: "' + name + '"');
@@ -3938,7 +3977,7 @@ function validateProp(name, value, prop, isAbsent) {
3938
3977
  return;
3939
3978
  }
3940
3979
  }
3941
- if (validator && !validator(value)) {
3980
+ if (validator && !validator(value, props)) {
3942
3981
  warn('Invalid prop: custom validator check failed for prop "' + name + '".');
3943
3982
  }
3944
3983
  }
@@ -4257,7 +4296,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4257
4296
  setScopeId: hostSetScopeId = NOOP,
4258
4297
  insertStaticContent: hostInsertStaticContent
4259
4298
  } = options;
4260
- const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
4299
+ const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, namespace = void 0, slotScopeIds = null, optimized = isHmrUpdating ? false : !!n2.dynamicChildren) => {
4261
4300
  if (n1 === n2) {
4262
4301
  return;
4263
4302
  }
@@ -4280,9 +4319,9 @@ function baseCreateRenderer(options, createHydrationFns) {
4280
4319
  break;
4281
4320
  case Static:
4282
4321
  if (n1 == null) {
4283
- mountStaticNode(n2, container, anchor, isSVG);
4322
+ mountStaticNode(n2, container, anchor, namespace);
4284
4323
  } else {
4285
- patchStaticNode(n1, n2, container, isSVG);
4324
+ patchStaticNode(n1, n2, container, namespace);
4286
4325
  }
4287
4326
  break;
4288
4327
  case Fragment:
@@ -4293,7 +4332,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4293
4332
  anchor,
4294
4333
  parentComponent,
4295
4334
  parentSuspense,
4296
- isSVG,
4335
+ namespace,
4297
4336
  slotScopeIds,
4298
4337
  optimized
4299
4338
  );
@@ -4307,7 +4346,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4307
4346
  anchor,
4308
4347
  parentComponent,
4309
4348
  parentSuspense,
4310
- isSVG,
4349
+ namespace,
4311
4350
  slotScopeIds,
4312
4351
  optimized
4313
4352
  );
@@ -4319,7 +4358,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4319
4358
  anchor,
4320
4359
  parentComponent,
4321
4360
  parentSuspense,
4322
- isSVG,
4361
+ namespace,
4323
4362
  slotScopeIds,
4324
4363
  optimized
4325
4364
  );
@@ -4331,7 +4370,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4331
4370
  anchor,
4332
4371
  parentComponent,
4333
4372
  parentSuspense,
4334
- isSVG,
4373
+ namespace,
4335
4374
  slotScopeIds,
4336
4375
  optimized,
4337
4376
  internals
@@ -4344,7 +4383,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4344
4383
  anchor,
4345
4384
  parentComponent,
4346
4385
  parentSuspense,
4347
- isSVG,
4386
+ namespace,
4348
4387
  slotScopeIds,
4349
4388
  optimized,
4350
4389
  internals
@@ -4382,17 +4421,17 @@ function baseCreateRenderer(options, createHydrationFns) {
4382
4421
  n2.el = n1.el;
4383
4422
  }
4384
4423
  };
4385
- const mountStaticNode = (n2, container, anchor, isSVG) => {
4424
+ const mountStaticNode = (n2, container, anchor, namespace) => {
4386
4425
  [n2.el, n2.anchor] = hostInsertStaticContent(
4387
4426
  n2.children,
4388
4427
  container,
4389
4428
  anchor,
4390
- isSVG,
4429
+ namespace,
4391
4430
  n2.el,
4392
4431
  n2.anchor
4393
4432
  );
4394
4433
  };
4395
- const patchStaticNode = (n1, n2, container, isSVG) => {
4434
+ const patchStaticNode = (n1, n2, container, namespace) => {
4396
4435
  if (n2.children !== n1.children) {
4397
4436
  const anchor = hostNextSibling(n1.anchor);
4398
4437
  removeStaticNode(n1);
@@ -4400,7 +4439,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4400
4439
  n2.children,
4401
4440
  container,
4402
4441
  anchor,
4403
- isSVG
4442
+ namespace
4404
4443
  );
4405
4444
  } else {
4406
4445
  n2.el = n1.el;
@@ -4425,8 +4464,12 @@ function baseCreateRenderer(options, createHydrationFns) {
4425
4464
  }
4426
4465
  hostRemove(anchor);
4427
4466
  };
4428
- const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4429
- isSVG = isSVG || n2.type === "svg";
4467
+ const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4468
+ if (n2.type === "svg") {
4469
+ namespace = "svg";
4470
+ } else if (n2.type === "math") {
4471
+ namespace = "mathml";
4472
+ }
4430
4473
  if (n1 == null) {
4431
4474
  mountElement(
4432
4475
  n2,
@@ -4434,7 +4477,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4434
4477
  anchor,
4435
4478
  parentComponent,
4436
4479
  parentSuspense,
4437
- isSVG,
4480
+ namespace,
4438
4481
  slotScopeIds,
4439
4482
  optimized
4440
4483
  );
@@ -4444,19 +4487,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4444
4487
  n2,
4445
4488
  parentComponent,
4446
4489
  parentSuspense,
4447
- isSVG,
4490
+ namespace,
4448
4491
  slotScopeIds,
4449
4492
  optimized
4450
4493
  );
4451
4494
  }
4452
4495
  };
4453
- const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4496
+ const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4454
4497
  let el;
4455
4498
  let vnodeHook;
4456
- const { type, props, shapeFlag, transition, dirs } = vnode;
4499
+ const { props, shapeFlag, transition, dirs } = vnode;
4457
4500
  el = vnode.el = hostCreateElement(
4458
4501
  vnode.type,
4459
- isSVG,
4502
+ namespace,
4460
4503
  props && props.is,
4461
4504
  props
4462
4505
  );
@@ -4469,7 +4512,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4469
4512
  null,
4470
4513
  parentComponent,
4471
4514
  parentSuspense,
4472
- isSVG && type !== "foreignObject",
4515
+ resolveChildrenNamespace(vnode, namespace),
4473
4516
  slotScopeIds,
4474
4517
  optimized
4475
4518
  );
@@ -4486,7 +4529,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4486
4529
  key,
4487
4530
  null,
4488
4531
  props[key],
4489
- isSVG,
4532
+ namespace,
4490
4533
  vnode.children,
4491
4534
  parentComponent,
4492
4535
  parentSuspense,
@@ -4495,7 +4538,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4495
4538
  }
4496
4539
  }
4497
4540
  if ("value" in props) {
4498
- hostPatchProp(el, "value", null, props.value);
4541
+ hostPatchProp(el, "value", null, props.value, namespace);
4499
4542
  }
4500
4543
  if (vnodeHook = props.onVnodeBeforeMount) {
4501
4544
  invokeVNodeHook(vnodeHook, parentComponent, vnode);
@@ -4553,7 +4596,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4553
4596
  }
4554
4597
  }
4555
4598
  };
4556
- const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => {
4599
+ const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
4557
4600
  for (let i = start; i < children.length; i++) {
4558
4601
  const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode$1(children[i]);
4559
4602
  patch(
@@ -4563,13 +4606,13 @@ function baseCreateRenderer(options, createHydrationFns) {
4563
4606
  anchor,
4564
4607
  parentComponent,
4565
4608
  parentSuspense,
4566
- isSVG,
4609
+ namespace,
4567
4610
  slotScopeIds,
4568
4611
  optimized
4569
4612
  );
4570
4613
  }
4571
4614
  };
4572
- const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4615
+ const patchElement = (n1, n2, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4573
4616
  const el = n2.el = n1.el;
4574
4617
  let { patchFlag, dynamicChildren, dirs } = n2;
4575
4618
  patchFlag |= n1.patchFlag & 16;
@@ -4589,7 +4632,6 @@ function baseCreateRenderer(options, createHydrationFns) {
4589
4632
  optimized = false;
4590
4633
  dynamicChildren = null;
4591
4634
  }
4592
- const areChildrenSVG = isSVG && n2.type !== "foreignObject";
4593
4635
  if (dynamicChildren) {
4594
4636
  patchBlockChildren(
4595
4637
  n1.dynamicChildren,
@@ -4597,7 +4639,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4597
4639
  el,
4598
4640
  parentComponent,
4599
4641
  parentSuspense,
4600
- areChildrenSVG,
4642
+ resolveChildrenNamespace(n2, namespace),
4601
4643
  slotScopeIds
4602
4644
  );
4603
4645
  {
@@ -4611,7 +4653,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4611
4653
  null,
4612
4654
  parentComponent,
4613
4655
  parentSuspense,
4614
- areChildrenSVG,
4656
+ resolveChildrenNamespace(n2, namespace),
4615
4657
  slotScopeIds,
4616
4658
  false
4617
4659
  );
@@ -4625,16 +4667,16 @@ function baseCreateRenderer(options, createHydrationFns) {
4625
4667
  newProps,
4626
4668
  parentComponent,
4627
4669
  parentSuspense,
4628
- isSVG
4670
+ namespace
4629
4671
  );
4630
4672
  } else {
4631
4673
  if (patchFlag & 2) {
4632
4674
  if (oldProps.class !== newProps.class) {
4633
- hostPatchProp(el, "class", null, newProps.class, isSVG);
4675
+ hostPatchProp(el, "class", null, newProps.class, namespace);
4634
4676
  }
4635
4677
  }
4636
4678
  if (patchFlag & 4) {
4637
- hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG);
4679
+ hostPatchProp(el, "style", oldProps.style, newProps.style, namespace);
4638
4680
  }
4639
4681
  if (patchFlag & 8) {
4640
4682
  const propsToUpdate = n2.dynamicProps;
@@ -4648,7 +4690,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4648
4690
  key,
4649
4691
  prev,
4650
4692
  next,
4651
- isSVG,
4693
+ namespace,
4652
4694
  n1.children,
4653
4695
  parentComponent,
4654
4696
  parentSuspense,
@@ -4671,7 +4713,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4671
4713
  newProps,
4672
4714
  parentComponent,
4673
4715
  parentSuspense,
4674
- isSVG
4716
+ namespace
4675
4717
  );
4676
4718
  }
4677
4719
  if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
@@ -4681,7 +4723,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4681
4723
  }, parentSuspense);
4682
4724
  }
4683
4725
  };
4684
- const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => {
4726
+ const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, namespace, slotScopeIds) => {
4685
4727
  for (let i = 0; i < newChildren.length; i++) {
4686
4728
  const oldVNode = oldChildren[i];
4687
4729
  const newVNode = newChildren[i];
@@ -4706,13 +4748,13 @@ function baseCreateRenderer(options, createHydrationFns) {
4706
4748
  null,
4707
4749
  parentComponent,
4708
4750
  parentSuspense,
4709
- isSVG,
4751
+ namespace,
4710
4752
  slotScopeIds,
4711
4753
  true
4712
4754
  );
4713
4755
  }
4714
4756
  };
4715
- const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
4757
+ const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, namespace) => {
4716
4758
  if (oldProps !== newProps) {
4717
4759
  if (oldProps !== EMPTY_OBJ) {
4718
4760
  for (const key in oldProps) {
@@ -4722,7 +4764,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4722
4764
  key,
4723
4765
  oldProps[key],
4724
4766
  null,
4725
- isSVG,
4767
+ namespace,
4726
4768
  vnode.children,
4727
4769
  parentComponent,
4728
4770
  parentSuspense,
@@ -4742,7 +4784,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4742
4784
  key,
4743
4785
  prev,
4744
4786
  next,
4745
- isSVG,
4787
+ namespace,
4746
4788
  vnode.children,
4747
4789
  parentComponent,
4748
4790
  parentSuspense,
@@ -4751,11 +4793,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4751
4793
  }
4752
4794
  }
4753
4795
  if ("value" in newProps) {
4754
- hostPatchProp(el, "value", oldProps.value, newProps.value);
4796
+ hostPatchProp(el, "value", oldProps.value, newProps.value, namespace);
4755
4797
  }
4756
4798
  }
4757
4799
  };
4758
- const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4800
+ const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4759
4801
  const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText("");
4760
4802
  const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText("");
4761
4803
  let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
@@ -4779,7 +4821,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4779
4821
  fragmentEndAnchor,
4780
4822
  parentComponent,
4781
4823
  parentSuspense,
4782
- isSVG,
4824
+ namespace,
4783
4825
  slotScopeIds,
4784
4826
  optimized
4785
4827
  );
@@ -4793,7 +4835,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4793
4835
  container,
4794
4836
  parentComponent,
4795
4837
  parentSuspense,
4796
- isSVG,
4838
+ namespace,
4797
4839
  slotScopeIds
4798
4840
  );
4799
4841
  {
@@ -4807,14 +4849,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4807
4849
  fragmentEndAnchor,
4808
4850
  parentComponent,
4809
4851
  parentSuspense,
4810
- isSVG,
4852
+ namespace,
4811
4853
  slotScopeIds,
4812
4854
  optimized
4813
4855
  );
4814
4856
  }
4815
4857
  }
4816
4858
  };
4817
- const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
4859
+ const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4818
4860
  n2.slotScopeIds = slotScopeIds;
4819
4861
  if (n1 == null) {
4820
4862
  if (n2.shapeFlag & 512) {
@@ -4822,7 +4864,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4822
4864
  n2,
4823
4865
  container,
4824
4866
  anchor,
4825
- isSVG,
4867
+ namespace,
4826
4868
  optimized
4827
4869
  );
4828
4870
  } else {
@@ -4832,7 +4874,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4832
4874
  anchor,
4833
4875
  parentComponent,
4834
4876
  parentSuspense,
4835
- isSVG,
4877
+ namespace,
4836
4878
  optimized
4837
4879
  );
4838
4880
  }
@@ -4840,7 +4882,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4840
4882
  updateComponent(n1, n2, optimized);
4841
4883
  }
4842
4884
  };
4843
- const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
4885
+ const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, namespace, optimized) => {
4844
4886
  const instance = (initialVNode.component = createComponentInstance$1(
4845
4887
  initialVNode,
4846
4888
  parentComponent,
@@ -4871,17 +4913,17 @@ function baseCreateRenderer(options, createHydrationFns) {
4871
4913
  const placeholder = instance.subTree = createVNode(Comment);
4872
4914
  processCommentNode(null, placeholder, container, anchor);
4873
4915
  }
4874
- return;
4916
+ } else {
4917
+ setupRenderEffect(
4918
+ instance,
4919
+ initialVNode,
4920
+ container,
4921
+ anchor,
4922
+ parentSuspense,
4923
+ namespace,
4924
+ optimized
4925
+ );
4875
4926
  }
4876
- setupRenderEffect(
4877
- instance,
4878
- initialVNode,
4879
- container,
4880
- anchor,
4881
- parentSuspense,
4882
- isSVG,
4883
- optimized
4884
- );
4885
4927
  {
4886
4928
  popWarningContext();
4887
4929
  endMeasure(instance, `mount`);
@@ -4910,7 +4952,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4910
4952
  instance.vnode = n2;
4911
4953
  }
4912
4954
  };
4913
- const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => {
4955
+ const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, namespace, optimized) => {
4914
4956
  const componentUpdateFn = () => {
4915
4957
  if (!instance.isMounted) {
4916
4958
  let vnodeHook;
@@ -4977,7 +5019,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4977
5019
  anchor,
4978
5020
  instance,
4979
5021
  parentSuspense,
4980
- isSVG
5022
+ namespace
4981
5023
  );
4982
5024
  {
4983
5025
  endMeasure(instance, `patch`);
@@ -5004,6 +5046,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5004
5046
  initialVNode = container = anchor = null;
5005
5047
  } else {
5006
5048
  let { next, bu, u, parent, vnode } = instance;
5049
+ {
5050
+ const nonHydratedAsyncRoot = locateNonHydratedAsyncRoot(instance);
5051
+ if (nonHydratedAsyncRoot) {
5052
+ if (next) {
5053
+ next.el = vnode.el;
5054
+ updateComponentPreRender(instance, next, optimized);
5055
+ }
5056
+ nonHydratedAsyncRoot.asyncDep.then(() => {
5057
+ if (!instance.isUnmounted) {
5058
+ componentUpdateFn();
5059
+ }
5060
+ });
5061
+ return;
5062
+ }
5063
+ }
5007
5064
  let originNext = next;
5008
5065
  let vnodeHook;
5009
5066
  {
@@ -5044,7 +5101,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5044
5101
  getNextHostNode(prevTree),
5045
5102
  instance,
5046
5103
  parentSuspense,
5047
- isSVG
5104
+ namespace
5048
5105
  );
5049
5106
  {
5050
5107
  endMeasure(instance, `patch`);
@@ -5099,10 +5156,10 @@ function baseCreateRenderer(options, createHydrationFns) {
5099
5156
  updateProps(instance, nextVNode.props, prevProps, optimized);
5100
5157
  updateSlots(instance, nextVNode.children, optimized);
5101
5158
  pauseTracking();
5102
- flushPreFlushCbs();
5159
+ flushPreFlushCbs(instance);
5103
5160
  resetTracking();
5104
5161
  };
5105
- const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
5162
+ const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized = false) => {
5106
5163
  const c1 = n1 && n1.children;
5107
5164
  const prevShapeFlag = n1 ? n1.shapeFlag : 0;
5108
5165
  const c2 = n2.children;
@@ -5116,7 +5173,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5116
5173
  anchor,
5117
5174
  parentComponent,
5118
5175
  parentSuspense,
5119
- isSVG,
5176
+ namespace,
5120
5177
  slotScopeIds,
5121
5178
  optimized
5122
5179
  );
@@ -5129,7 +5186,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5129
5186
  anchor,
5130
5187
  parentComponent,
5131
5188
  parentSuspense,
5132
- isSVG,
5189
+ namespace,
5133
5190
  slotScopeIds,
5134
5191
  optimized
5135
5192
  );
@@ -5153,7 +5210,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5153
5210
  anchor,
5154
5211
  parentComponent,
5155
5212
  parentSuspense,
5156
- isSVG,
5213
+ namespace,
5157
5214
  slotScopeIds,
5158
5215
  optimized
5159
5216
  );
@@ -5171,7 +5228,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5171
5228
  anchor,
5172
5229
  parentComponent,
5173
5230
  parentSuspense,
5174
- isSVG,
5231
+ namespace,
5175
5232
  slotScopeIds,
5176
5233
  optimized
5177
5234
  );
@@ -5179,7 +5236,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5179
5236
  }
5180
5237
  }
5181
5238
  };
5182
- const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5239
+ const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5183
5240
  c1 = c1 || EMPTY_ARR;
5184
5241
  c2 = c2 || EMPTY_ARR;
5185
5242
  const oldLength = c1.length;
@@ -5195,7 +5252,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5195
5252
  null,
5196
5253
  parentComponent,
5197
5254
  parentSuspense,
5198
- isSVG,
5255
+ namespace,
5199
5256
  slotScopeIds,
5200
5257
  optimized
5201
5258
  );
@@ -5216,14 +5273,14 @@ function baseCreateRenderer(options, createHydrationFns) {
5216
5273
  anchor,
5217
5274
  parentComponent,
5218
5275
  parentSuspense,
5219
- isSVG,
5276
+ namespace,
5220
5277
  slotScopeIds,
5221
5278
  optimized,
5222
5279
  commonLength
5223
5280
  );
5224
5281
  }
5225
5282
  };
5226
- const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
5283
+ const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
5227
5284
  let i = 0;
5228
5285
  const l2 = c2.length;
5229
5286
  let e1 = c1.length - 1;
@@ -5239,7 +5296,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5239
5296
  null,
5240
5297
  parentComponent,
5241
5298
  parentSuspense,
5242
- isSVG,
5299
+ namespace,
5243
5300
  slotScopeIds,
5244
5301
  optimized
5245
5302
  );
@@ -5259,7 +5316,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5259
5316
  null,
5260
5317
  parentComponent,
5261
5318
  parentSuspense,
5262
- isSVG,
5319
+ namespace,
5263
5320
  slotScopeIds,
5264
5321
  optimized
5265
5322
  );
@@ -5281,7 +5338,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5281
5338
  anchor,
5282
5339
  parentComponent,
5283
5340
  parentSuspense,
5284
- isSVG,
5341
+ namespace,
5285
5342
  slotScopeIds,
5286
5343
  optimized
5287
5344
  );
@@ -5351,7 +5408,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5351
5408
  null,
5352
5409
  parentComponent,
5353
5410
  parentSuspense,
5354
- isSVG,
5411
+ namespace,
5355
5412
  slotScopeIds,
5356
5413
  optimized
5357
5414
  );
@@ -5372,7 +5429,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5372
5429
  anchor,
5373
5430
  parentComponent,
5374
5431
  parentSuspense,
5375
- isSVG,
5432
+ namespace,
5376
5433
  slotScopeIds,
5377
5434
  optimized
5378
5435
  );
@@ -5593,13 +5650,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5593
5650
  }
5594
5651
  return hostNextSibling(vnode.anchor || vnode.el);
5595
5652
  };
5596
- const render = (vnode, container, isSVG) => {
5653
+ const render = (vnode, container, namespace) => {
5597
5654
  if (vnode == null) {
5598
5655
  if (container._vnode) {
5599
5656
  unmount(container._vnode, null, null, true);
5600
5657
  }
5601
5658
  } else {
5602
- patch(container._vnode || null, vnode, container, null, null, null, isSVG);
5659
+ patch(
5660
+ container._vnode || null,
5661
+ vnode,
5662
+ container,
5663
+ null,
5664
+ null,
5665
+ null,
5666
+ namespace
5667
+ );
5603
5668
  }
5604
5669
  flushPreFlushCbs();
5605
5670
  flushPostFlushCbs();
@@ -5630,6 +5695,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5630
5695
  createApp: createAppAPI(render, hydrate)
5631
5696
  };
5632
5697
  }
5698
+ function resolveChildrenNamespace({ type, props }, currentNamespace) {
5699
+ return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
5700
+ }
5633
5701
  function toggleRecurse({ effect, update }, allowed) {
5634
5702
  effect.allowRecurse = update.allowRecurse = allowed;
5635
5703
  }
@@ -5700,6 +5768,16 @@ function getSequence(arr) {
5700
5768
  }
5701
5769
  return result;
5702
5770
  }
5771
+ function locateNonHydratedAsyncRoot(instance) {
5772
+ const subComponent = instance.subTree.component;
5773
+ if (subComponent) {
5774
+ if (subComponent.asyncDep && !subComponent.asyncResolved) {
5775
+ return subComponent;
5776
+ } else {
5777
+ return locateNonHydratedAsyncRoot(subComponent);
5778
+ }
5779
+ }
5780
+ }
5703
5781
 
5704
5782
  const isTeleport = (type) => type.__isTeleport;
5705
5783
 
@@ -6108,20 +6186,29 @@ function createComponentInstance$1(vnode, parent, suspense) {
6108
6186
  }
6109
6187
  let currentInstance = null;
6110
6188
  let internalSetCurrentInstance;
6111
- let globalCurrentInstanceSetters;
6112
- let settersKey = "__VUE_INSTANCE_SETTERS__";
6189
+ let setInSSRSetupState;
6113
6190
  {
6114
- if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
6115
- globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
6116
- }
6117
- globalCurrentInstanceSetters.push((i) => currentInstance = i);
6118
- internalSetCurrentInstance = (instance) => {
6119
- if (globalCurrentInstanceSetters.length > 1) {
6120
- globalCurrentInstanceSetters.forEach((s) => s(instance));
6121
- } else {
6122
- globalCurrentInstanceSetters[0](instance);
6123
- }
6191
+ const g = getGlobalThis();
6192
+ const registerGlobalSetter = (key, setter) => {
6193
+ let setters;
6194
+ if (!(setters = g[key]))
6195
+ setters = g[key] = [];
6196
+ setters.push(setter);
6197
+ return (v) => {
6198
+ if (setters.length > 1)
6199
+ setters.forEach((set) => set(v));
6200
+ else
6201
+ setters[0](v);
6202
+ };
6124
6203
  };
6204
+ internalSetCurrentInstance = registerGlobalSetter(
6205
+ `__VUE_INSTANCE_SETTERS__`,
6206
+ (v) => currentInstance = v
6207
+ );
6208
+ setInSSRSetupState = registerGlobalSetter(
6209
+ `__VUE_SSR_SETTERS__`,
6210
+ (v) => isInSSRComponentSetup = v
6211
+ );
6125
6212
  }
6126
6213
  const setCurrentInstance = (instance) => {
6127
6214
  internalSetCurrentInstance(instance);
@@ -6145,13 +6232,13 @@ function isStatefulComponent(instance) {
6145
6232
  }
6146
6233
  let isInSSRComponentSetup = false;
6147
6234
  function setupComponent$1(instance, isSSR = false) {
6148
- isInSSRComponentSetup = isSSR;
6235
+ isSSR && setInSSRSetupState(isSSR);
6149
6236
  const { props, children } = instance.vnode;
6150
6237
  const isStateful = isStatefulComponent(instance);
6151
6238
  initProps(instance, props, isStateful, isSSR);
6152
6239
  initSlots(instance, children);
6153
6240
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
6154
- isInSSRComponentSetup = false;
6241
+ isSSR && setInSSRSetupState(false);
6155
6242
  return setupResult;
6156
6243
  }
6157
6244
  function setupStatefulComponent(instance, isSSR) {
@@ -6431,7 +6518,7 @@ const useSSRContext = () => {
6431
6518
  }
6432
6519
  };
6433
6520
 
6434
- const version = "3.4.0-alpha.4";
6521
+ const version = "3.4.0-beta.2";
6435
6522
  const _ssrUtils = {
6436
6523
  createComponentInstance: createComponentInstance$1,
6437
6524
  setupComponent: setupComponent$1,
@@ -6443,6 +6530,7 @@ const _ssrUtils = {
6443
6530
  const ssrUtils = _ssrUtils ;
6444
6531
 
6445
6532
  const svgNS = "http://www.w3.org/2000/svg";
6533
+ const mathmlNS = "http://www.w3.org/1998/Math/MathML";
6446
6534
  const doc = typeof document !== "undefined" ? document : null;
6447
6535
  const templateContainer = doc && /* @__PURE__ */ doc.createElement("template");
6448
6536
  const nodeOps = {
@@ -6455,8 +6543,8 @@ const nodeOps = {
6455
6543
  parent.removeChild(child);
6456
6544
  }
6457
6545
  },
6458
- createElement: (tag, isSVG, is, props) => {
6459
- const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0);
6546
+ createElement: (tag, namespace, is, props) => {
6547
+ const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
6460
6548
  if (tag === "select" && props && props.multiple != null) {
6461
6549
  el.setAttribute("multiple", props.multiple);
6462
6550
  }
@@ -6480,7 +6568,7 @@ const nodeOps = {
6480
6568
  // Reason: innerHTML.
6481
6569
  // Static content here can only come from compiled templates.
6482
6570
  // As long as the user only uses trusted templates, this is safe.
6483
- insertStaticContent(content, parent, anchor, isSVG, start, end) {
6571
+ insertStaticContent(content, parent, anchor, namespace, start, end) {
6484
6572
  const before = anchor ? anchor.previousSibling : parent.lastChild;
6485
6573
  if (start && (start === end || start.nextSibling)) {
6486
6574
  while (true) {
@@ -6489,9 +6577,9 @@ const nodeOps = {
6489
6577
  break;
6490
6578
  }
6491
6579
  } else {
6492
- templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content;
6580
+ templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
6493
6581
  const template = templateContainer.content;
6494
- if (isSVG) {
6582
+ if (namespace === "svg" || namespace === "mathml") {
6495
6583
  const wrapper = template.firstChild;
6496
6584
  while (wrapper.firstChild) {
6497
6585
  template.appendChild(wrapper.firstChild);
@@ -6791,7 +6879,8 @@ function patchStopImmediatePropagation(e, value) {
6791
6879
 
6792
6880
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
6793
6881
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
6794
- const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
6882
+ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
6883
+ const isSVG = namespace === "svg";
6795
6884
  if (key === "class") {
6796
6885
  patchClass(el, nextValue, isSVG);
6797
6886
  } else if (key === "style") {
@@ -6843,7 +6932,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
6843
6932
  }
6844
6933
  if (key === "width" || key === "height") {
6845
6934
  const tag = el.tagName;
6846
- return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
6935
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
6936
+ return false;
6937
+ }
6847
6938
  }
6848
6939
  if (isNativeOn(key) && isString(value)) {
6849
6940
  return false;
@@ -6942,7 +7033,7 @@ const createApp = (...args) => {
6942
7033
  component.template = container.innerHTML;
6943
7034
  }
6944
7035
  container.innerHTML = "";
6945
- const proxy = mount(container, false, container instanceof SVGElement);
7036
+ const proxy = mount(container, false, resolveRootNamespace(container));
6946
7037
  if (container instanceof Element) {
6947
7038
  container.removeAttribute("v-cloak");
6948
7039
  container.setAttribute("data-v-app", "");
@@ -6951,9 +7042,17 @@ const createApp = (...args) => {
6951
7042
  };
6952
7043
  return app;
6953
7044
  };
7045
+ function resolveRootNamespace(container) {
7046
+ if (container instanceof SVGElement) {
7047
+ return "svg";
7048
+ }
7049
+ if (typeof MathMLElement === "function" && container instanceof MathMLElement) {
7050
+ return "mathml";
7051
+ }
7052
+ }
6954
7053
  function injectNativeTagCheck(app) {
6955
7054
  Object.defineProperty(app.config, "isNativeTag", {
6956
- value: (tag) => isHTMLTag(tag) || isSVGTag(tag),
7055
+ value: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag),
6957
7056
  writable: false
6958
7057
  });
6959
7058
  }