@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;
@@ -979,7 +976,7 @@ const arrayInstrumentations = {
979
976
  },
980
977
  concat(...args) {
981
978
  return reactiveReadArray(this).concat(
982
- ...args.map((x) => reactiveReadArray(x))
979
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
983
980
  );
984
981
  },
985
982
  entries() {
@@ -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);
@@ -3847,7 +3855,9 @@ const BaseTransitionImpl = {
3847
3855
  // #11061, ensure enterHooks is fresh after clone
3848
3856
  (hooks) => enterHooks = hooks
3849
3857
  );
3850
- setTransitionHooks(innerChild, enterHooks);
3858
+ if (innerChild.type !== Comment) {
3859
+ setTransitionHooks(innerChild, enterHooks);
3860
+ }
3851
3861
  const oldChild = instance.subTree;
3852
3862
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3853
3863
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3865,6 +3875,7 @@ const BaseTransitionImpl = {
3865
3875
  if (!(instance.job.flags & 8)) {
3866
3876
  instance.update();
3867
3877
  }
3878
+ delete leavingHooks.afterLeave;
3868
3879
  };
3869
3880
  return emptyPlaceholder(child);
3870
3881
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4146,6 +4157,34 @@ function markAsyncBoundary(instance) {
4146
4157
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4147
4158
  }
4148
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
+
4149
4188
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4150
4189
  if (isArray(rawRef)) {
4151
4190
  rawRef.forEach(
@@ -4174,10 +4213,17 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4174
4213
  const oldRef = oldRawRef && oldRawRef.r;
4175
4214
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4176
4215
  const setupState = owner.setupState;
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
+ };
4177
4223
  if (oldRef != null && oldRef !== ref) {
4178
4224
  if (isString(oldRef)) {
4179
4225
  refs[oldRef] = null;
4180
- if (hasOwn(setupState, oldRef)) {
4226
+ if (canSetSetupRef(oldRef)) {
4181
4227
  setupState[oldRef] = null;
4182
4228
  }
4183
4229
  } else if (isRef(oldRef)) {
@@ -4192,14 +4238,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4192
4238
  if (_isString || _isRef) {
4193
4239
  const doSet = () => {
4194
4240
  if (rawRef.f) {
4195
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4241
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4196
4242
  if (isUnmount) {
4197
4243
  isArray(existing) && remove(existing, refValue);
4198
4244
  } else {
4199
4245
  if (!isArray(existing)) {
4200
4246
  if (_isString) {
4201
4247
  refs[ref] = [refValue];
4202
- if (hasOwn(setupState, ref)) {
4248
+ if (canSetSetupRef(ref)) {
4203
4249
  setupState[ref] = refs[ref];
4204
4250
  }
4205
4251
  } else {
@@ -4212,7 +4258,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4212
4258
  }
4213
4259
  } else if (_isString) {
4214
4260
  refs[ref] = value;
4215
- if (hasOwn(setupState, ref)) {
4261
+ if (canSetSetupRef(ref)) {
4216
4262
  setupState[ref] = value;
4217
4263
  }
4218
4264
  } else if (_isRef) {
@@ -5241,7 +5287,7 @@ const KeepAliveImpl = {
5241
5287
  return () => {
5242
5288
  pendingCacheKey = null;
5243
5289
  if (!slots.default) {
5244
- return null;
5290
+ return current = null;
5245
5291
  }
5246
5292
  const children = slots.default();
5247
5293
  const rawVNode = children[0];
@@ -5300,10 +5346,11 @@ const KeepAliveImpl = {
5300
5346
  };
5301
5347
  }
5302
5348
  };
5303
- {
5304
- KeepAliveImpl.__isBuildIn = true;
5305
- }
5306
- const KeepAlive = KeepAliveImpl;
5349
+ const decorate$2 = (t) => {
5350
+ t.__isBuiltIn = true;
5351
+ return t;
5352
+ };
5353
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5307
5354
  function matches(pattern, name) {
5308
5355
  if (isArray(pattern)) {
5309
5356
  return pattern.some((p) => matches(p, name));
@@ -7017,7 +7064,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7017
7064
  return vm;
7018
7065
  }
7019
7066
  }
7020
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7067
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7021
7068
  Vue.config = singletonApp.config;
7022
7069
  Vue.use = (plugin, ...options) => {
7023
7070
  if (plugin && isFunction(plugin.install)) {
@@ -10170,7 +10217,8 @@ function renderComponentRoot(instance) {
10170
10217
  data,
10171
10218
  setupState,
10172
10219
  ctx,
10173
- inheritAttrs
10220
+ inheritAttrs,
10221
+ isMounted
10174
10222
  } = instance;
10175
10223
  const prev = setCurrentRenderingInstance(instance);
10176
10224
  let result;
@@ -10311,7 +10359,7 @@ function renderComponentRoot(instance) {
10311
10359
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10312
10360
  );
10313
10361
  }
10314
- root.transition = vnode.transition;
10362
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10315
10363
  }
10316
10364
  if (!!(process.env.NODE_ENV !== "production") && setRoot) {
10317
10365
  setRoot(root);
@@ -10805,7 +10853,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10805
10853
  };
10806
10854
  }
10807
10855
  if (activeBranch) {
10808
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10856
+ if (parentNode(activeBranch.el) === container2) {
10809
10857
  anchor = next(activeBranch);
10810
10858
  }
10811
10859
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11959,29 +12007,6 @@ const computed = (getterOrOptions, debugOptions) => {
11959
12007
  return c;
11960
12008
  };
11961
12009
 
11962
- function useTemplateRef(key) {
11963
- const i = getCurrentInstance();
11964
- const r = shallowRef(null);
11965
- if (i) {
11966
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11967
- let desc;
11968
- if (!!(process.env.NODE_ENV !== "production") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11969
- warn$1(`useTemplateRef('${key}') already exists.`);
11970
- } else {
11971
- Object.defineProperty(refs, key, {
11972
- enumerable: true,
11973
- get: () => r.value,
11974
- set: (val) => r.value = val
11975
- });
11976
- }
11977
- } else if (!!(process.env.NODE_ENV !== "production")) {
11978
- warn$1(
11979
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11980
- );
11981
- }
11982
- return !!(process.env.NODE_ENV !== "production") ? readonly(r) : r;
11983
- }
11984
-
11985
12010
  function h(type, propsOrChildren, children) {
11986
12011
  const l = arguments.length;
11987
12012
  if (l === 2) {
@@ -12207,7 +12232,7 @@ function isMemoSame(cached, memo) {
12207
12232
  return true;
12208
12233
  }
12209
12234
 
12210
- const version = "3.5.0";
12235
+ const version = "3.5.2";
12211
12236
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12212
12237
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12213
12238
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12318,11 +12343,6 @@ const nodeOps = {
12318
12343
  const TRANSITION = "transition";
12319
12344
  const ANIMATION = "animation";
12320
12345
  const vtcKey = Symbol("_vtc");
12321
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12322
- Transition.displayName = "Transition";
12323
- {
12324
- Transition.__isBuiltIn = true;
12325
- }
12326
12346
  const DOMTransitionPropsValidators = {
12327
12347
  name: String,
12328
12348
  type: String,
@@ -12341,11 +12361,22 @@ const DOMTransitionPropsValidators = {
12341
12361
  leaveActiveClass: String,
12342
12362
  leaveToClass: String
12343
12363
  };
12344
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12364
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12345
12365
  {},
12346
12366
  BaseTransitionPropsValidators,
12347
12367
  DOMTransitionPropsValidators
12348
12368
  );
12369
+ const decorate$1 = (t) => {
12370
+ t.displayName = "Transition";
12371
+ t.props = TransitionPropsValidators;
12372
+ {
12373
+ t.__isBuiltIn = true;
12374
+ }
12375
+ return t;
12376
+ };
12377
+ const Transition = /* @__PURE__ */ decorate$1(
12378
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12379
+ );
12349
12380
  const callHook = (hook, args = []) => {
12350
12381
  if (isArray(hook)) {
12351
12382
  hook.forEach((h2) => h2(...args));
@@ -13559,7 +13590,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
13559
13590
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13560
13591
  const moveCbKey = Symbol("_moveCb");
13561
13592
  const enterCbKey = Symbol("_enterCb");
13562
- const TransitionGroupImpl = {
13593
+ const decorate = (t) => {
13594
+ delete t.props.mode;
13595
+ {
13596
+ t.__isBuiltIn = true;
13597
+ }
13598
+ return t;
13599
+ };
13600
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13563
13601
  name: "TransitionGroup",
13564
13602
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13565
13603
  tag: String,
@@ -13651,12 +13689,7 @@ const TransitionGroupImpl = {
13651
13689
  return createVNode(tag, null, children);
13652
13690
  };
13653
13691
  }
13654
- };
13655
- {
13656
- TransitionGroupImpl.__isBuiltIn = true;
13657
- }
13658
- const removeMode = (props) => delete props.mode;
13659
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13692
+ });
13660
13693
  const TransitionGroup = TransitionGroupImpl;
13661
13694
  function callPendingCbs(c) {
13662
13695
  const el = c.el;