@vue/runtime-dom 3.5.0-alpha.1 → 3.5.0-alpha.2

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.5.0-alpha.1
2
+ * @vue/runtime-dom v3.5.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -84,10 +84,11 @@ var VueRuntimeDOM = (function (exports) {
84
84
  fns[i](arg);
85
85
  }
86
86
  };
87
- const def = (obj, key, value) => {
87
+ const def = (obj, key, value, writable = false) => {
88
88
  Object.defineProperty(obj, key, {
89
89
  configurable: true,
90
90
  enumerable: false,
91
+ writable,
91
92
  value
92
93
  });
93
94
  };
@@ -2020,7 +2021,9 @@ var VueRuntimeDOM = (function (exports) {
2020
2021
  "ASYNC_COMPONENT_LOADER": 13,
2021
2022
  "13": "ASYNC_COMPONENT_LOADER",
2022
2023
  "SCHEDULER": 14,
2023
- "14": "SCHEDULER"
2024
+ "14": "SCHEDULER",
2025
+ "APP_UNMOUNT_CLEANUP": 15,
2026
+ "15": "APP_UNMOUNT_CLEANUP"
2024
2027
  };
2025
2028
  const ErrorTypeStrings$1 = {
2026
2029
  ["sp"]: "serverPrefetch hook",
@@ -2051,7 +2054,8 @@ var VueRuntimeDOM = (function (exports) {
2051
2054
  [11]: "app warnHandler",
2052
2055
  [12]: "ref function",
2053
2056
  [13]: "async component loader",
2054
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
2057
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
2058
+ [15]: "app unmount cleanup function"
2055
2059
  };
2056
2060
  function callWithErrorHandling(fn, instance, type, args) {
2057
2061
  try {
@@ -2776,7 +2780,7 @@ var VueRuntimeDOM = (function (exports) {
2776
2780
  true ? {
2777
2781
  get attrs() {
2778
2782
  markAttrsAccessed();
2779
- return attrs;
2783
+ return shallowReadonly(attrs);
2780
2784
  },
2781
2785
  slots,
2782
2786
  emit
@@ -2809,7 +2813,7 @@ var VueRuntimeDOM = (function (exports) {
2809
2813
  propsOptions
2810
2814
  );
2811
2815
  }
2812
- root = cloneVNode(root, fallthroughAttrs);
2816
+ root = cloneVNode(root, fallthroughAttrs, false, true);
2813
2817
  } else if (!accessedAttrs && root.type !== Comment) {
2814
2818
  const allAttrs = Object.keys(attrs);
2815
2819
  const eventAttrs = [];
@@ -2843,7 +2847,7 @@ var VueRuntimeDOM = (function (exports) {
2843
2847
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
2844
2848
  );
2845
2849
  }
2846
- root = cloneVNode(root);
2850
+ root = cloneVNode(root, null, false, true);
2847
2851
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2848
2852
  }
2849
2853
  if (vnode.transition) {
@@ -3334,7 +3338,7 @@ If this is a native custom element, make sure to exclude it from component resol
3334
3338
  let parentSuspenseId;
3335
3339
  const isSuspensible = isVNodeSuspensible(vnode);
3336
3340
  if (isSuspensible) {
3337
- if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3341
+ if (parentSuspense && parentSuspense.pendingBranch) {
3338
3342
  parentSuspenseId = parentSuspense.pendingId;
3339
3343
  parentSuspense.deps++;
3340
3344
  }
@@ -3646,8 +3650,8 @@ If this is a native custom element, make sure to exclude it from component resol
3646
3650
  }
3647
3651
  }
3648
3652
  function isVNodeSuspensible(vnode) {
3649
- var _a;
3650
- return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3653
+ const suspensible = vnode.props && vnode.props.suspensible;
3654
+ return suspensible != null && suspensible !== false;
3651
3655
  }
3652
3656
 
3653
3657
  const ssrContextKey = Symbol.for("v-scx");
@@ -3877,34 +3881,29 @@ If this is a native custom element, make sure to exclude it from component resol
3877
3881
  return cur;
3878
3882
  };
3879
3883
  }
3880
- function traverse(value, depth, currentDepth = 0, seen) {
3881
- if (!isObject(value) || value["__v_skip"]) {
3884
+ function traverse(value, depth = Infinity, seen) {
3885
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
3882
3886
  return value;
3883
3887
  }
3884
- if (depth && depth > 0) {
3885
- if (currentDepth >= depth) {
3886
- return value;
3887
- }
3888
- currentDepth++;
3889
- }
3890
3888
  seen = seen || /* @__PURE__ */ new Set();
3891
3889
  if (seen.has(value)) {
3892
3890
  return value;
3893
3891
  }
3894
3892
  seen.add(value);
3893
+ depth--;
3895
3894
  if (isRef(value)) {
3896
- traverse(value.value, depth, currentDepth, seen);
3895
+ traverse(value.value, depth, seen);
3897
3896
  } else if (isArray(value)) {
3898
3897
  for (let i = 0; i < value.length; i++) {
3899
- traverse(value[i], depth, currentDepth, seen);
3898
+ traverse(value[i], depth, seen);
3900
3899
  }
3901
3900
  } else if (isSet(value) || isMap(value)) {
3902
3901
  value.forEach((v) => {
3903
- traverse(v, depth, currentDepth, seen);
3902
+ traverse(v, depth, seen);
3904
3903
  });
3905
3904
  } else if (isPlainObject(value)) {
3906
3905
  for (const key in value) {
3907
- traverse(value[key], depth, currentDepth, seen);
3906
+ traverse(value[key], depth, seen);
3908
3907
  }
3909
3908
  }
3910
3909
  return value;
@@ -4047,7 +4046,7 @@ If this is a native custom element, make sure to exclude it from component resol
4047
4046
  instance
4048
4047
  );
4049
4048
  setTransitionHooks(oldInnerChild, leavingHooks);
4050
- if (mode === "out-in") {
4049
+ if (mode === "out-in" && innerChild.type !== Comment) {
4051
4050
  state.isLeaving = true;
4052
4051
  leavingHooks.afterLeave = () => {
4053
4052
  state.isLeaving = false;
@@ -4582,7 +4581,7 @@ If this is a native custom element, make sure to exclude it from component resol
4582
4581
  return () => {
4583
4582
  pendingCacheKey = null;
4584
4583
  if (!slots.default) {
4585
- return current = null;
4584
+ return null;
4586
4585
  }
4587
4586
  const children = slots.default();
4588
4587
  const rawVNode = children[0];
@@ -5688,6 +5687,7 @@ If this is a native custom element, make sure to exclude it from component resol
5688
5687
  }
5689
5688
  const context = createAppContext();
5690
5689
  const installedPlugins = /* @__PURE__ */ new WeakSet();
5690
+ const pluginCleanupFns = [];
5691
5691
  let isMounted = false;
5692
5692
  const app = context.app = {
5693
5693
  _uid: uid$1++,
@@ -5805,8 +5805,21 @@ If you want to remount the same app, move your app creation logic into a factory
5805
5805
  );
5806
5806
  }
5807
5807
  },
5808
+ onUnmount(cleanupFn) {
5809
+ if (typeof cleanupFn !== "function") {
5810
+ warn$1(
5811
+ `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
5812
+ );
5813
+ }
5814
+ pluginCleanupFns.push(cleanupFn);
5815
+ },
5808
5816
  unmount() {
5809
5817
  if (isMounted) {
5818
+ callWithAsyncErrorHandling(
5819
+ pluginCleanupFns,
5820
+ app._instance,
5821
+ 15
5822
+ );
5810
5823
  render(null, app._container);
5811
5824
  {
5812
5825
  app._instance = null;
@@ -6332,7 +6345,7 @@ If you want to remount the same app, move your app creation logic into a factory
6332
6345
  const type = children._;
6333
6346
  if (type) {
6334
6347
  extend(slots, children);
6335
- def(slots, "_", type);
6348
+ def(slots, "_", type, true);
6336
6349
  } else {
6337
6350
  normalizeObjectSlots(children, slots);
6338
6351
  }
@@ -9078,8 +9091,8 @@ Component that was made reactive: `,
9078
9091
  return null;
9079
9092
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
9080
9093
  }
9081
- function cloneVNode(vnode, extraProps, mergeRef = false) {
9082
- const { props, ref, patchFlag, children } = vnode;
9094
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
9095
+ const { props, ref, patchFlag, children, transition } = vnode;
9083
9096
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
9084
9097
  const cloned = {
9085
9098
  __v_isVNode: true,
@@ -9109,7 +9122,7 @@ Component that was made reactive: `,
9109
9122
  dynamicChildren: vnode.dynamicChildren,
9110
9123
  appContext: vnode.appContext,
9111
9124
  dirs: vnode.dirs,
9112
- transition: vnode.transition,
9125
+ transition,
9113
9126
  // These should technically only be non-null on mounted VNodes. However,
9114
9127
  // they *should* be copied for kept-alive vnodes. So we just always copy
9115
9128
  // them since them being non-null during a mount doesn't affect the logic as
@@ -9123,6 +9136,9 @@ Component that was made reactive: `,
9123
9136
  ctx: vnode.ctx,
9124
9137
  ce: vnode.ce
9125
9138
  };
9139
+ if (transition && cloneTransition) {
9140
+ cloned.transition = transition.clone(cloned);
9141
+ }
9126
9142
  return cloned;
9127
9143
  }
9128
9144
  function deepCloneVNode(vnode) {
@@ -9932,7 +9948,7 @@ Component that was made reactive: `,
9932
9948
  return true;
9933
9949
  }
9934
9950
 
9935
- const version = "3.5.0-alpha.1";
9951
+ const version = "3.5.0-alpha.2";
9936
9952
  const warn = warn$1 ;
9937
9953
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9938
9954
  const devtools = devtools$1 ;