@vue/server-renderer 3.5.0-alpha.4 → 3.5.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/server-renderer v3.5.0-alpha.4
2
+ * @vue/server-renderer v3.5.0-beta.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -60,9 +60,11 @@ const cacheStringFunction = (fn) => {
60
60
  };
61
61
  };
62
62
  const camelizeRE = /-(\w)/g;
63
- const camelize = cacheStringFunction((str) => {
64
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
65
- });
63
+ const camelize = cacheStringFunction(
64
+ (str) => {
65
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
66
+ }
67
+ );
66
68
  const hyphenateRE = /\B([A-Z])/g;
67
69
  const hyphenate = cacheStringFunction(
68
70
  (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
@@ -70,10 +72,12 @@ const hyphenate = cacheStringFunction(
70
72
  const capitalize = cacheStringFunction((str) => {
71
73
  return str.charAt(0).toUpperCase() + str.slice(1);
72
74
  });
73
- const toHandlerKey = cacheStringFunction((str) => {
74
- const s = str ? `on${capitalize(str)}` : ``;
75
- return s;
76
- });
75
+ const toHandlerKey = cacheStringFunction(
76
+ (str) => {
77
+ const s = str ? `on${capitalize(str)}` : ``;
78
+ return s;
79
+ }
80
+ );
77
81
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
78
82
  const invokeArrayFns = (fns, ...arg) => {
79
83
  for (let i = 0; i < fns.length; i++) {
@@ -358,6 +362,7 @@ class EffectScope {
358
362
  * @internal
359
363
  */
360
364
  this.cleanups = [];
365
+ this._isPaused = false;
361
366
  this.parent = activeEffectScope;
362
367
  if (!detached && activeEffectScope) {
363
368
  this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
@@ -368,6 +373,37 @@ class EffectScope {
368
373
  get active() {
369
374
  return this._active;
370
375
  }
376
+ pause() {
377
+ if (this._active) {
378
+ this._isPaused = true;
379
+ if (this.scopes) {
380
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
381
+ this.scopes[i].pause();
382
+ }
383
+ }
384
+ for (let i = 0, l = this.effects.length; i < l; i++) {
385
+ this.effects[i].pause();
386
+ }
387
+ }
388
+ }
389
+ /**
390
+ * Resumes the effect scope, including all child scopes and effects.
391
+ */
392
+ resume() {
393
+ if (this._active) {
394
+ if (this._isPaused) {
395
+ this._isPaused = false;
396
+ if (this.scopes) {
397
+ for (let i = 0, l = this.scopes.length; i < l; i++) {
398
+ this.scopes[i].resume();
399
+ }
400
+ }
401
+ for (let i = 0, l = this.effects.length; i < l; i++) {
402
+ this.effects[i].resume();
403
+ }
404
+ }
405
+ }
406
+ }
371
407
  run(fn) {
372
408
  if (this._active) {
373
409
  const currentEffectScope = activeEffectScope;
@@ -426,6 +462,7 @@ function getCurrentScope() {
426
462
  }
427
463
 
428
464
  let activeSub;
465
+ const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
429
466
  class ReactiveEffect {
430
467
  constructor(fn) {
431
468
  this.fn = fn;
@@ -454,6 +491,18 @@ class ReactiveEffect {
454
491
  activeEffectScope.effects.push(this);
455
492
  }
456
493
  }
494
+ pause() {
495
+ this.flags |= 128;
496
+ }
497
+ resume() {
498
+ if (this.flags & 128) {
499
+ this.flags &= ~128;
500
+ if (pausedQueueEffects.has(this)) {
501
+ pausedQueueEffects.delete(this);
502
+ this.trigger();
503
+ }
504
+ }
505
+ }
457
506
  /**
458
507
  * @internal
459
508
  */
@@ -507,7 +556,9 @@ class ReactiveEffect {
507
556
  }
508
557
  }
509
558
  trigger() {
510
- if (this.scheduler) {
559
+ if (this.flags & 128) {
560
+ pausedQueueEffects.add(this);
561
+ } else if (this.scheduler) {
511
562
  this.scheduler();
512
563
  } else {
513
564
  this.runIfDirty();
@@ -806,9 +857,15 @@ function addSub(link) {
806
857
  link.dep.subs = link;
807
858
  }
808
859
  const targetMap = /* @__PURE__ */ new WeakMap();
809
- const ITERATE_KEY = Symbol("Object iterate" );
810
- const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
811
- const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
860
+ const ITERATE_KEY = Symbol(
861
+ "Object iterate"
862
+ );
863
+ const MAP_KEY_ITERATE_KEY = Symbol(
864
+ "Map keys iterate"
865
+ );
866
+ const ARRAY_ITERATE_KEY = Symbol(
867
+ "Array iterate"
868
+ );
812
869
  function track(target, type, key) {
813
870
  if (shouldTrack && activeSub) {
814
871
  let depsMap = targetMap.get(target);
@@ -928,19 +985,16 @@ const arrayInstrumentations = {
928
985
  return apply(this, "every", fn, thisArg);
929
986
  },
930
987
  filter(fn, thisArg) {
931
- const result = apply(this, "filter", fn, thisArg);
932
- return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
988
+ return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive));
933
989
  },
934
990
  find(fn, thisArg) {
935
- const result = apply(this, "find", fn, thisArg);
936
- return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
991
+ return apply(this, "find", fn, thisArg, toReactive);
937
992
  },
938
993
  findIndex(fn, thisArg) {
939
994
  return apply(this, "findIndex", fn, thisArg);
940
995
  },
941
996
  findLast(fn, thisArg) {
942
- const result = apply(this, "findLast", fn, thisArg);
943
- return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
997
+ return apply(this, "findLast", fn, thisArg, toReactive);
944
998
  },
945
999
  findLastIndex(fn, thisArg) {
946
1000
  return apply(this, "findLastIndex", fn, thisArg);
@@ -1018,11 +1072,13 @@ function iterator(self, method, wrapValue) {
1018
1072
  }
1019
1073
  return iter;
1020
1074
  }
1021
- function apply(self, method, fn, thisArg) {
1075
+ function apply(self, method, fn, thisArg, wrappedRetFn) {
1022
1076
  const arr = shallowReadArray(self);
1077
+ let needsWrap = false;
1023
1078
  let wrappedFn = fn;
1024
1079
  if (arr !== self) {
1025
- if (!isShallow(self)) {
1080
+ needsWrap = !isShallow(self);
1081
+ if (needsWrap) {
1026
1082
  wrappedFn = function(item, index) {
1027
1083
  return fn.call(this, toReactive(item), index, self);
1028
1084
  };
@@ -1032,7 +1088,8 @@ function apply(self, method, fn, thisArg) {
1032
1088
  };
1033
1089
  }
1034
1090
  }
1035
- return arr[method](wrappedFn, thisArg);
1091
+ const result = arr[method](wrappedFn, thisArg);
1092
+ return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
1036
1093
  }
1037
1094
  function reduce(self, method, fn, args) {
1038
1095
  const arr = shallowReadArray(self);
@@ -1094,7 +1151,7 @@ class BaseReactiveHandler {
1094
1151
  return isShallow2;
1095
1152
  } else if (key === "__v_raw") {
1096
1153
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
1097
- // this means the reciever is a user proxy of the reactive proxy
1154
+ // this means the receiver is a user proxy of the reactive proxy
1098
1155
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
1099
1156
  return target;
1100
1157
  }
@@ -1218,9 +1275,7 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler {
1218
1275
  }
1219
1276
  const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
1220
1277
  const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
1221
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(
1222
- true
1223
- );
1278
+ const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
1224
1279
  const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
1225
1280
 
1226
1281
  const toShallow = (value) => value;
@@ -1665,7 +1720,8 @@ class ComputedRefImpl {
1665
1720
  /**
1666
1721
  * @internal
1667
1722
  */
1668
- this["__v_isRef"] = true;
1723
+ this.__v_isRef = true;
1724
+ // TODO isolatedDeclarations "__v_isReadonly"
1669
1725
  // A computed is also a subscriber that tracks other deps
1670
1726
  /**
1671
1727
  * @internal
@@ -2229,6 +2285,9 @@ function reload(id, newComp) {
2229
2285
  "[HMR] Root or manually mounted instance modified. Full reload required."
2230
2286
  );
2231
2287
  }
2288
+ if (instance.root.ce && instance !== instance.root) {
2289
+ instance.root.ce._removeChildStyle(oldComp);
2290
+ }
2232
2291
  }
2233
2292
  queuePostFlushCb(() => {
2234
2293
  hmrDirtyComponents.clear();
@@ -2308,9 +2367,7 @@ function devtoolsInitApp(app, version) {
2308
2367
  function devtoolsUnmountApp(app) {
2309
2368
  emit$1("app:unmount" /* APP_UNMOUNT */, app);
2310
2369
  }
2311
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
2312
- "component:added" /* COMPONENT_ADDED */
2313
- );
2370
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
2314
2371
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
2315
2372
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
2316
2373
  "component:removed" /* COMPONENT_REMOVED */
@@ -2334,12 +2391,8 @@ function createDevtoolsComponentHook(hook) {
2334
2391
  );
2335
2392
  };
2336
2393
  }
2337
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
2338
- "perf:start" /* PERFORMANCE_START */
2339
- );
2340
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
2341
- "perf:end" /* PERFORMANCE_END */
2342
- );
2394
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
2395
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
2343
2396
  function createDevtoolsPerformanceHook(hook) {
2344
2397
  return (component, type, time) => {
2345
2398
  emit$1(hook, component.appContext.app, component.uid, component, type, time);
@@ -2438,6 +2491,94 @@ function markAsyncBoundary(instance) {
2438
2491
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
2439
2492
  }
2440
2493
 
2494
+ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
2495
+ if (isArray(rawRef)) {
2496
+ rawRef.forEach(
2497
+ (r, i) => setRef(
2498
+ r,
2499
+ oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
2500
+ parentSuspense,
2501
+ vnode,
2502
+ isUnmount
2503
+ )
2504
+ );
2505
+ return;
2506
+ }
2507
+ if (isAsyncWrapper(vnode) && !isUnmount) {
2508
+ return;
2509
+ }
2510
+ const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
2511
+ const value = isUnmount ? null : refValue;
2512
+ const { i: owner, r: ref } = rawRef;
2513
+ if (!owner) {
2514
+ warn$1(
2515
+ `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
2516
+ );
2517
+ return;
2518
+ }
2519
+ const oldRef = oldRawRef && oldRawRef.r;
2520
+ const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
2521
+ const setupState = owner.setupState;
2522
+ if (oldRef != null && oldRef !== ref) {
2523
+ if (isString(oldRef)) {
2524
+ refs[oldRef] = null;
2525
+ if (hasOwn(setupState, oldRef)) {
2526
+ setupState[oldRef] = null;
2527
+ }
2528
+ } else if (isRef(oldRef)) {
2529
+ oldRef.value = null;
2530
+ }
2531
+ }
2532
+ if (isFunction(ref)) {
2533
+ callWithErrorHandling(ref, owner, 12, [value, refs]);
2534
+ } else {
2535
+ const _isString = isString(ref);
2536
+ const _isRef = isRef(ref);
2537
+ if (_isString || _isRef) {
2538
+ const doSet = () => {
2539
+ if (rawRef.f) {
2540
+ const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
2541
+ if (isUnmount) {
2542
+ isArray(existing) && remove(existing, refValue);
2543
+ } else {
2544
+ if (!isArray(existing)) {
2545
+ if (_isString) {
2546
+ refs[ref] = [refValue];
2547
+ if (hasOwn(setupState, ref)) {
2548
+ setupState[ref] = refs[ref];
2549
+ }
2550
+ } else {
2551
+ ref.value = [refValue];
2552
+ if (rawRef.k) refs[rawRef.k] = ref.value;
2553
+ }
2554
+ } else if (!existing.includes(refValue)) {
2555
+ existing.push(refValue);
2556
+ }
2557
+ }
2558
+ } else if (_isString) {
2559
+ refs[ref] = value;
2560
+ if (hasOwn(setupState, ref)) {
2561
+ setupState[ref] = value;
2562
+ }
2563
+ } else if (_isRef) {
2564
+ ref.value = value;
2565
+ if (rawRef.k) refs[rawRef.k] = value;
2566
+ } else {
2567
+ warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
2568
+ }
2569
+ };
2570
+ if (value) {
2571
+ doSet.id = -1;
2572
+ queuePostRenderEffect(doSet, parentSuspense);
2573
+ } else {
2574
+ doSet();
2575
+ }
2576
+ } else {
2577
+ warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
2578
+ }
2579
+ }
2580
+ }
2581
+
2441
2582
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2442
2583
 
2443
2584
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
@@ -2513,23 +2654,35 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2513
2654
  };
2514
2655
  const onBeforeMount = createHook("bm");
2515
2656
  const onMounted = createHook("m");
2516
- const onBeforeUpdate = createHook("bu");
2657
+ const onBeforeUpdate = createHook(
2658
+ "bu"
2659
+ );
2517
2660
  const onUpdated = createHook("u");
2518
- const onBeforeUnmount = createHook("bum");
2519
- const onUnmounted = createHook("um");
2520
- const onServerPrefetch = createHook("sp");
2521
- const onRenderTriggered = createHook(
2522
- "rtg"
2661
+ const onBeforeUnmount = createHook(
2662
+ "bum"
2523
2663
  );
2524
- const onRenderTracked = createHook(
2525
- "rtc"
2664
+ const onUnmounted = createHook("um");
2665
+ const onServerPrefetch = createHook(
2666
+ "sp"
2526
2667
  );
2668
+ const onRenderTriggered = createHook("rtg");
2669
+ const onRenderTracked = createHook("rtc");
2527
2670
  function onErrorCaptured(hook, target = currentInstance) {
2528
2671
  injectHook("ec", hook, target);
2529
2672
  }
2530
2673
 
2531
2674
  const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2532
2675
 
2676
+ function ensureValidVNode$1(vnodes) {
2677
+ return vnodes.some((child) => {
2678
+ if (!isVNode$2(child)) return true;
2679
+ if (child.type === Comment) return false;
2680
+ if (child.type === Fragment && !ensureValidVNode$1(child.children))
2681
+ return false;
2682
+ return true;
2683
+ }) ? vnodes : null;
2684
+ }
2685
+
2533
2686
  const getPublicInstance = (i) => {
2534
2687
  if (!i) return null;
2535
2688
  if (isStatefulComponent(i)) return getComponentPublicInstance(i);
@@ -2548,6 +2701,7 @@ const publicPropertiesMap = (
2548
2701
  $refs: (i) => shallowReadonly(i.refs) ,
2549
2702
  $parent: (i) => getPublicInstance(i.parent),
2550
2703
  $root: (i) => getPublicInstance(i.root),
2704
+ $host: (i) => i.ce,
2551
2705
  $emit: (i) => i.emit,
2552
2706
  $options: (i) => resolveMergedOptions(i) ,
2553
2707
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -3289,7 +3443,7 @@ function createAppAPI(render, hydrate) {
3289
3443
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
3290
3444
  );
3291
3445
  }
3292
- const vnode = createVNode(rootComponent, rootProps);
3446
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
3293
3447
  vnode.appContext = context;
3294
3448
  if (namespace === true) {
3295
3449
  namespace = "svg";
@@ -3391,7 +3545,7 @@ function provide(key, value) {
3391
3545
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
3392
3546
  const instance = currentInstance || currentRenderingInstance;
3393
3547
  if (instance || currentApp) {
3394
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
3548
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
3395
3549
  if (provides && key in provides) {
3396
3550
  return provides[key];
3397
3551
  } else if (arguments.length > 1) {
@@ -3593,6 +3747,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3593
3747
  } else {
3594
3748
  value = defaultValue;
3595
3749
  }
3750
+ if (instance.ce) {
3751
+ instance.ce._setProp(key, value);
3752
+ }
3596
3753
  }
3597
3754
  if (opt[0 /* shouldCast */]) {
3598
3755
  if (isAbsent && !hasDefault) {
@@ -3657,14 +3814,27 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3657
3814
  if (validatePropName(normalizedKey)) {
3658
3815
  const opt = raw[key];
3659
3816
  const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
3660
- if (prop) {
3661
- const booleanIndex = getTypeIndex(Boolean, prop.type);
3662
- const stringIndex = getTypeIndex(String, prop.type);
3663
- prop[0 /* shouldCast */] = booleanIndex > -1;
3664
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
3665
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
3666
- needCastKeys.push(normalizedKey);
3817
+ const propType = prop.type;
3818
+ let shouldCast = false;
3819
+ let shouldCastTrue = true;
3820
+ if (isArray(propType)) {
3821
+ for (let index = 0; index < propType.length; ++index) {
3822
+ const type = propType[index];
3823
+ const typeName = isFunction(type) && type.name;
3824
+ if (typeName === "Boolean") {
3825
+ shouldCast = true;
3826
+ break;
3827
+ } else if (typeName === "String") {
3828
+ shouldCastTrue = false;
3829
+ }
3667
3830
  }
3831
+ } else {
3832
+ shouldCast = isFunction(propType) && propType.name === "Boolean";
3833
+ }
3834
+ prop[0 /* shouldCast */] = shouldCast;
3835
+ prop[1 /* shouldCastTrue */] = shouldCastTrue;
3836
+ if (shouldCast || hasOwn(prop, "default")) {
3837
+ needCastKeys.push(normalizedKey);
3668
3838
  }
3669
3839
  }
3670
3840
  }
@@ -3695,17 +3865,6 @@ function getType(ctor) {
3695
3865
  }
3696
3866
  return "";
3697
3867
  }
3698
- function isSameType(a, b) {
3699
- return getType(a) === getType(b);
3700
- }
3701
- function getTypeIndex(type, expectedTypes) {
3702
- if (isArray(expectedTypes)) {
3703
- return expectedTypes.findIndex((t) => isSameType(t, type));
3704
- } else if (isFunction(expectedTypes)) {
3705
- return isSameType(expectedTypes, type) ? 0 : -1;
3706
- }
3707
- return -1;
3708
- }
3709
3868
  function validateProps(rawProps, props, instance) {
3710
3869
  const resolvedValues = toRaw(props);
3711
3870
  const options = instance.propsOptions[0];
@@ -3909,94 +4068,6 @@ const updateSlots = (instance, children, optimized) => {
3909
4068
  }
3910
4069
  };
3911
4070
 
3912
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3913
- if (isArray(rawRef)) {
3914
- rawRef.forEach(
3915
- (r, i) => setRef(
3916
- r,
3917
- oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
3918
- parentSuspense,
3919
- vnode,
3920
- isUnmount
3921
- )
3922
- );
3923
- return;
3924
- }
3925
- if (isAsyncWrapper(vnode) && !isUnmount) {
3926
- return;
3927
- }
3928
- const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
3929
- const value = isUnmount ? null : refValue;
3930
- const { i: owner, r: ref } = rawRef;
3931
- if (!owner) {
3932
- warn$1(
3933
- `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`
3934
- );
3935
- return;
3936
- }
3937
- const oldRef = oldRawRef && oldRawRef.r;
3938
- const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3939
- const setupState = owner.setupState;
3940
- if (oldRef != null && oldRef !== ref) {
3941
- if (isString(oldRef)) {
3942
- refs[oldRef] = null;
3943
- if (hasOwn(setupState, oldRef)) {
3944
- setupState[oldRef] = null;
3945
- }
3946
- } else if (isRef(oldRef)) {
3947
- oldRef.value = null;
3948
- }
3949
- }
3950
- if (isFunction(ref)) {
3951
- callWithErrorHandling(ref, owner, 12, [value, refs]);
3952
- } else {
3953
- const _isString = isString(ref);
3954
- const _isRef = isRef(ref);
3955
- if (_isString || _isRef) {
3956
- const doSet = () => {
3957
- if (rawRef.f) {
3958
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3959
- if (isUnmount) {
3960
- isArray(existing) && remove(existing, refValue);
3961
- } else {
3962
- if (!isArray(existing)) {
3963
- if (_isString) {
3964
- refs[ref] = [refValue];
3965
- if (hasOwn(setupState, ref)) {
3966
- setupState[ref] = refs[ref];
3967
- }
3968
- } else {
3969
- ref.value = [refValue];
3970
- if (rawRef.k) refs[rawRef.k] = ref.value;
3971
- }
3972
- } else if (!existing.includes(refValue)) {
3973
- existing.push(refValue);
3974
- }
3975
- }
3976
- } else if (_isString) {
3977
- refs[ref] = value;
3978
- if (hasOwn(setupState, ref)) {
3979
- setupState[ref] = value;
3980
- }
3981
- } else if (_isRef) {
3982
- ref.value = value;
3983
- if (rawRef.k) refs[rawRef.k] = value;
3984
- } else {
3985
- warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3986
- }
3987
- };
3988
- if (value) {
3989
- doSet.id = -1;
3990
- queuePostRenderEffect(doSet, parentSuspense);
3991
- } else {
3992
- doSet();
3993
- }
3994
- } else {
3995
- warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
3996
- }
3997
- }
3998
- }
3999
-
4000
4071
  let supported;
4001
4072
  let perf;
4002
4073
  function startMeasure(instance, type) {
@@ -4674,8 +4745,8 @@ function baseCreateRenderer(options, createHydrationFns) {
4674
4745
  const componentUpdateFn = () => {
4675
4746
  if (!instance.isMounted) {
4676
4747
  let vnodeHook;
4677
- const { el, props, type } = initialVNode;
4678
- const { bm, m, parent } = instance;
4748
+ const { el, props } = initialVNode;
4749
+ const { bm, m, parent, root, type } = instance;
4679
4750
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
4680
4751
  toggleRecurse(instance, false);
4681
4752
  if (bm) {
@@ -4708,18 +4779,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4708
4779
  endMeasure(instance, `hydrate`);
4709
4780
  }
4710
4781
  };
4711
- if (isAsyncWrapperVNode && !type.__asyncResolved) {
4712
- type.__asyncLoader().then(
4713
- // note: we are moving the render call into an async callback,
4714
- // which means it won't track dependencies - but it's ok because
4715
- // a server-rendered async wrapper is already in resolved state
4716
- // and it will never need to change.
4717
- () => !instance.isUnmounted && hydrateSubTree()
4782
+ if (isAsyncWrapperVNode) {
4783
+ type.__asyncHydrate(
4784
+ el,
4785
+ instance,
4786
+ hydrateSubTree
4718
4787
  );
4719
4788
  } else {
4720
4789
  hydrateSubTree();
4721
4790
  }
4722
4791
  } else {
4792
+ if (root.ce) {
4793
+ root.ce._injectChildStyle(type);
4794
+ }
4723
4795
  {
4724
4796
  startMeasure(instance, `render`);
4725
4797
  }
@@ -5393,13 +5465,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5393
5465
  namespace
5394
5466
  );
5395
5467
  }
5468
+ container._vnode = vnode;
5396
5469
  if (!isFlushing) {
5397
5470
  isFlushing = true;
5398
5471
  flushPreFlushCbs();
5399
5472
  flushPostFlushCbs();
5400
5473
  isFlushing = false;
5401
5474
  }
5402
- container._vnode = vnode;
5403
5475
  };
5404
5476
  const internals = {
5405
5477
  p: patch,
@@ -5551,14 +5623,9 @@ function doWatch(source, cb, {
5551
5623
  const _cb = cb;
5552
5624
  cb = (...args) => {
5553
5625
  _cb(...args);
5554
- unwatch();
5626
+ watchHandle();
5555
5627
  };
5556
5628
  }
5557
- if (deep !== void 0 && typeof deep === "number") {
5558
- warn$1(
5559
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
5560
- );
5561
- }
5562
5629
  if (!cb) {
5563
5630
  if (immediate !== void 0) {
5564
5631
  warn$1(
@@ -5584,10 +5651,12 @@ function doWatch(source, cb, {
5584
5651
  );
5585
5652
  };
5586
5653
  const instance = currentInstance;
5587
- const reactiveGetter = (source2) => deep === true ? source2 : (
5588
- // for deep: false, only traverse root-level properties
5589
- traverse(source2, deep === false ? 1 : void 0)
5590
- );
5654
+ const reactiveGetter = (source2) => {
5655
+ if (deep) return source2;
5656
+ if (isShallow(source2) || deep === false || deep === 0)
5657
+ return traverse(source2, 1);
5658
+ return traverse(source2);
5659
+ };
5591
5660
  let getter;
5592
5661
  let forceTrigger = false;
5593
5662
  let isMultiSource = false;
@@ -5633,7 +5702,8 @@ function doWatch(source, cb, {
5633
5702
  }
5634
5703
  if (cb && deep) {
5635
5704
  const baseGetter = getter;
5636
- getter = () => traverse(baseGetter());
5705
+ const depth = deep === true ? Infinity : deep;
5706
+ getter = () => traverse(baseGetter(), depth);
5637
5707
  }
5638
5708
  let cleanup;
5639
5709
  let onCleanup = (fn) => {
@@ -5658,7 +5728,12 @@ function doWatch(source, cb, {
5658
5728
  const ctx = useSSRContext();
5659
5729
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
5660
5730
  } else {
5661
- return NOOP;
5731
+ const watchHandle2 = () => {
5732
+ };
5733
+ watchHandle2.stop = NOOP;
5734
+ watchHandle2.resume = NOOP;
5735
+ watchHandle2.pause = NOOP;
5736
+ return watchHandle2;
5662
5737
  }
5663
5738
  }
5664
5739
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -5699,12 +5774,15 @@ function doWatch(source, cb, {
5699
5774
  }
5700
5775
  effect.scheduler = scheduler;
5701
5776
  const scope = getCurrentScope();
5702
- const unwatch = () => {
5777
+ const watchHandle = () => {
5703
5778
  effect.stop();
5704
5779
  if (scope) {
5705
5780
  remove(scope.effects, effect);
5706
5781
  }
5707
5782
  };
5783
+ watchHandle.pause = effect.pause.bind(effect);
5784
+ watchHandle.resume = effect.resume.bind(effect);
5785
+ watchHandle.stop = watchHandle;
5708
5786
  {
5709
5787
  effect.onTrack = onTrack;
5710
5788
  effect.onTrigger = onTrigger;
@@ -5723,8 +5801,8 @@ function doWatch(source, cb, {
5723
5801
  } else {
5724
5802
  effect.run();
5725
5803
  }
5726
- if (ssrCleanup) ssrCleanup.push(unwatch);
5727
- return unwatch;
5804
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
5805
+ return watchHandle;
5728
5806
  }
5729
5807
  function instanceWatch(source, value, options) {
5730
5808
  const publicThis = this.proxy;
@@ -5798,9 +5876,9 @@ function emit(instance, event, ...rawArgs) {
5798
5876
  } = instance;
5799
5877
  if (emitsOptions) {
5800
5878
  if (!(event in emitsOptions) && true) {
5801
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
5879
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
5802
5880
  warn$1(
5803
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
5881
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
5804
5882
  );
5805
5883
  }
5806
5884
  } else {
@@ -6973,7 +7051,7 @@ const computed = (getterOrOptions, debugOptions) => {
6973
7051
  return c;
6974
7052
  };
6975
7053
 
6976
- const version = "3.5.0-alpha.4";
7054
+ const version = "3.5.0-beta.1";
6977
7055
  const warn = warn$1 ;
6978
7056
  const _ssrUtils = {
6979
7057
  createComponentInstance: createComponentInstance$1,
@@ -6982,10 +7060,23 @@ const _ssrUtils = {
6982
7060
  setCurrentRenderingInstance: setCurrentRenderingInstance$1,
6983
7061
  isVNode: isVNode$2,
6984
7062
  normalizeVNode: normalizeVNode$1,
6985
- getComponentPublicInstance
7063
+ getComponentPublicInstance,
7064
+ ensureValidVNode: ensureValidVNode$1
6986
7065
  };
6987
7066
  const ssrUtils = _ssrUtils ;
6988
7067
 
7068
+ let policy = void 0;
7069
+ const tt = typeof window !== "undefined" && window.trustedTypes;
7070
+ if (tt) {
7071
+ try {
7072
+ policy = /* @__PURE__ */ tt.createPolicy("vue", {
7073
+ createHTML: (val) => val
7074
+ });
7075
+ } catch (e) {
7076
+ warn(`Error creating trusted types policy: ${e}`);
7077
+ }
7078
+ }
7079
+ const unsafeToTrustedHTML = policy ? (val) => policy.createHTML(val) : (val) => val;
6989
7080
  const svgNS = "http://www.w3.org/2000/svg";
6990
7081
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
6991
7082
  const doc = typeof document !== "undefined" ? document : null;
@@ -7033,7 +7124,9 @@ const nodeOps = {
7033
7124
  if (start === end || !(start = start.nextSibling)) break;
7034
7125
  }
7035
7126
  } else {
7036
- templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
7127
+ templateContainer.innerHTML = unsafeToTrustedHTML(
7128
+ namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content
7129
+ );
7037
7130
  const template = templateContainer.content;
7038
7131
  if (namespace === "svg" || namespace === "mathml") {
7039
7132
  const wrapper = template.firstChild;
@@ -7383,7 +7476,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
7383
7476
  if (isNativeOn(key) && isString(value)) {
7384
7477
  return false;
7385
7478
  }
7386
- return key in el;
7479
+ if (key in el) {
7480
+ return true;
7481
+ }
7482
+ if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) {
7483
+ return true;
7484
+ }
7485
+ return false;
7387
7486
  }
7388
7487
 
7389
7488
  const getModelAssigner = (vnode) => {
@@ -7563,7 +7662,9 @@ const createApp = (...args) => {
7563
7662
  if (!isFunction(component) && !component.render && !component.template) {
7564
7663
  component.template = container.innerHTML;
7565
7664
  }
7566
- container.innerHTML = "";
7665
+ if (container.nodeType === 1) {
7666
+ container.textContent = "";
7667
+ }
7567
7668
  const proxy = mount(container, false, resolveRootNamespace(container));
7568
7669
  if (container instanceof Element) {
7569
7670
  container.removeAttribute("v-cloak");
@@ -7705,6 +7806,7 @@ function ssrRenderComponent(comp, props = null, children = null, parentComponent
7705
7806
  );
7706
7807
  }
7707
7808
 
7809
+ const { ensureValidVNode } = ssrUtils;
7708
7810
  function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
7709
7811
  push(`<!--[-->`);
7710
7812
  ssrRenderSlotInner(
@@ -7732,7 +7834,17 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
7732
7834
  slotScopeId ? " " + slotScopeId : ""
7733
7835
  );
7734
7836
  if (isArray(ret)) {
7735
- renderVNodeChildren(push, ret, parentComponent, slotScopeId);
7837
+ const validSlotContent = ensureValidVNode(ret);
7838
+ if (validSlotContent) {
7839
+ renderVNodeChildren(
7840
+ push,
7841
+ validSlotContent,
7842
+ parentComponent,
7843
+ slotScopeId
7844
+ );
7845
+ } else if (fallbackRenderFn) {
7846
+ fallbackRenderFn();
7847
+ }
7736
7848
  } else {
7737
7849
  let isEmptySlot = true;
7738
7850
  if (transition) {
@@ -7782,9 +7894,10 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
7782
7894
  let teleportContent;
7783
7895
  if (disabled) {
7784
7896
  contentRenderFn(parentPush);
7785
- teleportContent = `<!--teleport anchor-->`;
7897
+ teleportContent = `<!--teleport start anchor--><!--teleport anchor-->`;
7786
7898
  } else {
7787
7899
  const { getBuffer, push } = createBuffer();
7900
+ push(`<!--teleport start anchor-->`);
7788
7901
  contentRenderFn(push);
7789
7902
  push(`<!--teleport anchor-->`);
7790
7903
  teleportContent = getBuffer();