@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;
@@ -1776,7 +1773,7 @@ function toValue(source) {
1776
1773
  return isFunction(source) ? source() : unref(source);
1777
1774
  }
1778
1775
  const shallowUnwrapHandlers = {
1779
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1776
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1780
1777
  set: (target, key, value, receiver) => {
1781
1778
  const oldValue = target[key];
1782
1779
  if (isRef(oldValue) && !isRef(value)) {
@@ -1908,8 +1905,8 @@ class ComputedRefImpl {
1908
1905
  * @internal
1909
1906
  */
1910
1907
  notify() {
1908
+ this.flags |= 16;
1911
1909
  if (activeSub !== this) {
1912
- this.flags |= 16;
1913
1910
  this.dep.notify();
1914
1911
  } else if (!!(process.env.NODE_ENV !== "production")) ;
1915
1912
  }
@@ -2483,9 +2480,7 @@ function queueJob(job) {
2483
2480
  } else {
2484
2481
  queue.splice(findInsertionIndex(jobId), 0, job);
2485
2482
  }
2486
- if (!(job.flags & 4)) {
2487
- job.flags |= 1;
2488
- }
2483
+ job.flags |= 1;
2489
2484
  queueFlush();
2490
2485
  }
2491
2486
  }
@@ -2501,9 +2496,7 @@ function queuePostFlushCb(cb) {
2501
2496
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2502
2497
  } else if (!(cb.flags & 1)) {
2503
2498
  pendingPostFlushCbs.push(cb);
2504
- if (!(cb.flags & 4)) {
2505
- cb.flags |= 1;
2506
- }
2499
+ cb.flags |= 1;
2507
2500
  }
2508
2501
  } else {
2509
2502
  pendingPostFlushCbs.push(...cb);
@@ -2525,6 +2518,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2525
2518
  }
2526
2519
  queue.splice(i, 1);
2527
2520
  i--;
2521
+ if (cb.flags & 4) {
2522
+ cb.flags &= ~1;
2523
+ }
2528
2524
  cb();
2529
2525
  cb.flags &= ~1;
2530
2526
  }
@@ -2549,6 +2545,9 @@ function flushPostFlushCbs(seen) {
2549
2545
  if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
2550
2546
  continue;
2551
2547
  }
2548
+ if (cb.flags & 4) {
2549
+ cb.flags &= ~1;
2550
+ }
2552
2551
  if (!(cb.flags & 8)) cb();
2553
2552
  cb.flags &= ~1;
2554
2553
  }
@@ -2571,6 +2570,9 @@ function flushJobs(seen) {
2571
2570
  if (!!(process.env.NODE_ENV !== "production") && check(job)) {
2572
2571
  continue;
2573
2572
  }
2573
+ if (job.flags & 4) {
2574
+ job.flags &= ~1;
2575
+ }
2574
2576
  callWithErrorHandling(
2575
2577
  job,
2576
2578
  job.i,
@@ -2580,6 +2582,12 @@ function flushJobs(seen) {
2580
2582
  }
2581
2583
  }
2582
2584
  } finally {
2585
+ for (; flushIndex < queue.length; flushIndex++) {
2586
+ const job = queue[flushIndex];
2587
+ if (job) {
2588
+ job.flags &= ~1;
2589
+ }
2590
+ }
2583
2591
  flushIndex = 0;
2584
2592
  queue.length = 0;
2585
2593
  flushPostFlushCbs(seen);
@@ -3867,6 +3875,7 @@ const BaseTransitionImpl = {
3867
3875
  if (!(instance.job.flags & 8)) {
3868
3876
  instance.update();
3869
3877
  }
3878
+ delete leavingHooks.afterLeave;
3870
3879
  };
3871
3880
  return emptyPlaceholder(child);
3872
3881
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4148,6 +4157,34 @@ function markAsyncBoundary(instance) {
4148
4157
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4149
4158
  }
4150
4159
 
4160
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4161
+ function useTemplateRef(key) {
4162
+ const i = getCurrentInstance();
4163
+ const r = shallowRef(null);
4164
+ if (i) {
4165
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4166
+ let desc;
4167
+ if (!!(process.env.NODE_ENV !== "production") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4168
+ warn$1(`useTemplateRef('${key}') already exists.`);
4169
+ } else {
4170
+ Object.defineProperty(refs, key, {
4171
+ enumerable: true,
4172
+ get: () => r.value,
4173
+ set: (val) => r.value = val
4174
+ });
4175
+ }
4176
+ } else if (!!(process.env.NODE_ENV !== "production")) {
4177
+ warn$1(
4178
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4179
+ );
4180
+ }
4181
+ const ret = !!(process.env.NODE_ENV !== "production") ? readonly(r) : r;
4182
+ if (!!(process.env.NODE_ENV !== "production")) {
4183
+ knownTemplateRefs.add(ret);
4184
+ }
4185
+ return ret;
4186
+ }
4187
+
4151
4188
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4152
4189
  if (isArray(rawRef)) {
4153
4190
  rawRef.forEach(
@@ -4176,7 +4213,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4176
4213
  const oldRef = oldRawRef && oldRawRef.r;
4177
4214
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4178
4215
  const setupState = owner.setupState;
4179
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4216
+ const rawSetupState = toRaw(setupState);
4217
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4218
+ if (!!(process.env.NODE_ENV !== "production") && knownTemplateRefs.has(rawSetupState[key])) {
4219
+ return false;
4220
+ }
4221
+ return hasOwn(rawSetupState, key);
4222
+ };
4180
4223
  if (oldRef != null && oldRef !== ref) {
4181
4224
  if (isString(oldRef)) {
4182
4225
  refs[oldRef] = null;
@@ -5244,7 +5287,7 @@ const KeepAliveImpl = {
5244
5287
  return () => {
5245
5288
  pendingCacheKey = null;
5246
5289
  if (!slots.default) {
5247
- return null;
5290
+ return current = null;
5248
5291
  }
5249
5292
  const children = slots.default();
5250
5293
  const rawVNode = children[0];
@@ -7021,7 +7064,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7021
7064
  return vm;
7022
7065
  }
7023
7066
  }
7024
- Vue.version = `2.6.14-compat:${"3.5.1"}`;
7067
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7025
7068
  Vue.config = singletonApp.config;
7026
7069
  Vue.use = (plugin, ...options) => {
7027
7070
  if (plugin && isFunction(plugin.install)) {
@@ -10174,7 +10217,8 @@ function renderComponentRoot(instance) {
10174
10217
  data,
10175
10218
  setupState,
10176
10219
  ctx,
10177
- inheritAttrs
10220
+ inheritAttrs,
10221
+ isMounted
10178
10222
  } = instance;
10179
10223
  const prev = setCurrentRenderingInstance(instance);
10180
10224
  let result;
@@ -10315,7 +10359,7 @@ function renderComponentRoot(instance) {
10315
10359
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10316
10360
  );
10317
10361
  }
10318
- root.transition = vnode.transition;
10362
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10319
10363
  }
10320
10364
  if (!!(process.env.NODE_ENV !== "production") && setRoot) {
10321
10365
  setRoot(root);
@@ -10809,7 +10853,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10809
10853
  };
10810
10854
  }
10811
10855
  if (activeBranch) {
10812
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10856
+ if (parentNode(activeBranch.el) === container2) {
10813
10857
  anchor = next(activeBranch);
10814
10858
  }
10815
10859
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11963,29 +12007,6 @@ const computed = (getterOrOptions, debugOptions) => {
11963
12007
  return c;
11964
12008
  };
11965
12009
 
11966
- function useTemplateRef(key) {
11967
- const i = getCurrentInstance();
11968
- const r = shallowRef(null);
11969
- if (i) {
11970
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11971
- let desc;
11972
- if (!!(process.env.NODE_ENV !== "production") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11973
- warn$1(`useTemplateRef('${key}') already exists.`);
11974
- } else {
11975
- Object.defineProperty(refs, key, {
11976
- enumerable: true,
11977
- get: () => r.value,
11978
- set: (val) => r.value = val
11979
- });
11980
- }
11981
- } else if (!!(process.env.NODE_ENV !== "production")) {
11982
- warn$1(
11983
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11984
- );
11985
- }
11986
- return !!(process.env.NODE_ENV !== "production") ? readonly(r) : r;
11987
- }
11988
-
11989
12010
  function h(type, propsOrChildren, children) {
11990
12011
  const l = arguments.length;
11991
12012
  if (l === 2) {
@@ -12211,7 +12232,7 @@ function isMemoSame(cached, memo) {
12211
12232
  return true;
12212
12233
  }
12213
12234
 
12214
- const version = "3.5.1";
12235
+ const version = "3.5.2";
12215
12236
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12216
12237
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12217
12238
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -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
  **/
@@ -624,9 +624,6 @@ var Vue = (function () {
624
624
  return false;
625
625
  }
626
626
  function refreshComputed(computed) {
627
- if (computed.flags & 2) {
628
- return false;
629
- }
630
627
  if (computed.flags & 4 && !(computed.flags & 16)) {
631
628
  return;
632
629
  }
@@ -647,7 +644,7 @@ var Vue = (function () {
647
644
  shouldTrack = true;
648
645
  try {
649
646
  prepareDeps(computed);
650
- const value = computed.fn();
647
+ const value = computed.fn(computed._value);
651
648
  if (dep.version === 0 || hasChanged(value, computed._value)) {
652
649
  computed._value = value;
653
650
  dep.version++;
@@ -756,7 +753,7 @@ var Vue = (function () {
756
753
  }
757
754
  }
758
755
  track(debugInfo) {
759
- if (!activeSub || !shouldTrack) {
756
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
760
757
  return;
761
758
  }
762
759
  let link = this.activeLink;
@@ -1769,7 +1766,7 @@ var Vue = (function () {
1769
1766
  return isFunction(source) ? source() : unref(source);
1770
1767
  }
1771
1768
  const shallowUnwrapHandlers = {
1772
- 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)),
1773
1770
  set: (target, key, value, receiver) => {
1774
1771
  const oldValue = target[key];
1775
1772
  if (isRef(oldValue) && !isRef(value)) {
@@ -1901,8 +1898,8 @@ var Vue = (function () {
1901
1898
  * @internal
1902
1899
  */
1903
1900
  notify() {
1901
+ this.flags |= 16;
1904
1902
  if (activeSub !== this) {
1905
- this.flags |= 16;
1906
1903
  this.dep.notify();
1907
1904
  }
1908
1905
  }
@@ -2471,9 +2468,7 @@ var Vue = (function () {
2471
2468
  } else {
2472
2469
  queue.splice(findInsertionIndex(jobId), 0, job);
2473
2470
  }
2474
- if (!(job.flags & 4)) {
2475
- job.flags |= 1;
2476
- }
2471
+ job.flags |= 1;
2477
2472
  queueFlush();
2478
2473
  }
2479
2474
  }
@@ -2489,9 +2484,7 @@ var Vue = (function () {
2489
2484
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2490
2485
  } else if (!(cb.flags & 1)) {
2491
2486
  pendingPostFlushCbs.push(cb);
2492
- if (!(cb.flags & 4)) {
2493
- cb.flags |= 1;
2494
- }
2487
+ cb.flags |= 1;
2495
2488
  }
2496
2489
  } else {
2497
2490
  pendingPostFlushCbs.push(...cb);
@@ -2513,6 +2506,9 @@ var Vue = (function () {
2513
2506
  }
2514
2507
  queue.splice(i, 1);
2515
2508
  i--;
2509
+ if (cb.flags & 4) {
2510
+ cb.flags &= ~1;
2511
+ }
2516
2512
  cb();
2517
2513
  cb.flags &= ~1;
2518
2514
  }
@@ -2537,6 +2533,9 @@ var Vue = (function () {
2537
2533
  if (checkRecursiveUpdates(seen, cb)) {
2538
2534
  continue;
2539
2535
  }
2536
+ if (cb.flags & 4) {
2537
+ cb.flags &= ~1;
2538
+ }
2540
2539
  if (!(cb.flags & 8)) cb();
2541
2540
  cb.flags &= ~1;
2542
2541
  }
@@ -2559,6 +2558,9 @@ var Vue = (function () {
2559
2558
  if (check(job)) {
2560
2559
  continue;
2561
2560
  }
2561
+ if (job.flags & 4) {
2562
+ job.flags &= ~1;
2563
+ }
2562
2564
  callWithErrorHandling(
2563
2565
  job,
2564
2566
  job.i,
@@ -2568,6 +2570,12 @@ var Vue = (function () {
2568
2570
  }
2569
2571
  }
2570
2572
  } finally {
2573
+ for (; flushIndex < queue.length; flushIndex++) {
2574
+ const job = queue[flushIndex];
2575
+ if (job) {
2576
+ job.flags &= ~1;
2577
+ }
2578
+ }
2571
2579
  flushIndex = 0;
2572
2580
  queue.length = 0;
2573
2581
  flushPostFlushCbs(seen);
@@ -3852,6 +3860,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3852
3860
  if (!(instance.job.flags & 8)) {
3853
3861
  instance.update();
3854
3862
  }
3863
+ delete leavingHooks.afterLeave;
3855
3864
  };
3856
3865
  return emptyPlaceholder(child);
3857
3866
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4132,6 +4141,34 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4132
4141
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4133
4142
  }
4134
4143
 
4144
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4145
+ function useTemplateRef(key) {
4146
+ const i = getCurrentInstance();
4147
+ const r = shallowRef(null);
4148
+ if (i) {
4149
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4150
+ let desc;
4151
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4152
+ warn$1(`useTemplateRef('${key}') already exists.`);
4153
+ } else {
4154
+ Object.defineProperty(refs, key, {
4155
+ enumerable: true,
4156
+ get: () => r.value,
4157
+ set: (val) => r.value = val
4158
+ });
4159
+ }
4160
+ } else {
4161
+ warn$1(
4162
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4163
+ );
4164
+ }
4165
+ const ret = readonly(r) ;
4166
+ {
4167
+ knownTemplateRefs.add(ret);
4168
+ }
4169
+ return ret;
4170
+ }
4171
+
4135
4172
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4136
4173
  if (isArray(rawRef)) {
4137
4174
  rawRef.forEach(
@@ -4160,7 +4197,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4160
4197
  const oldRef = oldRawRef && oldRawRef.r;
4161
4198
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4162
4199
  const setupState = owner.setupState;
4163
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4200
+ const rawSetupState = toRaw(setupState);
4201
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4202
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4203
+ return false;
4204
+ }
4205
+ return hasOwn(rawSetupState, key);
4206
+ };
4164
4207
  if (oldRef != null && oldRef !== ref) {
4165
4208
  if (isString(oldRef)) {
4166
4209
  refs[oldRef] = null;
@@ -5211,7 +5254,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5211
5254
  return () => {
5212
5255
  pendingCacheKey = null;
5213
5256
  if (!slots.default) {
5214
- return null;
5257
+ return current = null;
5215
5258
  }
5216
5259
  const children = slots.default();
5217
5260
  const rawVNode = children[0];
@@ -6983,7 +7026,7 @@ If this is a native custom element, make sure to exclude it from component resol
6983
7026
  return vm;
6984
7027
  }
6985
7028
  }
6986
- Vue.version = `2.6.14-compat:${"3.5.1"}`;
7029
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
6987
7030
  Vue.config = singletonApp.config;
6988
7031
  Vue.use = (plugin, ...options) => {
6989
7032
  if (plugin && isFunction(plugin.install)) {
@@ -10074,7 +10117,8 @@ If you want to remount the same app, move your app creation logic into a factory
10074
10117
  data,
10075
10118
  setupState,
10076
10119
  ctx,
10077
- inheritAttrs
10120
+ inheritAttrs,
10121
+ isMounted
10078
10122
  } = instance;
10079
10123
  const prev = setCurrentRenderingInstance(instance);
10080
10124
  let result;
@@ -10215,7 +10259,7 @@ If you want to remount the same app, move your app creation logic into a factory
10215
10259
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10216
10260
  );
10217
10261
  }
10218
- root.transition = vnode.transition;
10262
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10219
10263
  }
10220
10264
  if (setRoot) {
10221
10265
  setRoot(root);
@@ -10709,7 +10753,7 @@ If you want to remount the same app, move your app creation logic into a factory
10709
10753
  };
10710
10754
  }
10711
10755
  if (activeBranch) {
10712
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10756
+ if (parentNode(activeBranch.el) === container2) {
10713
10757
  anchor = next(activeBranch);
10714
10758
  }
10715
10759
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11835,29 +11879,6 @@ Component that was made reactive: `,
11835
11879
  return c;
11836
11880
  };
11837
11881
 
11838
- function useTemplateRef(key) {
11839
- const i = getCurrentInstance();
11840
- const r = shallowRef(null);
11841
- if (i) {
11842
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11843
- let desc;
11844
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11845
- warn$1(`useTemplateRef('${key}') already exists.`);
11846
- } else {
11847
- Object.defineProperty(refs, key, {
11848
- enumerable: true,
11849
- get: () => r.value,
11850
- set: (val) => r.value = val
11851
- });
11852
- }
11853
- } else {
11854
- warn$1(
11855
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11856
- );
11857
- }
11858
- return readonly(r) ;
11859
- }
11860
-
11861
11882
  function h(type, propsOrChildren, children) {
11862
11883
  const l = arguments.length;
11863
11884
  if (l === 2) {
@@ -12083,7 +12104,7 @@ Component that was made reactive: `,
12083
12104
  return true;
12084
12105
  }
12085
12106
 
12086
- const version = "3.5.1";
12107
+ const version = "3.5.2";
12087
12108
  const warn = warn$1 ;
12088
12109
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12089
12110
  const devtools = devtools$1 ;