@vue/compat 3.5.1 → 3.5.3

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/compat v3.5.1
2
+ * @vue/compat v3.5.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -644,7 +644,7 @@ function refreshComputed(computed) {
644
644
  shouldTrack = true;
645
645
  try {
646
646
  prepareDeps(computed);
647
- const value = computed.fn();
647
+ const value = computed.fn(computed._value);
648
648
  if (dep.version === 0 || hasChanged(value, computed._value)) {
649
649
  computed._value = value;
650
650
  dep.version++;
@@ -753,7 +753,7 @@ class Dep {
753
753
  }
754
754
  }
755
755
  track(debugInfo) {
756
- if (!activeSub || !shouldTrack) {
756
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
757
757
  return;
758
758
  }
759
759
  let link = this.activeLink;
@@ -1766,7 +1766,7 @@ function toValue(source) {
1766
1766
  return isFunction(source) ? source() : unref(source);
1767
1767
  }
1768
1768
  const shallowUnwrapHandlers = {
1769
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1769
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1770
1770
  set: (target, key, value, receiver) => {
1771
1771
  const oldValue = target[key];
1772
1772
  if (isRef(oldValue) && !isRef(value)) {
@@ -2468,9 +2468,7 @@ function queueJob(job) {
2468
2468
  } else {
2469
2469
  queue.splice(findInsertionIndex(jobId), 0, job);
2470
2470
  }
2471
- if (!(job.flags & 4)) {
2472
- job.flags |= 1;
2473
- }
2471
+ job.flags |= 1;
2474
2472
  queueFlush();
2475
2473
  }
2476
2474
  }
@@ -2486,9 +2484,7 @@ function queuePostFlushCb(cb) {
2486
2484
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2487
2485
  } else if (!(cb.flags & 1)) {
2488
2486
  pendingPostFlushCbs.push(cb);
2489
- if (!(cb.flags & 4)) {
2490
- cb.flags |= 1;
2491
- }
2487
+ cb.flags |= 1;
2492
2488
  }
2493
2489
  } else {
2494
2490
  pendingPostFlushCbs.push(...cb);
@@ -2510,6 +2506,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2510
2506
  }
2511
2507
  queue.splice(i, 1);
2512
2508
  i--;
2509
+ if (cb.flags & 4) {
2510
+ cb.flags &= ~1;
2511
+ }
2513
2512
  cb();
2514
2513
  cb.flags &= ~1;
2515
2514
  }
@@ -2534,6 +2533,9 @@ function flushPostFlushCbs(seen) {
2534
2533
  if (checkRecursiveUpdates(seen, cb)) {
2535
2534
  continue;
2536
2535
  }
2536
+ if (cb.flags & 4) {
2537
+ cb.flags &= ~1;
2538
+ }
2537
2539
  if (!(cb.flags & 8)) cb();
2538
2540
  cb.flags &= ~1;
2539
2541
  }
@@ -2556,6 +2558,9 @@ function flushJobs(seen) {
2556
2558
  if (check(job)) {
2557
2559
  continue;
2558
2560
  }
2561
+ if (job.flags & 4) {
2562
+ job.flags &= ~1;
2563
+ }
2559
2564
  callWithErrorHandling(
2560
2565
  job,
2561
2566
  job.i,
@@ -2565,6 +2570,12 @@ function flushJobs(seen) {
2565
2570
  }
2566
2571
  }
2567
2572
  } finally {
2573
+ for (; flushIndex < queue.length; flushIndex++) {
2574
+ const job = queue[flushIndex];
2575
+ if (job) {
2576
+ job.flags &= ~1;
2577
+ }
2578
+ }
2568
2579
  flushIndex = 0;
2569
2580
  queue.length = 0;
2570
2581
  flushPostFlushCbs(seen);
@@ -3849,6 +3860,7 @@ const BaseTransitionImpl = {
3849
3860
  if (!(instance.job.flags & 8)) {
3850
3861
  instance.update();
3851
3862
  }
3863
+ delete leavingHooks.afterLeave;
3852
3864
  };
3853
3865
  return emptyPlaceholder(child);
3854
3866
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4074,6 +4086,7 @@ function getInnerChild$1(vnode) {
4074
4086
  }
4075
4087
  function setTransitionHooks(vnode, hooks) {
4076
4088
  if (vnode.shapeFlag & 6 && vnode.component) {
4089
+ vnode.transition = hooks;
4077
4090
  setTransitionHooks(vnode.component.subTree, hooks);
4078
4091
  } else if (vnode.shapeFlag & 128) {
4079
4092
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
@@ -4118,7 +4131,7 @@ function defineComponent(options, extraOptions) {
4118
4131
  function useId() {
4119
4132
  const i = getCurrentInstance();
4120
4133
  if (i) {
4121
- return (i.appContext.config.idPrefix || "v") + ":" + i.ids[0] + i.ids[1]++;
4134
+ return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
4122
4135
  } else {
4123
4136
  warn$1(
4124
4137
  `useId() is called when there is no active component instance to be associated with.`
@@ -4129,6 +4142,34 @@ function markAsyncBoundary(instance) {
4129
4142
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4130
4143
  }
4131
4144
 
4145
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4146
+ function useTemplateRef(key) {
4147
+ const i = getCurrentInstance();
4148
+ const r = shallowRef(null);
4149
+ if (i) {
4150
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4151
+ let desc;
4152
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4153
+ warn$1(`useTemplateRef('${key}') already exists.`);
4154
+ } else {
4155
+ Object.defineProperty(refs, key, {
4156
+ enumerable: true,
4157
+ get: () => r.value,
4158
+ set: (val) => r.value = val
4159
+ });
4160
+ }
4161
+ } else {
4162
+ warn$1(
4163
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4164
+ );
4165
+ }
4166
+ const ret = readonly(r) ;
4167
+ {
4168
+ knownTemplateRefs.add(ret);
4169
+ }
4170
+ return ret;
4171
+ }
4172
+
4132
4173
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4133
4174
  if (isArray(rawRef)) {
4134
4175
  rawRef.forEach(
@@ -4157,7 +4198,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4157
4198
  const oldRef = oldRawRef && oldRawRef.r;
4158
4199
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4159
4200
  const setupState = owner.setupState;
4160
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4201
+ const rawSetupState = toRaw(setupState);
4202
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4203
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4204
+ return false;
4205
+ }
4206
+ return hasOwn(rawSetupState, key);
4207
+ };
4161
4208
  if (oldRef != null && oldRef !== ref) {
4162
4209
  if (isString(oldRef)) {
4163
4210
  refs[oldRef] = null;
@@ -5214,7 +5261,7 @@ const KeepAliveImpl = {
5214
5261
  return () => {
5215
5262
  pendingCacheKey = null;
5216
5263
  if (!slots.default) {
5217
- return null;
5264
+ return current = null;
5218
5265
  }
5219
5266
  const children = slots.default();
5220
5267
  const rawVNode = children[0];
@@ -6989,7 +7036,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6989
7036
  return vm;
6990
7037
  }
6991
7038
  }
6992
- Vue.version = `2.6.14-compat:${"3.5.1"}`;
7039
+ Vue.version = `2.6.14-compat:${"3.5.3"}`;
6993
7040
  Vue.config = singletonApp.config;
6994
7041
  Vue.use = (plugin, ...options) => {
6995
7042
  if (plugin && isFunction(plugin.install)) {
@@ -8894,7 +8941,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8894
8941
  endMeasure(instance, `hydrate`);
8895
8942
  }
8896
8943
  };
8897
- if (isAsyncWrapperVNode) {
8944
+ if (isAsyncWrapperVNode && type.__asyncHydrate) {
8898
8945
  type.__asyncHydrate(
8899
8946
  el,
8900
8947
  instance,
@@ -10243,7 +10290,7 @@ function renderComponentRoot(instance) {
10243
10290
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10244
10291
  );
10245
10292
  }
10246
- root.transition = vnode.transition;
10293
+ setTransitionHooks(root, vnode.transition);
10247
10294
  }
10248
10295
  if (setRoot) {
10249
10296
  setRoot(root);
@@ -10737,7 +10784,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10737
10784
  };
10738
10785
  }
10739
10786
  if (activeBranch) {
10740
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10787
+ if (parentNode(activeBranch.el) === container2) {
10741
10788
  anchor = next(activeBranch);
10742
10789
  }
10743
10790
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11877,29 +11924,6 @@ const computed = (getterOrOptions, debugOptions) => {
11877
11924
  return c;
11878
11925
  };
11879
11926
 
11880
- function useTemplateRef(key) {
11881
- const i = getCurrentInstance();
11882
- const r = shallowRef(null);
11883
- if (i) {
11884
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11885
- let desc;
11886
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11887
- warn$1(`useTemplateRef('${key}') already exists.`);
11888
- } else {
11889
- Object.defineProperty(refs, key, {
11890
- enumerable: true,
11891
- get: () => r.value,
11892
- set: (val) => r.value = val
11893
- });
11894
- }
11895
- } else {
11896
- warn$1(
11897
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11898
- );
11899
- }
11900
- return readonly(r) ;
11901
- }
11902
-
11903
11927
  function h(type, propsOrChildren, children) {
11904
11928
  const l = arguments.length;
11905
11929
  if (l === 2) {
@@ -12125,7 +12149,7 @@ function isMemoSame(cached, memo) {
12125
12149
  return true;
12126
12150
  }
12127
12151
 
12128
- const version = "3.5.1";
12152
+ const version = "3.5.3";
12129
12153
  const warn = warn$1 ;
12130
12154
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12131
12155
  const devtools = devtools$1 ;
@@ -12138,7 +12162,9 @@ const _ssrUtils = {
12138
12162
  isVNode: isVNode,
12139
12163
  normalizeVNode,
12140
12164
  getComponentPublicInstance,
12141
- ensureValidVNode
12165
+ ensureValidVNode,
12166
+ pushWarningContext,
12167
+ popWarningContext
12142
12168
  };
12143
12169
  const ssrUtils = _ssrUtils ;
12144
12170
  const resolveFilter = resolveFilter$1 ;