@vue/runtime-core 3.5.0-alpha.5 → 3.5.0-beta.1

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-core v3.5.0-alpha.5
2
+ * @vue/runtime-core v3.5.0-beta.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -557,6 +557,9 @@ function reload(id, newComp) {
557
557
  "[HMR] Root or manually mounted instance modified. Full reload required."
558
558
  );
559
559
  }
560
+ if (instance.root.ce && instance !== instance.root) {
561
+ instance.root.ce._removeChildStyle(oldComp);
562
+ }
560
563
  }
561
564
  queuePostFlushCb(() => {
562
565
  hmrDirtyComponents.clear();
@@ -636,9 +639,7 @@ function devtoolsInitApp(app, version) {
636
639
  function devtoolsUnmountApp(app) {
637
640
  emit$1("app:unmount" /* APP_UNMOUNT */, app);
638
641
  }
639
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
640
- "component:added" /* COMPONENT_ADDED */
641
- );
642
+ const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
642
643
  const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
643
644
  const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
644
645
  "component:removed" /* COMPONENT_REMOVED */
@@ -662,12 +663,8 @@ function createDevtoolsComponentHook(hook) {
662
663
  );
663
664
  };
664
665
  }
665
- const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
666
- "perf:start" /* PERFORMANCE_START */
667
- );
668
- const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
669
- "perf:end" /* PERFORMANCE_END */
670
- );
666
+ const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
667
+ const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
671
668
  function createDevtoolsPerformanceHook(hook) {
672
669
  return (component, type, time) => {
673
670
  emit$1(hook, component.appContext.app, component.uid, component, type, time);
@@ -1846,6 +1843,7 @@ Server rendered element contains more child nodes than client vdom.`
1846
1843
  }
1847
1844
  if (props) {
1848
1845
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {
1846
+ const isCustomElement = el.tagName.includes("-");
1849
1847
  for (const key in props) {
1850
1848
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks
1851
1849
  // as it could have mutated the DOM in any possible way
@@ -1853,7 +1851,7 @@ Server rendered element contains more child nodes than client vdom.`
1853
1851
  logMismatchError();
1854
1852
  }
1855
1853
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
1856
- key[0] === ".") {
1854
+ key[0] === "." || isCustomElement) {
1857
1855
  patchProp(el, key, null, props[key], void 0, parentComponent);
1858
1856
  }
1859
1857
  }
@@ -2189,24 +2187,19 @@ function isMismatchAllowed(el, allowedType) {
2189
2187
  }
2190
2188
  }
2191
2189
 
2192
- const hydrateOnIdle = () => (hydrate) => {
2193
- const id = requestIdleCallback(hydrate);
2190
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
2191
+ const id = requestIdleCallback(hydrate, { timeout });
2194
2192
  return () => cancelIdleCallback(id);
2195
2193
  };
2196
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
2197
- const ob = new IntersectionObserver(
2198
- (entries) => {
2199
- for (const e of entries) {
2200
- if (!e.isIntersecting) continue;
2201
- ob.disconnect();
2202
- hydrate();
2203
- break;
2204
- }
2205
- },
2206
- {
2207
- rootMargin: isString(margin) ? margin : margin + "px"
2194
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
2195
+ const ob = new IntersectionObserver((entries) => {
2196
+ for (const e of entries) {
2197
+ if (!e.isIntersecting) continue;
2198
+ ob.disconnect();
2199
+ hydrate();
2200
+ break;
2208
2201
  }
2209
- );
2202
+ }, opts);
2210
2203
  forEach((el) => ob.observe(el));
2211
2204
  return () => ob.disconnect();
2212
2205
  };
@@ -2521,7 +2514,7 @@ const KeepAliveImpl = {
2521
2514
  }
2522
2515
  function pruneCacheEntry(key) {
2523
2516
  const cached = cache.get(key);
2524
- if (!current || !isSameVNodeType(cached, current)) {
2517
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
2525
2518
  unmount(cached);
2526
2519
  } else if (current) {
2527
2520
  resetShapeFlag(current);
@@ -2583,6 +2576,10 @@ const KeepAliveImpl = {
2583
2576
  return rawVNode;
2584
2577
  }
2585
2578
  let vnode = getInnerChild(rawVNode);
2579
+ if (vnode.type === Comment) {
2580
+ current = null;
2581
+ return vnode;
2582
+ }
2586
2583
  const comp = vnode.type;
2587
2584
  const name = getComponentName(
2588
2585
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -2712,17 +2709,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2712
2709
  };
2713
2710
  const onBeforeMount = createHook("bm");
2714
2711
  const onMounted = createHook("m");
2715
- const onBeforeUpdate = createHook("bu");
2712
+ const onBeforeUpdate = createHook(
2713
+ "bu"
2714
+ );
2716
2715
  const onUpdated = createHook("u");
2717
- const onBeforeUnmount = createHook("bum");
2718
- const onUnmounted = createHook("um");
2719
- const onServerPrefetch = createHook("sp");
2720
- const onRenderTriggered = createHook(
2721
- "rtg"
2716
+ const onBeforeUnmount = createHook(
2717
+ "bum"
2722
2718
  );
2723
- const onRenderTracked = createHook(
2724
- "rtc"
2719
+ const onUnmounted = createHook("um");
2720
+ const onServerPrefetch = createHook(
2721
+ "sp"
2725
2722
  );
2723
+ const onRenderTriggered = createHook("rtg");
2724
+ const onRenderTracked = createHook("rtc");
2726
2725
  function onErrorCaptured(hook, target = currentInstance) {
2727
2726
  injectHook("ec", hook, target);
2728
2727
  }
@@ -2849,9 +2848,14 @@ function createSlots(slots, dynamicSlots) {
2849
2848
  }
2850
2849
 
2851
2850
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2852
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2851
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
2853
2852
  if (name !== "default") props.name = name;
2854
- return createVNode("slot", props, fallback && fallback());
2853
+ return openBlock(), createBlock(
2854
+ Fragment,
2855
+ null,
2856
+ [createVNode("slot", props, fallback && fallback())],
2857
+ 64
2858
+ );
2855
2859
  }
2856
2860
  let slot = slots[name];
2857
2861
  if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
@@ -2924,6 +2928,7 @@ const publicPropertiesMap = (
2924
2928
  $refs: (i) => !!(process.env.NODE_ENV !== "production") ? shallowReadonly(i.refs) : i.refs,
2925
2929
  $parent: (i) => getPublicInstance(i.parent),
2926
2930
  $root: (i) => getPublicInstance(i.root),
2931
+ $host: (i) => i.ce,
2927
2932
  $emit: (i) => i.emit,
2928
2933
  $options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
2929
2934
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -3075,29 +3080,25 @@ if (!!(process.env.NODE_ENV !== "production") && true) {
3075
3080
  return Reflect.ownKeys(target);
3076
3081
  };
3077
3082
  }
3078
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend(
3079
- {},
3080
- PublicInstanceProxyHandlers,
3081
- {
3082
- get(target, key) {
3083
- if (key === Symbol.unscopables) {
3084
- return;
3085
- }
3086
- return PublicInstanceProxyHandlers.get(target, key, target);
3087
- },
3088
- has(_, key) {
3089
- const has = key[0] !== "_" && !isGloballyAllowed(key);
3090
- if (!!(process.env.NODE_ENV !== "production") && !has && PublicInstanceProxyHandlers.has(_, key)) {
3091
- warn$1(
3092
- `Property ${JSON.stringify(
3093
- key
3094
- )} should not start with _ which is a reserved prefix for Vue internals.`
3095
- );
3096
- }
3097
- return has;
3083
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend({}, PublicInstanceProxyHandlers, {
3084
+ get(target, key) {
3085
+ if (key === Symbol.unscopables) {
3086
+ return;
3098
3087
  }
3088
+ return PublicInstanceProxyHandlers.get(target, key, target);
3089
+ },
3090
+ has(_, key) {
3091
+ const has = key[0] !== "_" && !isGloballyAllowed(key);
3092
+ if (!!(process.env.NODE_ENV !== "production") && !has && PublicInstanceProxyHandlers.has(_, key)) {
3093
+ warn$1(
3094
+ `Property ${JSON.stringify(
3095
+ key
3096
+ )} should not start with _ which is a reserved prefix for Vue internals.`
3097
+ );
3098
+ }
3099
+ return has;
3099
3100
  }
3100
- );
3101
+ });
3101
3102
  function createDevRenderContext(instance) {
3102
3103
  const target = {};
3103
3104
  Object.defineProperty(target, `_`, {
@@ -3803,7 +3804,7 @@ function createAppAPI(render, hydrate) {
3803
3804
  If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
3804
3805
  );
3805
3806
  }
3806
- const vnode = createVNode(rootComponent, rootProps);
3807
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
3807
3808
  vnode.appContext = context;
3808
3809
  if (namespace === true) {
3809
3810
  namespace = "svg";
@@ -3905,7 +3906,7 @@ function provide(key, value) {
3905
3906
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
3906
3907
  const instance = currentInstance || currentRenderingInstance;
3907
3908
  if (instance || currentApp) {
3908
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
3909
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
3909
3910
  if (provides && key in provides) {
3910
3911
  return provides[key];
3911
3912
  } else if (arguments.length > 1) {
@@ -4110,6 +4111,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
4110
4111
  } else {
4111
4112
  value = defaultValue;
4112
4113
  }
4114
+ if (instance.ce) {
4115
+ instance.ce._setProp(key, value);
4116
+ }
4113
4117
  }
4114
4118
  if (opt[0 /* shouldCast */]) {
4115
4119
  if (isAbsent && !hasDefault) {
@@ -5146,8 +5150,8 @@ function baseCreateRenderer(options, createHydrationFns) {
5146
5150
  const componentUpdateFn = () => {
5147
5151
  if (!instance.isMounted) {
5148
5152
  let vnodeHook;
5149
- const { el, props, type } = initialVNode;
5150
- const { bm, m, parent } = instance;
5153
+ const { el, props } = initialVNode;
5154
+ const { bm, m, parent, root, type } = instance;
5151
5155
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
5152
5156
  toggleRecurse(instance, false);
5153
5157
  if (bm) {
@@ -5190,6 +5194,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5190
5194
  hydrateSubTree();
5191
5195
  }
5192
5196
  } else {
5197
+ if (root.ce) {
5198
+ root.ce._injectChildStyle(type);
5199
+ }
5193
5200
  if (!!(process.env.NODE_ENV !== "production")) {
5194
5201
  startMeasure(instance, `render`);
5195
5202
  }
@@ -5863,13 +5870,13 @@ function baseCreateRenderer(options, createHydrationFns) {
5863
5870
  namespace
5864
5871
  );
5865
5872
  }
5873
+ container._vnode = vnode;
5866
5874
  if (!isFlushing) {
5867
5875
  isFlushing = true;
5868
5876
  flushPreFlushCbs();
5869
5877
  flushPostFlushCbs();
5870
5878
  isFlushing = false;
5871
5879
  }
5872
- container._vnode = vnode;
5873
5880
  };
5874
5881
  const internals = {
5875
5882
  p: patch,
@@ -6043,14 +6050,9 @@ function doWatch(source, cb, {
6043
6050
  const _cb = cb;
6044
6051
  cb = (...args) => {
6045
6052
  _cb(...args);
6046
- unwatch();
6053
+ watchHandle();
6047
6054
  };
6048
6055
  }
6049
- if (!!(process.env.NODE_ENV !== "production") && deep !== void 0 && typeof deep === "number") {
6050
- warn$1(
6051
- `watch() "deep" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.`
6052
- );
6053
- }
6054
6056
  if (!!(process.env.NODE_ENV !== "production") && !cb) {
6055
6057
  if (immediate !== void 0) {
6056
6058
  warn$1(
@@ -6076,10 +6078,12 @@ function doWatch(source, cb, {
6076
6078
  );
6077
6079
  };
6078
6080
  const instance = currentInstance;
6079
- const reactiveGetter = (source2) => deep === true ? source2 : (
6080
- // for deep: false, only traverse root-level properties
6081
- traverse(source2, deep === false ? 1 : void 0)
6082
- );
6081
+ const reactiveGetter = (source2) => {
6082
+ if (deep) return source2;
6083
+ if (isShallow(source2) || deep === false || deep === 0)
6084
+ return traverse(source2, 1);
6085
+ return traverse(source2);
6086
+ };
6083
6087
  let getter;
6084
6088
  let forceTrigger = false;
6085
6089
  let isMultiSource = false;
@@ -6125,7 +6129,8 @@ function doWatch(source, cb, {
6125
6129
  }
6126
6130
  if (cb && deep) {
6127
6131
  const baseGetter = getter;
6128
- getter = () => traverse(baseGetter());
6132
+ const depth = deep === true ? Infinity : deep;
6133
+ getter = () => traverse(baseGetter(), depth);
6129
6134
  }
6130
6135
  let cleanup;
6131
6136
  let onCleanup = (fn) => {
@@ -6150,7 +6155,12 @@ function doWatch(source, cb, {
6150
6155
  const ctx = useSSRContext();
6151
6156
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
6152
6157
  } else {
6153
- return NOOP;
6158
+ const watchHandle2 = () => {
6159
+ };
6160
+ watchHandle2.stop = NOOP;
6161
+ watchHandle2.resume = NOOP;
6162
+ watchHandle2.pause = NOOP;
6163
+ return watchHandle2;
6154
6164
  }
6155
6165
  }
6156
6166
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -6191,12 +6201,15 @@ function doWatch(source, cb, {
6191
6201
  }
6192
6202
  effect.scheduler = scheduler;
6193
6203
  const scope = getCurrentScope();
6194
- const unwatch = () => {
6204
+ const watchHandle = () => {
6195
6205
  effect.stop();
6196
6206
  if (scope) {
6197
6207
  remove(scope.effects, effect);
6198
6208
  }
6199
6209
  };
6210
+ watchHandle.pause = effect.pause.bind(effect);
6211
+ watchHandle.resume = effect.resume.bind(effect);
6212
+ watchHandle.stop = watchHandle;
6200
6213
  if (!!(process.env.NODE_ENV !== "production")) {
6201
6214
  effect.onTrack = onTrack;
6202
6215
  effect.onTrigger = onTrigger;
@@ -6215,8 +6228,8 @@ function doWatch(source, cb, {
6215
6228
  } else {
6216
6229
  effect.run();
6217
6230
  }
6218
- if (ssrCleanup) ssrCleanup.push(unwatch);
6219
- return unwatch;
6231
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
6232
+ return watchHandle;
6220
6233
  }
6221
6234
  function instanceWatch(source, value, options) {
6222
6235
  const publicThis = this.proxy;
@@ -6306,7 +6319,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
6306
6319
  return options.get ? options.get(localValue) : localValue;
6307
6320
  },
6308
6321
  set(value) {
6309
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
6322
+ const emittedValue = options.set ? options.set(value) : value;
6323
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
6310
6324
  return;
6311
6325
  }
6312
6326
  const rawProps = i.vnode.props;
@@ -6315,7 +6329,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
6315
6329
  localValue = value;
6316
6330
  trigger();
6317
6331
  }
6318
- const emittedValue = options.set ? options.set(value) : value;
6319
6332
  i.emit(`update:${name}`, emittedValue);
6320
6333
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
6321
6334
  trigger();
@@ -6353,9 +6366,9 @@ function emit(instance, event, ...rawArgs) {
6353
6366
  } = instance;
6354
6367
  if (emitsOptions) {
6355
6368
  if (!(event in emitsOptions) && true) {
6356
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
6369
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
6357
6370
  warn$1(
6358
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
6371
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
6359
6372
  );
6360
6373
  }
6361
6374
  } else {
@@ -8193,11 +8206,16 @@ function useTemplateRef(key) {
8193
8206
  const r = shallowRef(null);
8194
8207
  if (i) {
8195
8208
  const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
8196
- Object.defineProperty(refs, key, {
8197
- enumerable: true,
8198
- get: () => r.value,
8199
- set: (val) => r.value = val
8200
- });
8209
+ let desc;
8210
+ if (!!(process.env.NODE_ENV !== "production") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
8211
+ warn$1(`useTemplateRef('${key}') already exists.`);
8212
+ } else {
8213
+ Object.defineProperty(refs, key, {
8214
+ enumerable: true,
8215
+ get: () => r.value,
8216
+ set: (val) => r.value = val
8217
+ });
8218
+ }
8201
8219
  } else if (!!(process.env.NODE_ENV !== "production")) {
8202
8220
  warn$1(
8203
8221
  `useTemplateRef() is called when there is no active component instance to be associated with.`
@@ -8431,7 +8449,7 @@ function isMemoSame(cached, memo) {
8431
8449
  return true;
8432
8450
  }
8433
8451
 
8434
- const version = "3.5.0-alpha.5";
8452
+ const version = "3.5.0-beta.1";
8435
8453
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8436
8454
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8437
8455
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -8443,7 +8461,8 @@ const _ssrUtils = {
8443
8461
  setCurrentRenderingInstance,
8444
8462
  isVNode: isVNode,
8445
8463
  normalizeVNode,
8446
- getComponentPublicInstance
8464
+ getComponentPublicInstance,
8465
+ ensureValidVNode
8447
8466
  };
8448
8467
  const ssrUtils = _ssrUtils ;
8449
8468
  const resolveFilter = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.5.0-alpha.5",
3
+ "version": "3.5.0-beta.1",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
48
48
  "dependencies": {
49
- "@vue/shared": "3.5.0-alpha.5",
50
- "@vue/reactivity": "3.5.0-alpha.5"
49
+ "@vue/shared": "3.5.0-beta.1",
50
+ "@vue/reactivity": "3.5.0-beta.1"
51
51
  }
52
52
  }