@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
  **/
@@ -1358,9 +1358,10 @@ function createHydrationFunctions(rendererInternals) {
1358
1358
  }
1359
1359
  if (props) {
1360
1360
  if (forcePatch || !optimized || patchFlag & (16 | 32)) {
1361
+ const isCustomElement = el.tagName.includes("-");
1361
1362
  for (const key in props) {
1362
1363
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
1363
- key[0] === ".") {
1364
+ key[0] === "." || isCustomElement) {
1364
1365
  patchProp(el, key, null, props[key], void 0, parentComponent);
1365
1366
  }
1366
1367
  }
@@ -1560,24 +1561,19 @@ function isMismatchAllowed(el, allowedType) {
1560
1561
  }
1561
1562
  }
1562
1563
 
1563
- const hydrateOnIdle = () => (hydrate) => {
1564
- const id = requestIdleCallback(hydrate);
1564
+ const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
1565
+ const id = requestIdleCallback(hydrate, { timeout });
1565
1566
  return () => cancelIdleCallback(id);
1566
1567
  };
1567
- const hydrateOnVisible = (margin = 0) => (hydrate, forEach) => {
1568
- const ob = new IntersectionObserver(
1569
- (entries) => {
1570
- for (const e of entries) {
1571
- if (!e.isIntersecting) continue;
1572
- ob.disconnect();
1573
- hydrate();
1574
- break;
1575
- }
1576
- },
1577
- {
1578
- rootMargin: shared.isString(margin) ? margin : margin + "px"
1568
+ const hydrateOnVisible = (opts) => (hydrate, forEach) => {
1569
+ const ob = new IntersectionObserver((entries) => {
1570
+ for (const e of entries) {
1571
+ if (!e.isIntersecting) continue;
1572
+ ob.disconnect();
1573
+ hydrate();
1574
+ break;
1579
1575
  }
1580
- );
1576
+ }, opts);
1581
1577
  forEach((el) => ob.observe(el));
1582
1578
  return () => ob.disconnect();
1583
1579
  };
@@ -1875,7 +1871,7 @@ const KeepAliveImpl = {
1875
1871
  }
1876
1872
  function pruneCacheEntry(key) {
1877
1873
  const cached = cache.get(key);
1878
- if (!current || !isSameVNodeType(cached, current)) {
1874
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
1879
1875
  unmount(cached);
1880
1876
  } else if (current) {
1881
1877
  resetShapeFlag(current);
@@ -1934,6 +1930,10 @@ const KeepAliveImpl = {
1934
1930
  return rawVNode;
1935
1931
  }
1936
1932
  let vnode = getInnerChild(rawVNode);
1933
+ if (vnode.type === Comment) {
1934
+ current = null;
1935
+ return vnode;
1936
+ }
1937
1937
  const comp = vnode.type;
1938
1938
  const name = getComponentName(
1939
1939
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -2058,17 +2058,19 @@ const createHook = (lifecycle) => (hook, target = currentInstance) => {
2058
2058
  };
2059
2059
  const onBeforeMount = createHook("bm");
2060
2060
  const onMounted = createHook("m");
2061
- const onBeforeUpdate = createHook("bu");
2061
+ const onBeforeUpdate = createHook(
2062
+ "bu"
2063
+ );
2062
2064
  const onUpdated = createHook("u");
2063
- const onBeforeUnmount = createHook("bum");
2064
- const onUnmounted = createHook("um");
2065
- const onServerPrefetch = createHook("sp");
2066
- const onRenderTriggered = createHook(
2067
- "rtg"
2065
+ const onBeforeUnmount = createHook(
2066
+ "bum"
2068
2067
  );
2069
- const onRenderTracked = createHook(
2070
- "rtc"
2068
+ const onUnmounted = createHook("um");
2069
+ const onServerPrefetch = createHook(
2070
+ "sp"
2071
2071
  );
2072
+ const onRenderTriggered = createHook("rtg");
2073
+ const onRenderTracked = createHook("rtc");
2072
2074
  function onErrorCaptured(hook, target = currentInstance) {
2073
2075
  injectHook("ec", hook, target);
2074
2076
  }
@@ -2183,9 +2185,14 @@ function createSlots(slots, dynamicSlots) {
2183
2185
  }
2184
2186
 
2185
2187
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2186
- if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
2188
+ if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
2187
2189
  if (name !== "default") props.name = name;
2188
- return createVNode("slot", props, fallback && fallback());
2190
+ return openBlock(), createBlock(
2191
+ Fragment,
2192
+ null,
2193
+ [createVNode("slot", props, fallback && fallback())],
2194
+ 64
2195
+ );
2189
2196
  }
2190
2197
  let slot = slots[name];
2191
2198
  if (slot && slot._c) {
@@ -2248,6 +2255,7 @@ const publicPropertiesMap = (
2248
2255
  $refs: (i) => i.refs,
2249
2256
  $parent: (i) => getPublicInstance(i.parent),
2250
2257
  $root: (i) => getPublicInstance(i.root),
2258
+ $host: (i) => i.ce,
2251
2259
  $emit: (i) => i.emit,
2252
2260
  $options: (i) => resolveMergedOptions(i) ,
2253
2261
  $forceUpdate: (i) => i.f || (i.f = () => {
@@ -2357,22 +2365,18 @@ const PublicInstanceProxyHandlers = {
2357
2365
  return Reflect.defineProperty(target, key, descriptor);
2358
2366
  }
2359
2367
  };
2360
- const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend(
2361
- {},
2362
- PublicInstanceProxyHandlers,
2363
- {
2364
- get(target, key) {
2365
- if (key === Symbol.unscopables) {
2366
- return;
2367
- }
2368
- return PublicInstanceProxyHandlers.get(target, key, target);
2369
- },
2370
- has(_, key) {
2371
- const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
2372
- return has;
2368
+ const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ shared.extend({}, PublicInstanceProxyHandlers, {
2369
+ get(target, key) {
2370
+ if (key === Symbol.unscopables) {
2371
+ return;
2373
2372
  }
2373
+ return PublicInstanceProxyHandlers.get(target, key, target);
2374
+ },
2375
+ has(_, key) {
2376
+ const has = key[0] !== "_" && !shared.isGloballyAllowed(key);
2377
+ return has;
2374
2378
  }
2375
- );
2379
+ });
2376
2380
 
2377
2381
  function defineProps() {
2378
2382
  return null;
@@ -2872,7 +2876,7 @@ function createAppAPI(render, hydrate) {
2872
2876
  },
2873
2877
  mount(rootContainer, isHydrate, namespace) {
2874
2878
  if (!isMounted) {
2875
- const vnode = createVNode(rootComponent, rootProps);
2879
+ const vnode = app._ceVNode || createVNode(rootComponent, rootProps);
2876
2880
  vnode.appContext = context;
2877
2881
  if (namespace === true) {
2878
2882
  namespace = "svg";
@@ -2936,7 +2940,7 @@ function provide(key, value) {
2936
2940
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
2937
2941
  const instance = currentInstance || currentRenderingInstance;
2938
2942
  if (instance || currentApp) {
2939
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
2943
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
2940
2944
  if (provides && key in provides) {
2941
2945
  return provides[key];
2942
2946
  } else if (arguments.length > 1) {
@@ -3125,6 +3129,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3125
3129
  } else {
3126
3130
  value = defaultValue;
3127
3131
  }
3132
+ if (instance.ce) {
3133
+ instance.ce._setProp(key, value);
3134
+ }
3128
3135
  }
3129
3136
  if (opt[0 /* shouldCast */]) {
3130
3137
  if (isAbsent && !hasDefault) {
@@ -3884,8 +3891,8 @@ function baseCreateRenderer(options, createHydrationFns) {
3884
3891
  const componentUpdateFn = () => {
3885
3892
  if (!instance.isMounted) {
3886
3893
  let vnodeHook;
3887
- const { el, props, type } = initialVNode;
3888
- const { bm, m, parent } = instance;
3894
+ const { el, props } = initialVNode;
3895
+ const { bm, m, parent, root, type } = instance;
3889
3896
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
3890
3897
  toggleRecurse(instance, false);
3891
3898
  if (bm) {
@@ -3916,6 +3923,9 @@ function baseCreateRenderer(options, createHydrationFns) {
3916
3923
  hydrateSubTree();
3917
3924
  }
3918
3925
  } else {
3926
+ if (root.ce) {
3927
+ root.ce._injectChildStyle(type);
3928
+ }
3919
3929
  const subTree = instance.subTree = renderComponentRoot(instance);
3920
3930
  patch(
3921
3931
  null,
@@ -4528,13 +4538,13 @@ function baseCreateRenderer(options, createHydrationFns) {
4528
4538
  namespace
4529
4539
  );
4530
4540
  }
4541
+ container._vnode = vnode;
4531
4542
  if (!isFlushing) {
4532
4543
  isFlushing = true;
4533
4544
  flushPreFlushCbs();
4534
4545
  flushPostFlushCbs();
4535
4546
  isFlushing = false;
4536
4547
  }
4537
- container._vnode = vnode;
4538
4548
  };
4539
4549
  const internals = {
4540
4550
  p: patch,
@@ -4695,14 +4705,16 @@ function doWatch(source, cb, {
4695
4705
  const _cb = cb;
4696
4706
  cb = (...args) => {
4697
4707
  _cb(...args);
4698
- unwatch();
4708
+ watchHandle();
4699
4709
  };
4700
4710
  }
4701
4711
  const instance = currentInstance;
4702
- const reactiveGetter = (source2) => deep === true ? source2 : (
4703
- // for deep: false, only traverse root-level properties
4704
- traverse(source2, deep === false ? 1 : void 0)
4705
- );
4712
+ const reactiveGetter = (source2) => {
4713
+ if (deep) return source2;
4714
+ if (reactivity.isShallow(source2) || deep === false || deep === 0)
4715
+ return traverse(source2, 1);
4716
+ return traverse(source2);
4717
+ };
4706
4718
  let getter;
4707
4719
  let forceTrigger = false;
4708
4720
  let isMultiSource = false;
@@ -4745,7 +4757,8 @@ function doWatch(source, cb, {
4745
4757
  }
4746
4758
  if (cb && deep) {
4747
4759
  const baseGetter = getter;
4748
- getter = () => traverse(baseGetter());
4760
+ const depth = deep === true ? Infinity : deep;
4761
+ getter = () => traverse(baseGetter(), depth);
4749
4762
  }
4750
4763
  let cleanup;
4751
4764
  let onCleanup = (fn) => {
@@ -4770,7 +4783,12 @@ function doWatch(source, cb, {
4770
4783
  const ctx = useSSRContext();
4771
4784
  ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
4772
4785
  } else {
4773
- return shared.NOOP;
4786
+ const watchHandle2 = () => {
4787
+ };
4788
+ watchHandle2.stop = shared.NOOP;
4789
+ watchHandle2.resume = shared.NOOP;
4790
+ watchHandle2.pause = shared.NOOP;
4791
+ return watchHandle2;
4774
4792
  }
4775
4793
  }
4776
4794
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4811,12 +4829,15 @@ function doWatch(source, cb, {
4811
4829
  }
4812
4830
  effect.scheduler = scheduler;
4813
4831
  const scope = reactivity.getCurrentScope();
4814
- const unwatch = () => {
4832
+ const watchHandle = () => {
4815
4833
  effect.stop();
4816
4834
  if (scope) {
4817
4835
  shared.remove(scope.effects, effect);
4818
4836
  }
4819
4837
  };
4838
+ watchHandle.pause = effect.pause.bind(effect);
4839
+ watchHandle.resume = effect.resume.bind(effect);
4840
+ watchHandle.stop = watchHandle;
4820
4841
  if (cb) {
4821
4842
  if (immediate) {
4822
4843
  job(true);
@@ -4831,8 +4852,8 @@ function doWatch(source, cb, {
4831
4852
  } else {
4832
4853
  effect.run();
4833
4854
  }
4834
- if (ssrCleanup) ssrCleanup.push(unwatch);
4835
- return unwatch;
4855
+ if (ssrCleanup) ssrCleanup.push(watchHandle);
4856
+ return watchHandle;
4836
4857
  }
4837
4858
  function instanceWatch(source, value, options) {
4838
4859
  const publicThis = this.proxy;
@@ -4914,7 +4935,8 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
4914
4935
  return options.get ? options.get(localValue) : localValue;
4915
4936
  },
4916
4937
  set(value) {
4917
- if (!shared.hasChanged(value, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
4938
+ const emittedValue = options.set ? options.set(value) : value;
4939
+ if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
4918
4940
  return;
4919
4941
  }
4920
4942
  const rawProps = i.vnode.props;
@@ -4923,7 +4945,6 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
4923
4945
  localValue = value;
4924
4946
  trigger();
4925
4947
  }
4926
- const emittedValue = options.set ? options.set(value) : value;
4927
4948
  i.emit(`update:${name}`, emittedValue);
4928
4949
  if (shared.hasChanged(value, emittedValue) && shared.hasChanged(value, prevSetValue) && !shared.hasChanged(emittedValue, prevEmittedValue)) {
4929
4950
  trigger();
@@ -6454,11 +6475,13 @@ function useTemplateRef(key) {
6454
6475
  const r = reactivity.shallowRef(null);
6455
6476
  if (i) {
6456
6477
  const refs = i.refs === shared.EMPTY_OBJ ? i.refs = {} : i.refs;
6457
- Object.defineProperty(refs, key, {
6458
- enumerable: true,
6459
- get: () => r.value,
6460
- set: (val) => r.value = val
6461
- });
6478
+ {
6479
+ Object.defineProperty(refs, key, {
6480
+ enumerable: true,
6481
+ get: () => r.value,
6482
+ set: (val) => r.value = val
6483
+ });
6484
+ }
6462
6485
  }
6463
6486
  return r;
6464
6487
  }
@@ -6516,7 +6539,7 @@ function isMemoSame(cached, memo) {
6516
6539
  return true;
6517
6540
  }
6518
6541
 
6519
- const version = "3.5.0-alpha.5";
6542
+ const version = "3.5.0-beta.1";
6520
6543
  const warn$1 = shared.NOOP;
6521
6544
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6522
6545
  const devtools = void 0;
@@ -6528,7 +6551,8 @@ const _ssrUtils = {
6528
6551
  setCurrentRenderingInstance,
6529
6552
  isVNode: isVNode,
6530
6553
  normalizeVNode,
6531
- getComponentPublicInstance
6554
+ getComponentPublicInstance,
6555
+ ensureValidVNode
6532
6556
  };
6533
6557
  const ssrUtils = _ssrUtils ;
6534
6558
  const resolveFilter = null;