@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
  **/
@@ -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;
@@ -975,7 +972,7 @@ const arrayInstrumentations = {
975
972
  },
976
973
  concat(...args) {
977
974
  return reactiveReadArray(this).concat(
978
- ...args.map((x) => reactiveReadArray(x))
975
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
979
976
  );
980
977
  },
981
978
  entries() {
@@ -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);
@@ -3829,7 +3837,9 @@ const BaseTransitionImpl = {
3829
3837
  // #11061, ensure enterHooks is fresh after clone
3830
3838
  (hooks) => enterHooks = hooks
3831
3839
  );
3832
- setTransitionHooks(innerChild, enterHooks);
3840
+ if (innerChild.type !== Comment) {
3841
+ setTransitionHooks(innerChild, enterHooks);
3842
+ }
3833
3843
  const oldChild = instance.subTree;
3834
3844
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3835
3845
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3847,6 +3857,7 @@ const BaseTransitionImpl = {
3847
3857
  if (!(instance.job.flags & 8)) {
3848
3858
  instance.update();
3849
3859
  }
3860
+ delete leavingHooks.afterLeave;
3850
3861
  };
3851
3862
  return emptyPlaceholder(child);
3852
3863
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4127,6 +4138,34 @@ function markAsyncBoundary(instance) {
4127
4138
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4128
4139
  }
4129
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
+
4130
4169
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4131
4170
  if (isArray(rawRef)) {
4132
4171
  rawRef.forEach(
@@ -4155,10 +4194,17 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4155
4194
  const oldRef = oldRawRef && oldRawRef.r;
4156
4195
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4157
4196
  const setupState = owner.setupState;
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
+ };
4158
4204
  if (oldRef != null && oldRef !== ref) {
4159
4205
  if (isString(oldRef)) {
4160
4206
  refs[oldRef] = null;
4161
- if (hasOwn(setupState, oldRef)) {
4207
+ if (canSetSetupRef(oldRef)) {
4162
4208
  setupState[oldRef] = null;
4163
4209
  }
4164
4210
  } else if (isRef(oldRef)) {
@@ -4173,14 +4219,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4173
4219
  if (_isString || _isRef) {
4174
4220
  const doSet = () => {
4175
4221
  if (rawRef.f) {
4176
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4222
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4177
4223
  if (isUnmount) {
4178
4224
  isArray(existing) && remove(existing, refValue);
4179
4225
  } else {
4180
4226
  if (!isArray(existing)) {
4181
4227
  if (_isString) {
4182
4228
  refs[ref] = [refValue];
4183
- if (hasOwn(setupState, ref)) {
4229
+ if (canSetSetupRef(ref)) {
4184
4230
  setupState[ref] = refs[ref];
4185
4231
  }
4186
4232
  } else {
@@ -4193,7 +4239,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4193
4239
  }
4194
4240
  } else if (_isString) {
4195
4241
  refs[ref] = value;
4196
- if (hasOwn(setupState, ref)) {
4242
+ if (canSetSetupRef(ref)) {
4197
4243
  setupState[ref] = value;
4198
4244
  }
4199
4245
  } else if (_isRef) {
@@ -5211,7 +5257,7 @@ const KeepAliveImpl = {
5211
5257
  return () => {
5212
5258
  pendingCacheKey = null;
5213
5259
  if (!slots.default) {
5214
- return null;
5260
+ return current = null;
5215
5261
  }
5216
5262
  const children = slots.default();
5217
5263
  const rawVNode = children[0];
@@ -5270,10 +5316,11 @@ const KeepAliveImpl = {
5270
5316
  };
5271
5317
  }
5272
5318
  };
5273
- {
5274
- KeepAliveImpl.__isBuildIn = true;
5275
- }
5276
- const KeepAlive = KeepAliveImpl;
5319
+ const decorate$2 = (t) => {
5320
+ t.__isBuiltIn = true;
5321
+ return t;
5322
+ };
5323
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5277
5324
  function matches(pattern, name) {
5278
5325
  if (isArray(pattern)) {
5279
5326
  return pattern.some((p) => matches(p, name));
@@ -6985,7 +7032,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6985
7032
  return vm;
6986
7033
  }
6987
7034
  }
6988
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7035
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
6989
7036
  Vue.config = singletonApp.config;
6990
7037
  Vue.use = (plugin, ...options) => {
6991
7038
  if (plugin && isFunction(plugin.install)) {
@@ -10098,7 +10145,8 @@ function renderComponentRoot(instance) {
10098
10145
  data,
10099
10146
  setupState,
10100
10147
  ctx,
10101
- inheritAttrs
10148
+ inheritAttrs,
10149
+ isMounted
10102
10150
  } = instance;
10103
10151
  const prev = setCurrentRenderingInstance(instance);
10104
10152
  let result;
@@ -10239,7 +10287,7 @@ function renderComponentRoot(instance) {
10239
10287
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10240
10288
  );
10241
10289
  }
10242
- root.transition = vnode.transition;
10290
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10243
10291
  }
10244
10292
  if (setRoot) {
10245
10293
  setRoot(root);
@@ -10733,7 +10781,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10733
10781
  };
10734
10782
  }
10735
10783
  if (activeBranch) {
10736
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10784
+ if (parentNode(activeBranch.el) === container2) {
10737
10785
  anchor = next(activeBranch);
10738
10786
  }
10739
10787
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11873,29 +11921,6 @@ const computed = (getterOrOptions, debugOptions) => {
11873
11921
  return c;
11874
11922
  };
11875
11923
 
11876
- function useTemplateRef(key) {
11877
- const i = getCurrentInstance();
11878
- const r = shallowRef(null);
11879
- if (i) {
11880
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11881
- let desc;
11882
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11883
- warn$1(`useTemplateRef('${key}') already exists.`);
11884
- } else {
11885
- Object.defineProperty(refs, key, {
11886
- enumerable: true,
11887
- get: () => r.value,
11888
- set: (val) => r.value = val
11889
- });
11890
- }
11891
- } else {
11892
- warn$1(
11893
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11894
- );
11895
- }
11896
- return readonly(r) ;
11897
- }
11898
-
11899
11924
  function h(type, propsOrChildren, children) {
11900
11925
  const l = arguments.length;
11901
11926
  if (l === 2) {
@@ -12121,7 +12146,7 @@ function isMemoSame(cached, memo) {
12121
12146
  return true;
12122
12147
  }
12123
12148
 
12124
- const version = "3.5.0";
12149
+ const version = "3.5.2";
12125
12150
  const warn = warn$1 ;
12126
12151
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12127
12152
  const devtools = devtools$1 ;
@@ -12232,11 +12257,6 @@ const nodeOps = {
12232
12257
  const TRANSITION = "transition";
12233
12258
  const ANIMATION = "animation";
12234
12259
  const vtcKey = Symbol("_vtc");
12235
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12236
- Transition.displayName = "Transition";
12237
- {
12238
- Transition.__isBuiltIn = true;
12239
- }
12240
12260
  const DOMTransitionPropsValidators = {
12241
12261
  name: String,
12242
12262
  type: String,
@@ -12255,11 +12275,22 @@ const DOMTransitionPropsValidators = {
12255
12275
  leaveActiveClass: String,
12256
12276
  leaveToClass: String
12257
12277
  };
12258
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12278
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12259
12279
  {},
12260
12280
  BaseTransitionPropsValidators,
12261
12281
  DOMTransitionPropsValidators
12262
12282
  );
12283
+ const decorate$1 = (t) => {
12284
+ t.displayName = "Transition";
12285
+ t.props = TransitionPropsValidators;
12286
+ {
12287
+ t.__isBuiltIn = true;
12288
+ }
12289
+ return t;
12290
+ };
12291
+ const Transition = /* @__PURE__ */ decorate$1(
12292
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12293
+ );
12263
12294
  const callHook = (hook, args = []) => {
12264
12295
  if (isArray(hook)) {
12265
12296
  hook.forEach((h2) => h2(...args));
@@ -13473,7 +13504,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
13473
13504
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13474
13505
  const moveCbKey = Symbol("_moveCb");
13475
13506
  const enterCbKey = Symbol("_enterCb");
13476
- const TransitionGroupImpl = {
13507
+ const decorate = (t) => {
13508
+ delete t.props.mode;
13509
+ {
13510
+ t.__isBuiltIn = true;
13511
+ }
13512
+ return t;
13513
+ };
13514
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13477
13515
  name: "TransitionGroup",
13478
13516
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13479
13517
  tag: String,
@@ -13565,12 +13603,7 @@ const TransitionGroupImpl = {
13565
13603
  return createVNode(tag, null, children);
13566
13604
  };
13567
13605
  }
13568
- };
13569
- {
13570
- TransitionGroupImpl.__isBuiltIn = true;
13571
- }
13572
- const removeMode = (props) => delete props.mode;
13573
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13606
+ });
13574
13607
  const TransitionGroup = TransitionGroupImpl;
13575
13608
  function callPendingCbs(c) {
13576
13609
  const el = c.el;