@vue/runtime-dom 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/runtime-dom v3.6.0-beta.12
2
+ * @vue/runtime-dom v3.6.0-beta.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -598,7 +598,21 @@ function createInvoker(initialValue, instance) {
598
598
  const invoker = (e) => {
599
599
  if (!e._vts) e._vts = Date.now();
600
600
  else if (e._vts <= invoker.attached) return;
601
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
601
+ const value = invoker.value;
602
+ if (isArray(value)) {
603
+ const originalStop = e.stopImmediatePropagation;
604
+ e.stopImmediatePropagation = () => {
605
+ originalStop.call(e);
606
+ e._stopped = true;
607
+ };
608
+ const handlers = value.slice();
609
+ const args = [e];
610
+ for (let i = 0; i < handlers.length; i++) {
611
+ if (e._stopped) break;
612
+ const handler = handlers[i];
613
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
614
+ }
615
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
602
616
  };
603
617
  invoker.value = initialValue;
604
618
  invoker.attached = getNow();
@@ -609,16 +623,6 @@ function sanitizeEventValue(value, propName) {
609
623
  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}.`);
610
624
  return NOOP;
611
625
  }
612
- function patchStopImmediatePropagation(e, value) {
613
- if (isArray(value)) {
614
- const originalStop = e.stopImmediatePropagation;
615
- e.stopImmediatePropagation = () => {
616
- originalStop.call(e);
617
- e._stopped = true;
618
- };
619
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
620
- } else return value;
621
- }
622
626
  //#endregion
623
627
  //#region packages/runtime-dom/src/patchProp.ts
624
628
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.6.0-beta.12
2
+ * @vue/runtime-dom v3.6.0-beta.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1224,9 +1224,6 @@ var VueRuntimeDOM = (function(exports) {
1224
1224
  default: return 0;
1225
1225
  }
1226
1226
  }
1227
- function getTargetType(value) {
1228
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
1229
- }
1230
1227
  /* @__NO_SIDE_EFFECTS__ */
1231
1228
  function reactive(target) {
1232
1229
  if (/* @__PURE__ */ isReadonly(target)) return target;
@@ -1339,10 +1336,11 @@ var VueRuntimeDOM = (function(exports) {
1339
1336
  return target;
1340
1337
  }
1341
1338
  if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) return target;
1342
- const targetType = getTargetType(target);
1343
- if (targetType === 0) return target;
1339
+ if (target["__v_skip"] || !Object.isExtensible(target)) return target;
1344
1340
  const existingProxy = proxyMap.get(target);
1345
1341
  if (existingProxy) return existingProxy;
1342
+ const targetType = targetTypeMap(toRawType(target));
1343
+ if (targetType === 0) return target;
1346
1344
  const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
1347
1345
  proxyMap.set(target, proxy);
1348
1346
  return proxy;
@@ -2592,6 +2590,7 @@ var VueRuntimeDOM = (function(exports) {
2592
2590
  }
2593
2591
  flushIndex = 0;
2594
2592
  jobsLength = 0;
2593
+ jobs.length = 0;
2595
2594
  flushPostFlushCbs(seen);
2596
2595
  currentFlushPromise = null;
2597
2596
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -2649,6 +2648,14 @@ var VueRuntimeDOM = (function(exports) {
2649
2648
  function normalizeClassComponent(component) {
2650
2649
  return isClassComponent(component) ? component.__vccOpts : component;
2651
2650
  }
2651
+ function hasDirtyAncestor(instance, dirtyInstances) {
2652
+ let parent = instance.parent;
2653
+ while (parent) {
2654
+ if (dirtyInstances.has(parent)) return true;
2655
+ parent = parent.parent;
2656
+ }
2657
+ return false;
2658
+ }
2652
2659
  function rerender(id, newRender) {
2653
2660
  const record = map.get(id);
2654
2661
  if (!record) return;
@@ -2680,42 +2687,69 @@ var VueRuntimeDOM = (function(exports) {
2680
2687
  const isVapor = record.initialDef.__vapor;
2681
2688
  updateComponentDef(record.initialDef, newComp);
2682
2689
  const instances = [...record.instances];
2683
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
2690
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
2684
2691
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
2685
- for (const instance of instances) instance.hmrReload(newComp);
2686
- } else for (const instance of instances) {
2687
- const oldComp = normalizeClassComponent(instance.type);
2688
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
2689
- if (!dirtyInstances) {
2690
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2691
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2692
- }
2693
- dirtyInstances.add(instance);
2694
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2695
- instance.appContext.propsCache.delete(instance.type);
2696
- instance.appContext.emitsCache.delete(instance.type);
2697
- instance.appContext.optionsCache.delete(instance.type);
2698
- if (instance.ceReload) {
2699
- dirtyInstances.add(instance);
2700
- instance.ceReload(newComp.styles);
2701
- dirtyInstances.delete(instance);
2702
- } else if (instance.parent) queueJob(() => {
2703
- isHmrUpdating = true;
2692
+ const dirtyInstances = new Set(instances);
2693
+ const rerenderedParents = /* @__PURE__ */ new Set();
2694
+ for (const instance of instances) {
2704
2695
  const parent = instance.parent;
2705
- if (parent.vapor) parent.hmrRerender();
2706
- else if (!(parent.effect.flags & 1024)) {
2707
- parent.renderCache = [];
2708
- parent.effect.run();
2696
+ if (parent) {
2697
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
2698
+ rerenderedParents.add(parent);
2699
+ parent.hmrRerender();
2700
+ }
2701
+ } else instance.hmrReload(newComp);
2702
+ }
2703
+ } else {
2704
+ const parentUpdates = /* @__PURE__ */ new Map();
2705
+ const dirtyInstanceSet = new Set(instances);
2706
+ for (const instance of instances) {
2707
+ const oldComp = normalizeClassComponent(instance.type);
2708
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
2709
+ if (!dirtyInstances) {
2710
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
2711
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
2709
2712
  }
2710
- nextTick(() => {
2711
- isHmrUpdating = false;
2713
+ dirtyInstances.add(instance);
2714
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
2715
+ instance.appContext.propsCache.delete(instance.type);
2716
+ instance.appContext.emitsCache.delete(instance.type);
2717
+ instance.appContext.optionsCache.delete(instance.type);
2718
+ if (instance.ceReload) {
2719
+ dirtyInstances.add(instance);
2720
+ instance.ceReload(newComp.styles);
2721
+ dirtyInstances.delete(instance);
2722
+ } else if (instance.parent) {
2723
+ const parent = instance.parent;
2724
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
2725
+ let updates = parentUpdates.get(parent);
2726
+ if (!updates) parentUpdates.set(parent, updates = []);
2727
+ updates.push([instance, dirtyInstances]);
2728
+ }
2729
+ } else if (instance.appContext.reload) instance.appContext.reload();
2730
+ else if (typeof window !== "undefined") window.location.reload();
2731
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2732
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2733
+ }
2734
+ parentUpdates.forEach((updates, parent) => {
2735
+ queueJob(() => {
2736
+ isHmrUpdating = true;
2737
+ if (parent.vapor) parent.hmrRerender();
2738
+ else {
2739
+ const i = parent;
2740
+ if (!(i.effect.flags & 1024)) {
2741
+ i.renderCache = [];
2742
+ i.effect.run();
2743
+ }
2744
+ }
2745
+ nextTick(() => {
2746
+ isHmrUpdating = false;
2747
+ });
2748
+ updates.forEach(([instance, dirtyInstances]) => {
2749
+ dirtyInstances.delete(instance);
2750
+ });
2712
2751
  });
2713
- dirtyInstances.delete(instance);
2714
2752
  });
2715
- else if (instance.appContext.reload) instance.appContext.reload();
2716
- else if (typeof window !== "undefined") window.location.reload();
2717
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
2718
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
2719
2753
  }
2720
2754
  queuePostFlushCb(() => {
2721
2755
  hmrDirtyComponents.clear();
@@ -3157,17 +3191,16 @@ var VueRuntimeDOM = (function(exports) {
3157
3191
  },
3158
3192
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
3159
3193
  const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
3160
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3194
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3161
3195
  const pendingMount = pendingMounts.get(vnode);
3162
3196
  if (pendingMount) {
3163
3197
  pendingMount.flags |= 4;
3164
3198
  pendingMounts.delete(vnode);
3165
- shouldRemove = false;
3166
3199
  }
3167
3200
  if (targetStart) hostRemove(targetStart);
3168
3201
  if (targetAnchor) hostRemove(targetAnchor);
3169
3202
  doRemove && hostRemove(anchor);
3170
- if (shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3203
+ if (!pendingMount && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
3171
3204
  const child = children[i];
3172
3205
  unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
3173
3206
  }
@@ -3819,15 +3852,11 @@ var VueRuntimeDOM = (function(exports) {
3819
3852
  }
3820
3853
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
3821
3854
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
3822
- let hasWarned = false;
3855
+ if (next && !isMismatchAllowed(el, 1)) {
3856
+ warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
3857
+ logMismatchError();
3858
+ }
3823
3859
  while (next) {
3824
- if (!isMismatchAllowed(el, 1)) {
3825
- if (!hasWarned) {
3826
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
3827
- hasWarned = true;
3828
- }
3829
- logMismatchError();
3830
- }
3831
3860
  const cur = next;
3832
3861
  next = next.nextSibling;
3833
3862
  remove(cur);
@@ -3866,7 +3895,7 @@ var VueRuntimeDOM = (function(exports) {
3866
3895
  optimized = optimized || !!parentVNode.dynamicChildren;
3867
3896
  const children = parentVNode.children;
3868
3897
  const l = children.length;
3869
- let hasWarned = false;
3898
+ let hasCheckedMismatch = false;
3870
3899
  for (let i = 0; i < l; i++) {
3871
3900
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
3872
3901
  const isText = vnode.type === Text;
@@ -3880,12 +3909,12 @@ var VueRuntimeDOM = (function(exports) {
3880
3909
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
3881
3910
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
3882
3911
  else {
3883
- if (!isMismatchAllowed(container, 1)) {
3884
- if (!hasWarned) {
3912
+ if (!hasCheckedMismatch) {
3913
+ hasCheckedMismatch = true;
3914
+ if (!isMismatchAllowed(container, 1)) {
3885
3915
  warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
3886
- hasWarned = true;
3916
+ logMismatchError();
3887
3917
  }
3888
- logMismatchError();
3889
3918
  }
3890
3919
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
3891
3920
  }
@@ -4668,6 +4697,7 @@ var VueRuntimeDOM = (function(exports) {
4668
4697
  slot: vaporSlot,
4669
4698
  fallback
4670
4699
  };
4700
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
4671
4701
  return ret;
4672
4702
  }
4673
4703
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
@@ -6898,8 +6928,10 @@ var VueRuntimeDOM = (function(exports) {
6898
6928
  else hostInsert(el, container, anchor);
6899
6929
  };
6900
6930
  const performLeave = () => {
6931
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
6901
6932
  if (el._isLeaving) el[leaveCbKey](true);
6902
- leave(el, () => {
6933
+ if (transition.persisted && !wasLeaving) remove();
6934
+ else leave(el, () => {
6903
6935
  remove();
6904
6936
  afterLeave && afterLeave();
6905
6937
  });
@@ -7120,6 +7152,10 @@ var VueRuntimeDOM = (function(exports) {
7120
7152
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
7121
7153
  }
7122
7154
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
7155
+ if (force && transition.persisted && !el[leaveCbKey]) {
7156
+ insert();
7157
+ return;
7158
+ }
7123
7159
  if (force || needTransition(parentSuspense, transition)) {
7124
7160
  transition.beforeEnter(el);
7125
7161
  insert();
@@ -8366,7 +8402,7 @@ var VueRuntimeDOM = (function(exports) {
8366
8402
  }
8367
8403
  //#endregion
8368
8404
  //#region packages/runtime-core/src/index.ts
8369
- const version = "3.6.0-beta.12";
8405
+ const version = "3.6.0-beta.14";
8370
8406
  const warn = warn$1;
8371
8407
  /**
8372
8408
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -8974,7 +9010,21 @@ var VueRuntimeDOM = (function(exports) {
8974
9010
  const invoker = (e) => {
8975
9011
  if (!e._vts) e._vts = Date.now();
8976
9012
  else if (e._vts <= invoker.attached) return;
8977
- callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5, [e]);
9013
+ const value = invoker.value;
9014
+ if (isArray(value)) {
9015
+ const originalStop = e.stopImmediatePropagation;
9016
+ e.stopImmediatePropagation = () => {
9017
+ originalStop.call(e);
9018
+ e._stopped = true;
9019
+ };
9020
+ const handlers = value.slice();
9021
+ const args = [e];
9022
+ for (let i = 0; i < handlers.length; i++) {
9023
+ if (e._stopped) break;
9024
+ const handler = handlers[i];
9025
+ if (handler) callWithAsyncErrorHandling(handler, instance, 5, args);
9026
+ }
9027
+ } else callWithAsyncErrorHandling(value, instance, 5, [e]);
8978
9028
  };
8979
9029
  invoker.value = initialValue;
8980
9030
  invoker.attached = getNow();
@@ -8985,16 +9035,6 @@ var VueRuntimeDOM = (function(exports) {
8985
9035
  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}.`);
8986
9036
  return NOOP;
8987
9037
  }
8988
- function patchStopImmediatePropagation(e, value) {
8989
- if (isArray(value)) {
8990
- const originalStop = e.stopImmediatePropagation;
8991
- e.stopImmediatePropagation = () => {
8992
- originalStop.call(e);
8993
- e._stopped = true;
8994
- };
8995
- return value.map((fn) => (e) => !e._stopped && fn && fn(e));
8996
- } else return value;
8997
- }
8998
9038
  //#endregion
8999
9039
  //#region packages/runtime-dom/src/patchProp.ts
9000
9040
  const patchProp = (el, key, prevValue, nextValue, namespace, parentComponent) => {