@vue/compat 3.6.0-beta.11 → 3.6.0-beta.13

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.11
2
+ * @vue/compat v3.6.0-beta.13
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -521,6 +521,13 @@ function warn$2(msg, ...args) {
521
521
  const notifyBuffer = [];
522
522
  let batchDepth = 0;
523
523
  let activeSub = void 0;
524
+ let runDepth = 0;
525
+ function incRunDepth() {
526
+ ++runDepth;
527
+ }
528
+ function decRunDepth() {
529
+ --runDepth;
530
+ }
524
531
  let globalVersion = 0;
525
532
  let notifyIndex = 0;
526
533
  let notifyBufferLength = 0;
@@ -594,8 +601,10 @@ function propagate(link) {
594
601
  const sub = link.sub;
595
602
  let flags = sub.flags;
596
603
  if (flags & 3) {
597
- if (!(flags & 60)) sub.flags = flags | 32;
598
- else if (!(flags & 12)) flags = 0;
604
+ if (!(flags & 60)) {
605
+ sub.flags = flags | 32;
606
+ if (runDepth) sub.flags |= 8;
607
+ } else if (!(flags & 12)) flags = 0;
599
608
  else if (!(flags & 4)) sub.flags = flags & -9 | 32;
600
609
  else if (!(flags & 48) && isValidLink(link, sub)) {
601
610
  sub.flags = flags | 40;
@@ -664,13 +673,13 @@ function checkDirty(link, sub) {
664
673
  let dirty = false;
665
674
  if (sub.flags & 16) dirty = true;
666
675
  else if ((depFlags & 17) === 17) {
676
+ const subs = dep.subs;
667
677
  if (dep.update()) {
668
- const subs = dep.subs;
669
678
  if (subs.nextSub !== void 0) shallowPropagate(subs);
670
679
  dirty = true;
671
680
  }
672
681
  } else if ((depFlags & 33) === 33) {
673
- if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
682
+ stack = {
674
683
  value: link,
675
684
  prev: stack
676
685
  };
@@ -685,15 +694,12 @@ function checkDirty(link, sub) {
685
694
  }
686
695
  while (checkDepth) {
687
696
  --checkDepth;
688
- const firstSub = sub.subs;
689
- const hasMultipleSubs = firstSub.nextSub !== void 0;
690
- if (hasMultipleSubs) {
691
- link = stack.value;
692
- stack = stack.prev;
693
- } else link = firstSub;
697
+ link = stack.value;
698
+ stack = stack.prev;
694
699
  if (dirty) {
700
+ const subs = sub.subs;
695
701
  if (sub.update()) {
696
- if (hasMultipleSubs) shallowPropagate(firstSub);
702
+ if (subs.nextSub !== void 0) shallowPropagate(subs);
697
703
  sub = link.sub;
698
704
  continue;
699
705
  }
@@ -705,7 +711,7 @@ function checkDirty(link, sub) {
705
711
  }
706
712
  dirty = false;
707
713
  }
708
- return dirty;
714
+ return dirty && !!sub.flags;
709
715
  } while (true);
710
716
  }
711
717
  function shallowPropagate(link) {
@@ -1306,9 +1312,6 @@ function targetTypeMap(rawType) {
1306
1312
  default: return 0;
1307
1313
  }
1308
1314
  }
1309
- function getTargetType(value) {
1310
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1311
- }
1312
1315
  /* @__NO_SIDE_EFFECTS__ */
1313
1316
  function reactive(target) {
1314
1317
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1421,10 +1424,11 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
1421
1424
  return target;
1422
1425
  }
1423
1426
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1424
- const targetType = getTargetType(target);
1425
- if (targetType === 0) return target;
1427
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1426
1428
  const existingProxy = proxyMap.get(target);
1427
1429
  if (existingProxy) return existingProxy;
1430
+ const targetType = targetTypeMap(toRawType(target));
1431
+ if (targetType === 0) return target;
1428
1432
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1429
1433
  proxyMap.set(target, proxy);
1430
1434
  return proxy;
@@ -1857,9 +1861,11 @@ var ReactiveEffect = class {
1857
1861
  if (!this.active) return this.fn();
1858
1862
  cleanup(this);
1859
1863
  const prevSub = startTracking(this);
1864
+ incRunDepth();
1860
1865
  try {
1861
1866
  return this.fn();
1862
1867
  } finally {
1868
+ decRunDepth();
1863
1869
  endTracking(this, prevSub);
1864
1870
  const flags = this.flags;
1865
1871
  if ((flags & 136) === 136) {
@@ -3592,17 +3598,16 @@ const TeleportImpl = {
3592
3598
  },
3593
3599
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3594
3600
  const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3595
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3601
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3596
3602
  const pendingMount = pendingMounts.get(vnode);
3597
3603
  if (pendingMount) {
3598
3604
  pendingMount.flags |= 4;
3599
3605
  pendingMounts.delete(vnode);
3600
- shouldRemove = false;
3601
3606
  }
3602
3607
  if (targetStart) hostRemove(targetStart);
3603
3608
  if (targetAnchor) hostRemove(targetAnchor);
3604
3609
  doRemove && hostRemove(anchor);
3605
- if (shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3610
+ if (!pendingMount && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3606
3611
  const child = children[i];
3607
3612
  unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3608
3613
  }
@@ -4255,15 +4260,11 @@ function createHydrationFunctions(rendererInternals) {
4255
4260
  }
4256
4261
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
4257
4262
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
4258
- let hasWarned = false;
4263
+ if (next && !isMismatchAllowed(el, 1)) {
4264
+ warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
4265
+ logMismatchError();
4266
+ }
4259
4267
  while (next) {
4260
- if (!isMismatchAllowed(el, 1)) {
4261
- if (!hasWarned) {
4262
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
4263
- hasWarned = true;
4264
- }
4265
- logMismatchError();
4266
- }
4267
4268
  const cur = next;
4268
4269
  next = next.nextSibling;
4269
4270
  remove(cur);
@@ -4302,7 +4303,7 @@ function createHydrationFunctions(rendererInternals) {
4302
4303
  optimized = optimized || !!parentVNode.dynamicChildren;
4303
4304
  const children = parentVNode.children;
4304
4305
  const l = children.length;
4305
- let hasWarned = false;
4306
+ let hasCheckedMismatch = false;
4306
4307
  for (let i = 0; i < l; i++) {
4307
4308
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
4308
4309
  const isText = vnode.type === Text;
@@ -4316,12 +4317,12 @@ function createHydrationFunctions(rendererInternals) {
4316
4317
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
4317
4318
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
4318
4319
  else {
4319
- if (!isMismatchAllowed(container, 1)) {
4320
- if (!hasWarned) {
4320
+ if (!hasCheckedMismatch) {
4321
+ hasCheckedMismatch = true;
4322
+ if (!isMismatchAllowed(container, 1)) {
4321
4323
  warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
4322
- hasWarned = true;
4324
+ logMismatchError();
4323
4325
  }
4324
- logMismatchError();
4325
4326
  }
4326
4327
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
4327
4328
  }
@@ -6255,7 +6256,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6255
6256
  if (options.el) return vm.$mount(options.el);
6256
6257
  else return vm;
6257
6258
  }
6258
- Vue.version = `2.6.14-compat:3.6.0-beta.11`;
6259
+ Vue.version = `2.6.14-compat:3.6.0-beta.13`;
6259
6260
  Vue.config = singletonApp.config;
6260
6261
  Vue.use = (plugin, ...options) => {
6261
6262
  if (plugin && isFunction(plugin.install)) plugin.install(Vue, ...options);
@@ -8191,8 +8192,10 @@ function baseCreateRenderer(options, createHydrationFns) {
8191
8192
  else hostInsert(el, container, anchor);
8192
8193
  };
8193
8194
  const performLeave = () => {
8195
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
8194
8196
  if (el._isLeaving) el[leaveCbKey](true);
8195
- leave(el, () => {
8197
+ if (transition.persisted && !wasLeaving) remove();
8198
+ else leave(el, () => {
8196
8199
  remove();
8197
8200
  afterLeave && afterLeave();
8198
8201
  });
@@ -8415,6 +8418,10 @@ function invalidateMount(hooks) {
8415
8418
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
8416
8419
  }
8417
8420
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
8421
+ if (force && transition.persisted && !el[leaveCbKey]) {
8422
+ insert();
8423
+ return;
8424
+ }
8418
8425
  if (force || needTransition(parentSuspense, transition)) {
8419
8426
  transition.beforeEnter(el);
8420
8427
  insert();
@@ -9709,7 +9716,7 @@ function isMemoSame(cached, memo) {
9709
9716
  }
9710
9717
  //#endregion
9711
9718
  //#region packages/runtime-core/src/index.ts
9712
- const version = "3.6.0-beta.11";
9719
+ const version = "3.6.0-beta.13";
9713
9720
  const warn = warn$1;
9714
9721
  /**
9715
9722
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -10367,7 +10374,21 @@ function createInvoker(initialValue, instance) {
10367
10374
  const invoker = (e) => {
10368
10375
  if (!e._vts) e._vts = Date.now();
10369
10376
  else if (e._vts <= invoker.attached) return;
10370
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
10377
+ const value = invoker.value;
10378
+ if (isArray(value)) {
10379
+ const originalStop = e.stopImmediatePropagation;
10380
+ e.stopImmediatePropagation = () => {
10381
+ originalStop.call(e);
10382
+ e._stopped = true;
10383
+ };
10384
+ const handlers = value.slice();
10385
+ const args = [e];
10386
+ for (let i = 0; i < handlers.length; i++) {
10387
+ if (e._stopped) break;
10388
+ const handler = handlers[i];
10389
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
10390
+ }
10391
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
10371
10392
  };
10372
10393
  invoker.value = initialValue;
10373
10394
  invoker.attached = getNow();
@@ -10378,16 +10399,6 @@ function sanitizeEventValue(value, propName) {
10378
10399
  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}.`);
10379
10400
  return NOOP;
10380
10401
  }
10381
- function patchStopImmediatePropagation(e, value) {
10382
- if (isArray(value)) {
10383
- const originalStop = e.stopImmediatePropagation;
10384
- e.stopImmediatePropagation = () => {
10385
- originalStop.call(e);
10386
- e._stopped = true;
10387
- };
10388
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
10389
- } else return value;
10390
- }
10391
10402
  //#endregion
10392
10403
  //#region packages/runtime-dom/src/patchProp.ts
10393
10404
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -14425,10 +14436,9 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
14425
14436
  const isTemplate = isTemplateNode(node);
14426
14437
  const memo = findDir(node, "memo");
14427
14438
  const keyProp = findProp(node, `key`, false, true);
14428
- const isDirKey = keyProp && keyProp.type === 7;
14439
+ keyProp && keyProp.type;
14429
14440
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
14430
- if (memo && keyExp && isDirKey) {}
14431
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
14441
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
14432
14442
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
14433
14443
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
14434
14444
  forNode.codegenNode = createVNodeCall(context, helper(FRAGMENT), void 0, renderExp, fragmentFlag, void 0, void 0, true, !isStableFragment, false, node.loc);