@vue/compat 3.6.0-beta.12 → 3.6.0-beta.14

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/compat v3.6.0-beta.12
2
+ * @vue/compat v3.6.0-beta.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1312,9 +1312,6 @@ function targetTypeMap(rawType) {
1312
1312
  default: return 0;
1313
1313
  }
1314
1314
  }
1315
- function getTargetType(value) {
1316
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1317
- }
1318
1315
  /* @__NO_SIDE_EFFECTS__ */
1319
1316
  function reactive(target) {
1320
1317
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1427,10 +1424,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1427
1424
  return target;
1428
1425
  }
1429
1426
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1430
- const targetType = getTargetType(target);
1431
- if (targetType === 0) return target;
1427
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1432
1428
  const existingProxy = proxyMap.get(target);
1433
1429
  if (existingProxy) return existingProxy;
1430
+ const targetType = targetTypeMap(toRawType(target));
1431
+ if (targetType === 0) return target;
1434
1432
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1435
1433
  proxyMap.set(target, proxy);
1436
1434
  return proxy;
@@ -2680,6 +2678,7 @@ function flushJobs(seen) {
2680
2678
  }
2681
2679
  flushIndex = 0;
2682
2680
  jobsLength = 0;
2681
+ jobs.length = 0;
2683
2682
  flushPostFlushCbs(seen);
2684
2683
  currentFlushPromise = null;
2685
2684
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2737,6 +2736,14 @@ function createRecord(id, initialDef) {
2737
2736
  function normalizeClassComponent(component) {
2738
2737
  return isClassComponent(component) ? component.__vccOpts : component;
2739
2738
  }
2739
+ function hasDirtyAncestor(instance, dirtyInstances) {
2740
+ let parent = instance.parent;
2741
+ while (parent) {
2742
+ if (dirtyInstances.has(parent)) return true;
2743
+ parent = parent.parent;
2744
+ }
2745
+ return false;
2746
+ }
2740
2747
  function rerender(id, newRender) {
2741
2748
  const record = map.get(id);
2742
2749
  if (!record) return;
@@ -2768,42 +2775,69 @@ function reload(id, newComp) {
2768
2775
  const isVapor = record.initialDef.__vapor;
2769
2776
  updateComponentDef(record.initialDef, newComp);
2770
2777
  const instances = [...record.instances];
2771
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2778
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2772
2779
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2773
- for (const instance of instances) instance.hmrReload(newComp);
2774
- } else for (const instance of instances) {
2775
- const oldComp = normalizeClassComponent(instance.type);
2776
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2777
- if (!dirtyInstances) {
2778
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2779
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2780
- }
2781
- dirtyInstances.add(instance);
2782
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2783
- instance.appContext.propsCache.delete(instance.type);
2784
- instance.appContext.emitsCache.delete(instance.type);
2785
- instance.appContext.optionsCache.delete(instance.type);
2786
- if (instance.ceReload) {
2787
- dirtyInstances.add(instance);
2788
- instance.ceReload(newComp.styles);
2789
- dirtyInstances.delete(instance);
2790
- } else if (instance.parent) queueJob(() => {
2791
- isHmrUpdating = true;
2780
+ const dirtyInstances = new Set(instances);
2781
+ const rerenderedParents = /* @__PURE__ */ new Set();
2782
+ for (const instance of instances) {
2792
2783
  const parent = instance.parent;
2793
- if (parent.vapor) parent.hmrRerender();
2794
- else if (!(parent.effect.flags & 1024)) {
2795
- parent.renderCache = [];
2796
- parent.effect.run();
2784
+ if (parent) {
2785
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2786
+ rerenderedParents.add(parent);
2787
+ parent.hmrRerender();
2788
+ }
2789
+ } else instance.hmrReload(newComp);
2790
+ }
2791
+ } else {
2792
+ const parentUpdates = /* @__PURE__ */ new Map();
2793
+ const dirtyInstanceSet = new Set(instances);
2794
+ for (const instance of instances) {
2795
+ const oldComp = normalizeClassComponent(instance.type);
2796
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2797
+ if (!dirtyInstances) {
2798
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2799
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2797
2800
  }
2798
- nextTick(() => {
2799
- isHmrUpdating = false;
2801
+ dirtyInstances.add(instance);
2802
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2803
+ instance.appContext.propsCache.delete(instance.type);
2804
+ instance.appContext.emitsCache.delete(instance.type);
2805
+ instance.appContext.optionsCache.delete(instance.type);
2806
+ if (instance.ceReload) {
2807
+ dirtyInstances.add(instance);
2808
+ instance.ceReload(newComp.styles);
2809
+ dirtyInstances.delete(instance);
2810
+ } else if (instance.parent) {
2811
+ const parent = instance.parent;
2812
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2813
+ let updates = parentUpdates.get(parent);
2814
+ if (!updates) parentUpdates.set(parent, updates = []);
2815
+ updates.push([instance, dirtyInstances]);
2816
+ }
2817
+ } else if (instance.appContext.reload) instance.appContext.reload();
2818
+ else if (typeof window !== "undefined") window.location.reload();
2819
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2820
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2821
+ }
2822
+ parentUpdates.forEach((updates, parent) => {
2823
+ queueJob(() => {
2824
+ isHmrUpdating = true;
2825
+ if (parent.vapor) parent.hmrRerender();
2826
+ else {
2827
+ const i = parent;
2828
+ if (!(i.effect.flags & 1024)) {
2829
+ i.renderCache = [];
2830
+ i.effect.run();
2831
+ }
2832
+ }
2833
+ nextTick(() => {
2834
+ isHmrUpdating = false;
2835
+ });
2836
+ updates.forEach(([instance, dirtyInstances]) => {
2837
+ dirtyInstances.delete(instance);
2838
+ });
2800
2839
  });
2801
- dirtyInstances.delete(instance);
2802
2840
  });
2803
- else if (instance.appContext.reload) instance.appContext.reload();
2804
- else if (typeof window !== "undefined") window.location.reload();
2805
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2806
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2807
2841
  }
2808
2842
  queuePostFlushCb(() => {
2809
2843
  hmrDirtyComponents.clear();
@@ -3600,17 +3634,16 @@ const TeleportImpl = {
3600
3634
  },
3601
3635
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3602
3636
  const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3603
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3637
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3604
3638
  const pendingMount = pendingMounts.get(vnode);
3605
3639
  if (pendingMount) {
3606
3640
  pendingMount.flags |= 4;
3607
3641
  pendingMounts.delete(vnode);
3608
- shouldRemove = false;
3609
3642
  }
3610
3643
  if (targetStart) hostRemove(targetStart);
3611
3644
  if (targetAnchor) hostRemove(targetAnchor);
3612
3645
  doRemove && hostRemove(anchor);
3613
- if (shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3646
+ if (!pendingMount && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3614
3647
  const child = children[i];
3615
3648
  unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3616
3649
  }
@@ -4263,15 +4296,11 @@ function createHydrationFunctions(rendererInternals) {
4263
4296
  }
4264
4297
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
4265
4298
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
4266
- let hasWarned = false;
4299
+ if (next && !isMismatchAllowed(el, 1)) {
4300
+ warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
4301
+ logMismatchError();
4302
+ }
4267
4303
  while (next) {
4268
- if (!isMismatchAllowed(el, 1)) {
4269
- if (!hasWarned) {
4270
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
4271
- hasWarned = true;
4272
- }
4273
- logMismatchError();
4274
- }
4275
4304
  const cur = next;
4276
4305
  next = next.nextSibling;
4277
4306
  remove(cur);
@@ -4310,7 +4339,7 @@ function createHydrationFunctions(rendererInternals) {
4310
4339
  optimized = optimized || !!parentVNode.dynamicChildren;
4311
4340
  const children = parentVNode.children;
4312
4341
  const l = children.length;
4313
- let hasWarned = false;
4342
+ let hasCheckedMismatch = false;
4314
4343
  for (let i = 0; i < l; i++) {
4315
4344
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4316
4345
  const isText = vnode.type === Text;
@@ -4324,12 +4353,12 @@ function createHydrationFunctions(rendererInternals) {
4324
4353
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
4325
4354
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
4326
4355
  else {
4327
- if (!isMismatchAllowed(container, 1)) {
4328
- if (!hasWarned) {
4356
+ if (!hasCheckedMismatch) {
4357
+ hasCheckedMismatch = true;
4358
+ if (!isMismatchAllowed(container, 1)) {
4329
4359
  warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
4330
- hasWarned = true;
4360
+ logMismatchError();
4331
4361
  }
4332
- logMismatchError();
4333
4362
  }
4334
4363
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
4335
4364
  }
@@ -5327,6 +5356,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5327
5356
  slot: vaporSlot,
5328
5357
  fallback
5329
5358
  };
5359
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
5330
5360
  return ret;
5331
5361
  }
5332
5362
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -6263,7 +6293,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6263
6293
  if (options.el) return vm.$mount(options.el);
6264
6294
  else return vm;
6265
6295
  }
6266
- Vue.version = `2.6.14-compat:3.6.0-beta.12`;
6296
+ Vue.version = `2.6.14-compat:3.6.0-beta.14`;
6267
6297
  Vue.config = singletonApp.config;
6268
6298
  Vue.use = (plugin, ...options) => {
6269
6299
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -8199,8 +8229,10 @@ function baseCreateRenderer(options, createHydrationFns) {
8199
8229
  else hostInsert(el, container, anchor);
8200
8230
  };
8201
8231
  const performLeave = () => {
8232
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
8202
8233
  if (el._isLeaving) el[leaveCbKey](true);
8203
- leave(el, () => {
8234
+ if (transition.persisted && !wasLeaving) remove();
8235
+ else leave(el, () => {
8204
8236
  remove();
8205
8237
  afterLeave && afterLeave();
8206
8238
  });
@@ -8423,6 +8455,10 @@ function invalidateMount(hooks) {
8423
8455
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
8424
8456
  }
8425
8457
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
8458
+ if (force && transition.persisted && !el[leaveCbKey]) {
8459
+ insert();
8460
+ return;
8461
+ }
8426
8462
  if (force || needTransition(parentSuspense, transition)) {
8427
8463
  transition.beforeEnter(el);
8428
8464
  insert();
@@ -9717,7 +9753,7 @@ function isMemoSame(cached, memo) {
9717
9753
  }
9718
9754
  //#endregion
9719
9755
  //#region packages/runtime-core/src/index.ts
9720
- const version = "3.6.0-beta.12";
9756
+ const version = "3.6.0-beta.14";
9721
9757
  const warn = warn$1;
9722
9758
  /**
9723
9759
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10375,7 +10411,21 @@ function createInvoker(initialValue, instance) {
10375
10411
  const invoker = (e) => {
10376
10412
  if (!e._vts) e._vts = Date.now();
10377
10413
  else if (e._vts <= invoker.attached) return;
10378
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
10414
+ const value = invoker.value;
10415
+ if (isArray(value)) {
10416
+ const originalStop = e.stopImmediatePropagation;
10417
+ e.stopImmediatePropagation = () => {
10418
+ originalStop.call(e);
10419
+ e._stopped = true;
10420
+ };
10421
+ const handlers = value.slice();
10422
+ const args = [e];
10423
+ for (let i = 0; i < handlers.length; i++) {
10424
+ if (e._stopped) break;
10425
+ const handler = handlers[i];
10426
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
10427
+ }
10428
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
10379
10429
  };
10380
10430
  invoker.value = initialValue;
10381
10431
  invoker.attached = getNow();
@@ -10386,16 +10436,6 @@ function sanitizeEventValue(value, propName) {
10386
10436
  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}.`);
10387
10437
  return NOOP;
10388
10438
  }
10389
- function patchStopImmediatePropagation(e, value) {
10390
- if (isArray(value)) {
10391
- const originalStop = e.stopImmediatePropagation;
10392
- e.stopImmediatePropagation = () => {
10393
- originalStop.call(e);
10394
- e._stopped = true;
10395
- };
10396
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
10397
- } else return value;
10398
- }
10399
10439
  //#endregion
10400
10440
  //#region packages/runtime-dom/src/patchProp.ts
10401
10441
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -14433,10 +14473,9 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
14433
14473
  const isTemplate = isTemplateNode(node);
14434
14474
  const memo = findDir(node, "memo");
14435
14475
  const keyProp = findProp(node, `key`, false, true);
14436
- const isDirKey = keyProp && keyProp.type === 7;
14476
+ keyProp && keyProp.type;
14437
14477
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
14438
- if (memo && keyExp && isDirKey) {}
14439
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
14478
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
14440
14479
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
14441
14480
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
14442
14481
  forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), void 0, renderExp, fragmentFlag, void 0, void 0, true, !isStableFragment, false, node.loc);