@vue/compat 3.5.0 → 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.0
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;
@@ -978,7 +975,7 @@ var Vue = (function () {
978
975
  },
979
976
  concat(...args) {
980
977
  return reactiveReadArray(this).concat(
981
- ...args.map((x) => reactiveReadArray(x))
978
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
982
979
  );
983
980
  },
984
981
  entries() {
@@ -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);
@@ -3832,7 +3840,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3832
3840
  // #11061, ensure enterHooks is fresh after clone
3833
3841
  (hooks) => enterHooks = hooks
3834
3842
  );
3835
- setTransitionHooks(innerChild, enterHooks);
3843
+ if (innerChild.type !== Comment) {
3844
+ setTransitionHooks(innerChild, enterHooks);
3845
+ }
3836
3846
  const oldChild = instance.subTree;
3837
3847
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3838
3848
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3850,6 +3860,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3850
3860
  if (!(instance.job.flags & 8)) {
3851
3861
  instance.update();
3852
3862
  }
3863
+ delete leavingHooks.afterLeave;
3853
3864
  };
3854
3865
  return emptyPlaceholder(child);
3855
3866
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4130,6 +4141,34 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4130
4141
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4131
4142
  }
4132
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
+
4133
4172
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4134
4173
  if (isArray(rawRef)) {
4135
4174
  rawRef.forEach(
@@ -4158,10 +4197,17 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4158
4197
  const oldRef = oldRawRef && oldRawRef.r;
4159
4198
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4160
4199
  const setupState = owner.setupState;
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
+ };
4161
4207
  if (oldRef != null && oldRef !== ref) {
4162
4208
  if (isString(oldRef)) {
4163
4209
  refs[oldRef] = null;
4164
- if (hasOwn(setupState, oldRef)) {
4210
+ if (canSetSetupRef(oldRef)) {
4165
4211
  setupState[oldRef] = null;
4166
4212
  }
4167
4213
  } else if (isRef(oldRef)) {
@@ -4176,14 +4222,14 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4176
4222
  if (_isString || _isRef) {
4177
4223
  const doSet = () => {
4178
4224
  if (rawRef.f) {
4179
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4225
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4180
4226
  if (isUnmount) {
4181
4227
  isArray(existing) && remove(existing, refValue);
4182
4228
  } else {
4183
4229
  if (!isArray(existing)) {
4184
4230
  if (_isString) {
4185
4231
  refs[ref] = [refValue];
4186
- if (hasOwn(setupState, ref)) {
4232
+ if (canSetSetupRef(ref)) {
4187
4233
  setupState[ref] = refs[ref];
4188
4234
  }
4189
4235
  } else {
@@ -4196,7 +4242,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4196
4242
  }
4197
4243
  } else if (_isString) {
4198
4244
  refs[ref] = value;
4199
- if (hasOwn(setupState, ref)) {
4245
+ if (canSetSetupRef(ref)) {
4200
4246
  setupState[ref] = value;
4201
4247
  }
4202
4248
  } else if (_isRef) {
@@ -5208,7 +5254,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5208
5254
  return () => {
5209
5255
  pendingCacheKey = null;
5210
5256
  if (!slots.default) {
5211
- return null;
5257
+ return current = null;
5212
5258
  }
5213
5259
  const children = slots.default();
5214
5260
  const rawVNode = children[0];
@@ -5267,10 +5313,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5267
5313
  };
5268
5314
  }
5269
5315
  };
5270
- {
5271
- KeepAliveImpl.__isBuildIn = true;
5272
- }
5273
- const KeepAlive = KeepAliveImpl;
5316
+ const decorate$2 = (t) => {
5317
+ t.__isBuiltIn = true;
5318
+ return t;
5319
+ };
5320
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5274
5321
  function matches(pattern, name) {
5275
5322
  if (isArray(pattern)) {
5276
5323
  return pattern.some((p) => matches(p, name));
@@ -6979,7 +7026,7 @@ If this is a native custom element, make sure to exclude it from component resol
6979
7026
  return vm;
6980
7027
  }
6981
7028
  }
6982
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7029
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
6983
7030
  Vue.config = singletonApp.config;
6984
7031
  Vue.use = (plugin, ...options) => {
6985
7032
  if (plugin && isFunction(plugin.install)) {
@@ -10070,7 +10117,8 @@ If you want to remount the same app, move your app creation logic into a factory
10070
10117
  data,
10071
10118
  setupState,
10072
10119
  ctx,
10073
- inheritAttrs
10120
+ inheritAttrs,
10121
+ isMounted
10074
10122
  } = instance;
10075
10123
  const prev = setCurrentRenderingInstance(instance);
10076
10124
  let result;
@@ -10211,7 +10259,7 @@ If you want to remount the same app, move your app creation logic into a factory
10211
10259
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10212
10260
  );
10213
10261
  }
10214
- root.transition = vnode.transition;
10262
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10215
10263
  }
10216
10264
  if (setRoot) {
10217
10265
  setRoot(root);
@@ -10705,7 +10753,7 @@ If you want to remount the same app, move your app creation logic into a factory
10705
10753
  };
10706
10754
  }
10707
10755
  if (activeBranch) {
10708
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10756
+ if (parentNode(activeBranch.el) === container2) {
10709
10757
  anchor = next(activeBranch);
10710
10758
  }
10711
10759
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11831,29 +11879,6 @@ Component that was made reactive: `,
11831
11879
  return c;
11832
11880
  };
11833
11881
 
11834
- function useTemplateRef(key) {
11835
- const i = getCurrentInstance();
11836
- const r = shallowRef(null);
11837
- if (i) {
11838
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11839
- let desc;
11840
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11841
- warn$1(`useTemplateRef('${key}') already exists.`);
11842
- } else {
11843
- Object.defineProperty(refs, key, {
11844
- enumerable: true,
11845
- get: () => r.value,
11846
- set: (val) => r.value = val
11847
- });
11848
- }
11849
- } else {
11850
- warn$1(
11851
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11852
- );
11853
- }
11854
- return readonly(r) ;
11855
- }
11856
-
11857
11882
  function h(type, propsOrChildren, children) {
11858
11883
  const l = arguments.length;
11859
11884
  if (l === 2) {
@@ -12079,7 +12104,7 @@ Component that was made reactive: `,
12079
12104
  return true;
12080
12105
  }
12081
12106
 
12082
- const version = "3.5.0";
12107
+ const version = "3.5.2";
12083
12108
  const warn = warn$1 ;
12084
12109
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12085
12110
  const devtools = devtools$1 ;
@@ -12180,11 +12205,6 @@ Component that was made reactive: `,
12180
12205
  const TRANSITION = "transition";
12181
12206
  const ANIMATION = "animation";
12182
12207
  const vtcKey = Symbol("_vtc");
12183
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12184
- Transition.displayName = "Transition";
12185
- {
12186
- Transition.__isBuiltIn = true;
12187
- }
12188
12208
  const DOMTransitionPropsValidators = {
12189
12209
  name: String,
12190
12210
  type: String,
@@ -12203,11 +12223,22 @@ Component that was made reactive: `,
12203
12223
  leaveActiveClass: String,
12204
12224
  leaveToClass: String
12205
12225
  };
12206
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12226
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12207
12227
  {},
12208
12228
  BaseTransitionPropsValidators,
12209
12229
  DOMTransitionPropsValidators
12210
12230
  );
12231
+ const decorate$1 = (t) => {
12232
+ t.displayName = "Transition";
12233
+ t.props = TransitionPropsValidators;
12234
+ {
12235
+ t.__isBuiltIn = true;
12236
+ }
12237
+ return t;
12238
+ };
12239
+ const Transition = /* @__PURE__ */ decorate$1(
12240
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12241
+ );
12211
12242
  const callHook = (hook, args = []) => {
12212
12243
  if (isArray(hook)) {
12213
12244
  hook.forEach((h2) => h2(...args));
@@ -13402,7 +13433,14 @@ Expected function or array of functions, received type ${typeof value}.`
13402
13433
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13403
13434
  const moveCbKey = Symbol("_moveCb");
13404
13435
  const enterCbKey = Symbol("_enterCb");
13405
- const TransitionGroupImpl = {
13436
+ const decorate = (t) => {
13437
+ delete t.props.mode;
13438
+ {
13439
+ t.__isBuiltIn = true;
13440
+ }
13441
+ return t;
13442
+ };
13443
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13406
13444
  name: "TransitionGroup",
13407
13445
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13408
13446
  tag: String,
@@ -13494,12 +13532,7 @@ Expected function or array of functions, received type ${typeof value}.`
13494
13532
  return createVNode(tag, null, children);
13495
13533
  };
13496
13534
  }
13497
- };
13498
- {
13499
- TransitionGroupImpl.__isBuiltIn = true;
13500
- }
13501
- const removeMode = (props) => delete props.mode;
13502
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13535
+ });
13503
13536
  const TransitionGroup = TransitionGroupImpl;
13504
13537
  function callPendingCbs(c) {
13505
13538
  const el = c.el;