@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
  **/
@@ -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
  **/
@@ -1,4 +1,4 @@
1
- import { BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, SetupContext, RenderFunction, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstance, DefineComponent, RootHydrateFunction, ConcreteComponent, VNodeRef, RootRenderFunction, CreateAppFunction } from '@vue/runtime-core';
1
+ import { BaseTransitionProps, FunctionalComponent, ObjectDirective, Directive, SetupContext, RenderFunction, ComponentObjectPropsOptions, EmitsOptions, ComputedOptions, MethodOptions, ComponentOptionsMixin, ComponentInjectOptions, SlotsType, Component, ComponentProvideOptions, ExtractPropTypes, EmitsToProps, ComponentOptionsBase, CreateComponentPublicInstanceWithMixins, DefineComponent, RootHydrateFunction, ConcreteComponent, VNodeRef, RootRenderFunction, CreateAppFunction } from '@vue/runtime-core';
2
2
  export * from '@vue/runtime-core';
3
3
  import * as CSS from 'csstype';
4
4
 
@@ -110,7 +110,7 @@ export declare function defineCustomElement<RuntimePropsOptions extends Componen
110
110
  }, ResolvedProps = InferredProps & EmitsToProps<RuntimeEmitsOptions>>(options: {
111
111
  props?: (RuntimePropsOptions & ThisType<void>) | PropsKeys[];
112
112
  } & ComponentOptionsBase<ResolvedProps, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, // Defaults
113
- InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstance<Readonly<ResolvedProps>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>): VueElementConstructor<ResolvedProps>;
113
+ InjectOptions, InjectKeys, Slots, LocalComponents, Directives, Exposed, Provide> & ThisType<CreateComponentPublicInstanceWithMixins<Readonly<ResolvedProps>, SetupBindings, Data, Computed, Methods, Mixin, Extends, RuntimeEmitsOptions, EmitsKeys, {}, false, InjectOptions, Slots, LocalComponents, Directives, Exposed>>): VueElementConstructor<ResolvedProps>;
114
114
  export declare function defineCustomElement<P>(options: DefineComponent<P, any, any, any>): VueElementConstructor<ExtractPropTypes<P>>;
115
115
  /*! #__NO_SIDE_EFFECTS__ */
116
116
  export declare const defineSSRCustomElement: typeof defineCustomElement;
@@ -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
  **/
@@ -81,10 +81,11 @@ const invokeArrayFns = (fns, arg) => {
81
81
  fns[i](arg);
82
82
  }
83
83
  };
84
- const def = (obj, key, value) => {
84
+ const def = (obj, key, value, writable = false) => {
85
85
  Object.defineProperty(obj, key, {
86
86
  configurable: true,
87
87
  enumerable: false,
88
+ writable,
88
89
  value
89
90
  });
90
91
  };
@@ -2017,7 +2018,9 @@ const ErrorCodes = {
2017
2018
  "ASYNC_COMPONENT_LOADER": 13,
2018
2019
  "13": "ASYNC_COMPONENT_LOADER",
2019
2020
  "SCHEDULER": 14,
2020
- "14": "SCHEDULER"
2021
+ "14": "SCHEDULER",
2022
+ "APP_UNMOUNT_CLEANUP": 15,
2023
+ "15": "APP_UNMOUNT_CLEANUP"
2021
2024
  };
2022
2025
  const ErrorTypeStrings$1 = {
2023
2026
  ["sp"]: "serverPrefetch hook",
@@ -2048,7 +2051,8 @@ const ErrorTypeStrings$1 = {
2048
2051
  [11]: "app warnHandler",
2049
2052
  [12]: "ref function",
2050
2053
  [13]: "async component loader",
2051
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
2054
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
2055
+ [15]: "app unmount cleanup function"
2052
2056
  };
2053
2057
  function callWithErrorHandling(fn, instance, type, args) {
2054
2058
  try {
@@ -2773,7 +2777,7 @@ function renderComponentRoot(instance) {
2773
2777
  true ? {
2774
2778
  get attrs() {
2775
2779
  markAttrsAccessed();
2776
- return attrs;
2780
+ return shallowReadonly(attrs);
2777
2781
  },
2778
2782
  slots,
2779
2783
  emit
@@ -2806,7 +2810,7 @@ function renderComponentRoot(instance) {
2806
2810
  propsOptions
2807
2811
  );
2808
2812
  }
2809
- root = cloneVNode(root, fallthroughAttrs);
2813
+ root = cloneVNode(root, fallthroughAttrs, false, true);
2810
2814
  } else if (!accessedAttrs && root.type !== Comment) {
2811
2815
  const allAttrs = Object.keys(attrs);
2812
2816
  const eventAttrs = [];
@@ -2840,7 +2844,7 @@ function renderComponentRoot(instance) {
2840
2844
  `Runtime directive used on component with non-element root node. The directives will not function as intended.`
2841
2845
  );
2842
2846
  }
2843
- root = cloneVNode(root);
2847
+ root = cloneVNode(root, null, false, true);
2844
2848
  root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
2845
2849
  }
2846
2850
  if (vnode.transition) {
@@ -3331,7 +3335,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3331
3335
  let parentSuspenseId;
3332
3336
  const isSuspensible = isVNodeSuspensible(vnode);
3333
3337
  if (isSuspensible) {
3334
- if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3338
+ if (parentSuspense && parentSuspense.pendingBranch) {
3335
3339
  parentSuspenseId = parentSuspense.pendingId;
3336
3340
  parentSuspense.deps++;
3337
3341
  }
@@ -3643,8 +3647,8 @@ function setActiveBranch(suspense, branch) {
3643
3647
  }
3644
3648
  }
3645
3649
  function isVNodeSuspensible(vnode) {
3646
- var _a;
3647
- return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3650
+ const suspensible = vnode.props && vnode.props.suspensible;
3651
+ return suspensible != null && suspensible !== false;
3648
3652
  }
3649
3653
 
3650
3654
  const ssrContextKey = Symbol.for("v-scx");
@@ -3880,34 +3884,29 @@ function createPathGetter(ctx, path) {
3880
3884
  return cur;
3881
3885
  };
3882
3886
  }
3883
- function traverse(value, depth, currentDepth = 0, seen) {
3884
- if (!isObject(value) || value["__v_skip"]) {
3887
+ function traverse(value, depth = Infinity, seen) {
3888
+ if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
3885
3889
  return value;
3886
3890
  }
3887
- if (depth && depth > 0) {
3888
- if (currentDepth >= depth) {
3889
- return value;
3890
- }
3891
- currentDepth++;
3892
- }
3893
3891
  seen = seen || /* @__PURE__ */ new Set();
3894
3892
  if (seen.has(value)) {
3895
3893
  return value;
3896
3894
  }
3897
3895
  seen.add(value);
3896
+ depth--;
3898
3897
  if (isRef(value)) {
3899
- traverse(value.value, depth, currentDepth, seen);
3898
+ traverse(value.value, depth, seen);
3900
3899
  } else if (isArray(value)) {
3901
3900
  for (let i = 0; i < value.length; i++) {
3902
- traverse(value[i], depth, currentDepth, seen);
3901
+ traverse(value[i], depth, seen);
3903
3902
  }
3904
3903
  } else if (isSet(value) || isMap(value)) {
3905
3904
  value.forEach((v) => {
3906
- traverse(v, depth, currentDepth, seen);
3905
+ traverse(v, depth, seen);
3907
3906
  });
3908
3907
  } else if (isPlainObject(value)) {
3909
3908
  for (const key in value) {
3910
- traverse(value[key], depth, currentDepth, seen);
3909
+ traverse(value[key], depth, seen);
3911
3910
  }
3912
3911
  }
3913
3912
  return value;
@@ -4050,7 +4049,7 @@ const BaseTransitionImpl = {
4050
4049
  instance
4051
4050
  );
4052
4051
  setTransitionHooks(oldInnerChild, leavingHooks);
4053
- if (mode === "out-in") {
4052
+ if (mode === "out-in" && innerChild.type !== Comment) {
4054
4053
  state.isLeaving = true;
4055
4054
  leavingHooks.afterLeave = () => {
4056
4055
  state.isLeaving = false;
@@ -4585,7 +4584,7 @@ const KeepAliveImpl = {
4585
4584
  return () => {
4586
4585
  pendingCacheKey = null;
4587
4586
  if (!slots.default) {
4588
- return current = null;
4587
+ return null;
4589
4588
  }
4590
4589
  const children = slots.default();
4591
4590
  const rawVNode = children[0];
@@ -5691,6 +5690,7 @@ function createAppAPI(render, hydrate) {
5691
5690
  }
5692
5691
  const context = createAppContext();
5693
5692
  const installedPlugins = /* @__PURE__ */ new WeakSet();
5693
+ const pluginCleanupFns = [];
5694
5694
  let isMounted = false;
5695
5695
  const app = context.app = {
5696
5696
  _uid: uid$1++,
@@ -5808,8 +5808,21 @@ If you want to remount the same app, move your app creation logic into a factory
5808
5808
  );
5809
5809
  }
5810
5810
  },
5811
+ onUnmount(cleanupFn) {
5812
+ if (typeof cleanupFn !== "function") {
5813
+ warn$1(
5814
+ `Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
5815
+ );
5816
+ }
5817
+ pluginCleanupFns.push(cleanupFn);
5818
+ },
5811
5819
  unmount() {
5812
5820
  if (isMounted) {
5821
+ callWithAsyncErrorHandling(
5822
+ pluginCleanupFns,
5823
+ app._instance,
5824
+ 15
5825
+ );
5813
5826
  render(null, app._container);
5814
5827
  {
5815
5828
  app._instance = null;
@@ -6335,7 +6348,7 @@ const initSlots = (instance, children) => {
6335
6348
  const type = children._;
6336
6349
  if (type) {
6337
6350
  extend(slots, children);
6338
- def(slots, "_", type);
6351
+ def(slots, "_", type, true);
6339
6352
  } else {
6340
6353
  normalizeObjectSlots(children, slots);
6341
6354
  }
@@ -9081,8 +9094,8 @@ function guardReactiveProps(props) {
9081
9094
  return null;
9082
9095
  return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
9083
9096
  }
9084
- function cloneVNode(vnode, extraProps, mergeRef = false) {
9085
- const { props, ref, patchFlag, children } = vnode;
9097
+ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
9098
+ const { props, ref, patchFlag, children, transition } = vnode;
9086
9099
  const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
9087
9100
  const cloned = {
9088
9101
  __v_isVNode: true,
@@ -9112,7 +9125,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
9112
9125
  dynamicChildren: vnode.dynamicChildren,
9113
9126
  appContext: vnode.appContext,
9114
9127
  dirs: vnode.dirs,
9115
- transition: vnode.transition,
9128
+ transition,
9116
9129
  // These should technically only be non-null on mounted VNodes. However,
9117
9130
  // they *should* be copied for kept-alive vnodes. So we just always copy
9118
9131
  // them since them being non-null during a mount doesn't affect the logic as
@@ -9126,6 +9139,9 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
9126
9139
  ctx: vnode.ctx,
9127
9140
  ce: vnode.ce
9128
9141
  };
9142
+ if (transition && cloneTransition) {
9143
+ cloned.transition = transition.clone(cloned);
9144
+ }
9129
9145
  return cloned;
9130
9146
  }
9131
9147
  function deepCloneVNode(vnode) {
@@ -9935,7 +9951,7 @@ function isMemoSame(cached, memo) {
9935
9951
  return true;
9936
9952
  }
9937
9953
 
9938
- const version = "3.5.0-alpha.1";
9954
+ const version = "3.5.0-alpha.2";
9939
9955
  const warn = warn$1 ;
9940
9956
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9941
9957
  const devtools = devtools$1 ;