@vue/compat 3.5.1 → 3.5.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/compat v3.5.1
2
+ * @vue/compat v3.5.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -621,9 +621,6 @@ function isDirty(sub) {
621
621
  return false;
622
622
  }
623
623
  function refreshComputed(computed) {
624
- if (computed.flags & 2) {
625
- return false;
626
- }
627
624
  if (computed.flags & 4 && !(computed.flags & 16)) {
628
625
  return;
629
626
  }
@@ -644,7 +641,7 @@ function refreshComputed(computed) {
644
641
  shouldTrack = true;
645
642
  try {
646
643
  prepareDeps(computed);
647
- const value = computed.fn();
644
+ const value = computed.fn(computed._value);
648
645
  if (dep.version === 0 || hasChanged(value, computed._value)) {
649
646
  computed._value = value;
650
647
  dep.version++;
@@ -753,7 +750,7 @@ class Dep {
753
750
  }
754
751
  }
755
752
  track(debugInfo) {
756
- if (!activeSub || !shouldTrack) {
753
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
757
754
  return;
758
755
  }
759
756
  let link = this.activeLink;
@@ -1766,7 +1763,7 @@ function toValue(source) {
1766
1763
  return isFunction(source) ? source() : unref(source);
1767
1764
  }
1768
1765
  const shallowUnwrapHandlers = {
1769
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1766
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1770
1767
  set: (target, key, value, receiver) => {
1771
1768
  const oldValue = target[key];
1772
1769
  if (isRef(oldValue) && !isRef(value)) {
@@ -1898,8 +1895,8 @@ class ComputedRefImpl {
1898
1895
  * @internal
1899
1896
  */
1900
1897
  notify() {
1898
+ this.flags |= 16;
1901
1899
  if (activeSub !== this) {
1902
- this.flags |= 16;
1903
1900
  this.dep.notify();
1904
1901
  }
1905
1902
  }
@@ -2468,9 +2465,7 @@ function queueJob(job) {
2468
2465
  } else {
2469
2466
  queue.splice(findInsertionIndex(jobId), 0, job);
2470
2467
  }
2471
- if (!(job.flags & 4)) {
2472
- job.flags |= 1;
2473
- }
2468
+ job.flags |= 1;
2474
2469
  queueFlush();
2475
2470
  }
2476
2471
  }
@@ -2486,9 +2481,7 @@ function queuePostFlushCb(cb) {
2486
2481
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2487
2482
  } else if (!(cb.flags & 1)) {
2488
2483
  pendingPostFlushCbs.push(cb);
2489
- if (!(cb.flags & 4)) {
2490
- cb.flags |= 1;
2491
- }
2484
+ cb.flags |= 1;
2492
2485
  }
2493
2486
  } else {
2494
2487
  pendingPostFlushCbs.push(...cb);
@@ -2510,6 +2503,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2510
2503
  }
2511
2504
  queue.splice(i, 1);
2512
2505
  i--;
2506
+ if (cb.flags & 4) {
2507
+ cb.flags &= ~1;
2508
+ }
2513
2509
  cb();
2514
2510
  cb.flags &= ~1;
2515
2511
  }
@@ -2534,6 +2530,9 @@ function flushPostFlushCbs(seen) {
2534
2530
  if (checkRecursiveUpdates(seen, cb)) {
2535
2531
  continue;
2536
2532
  }
2533
+ if (cb.flags & 4) {
2534
+ cb.flags &= ~1;
2535
+ }
2537
2536
  if (!(cb.flags & 8)) cb();
2538
2537
  cb.flags &= ~1;
2539
2538
  }
@@ -2556,6 +2555,9 @@ function flushJobs(seen) {
2556
2555
  if (check(job)) {
2557
2556
  continue;
2558
2557
  }
2558
+ if (job.flags & 4) {
2559
+ job.flags &= ~1;
2560
+ }
2559
2561
  callWithErrorHandling(
2560
2562
  job,
2561
2563
  job.i,
@@ -2565,6 +2567,12 @@ function flushJobs(seen) {
2565
2567
  }
2566
2568
  }
2567
2569
  } finally {
2570
+ for (; flushIndex < queue.length; flushIndex++) {
2571
+ const job = queue[flushIndex];
2572
+ if (job) {
2573
+ job.flags &= ~1;
2574
+ }
2575
+ }
2568
2576
  flushIndex = 0;
2569
2577
  queue.length = 0;
2570
2578
  flushPostFlushCbs(seen);
@@ -3849,6 +3857,7 @@ const BaseTransitionImpl = {
3849
3857
  if (!(instance.job.flags & 8)) {
3850
3858
  instance.update();
3851
3859
  }
3860
+ delete leavingHooks.afterLeave;
3852
3861
  };
3853
3862
  return emptyPlaceholder(child);
3854
3863
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4129,6 +4138,34 @@ function markAsyncBoundary(instance) {
4129
4138
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4130
4139
  }
4131
4140
 
4141
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4142
+ function useTemplateRef(key) {
4143
+ const i = getCurrentInstance();
4144
+ const r = shallowRef(null);
4145
+ if (i) {
4146
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4147
+ let desc;
4148
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4149
+ warn$1(`useTemplateRef('${key}') already exists.`);
4150
+ } else {
4151
+ Object.defineProperty(refs, key, {
4152
+ enumerable: true,
4153
+ get: () => r.value,
4154
+ set: (val) => r.value = val
4155
+ });
4156
+ }
4157
+ } else {
4158
+ warn$1(
4159
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4160
+ );
4161
+ }
4162
+ const ret = readonly(r) ;
4163
+ {
4164
+ knownTemplateRefs.add(ret);
4165
+ }
4166
+ return ret;
4167
+ }
4168
+
4132
4169
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4133
4170
  if (isArray(rawRef)) {
4134
4171
  rawRef.forEach(
@@ -4157,7 +4194,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4157
4194
  const oldRef = oldRawRef && oldRawRef.r;
4158
4195
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4159
4196
  const setupState = owner.setupState;
4160
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4197
+ const rawSetupState = toRaw(setupState);
4198
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4199
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4200
+ return false;
4201
+ }
4202
+ return hasOwn(rawSetupState, key);
4203
+ };
4161
4204
  if (oldRef != null && oldRef !== ref) {
4162
4205
  if (isString(oldRef)) {
4163
4206
  refs[oldRef] = null;
@@ -5214,7 +5257,7 @@ const KeepAliveImpl = {
5214
5257
  return () => {
5215
5258
  pendingCacheKey = null;
5216
5259
  if (!slots.default) {
5217
- return null;
5260
+ return current = null;
5218
5261
  }
5219
5262
  const children = slots.default();
5220
5263
  const rawVNode = children[0];
@@ -6989,7 +7032,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6989
7032
  return vm;
6990
7033
  }
6991
7034
  }
6992
- Vue.version = `2.6.14-compat:${"3.5.1"}`;
7035
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
6993
7036
  Vue.config = singletonApp.config;
6994
7037
  Vue.use = (plugin, ...options) => {
6995
7038
  if (plugin && isFunction(plugin.install)) {
@@ -10102,7 +10145,8 @@ function renderComponentRoot(instance) {
10102
10145
  data,
10103
10146
  setupState,
10104
10147
  ctx,
10105
- inheritAttrs
10148
+ inheritAttrs,
10149
+ isMounted
10106
10150
  } = instance;
10107
10151
  const prev = setCurrentRenderingInstance(instance);
10108
10152
  let result;
@@ -10243,7 +10287,7 @@ function renderComponentRoot(instance) {
10243
10287
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10244
10288
  );
10245
10289
  }
10246
- root.transition = vnode.transition;
10290
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10247
10291
  }
10248
10292
  if (setRoot) {
10249
10293
  setRoot(root);
@@ -10737,7 +10781,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10737
10781
  };
10738
10782
  }
10739
10783
  if (activeBranch) {
10740
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10784
+ if (parentNode(activeBranch.el) === container2) {
10741
10785
  anchor = next(activeBranch);
10742
10786
  }
10743
10787
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11877,29 +11921,6 @@ const computed = (getterOrOptions, debugOptions) => {
11877
11921
  return c;
11878
11922
  };
11879
11923
 
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
11924
  function h(type, propsOrChildren, children) {
11904
11925
  const l = arguments.length;
11905
11926
  if (l === 2) {
@@ -12125,7 +12146,7 @@ function isMemoSame(cached, memo) {
12125
12146
  return true;
12126
12147
  }
12127
12148
 
12128
- const version = "3.5.1";
12149
+ const version = "3.5.2";
12129
12150
  const warn = warn$1 ;
12130
12151
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12131
12152
  const devtools = devtools$1 ;