@vue/server-renderer 3.6.0-beta.9 → 3.6.0-rc.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.6.0-beta.9
2
+ * @vue/server-renderer v3.6.0-rc.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -292,9 +292,14 @@ function escapeHtml(string) {
292
292
  }
293
293
  return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
294
294
  }
295
- const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
295
+ const commentStripRE = /^(?:-?>)+|<!--|-->|--!>|<!-$/g;
296
296
  function escapeHtmlComment(src) {
297
- return src.replace(commentStripRE, "");
297
+ let prev;
298
+ do {
299
+ prev = src;
300
+ src = src.replace(commentStripRE, "");
301
+ } while (src !== prev);
302
+ return src;
298
303
  }
299
304
  //#endregion
300
305
  //#region packages/shared/src/looseEqual.ts
@@ -457,6 +462,13 @@ function warn$2(msg, ...args) {
457
462
  const notifyBuffer = [];
458
463
  let batchDepth = 0;
459
464
  let activeSub = void 0;
465
+ let runDepth = 0;
466
+ function incRunDepth() {
467
+ ++runDepth;
468
+ }
469
+ function decRunDepth() {
470
+ --runDepth;
471
+ }
460
472
  let globalVersion = 0;
461
473
  let notifyIndex = 0;
462
474
  let notifyBufferLength = 0;
@@ -530,8 +542,10 @@ function propagate(link) {
530
542
  const sub = link.sub;
531
543
  let flags = sub.flags;
532
544
  if (flags & 3) {
533
- if (!(flags & 60)) sub.flags = flags | 32;
534
- else if (!(flags & 12)) flags = 0;
545
+ if (!(flags & 60)) {
546
+ sub.flags = flags | 32;
547
+ if (runDepth) sub.flags |= 8;
548
+ } else if (!(flags & 12)) flags = 0;
535
549
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
536
550
  else if (!(flags & 48) && isValidLink(link, sub)) {
537
551
  sub.flags = flags | 40;
@@ -600,13 +614,13 @@ function checkDirty(link, sub) {
600
614
  let dirty = false;
601
615
  if (sub.flags & 16) dirty = true;
602
616
  else if ((depFlags & 17) === 17) {
617
+ const subs = dep.subs;
603
618
  if (dep.update()) {
604
- const subs = dep.subs;
605
619
  if (subs.nextSub !== void 0) shallowPropagate(subs);
606
620
  dirty = true;
607
621
  }
608
622
  } else if ((depFlags & 33) === 33) {
609
- if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
623
+ stack = {
610
624
  value: link,
611
625
  prev: stack
612
626
  };
@@ -621,15 +635,12 @@ function checkDirty(link, sub) {
621
635
  }
622
636
  while (checkDepth) {
623
637
  --checkDepth;
624
- const firstSub = sub.subs;
625
- const hasMultipleSubs = firstSub.nextSub !== void 0;
626
- if (hasMultipleSubs) {
627
- link = stack.value;
628
- stack = stack.prev;
629
- } else link = firstSub;
638
+ link = stack.value;
639
+ stack = stack.prev;
630
640
  if (dirty) {
641
+ const subs = sub.subs;
631
642
  if (sub.update()) {
632
- if (hasMultipleSubs) shallowPropagate(firstSub);
643
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
633
644
  sub = link.sub;
634
645
  continue;
635
646
  }
@@ -641,7 +652,7 @@ function checkDirty(link, sub) {
641
652
  }
642
653
  dirty = false;
643
654
  }
644
- return dirty;
655
+ return dirty && !!sub.flags;
645
656
  } while (true);
646
657
  }
647
658
  function shallowPropagate(link) {
@@ -1020,7 +1031,7 @@ var MutableReactiveHandler = class extends BaseReactiveHandler {
1020
1031
  }
1021
1032
  const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
1022
1033
  const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
1023
- if (target === /* @__PURE__ */ toRaw(receiver)) {
1034
+ if (target === /* @__PURE__ */ toRaw(receiver) && result) {
1024
1035
  if (!hadKey) trigger(target, "add", key, value);
1025
1036
  else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
1026
1037
  }
@@ -1238,9 +1249,6 @@ function targetTypeMap(rawType) {
1238
1249
  default: return 0;
1239
1250
  }
1240
1251
  }
1241
- function getTargetType(value) {
1242
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1243
- }
1244
1252
  /* @__NO_SIDE_EFFECTS__ */
1245
1253
  function reactive(target) {
1246
1254
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1353,10 +1361,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1353
1361
  return target;
1354
1362
  }
1355
1363
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1356
- const targetType = getTargetType(target);
1357
- if (targetType === 0) return target;
1364
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1358
1365
  const existingProxy = proxyMap.get(target);
1359
1366
  if (existingProxy) return existingProxy;
1367
+ const targetType = targetTypeMap(toRawType(target));
1368
+ if (targetType === 0) return target;
1360
1369
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1361
1370
  proxyMap.set(target, proxy);
1362
1371
  return proxy;
@@ -1561,9 +1570,11 @@ var ReactiveEffect = class {
1561
1570
  if (!this.active) return this.fn();
1562
1571
  cleanup(this);
1563
1572
  const prevSub = startTracking(this);
1573
+ incRunDepth();
1564
1574
  try {
1565
1575
  return this.fn();
1566
1576
  } finally {
1577
+ decRunDepth();
1567
1578
  endTracking(this, prevSub);
1568
1579
  const flags = this.flags;
1569
1580
  if ((flags & 136) === 136) {
@@ -1855,8 +1866,9 @@ var WatcherEffect = class extends ReactiveEffect {
1855
1866
  if (once && cb) {
1856
1867
  const _cb = cb;
1857
1868
  cb = (...args) => {
1858
- _cb(...args);
1869
+ const res = _cb(...args);
1859
1870
  this.stop();
1871
+ return res;
1860
1872
  };
1861
1873
  }
1862
1874
  this.cb = cb;
@@ -1870,7 +1882,7 @@ var WatcherEffect = class extends ReactiveEffect {
1870
1882
  if (!this.cb) return;
1871
1883
  const { immediate, deep, call } = this.options;
1872
1884
  if (initialRun && !immediate) return;
1873
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1885
+ if (initialRun || deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1874
1886
  cleanup(this);
1875
1887
  const currentWatcher = activeWatcher;
1876
1888
  activeWatcher = this;
@@ -2139,8 +2151,8 @@ function findInsertionIndex(order, queue, start, end) {
2139
2151
  /**
2140
2152
  * @internal for runtime-vapor only
2141
2153
  */
2142
- function queueJob(job, id, isPre = false) {
2143
- if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
2154
+ function queueJob(job, id, isPre = false, order = 0) {
2155
+ if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : order ? id * 2 + 1 + order / (order + 1) : id * 2 + 1, jobs, jobsLength, flushIndex)) {
2144
2156
  jobsLength++;
2145
2157
  queueFlush();
2146
2158
  }
@@ -2249,6 +2261,7 @@ function flushJobs(seen) {
2249
2261
  }
2250
2262
  flushIndex = 0;
2251
2263
  jobsLength = 0;
2264
+ jobs.length = 0;
2252
2265
  flushPostFlushCbs(seen);
2253
2266
  currentFlushPromise = null;
2254
2267
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2306,6 +2319,14 @@ function createRecord(id, initialDef) {
2306
2319
  function normalizeClassComponent(component) {
2307
2320
  return isClassComponent(component) ? component.__vccOpts : component;
2308
2321
  }
2322
+ function hasDirtyAncestor(instance, dirtyInstances) {
2323
+ let parent = instance.parent;
2324
+ while (parent) {
2325
+ if (dirtyInstances.has(parent)) return true;
2326
+ parent = parent.parent;
2327
+ }
2328
+ return false;
2329
+ }
2309
2330
  function rerender(id, newRender) {
2310
2331
  const record = map.get(id);
2311
2332
  if (!record) return;
@@ -2337,42 +2358,69 @@ function reload(id, newComp) {
2337
2358
  const isVapor = record.initialDef.__vapor;
2338
2359
  updateComponentDef(record.initialDef, newComp);
2339
2360
  const instances = [...record.instances];
2340
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2361
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2341
2362
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2342
- for (const instance of instances) instance.hmrReload(newComp);
2343
- } else for (const instance of instances) {
2344
- const oldComp = normalizeClassComponent(instance.type);
2345
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2346
- if (!dirtyInstances) {
2347
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2348
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2349
- }
2350
- dirtyInstances.add(instance);
2351
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2352
- instance.appContext.propsCache.delete(instance.type);
2353
- instance.appContext.emitsCache.delete(instance.type);
2354
- instance.appContext.optionsCache.delete(instance.type);
2355
- if (instance.ceReload) {
2356
- dirtyInstances.add(instance);
2357
- instance.ceReload(newComp.styles);
2358
- dirtyInstances.delete(instance);
2359
- } else if (instance.parent) queueJob(() => {
2360
- isHmrUpdating = true;
2363
+ const dirtyInstances = new Set(instances);
2364
+ const rerenderedParents = /* @__PURE__ */ new Set();
2365
+ for (const instance of instances) {
2361
2366
  const parent = instance.parent;
2362
- if (parent.vapor) parent.hmrRerender();
2363
- else if (!(parent.effect.flags & 1024)) {
2364
- parent.renderCache = [];
2365
- parent.effect.run();
2367
+ if (parent) {
2368
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2369
+ rerenderedParents.add(parent);
2370
+ parent.hmrRerender();
2371
+ }
2372
+ } else instance.hmrReload(newComp);
2373
+ }
2374
+ } else {
2375
+ const parentUpdates = /* @__PURE__ */ new Map();
2376
+ const dirtyInstanceSet = new Set(instances);
2377
+ for (const instance of instances) {
2378
+ const oldComp = normalizeClassComponent(instance.type);
2379
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2380
+ if (!dirtyInstances) {
2381
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2382
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2366
2383
  }
2367
- nextTick(() => {
2368
- isHmrUpdating = false;
2384
+ dirtyInstances.add(instance);
2385
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2386
+ instance.appContext.propsCache.delete(instance.type);
2387
+ instance.appContext.emitsCache.delete(instance.type);
2388
+ instance.appContext.optionsCache.delete(instance.type);
2389
+ if (instance.ceReload) {
2390
+ dirtyInstances.add(instance);
2391
+ instance.ceReload(newComp.styles);
2392
+ dirtyInstances.delete(instance);
2393
+ } else if (instance.parent) {
2394
+ const parent = instance.parent;
2395
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2396
+ let updates = parentUpdates.get(parent);
2397
+ if (!updates) parentUpdates.set(parent, updates = []);
2398
+ updates.push([instance, dirtyInstances]);
2399
+ }
2400
+ } else if (instance.appContext.reload) instance.appContext.reload();
2401
+ else if (typeof window !== "undefined") window.location.reload();
2402
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2403
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2404
+ }
2405
+ parentUpdates.forEach((updates, parent) => {
2406
+ queueJob(() => {
2407
+ isHmrUpdating = true;
2408
+ if (parent.vapor) parent.hmrRerender();
2409
+ else {
2410
+ const i = parent;
2411
+ if (!(i.effect.flags & 1024)) {
2412
+ i.renderCache = [];
2413
+ i.effect.run();
2414
+ }
2415
+ }
2416
+ nextTick(() => {
2417
+ isHmrUpdating = false;
2418
+ });
2419
+ updates.forEach(([instance, dirtyInstances]) => {
2420
+ dirtyInstances.delete(instance);
2421
+ });
2369
2422
  });
2370
- dirtyInstances.delete(instance);
2371
2423
  });
2372
- else if (instance.appContext.reload) instance.appContext.reload();
2373
- else if (typeof window !== "undefined") window.location.reload();
2374
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2375
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2376
2424
  }
2377
2425
  queuePostFlushCb(() => {
2378
2426
  hmrDirtyComponents.clear();
@@ -2495,10 +2543,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
2495
2543
  const renderFnWithContext = (...args) => {
2496
2544
  if (renderFnWithContext._d) setBlockTracking(-1);
2497
2545
  const prevInstance = setCurrentRenderingInstance$1(ctx);
2546
+ const prevStackSize = blockStack.length;
2498
2547
  let res;
2499
2548
  try {
2500
2549
  res = fn(...args);
2501
2550
  } finally {
2551
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2502
2552
  setCurrentRenderingInstance$1(prevInstance);
2503
2553
  if (renderFnWithContext._d) setBlockTracking(1);
2504
2554
  }
@@ -3520,7 +3570,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
3520
3570
  */
3521
3571
  function isEmitListener(options, key) {
3522
3572
  if (!options || !isOn(key)) return false;
3523
- key = key.slice(2).replace(/Once$/, "");
3573
+ key = key.slice(2);
3574
+ key = key === "Once" ? key : key.replace(/Once$/, "");
3524
3575
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
3525
3576
  }
3526
3577
  //#endregion
@@ -3995,7 +4046,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3995
4046
  const receivedType = toRawType(value);
3996
4047
  const expectedValue = styleValue(value, expectedType);
3997
4048
  const receivedValue = styleValue(value, receivedType);
3998
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
4049
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
3999
4050
  message += `, got ${receivedType} `;
4000
4051
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
4001
4052
  return message;
@@ -4004,7 +4055,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
4004
4055
  * dev only
4005
4056
  */
4006
4057
  function styleValue(value, type) {
4007
- if (type === "String") return `"${value}"`;
4058
+ if (isSymbol(value)) return value.toString();
4059
+ else if (type === "String") return `"${value}"`;
4008
4060
  else if (type === "Number") return `${Number(value)}`;
4009
4061
  else return `${value}`;
4010
4062
  }
@@ -4021,8 +4073,11 @@ function isExplicable(type) {
4021
4073
  /**
4022
4074
  * dev only
4023
4075
  */
4024
- function isBoolean(...args) {
4025
- return args.some((elem) => elem.toLowerCase() === "boolean");
4076
+ function isCoercible(...args) {
4077
+ return args.every((elem) => {
4078
+ const value = elem.toLowerCase();
4079
+ return value !== "boolean" && value !== "symbol";
4080
+ });
4026
4081
  }
4027
4082
  //#endregion
4028
4083
  //#region packages/runtime-core/src/componentSlots.ts
@@ -4316,7 +4371,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4316
4371
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4317
4372
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4318
4373
  parentComponent && toggleRecurse(parentComponent, true);
4319
- if (isHmrUpdating) {
4374
+ if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
4320
4375
  patchFlag = 0;
4321
4376
  optimized = false;
4322
4377
  dynamicChildren = null;
@@ -4396,19 +4451,35 @@ function baseCreateRenderer(options, createHydrationFns) {
4396
4451
  n2.slotScopeIds = slotScopeIds;
4397
4452
  if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
4398
4453
  else {
4454
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
4399
4455
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
4400
4456
  if (n2.dirs) {
4401
4457
  invokeDirectiveHook(n2, null, parentComponent, "created");
4402
4458
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
4403
4459
  }
4460
+ }, () => {
4461
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
4404
4462
  });
4405
4463
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
4464
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
4465
+ if (vnodeMountedHook) {
4466
+ const scopedVNode = n2;
4467
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
4468
+ }
4406
4469
  }
4407
4470
  else {
4408
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
4471
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
4472
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
4409
4473
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4474
+ }, () => {
4475
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
4476
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
4410
4477
  });
4411
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
4478
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
4479
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
4480
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4481
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
4482
+ }, void 0, parentSuspense);
4412
4483
  }
4413
4484
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
4414
4485
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -4754,8 +4825,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4754
4825
  else hostInsert(el, container, anchor);
4755
4826
  };
4756
4827
  const performLeave = () => {
4828
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
4757
4829
  if (el._isLeaving) el[leaveCbKey](true);
4758
- leave(el, () => {
4830
+ if (transition.persisted && !wasLeaving) remove();
4831
+ else leave(el, () => {
4759
4832
  remove();
4760
4833
  afterLeave && afterLeave();
4761
4834
  });
@@ -4786,7 +4859,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4786
4859
  if (shapeFlag & 6) if (isVaporComponent(type)) {
4787
4860
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4788
4861
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
4789
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
4862
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
4863
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4864
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4865
+ }, void 0, parentSuspense);
4790
4866
  return;
4791
4867
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
4792
4868
  else {
@@ -4847,7 +4923,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4847
4923
  if (effect) {
4848
4924
  effect.stop();
4849
4925
  unmount(subTree, instance, parentSuspense, doRemove);
4850
- }
4926
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
4851
4927
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
4852
4928
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
4853
4929
  devtoolsComponentRemoved(instance);
@@ -4973,6 +5049,10 @@ function invalidateMount(hooks) {
4973
5049
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
4974
5050
  }
4975
5051
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
5052
+ if (force && transition.persisted && !el[leaveCbKey]) {
5053
+ insert();
5054
+ return;
5055
+ }
4976
5056
  if (force || needTransition(parentSuspense, transition)) {
4977
5057
  transition.beforeEnter(el);
4978
5058
  insert();
@@ -5047,6 +5127,11 @@ const Comment = Symbol.for("v-cmt");
5047
5127
  const Static = Symbol.for("v-stc");
5048
5128
  const VaporSlot = Symbol.for("v-vps");
5049
5129
  const blockStack = [];
5130
+ let currentBlock = null;
5131
+ function closeBlock() {
5132
+ blockStack.pop();
5133
+ currentBlock = blockStack[blockStack.length - 1] || null;
5134
+ }
5050
5135
  let isBlockTreeEnabled = 1;
5051
5136
  /**
5052
5137
  * Block tracking sometimes needs to be disabled, for example during the
@@ -5066,6 +5151,7 @@ let isBlockTreeEnabled = 1;
5066
5151
  */
5067
5152
  function setBlockTracking(value, inVOnce = false) {
5068
5153
  isBlockTreeEnabled += value;
5154
+ if (value < 0 && currentBlock && inVOnce) currentBlock.hasOnce = true;
5069
5155
  }
5070
5156
  function isVNode$2(value) {
5071
5157
  return value ? value.__v_isVNode === true : false;
@@ -5129,6 +5215,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
5129
5215
  if (shapeFlag & 128) type.normalize(vnode);
5130
5216
  } else if (children) vnode.shapeFlag |= isString(children) ? 8 : 16;
5131
5217
  if (vnode.key !== vnode.key) warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
5218
+ if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock && (vnode.patchFlag > 0 || shapeFlag & 6) && vnode.patchFlag !== 32) currentBlock.push(vnode);
5132
5219
  return vnode;
5133
5220
  }
5134
5221
  const createVNode = createVNodeWithArgsTransform;
@@ -5140,6 +5227,8 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
5140
5227
  if (isVNode$2(type)) {
5141
5228
  const cloned = cloneVNode(type, props, true);
5142
5229
  if (children) normalizeChildren(cloned, children);
5230
+ if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) if (cloned.shapeFlag & 6) currentBlock[currentBlock.indexOf(type)] = cloned;
5231
+ else currentBlock.push(cloned);
5143
5232
  cloned.patchFlag = -2;
5144
5233
  return cloned;
5145
5234
  }
@@ -5196,11 +5285,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5196
5285
  el: vnode.el,
5197
5286
  anchor: vnode.anchor,
5198
5287
  ctx: vnode.ctx,
5199
- ce: vnode.ce
5288
+ ce: vnode.ce,
5289
+ vi: vnode.vi,
5290
+ vs: cloneVaporSlotMeta(vnode),
5291
+ vb: vnode.vb
5200
5292
  };
5201
5293
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
5202
5294
  return cloned;
5203
5295
  }
5296
+ function cloneVaporSlotMeta(vnode) {
5297
+ const vaporSlot = vnode.vs;
5298
+ if (!vaporSlot) return vaporSlot;
5299
+ const cloned = {
5300
+ slot: vaporSlot.slot,
5301
+ fallback: vaporSlot.fallback,
5302
+ outletFallback: vaporSlot.outletFallback
5303
+ };
5304
+ if (vnode.el) {
5305
+ cloned.state = vaporSlot.state;
5306
+ cloned.ref = vaporSlot.ref;
5307
+ cloned.scope = vaporSlot.scope;
5308
+ }
5309
+ return cloned;
5310
+ }
5204
5311
  /**
5205
5312
  * Dev only, for HMR of hoisted vnodes reused in v-for
5206
5313
  * https://github.com/vitejs/vite/issues/2022
@@ -5249,6 +5356,10 @@ function normalizeChildren(vnode, children) {
5249
5356
  }
5250
5357
  }
5251
5358
  else if (isFunction(children)) {
5359
+ if (shapeFlag & 65) {
5360
+ normalizeChildren(vnode, { default: children });
5361
+ return;
5362
+ }
5252
5363
  children = {
5253
5364
  default: children,
5254
5365
  _ctx: currentRenderingInstance
@@ -5593,7 +5704,7 @@ const computed = (getterOrOptions, debugOptions) => {
5593
5704
  };
5594
5705
  //#endregion
5595
5706
  //#region packages/runtime-core/src/index.ts
5596
- const version = "3.6.0-beta.9";
5707
+ const version = "3.6.0-rc.1";
5597
5708
  const warn = warn$1;
5598
5709
  /**
5599
5710
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
@@ -5740,7 +5851,10 @@ function patchStyle(el, prev, next) {
5740
5851
  }
5741
5852
  for (const key in next) {
5742
5853
  if (key === "display") hasControlledDisplay = true;
5743
- setStyle(style, key, next[key]);
5854
+ const value = next[key];
5855
+ if (value != null) {
5856
+ if (!shouldPreserveTextareaResizeStyle(el, key, !isString(prev) && prev ? prev[key] : void 0, value)) setStyle(style, key, value);
5857
+ } else setStyle(style, key, "");
5744
5858
  }
5745
5859
  } else if (isCssString) {
5746
5860
  if (prev !== next) {
@@ -5788,6 +5902,14 @@ function autoPrefix(style, rawName) {
5788
5902
  }
5789
5903
  return rawName;
5790
5904
  }
5905
+ /**
5906
+ * Browsers update textarea width/height directly during native resize.
5907
+ * Only special-case this common textarea path for now; other resize scenarios
5908
+ * still follow normal vnode style patching.
5909
+ */
5910
+ function shouldPreserveTextareaResizeStyle(el, key, prev, next) {
5911
+ return el.tagName === "TEXTAREA" && (key === "width" || key === "height") && isString(next) && prev === next;
5912
+ }
5791
5913
  //#endregion
5792
5914
  //#region packages/runtime-dom/src/modules/attrs.ts
5793
5915
  const xlinkNS = "http://www.w3.org/1999/xlink";
@@ -5846,7 +5968,7 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
5846
5968
  const existingInvoker = invokers[rawName];
5847
5969
  if (nextValue && existingInvoker) existingInvoker.value = sanitizeEventValue(nextValue, rawName);
5848
5970
  else {
5849
- const [name, options] = parseName(rawName);
5971
+ const [name, options] = parseEventName(rawName);
5850
5972
  if (nextValue) addEventListener(el, name, invokers[rawName] = createInvoker(sanitizeEventValue(nextValue, rawName), instance), options);
5851
5973
  else if (existingInvoker) {
5852
5974
  removeEventListener(el, name, existingInvoker, options);
@@ -5854,16 +5976,15 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
5854
5976
  }
5855
5977
  }
5856
5978
  }
5857
- const optionsModifierRE = /(?:Once|Passive|Capture)$/;
5858
- function parseName(name) {
5979
+ const optionsModifierRE = /(Once|Passive|Capture)$/;
5980
+ const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
5981
+ function parseEventName(name) {
5859
5982
  let options;
5860
- if (optionsModifierRE.test(name)) {
5861
- options = {};
5862
- let m;
5863
- while (m = name.match(optionsModifierRE)) {
5864
- name = name.slice(0, name.length - m[0].length);
5865
- options[m[0].toLowerCase()] = true;
5866
- }
5983
+ let m;
5984
+ while ((m = name.match(optionsModifierRE)) && !optionsModifierEventRE.test(name)) {
5985
+ if (!options) options = {};
5986
+ name = name.slice(0, name.length - m[1].length);
5987
+ options[m[1].toLowerCase()] = true;
5867
5988
  }
5868
5989
  return [name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)), options];
5869
5990
  }
@@ -5874,7 +5995,21 @@ function createInvoker(initialValue, instance) {
5874
5995
  const invoker = (e) => {
5875
5996
  if (!e._vts) e._vts = Date.now();
5876
5997
  else if (e._vts <= invoker.attached) return;
5877
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
5998
+ const value = invoker.value;
5999
+ if (isArray(value)) {
6000
+ const originalStop = e.stopImmediatePropagation;
6001
+ e.stopImmediatePropagation = () => {
6002
+ originalStop.call(e);
6003
+ e._stopped = true;
6004
+ };
6005
+ const handlers = value.slice();
6006
+ const args = [e];
6007
+ for (let i = 0; i < handlers.length; i++) {
6008
+ if (e._stopped) break;
6009
+ const handler = handlers[i];
6010
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
6011
+ }
6012
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
5878
6013
  };
5879
6014
  invoker.value = initialValue;
5880
6015
  invoker.attached = getNow();
@@ -5885,16 +6020,6 @@ function sanitizeEventValue(value, propName) {
5885
6020
  warn(`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`);
5886
6021
  return NOOP;
5887
6022
  }
5888
- function patchStopImmediatePropagation(e, value) {
5889
- if (isArray(value)) {
5890
- const originalStop = e.stopImmediatePropagation;
5891
- e.stopImmediatePropagation = () => {
5892
- originalStop.call(e);
5893
- e._stopped = true;
5894
- };
5895
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
5896
- } else return value;
5897
- }
5898
6023
  //#endregion
5899
6024
  //#region packages/runtime-dom/src/patchProp.ts
5900
6025
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -6072,7 +6197,8 @@ const vModelSelect = {
6072
6197
  mounted(el, { value }) {
6073
6198
  vModelSetSelected(el, value);
6074
6199
  },
6075
- beforeUpdate(el, _binding, vnode) {
6200
+ beforeUpdate(el, { value }, vnode) {
6201
+ el._modelValue = value;
6076
6202
  el[assignKey] = getModelAssigner(vnode);
6077
6203
  },
6078
6204
  updated(el, { value }) {
@@ -6083,10 +6209,10 @@ const vModelSelect = {
6083
6209
  * @internal
6084
6210
  */
6085
6211
  const vModelSelectInit = (el, value, number, set) => {
6086
- const isSetModel = isSet(value);
6212
+ el._modelValue = value;
6087
6213
  addEventListener(el, "change", () => {
6088
6214
  const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map((o) => number ? looseToNumber(getValue(o)) : getValue(o));
6089
- (set || el[assignKey])(el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0]);
6215
+ (set || el[assignKey])(el.multiple ? isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0]);
6090
6216
  el._assigning = true;
6091
6217
  nextTick(() => {
6092
6218
  el._assigning = false;
@@ -6097,6 +6223,7 @@ const vModelSelectInit = (el, value, number, set) => {
6097
6223
  * @internal
6098
6224
  */
6099
6225
  const vModelSetSelected = (el, value) => {
6226
+ el._modelValue = value;
6100
6227
  if (el._assigning) return;
6101
6228
  const isMultiple = el.multiple;
6102
6229
  const isArrayValue = isArray(value);
@@ -6314,6 +6441,11 @@ function ssrResetCssVars(raw) {
6314
6441
  //#endregion
6315
6442
  //#region packages/server-renderer/src/helpers/ssrRenderComponent.ts
6316
6443
  function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
6444
+ if (isString(comp)) {
6445
+ const { getBuffer, push } = createBuffer();
6446
+ renderVNode(push, createVNode(comp, props, children), parentComponent, slotScopeId);
6447
+ return getBuffer();
6448
+ }
6317
6449
  return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
6318
6450
  }
6319
6451
  //#endregion
@@ -6387,6 +6519,7 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
6387
6519
  teleportContent = getBuffer();
6388
6520
  }
6389
6521
  targetBuffer.splice(bufferIndex, 0, teleportContent);
6522
+ if (isPromise(teleportContent) || isArray(teleportContent) && teleportContent.hasAsync) targetBuffer.hasAsync = true;
6390
6523
  parentPush("<!--teleport end-->");
6391
6524
  }
6392
6525
  //#endregion
@@ -6405,8 +6538,8 @@ function ssrRenderList(source, renderItem) {
6405
6538
  }
6406
6539
  for (let i = 0; i < source; i++) renderItem(i + 1, i);
6407
6540
  } else if (isObject(source)) if (source[Symbol.iterator]) {
6408
- const arr = Array.from(source);
6409
- for (let i = 0, l = arr.length; i < l; i++) renderItem(arr[i], i);
6541
+ let i = 0;
6542
+ for (const item of source) renderItem(item, i++);
6410
6543
  } else {
6411
6544
  const keys = Object.keys(source);
6412
6545
  for (let i = 0, l = keys.length; i < l; i++) {
@@ -6417,7 +6550,7 @@ function ssrRenderList(source, renderItem) {
6417
6550
  }
6418
6551
  //#endregion
6419
6552
  //#region packages/server-renderer/src/helpers/ssrRenderSuspense.ts
6420
- async function ssrRenderSuspense(push, { default: renderContent }) {
6553
+ function ssrRenderSuspense(push, { default: renderContent }) {
6421
6554
  if (renderContent) renderContent();
6422
6555
  else push(`<!---->`);
6423
6556
  }
@@ -6515,7 +6648,11 @@ function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
6515
6648
  if (hasAsyncSetup) prefetches = instance.sp;
6516
6649
  if (prefetches) return Promise.all(prefetches.map((prefetch) => prefetch.call(instance.proxy)));
6517
6650
  }).catch(NOOP).then(() => renderComponentSubTree(instance, slotScopeId));
6518
- else return renderComponentSubTree(instance, slotScopeId);
6651
+ else try {
6652
+ return renderComponentSubTree(instance, slotScopeId);
6653
+ } catch (err) {
6654
+ return Promise.reject(err);
6655
+ }
6519
6656
  }
6520
6657
  function renderComponentSubTree(instance, slotScopeId) {
6521
6658
  pushWarningContext(instance.vnode);
@@ -6555,6 +6692,8 @@ function renderComponentSubTree(instance, slotScopeId) {
6555
6692
  const prev = setCurrentRenderingInstance(instance);
6556
6693
  try {
6557
6694
  ssrRender(instance.proxy, push, instance, attrs, instance.props, instance.setupState, instance.data, instance.ctx);
6695
+ } catch (err) {
6696
+ handleError(err, instance, 1);
6558
6697
  } finally {
6559
6698
  setCurrentRenderingInstance(prev);
6560
6699
  }
@@ -6601,15 +6740,25 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
6601
6740
  let { props, children, shapeFlag, scopeId } = vnode;
6602
6741
  let openTag = `<${tag}`;
6603
6742
  if (props) openTag += ssrRenderAttrs(props, tag);
6604
- if (scopeId) openTag += ` ${scopeId}`;
6743
+ const renderedScopeIds = [];
6744
+ const appendScopeId = (id) => {
6745
+ if (id && (!props || !hasOwn(props, id)) && !renderedScopeIds.includes(id)) {
6746
+ openTag += ` ${id}`;
6747
+ renderedScopeIds.push(id);
6748
+ }
6749
+ };
6750
+ if (scopeId) appendScopeId(scopeId);
6605
6751
  let curParent = parentComponent;
6606
6752
  let curVnode = vnode;
6607
6753
  while (curParent && curVnode === curParent.subTree) {
6608
6754
  curVnode = curParent.vnode;
6609
- if (curVnode.scopeId) openTag += ` ${curVnode.scopeId}`;
6755
+ if (curVnode.scopeId) appendScopeId(curVnode.scopeId);
6610
6756
  curParent = curParent.parent;
6611
6757
  }
6612
- if (slotScopeId) openTag += ` ${slotScopeId}`;
6758
+ if (slotScopeId) {
6759
+ const slotScopeIdList = slotScopeId.trim().split(" ");
6760
+ for (let i = 0; i < slotScopeIdList.length; i++) appendScopeId(slotScopeIdList[i]);
6761
+ }
6613
6762
  push(openTag + `>`);
6614
6763
  if (!isVoidTag(tag)) {
6615
6764
  let hasChildrenOverride = false;
@@ -6712,7 +6861,7 @@ async function renderToString(input, context = {}) {
6712
6861
  async function resolveTeleports(context) {
6713
6862
  if (context.__teleportBuffers) {
6714
6863
  context.teleports = context.teleports || {};
6715
- for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(await Promise.all([context.__teleportBuffers[key]]));
6864
+ for (const key in context.__teleportBuffers) context.teleports[key] = await unrollBuffer$1(context.__teleportBuffers[key]);
6716
6865
  }
6717
6866
  }
6718
6867
  //#endregion