@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
  **/
@@ -688,9 +688,6 @@ function isDirty(sub) {
688
688
  return false;
689
689
  }
690
690
  function refreshComputed(computed) {
691
- if (computed.flags & 2) {
692
- return false;
693
- }
694
691
  if (computed.flags & 4 && !(computed.flags & 16)) {
695
692
  return;
696
693
  }
@@ -711,7 +708,7 @@ function refreshComputed(computed) {
711
708
  shouldTrack = true;
712
709
  try {
713
710
  prepareDeps(computed);
714
- const value = computed.fn();
711
+ const value = computed.fn(computed._value);
715
712
  if (dep.version === 0 || hasChanged(value, computed._value)) {
716
713
  computed._value = value;
717
714
  dep.version++;
@@ -820,7 +817,7 @@ class Dep {
820
817
  }
821
818
  }
822
819
  track(debugInfo) {
823
- if (!activeSub || !shouldTrack) {
820
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
824
821
  return;
825
822
  }
826
823
  let link = this.activeLink;
@@ -1833,7 +1830,7 @@ function toValue(source) {
1833
1830
  return isFunction(source) ? source() : unref(source);
1834
1831
  }
1835
1832
  const shallowUnwrapHandlers = {
1836
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1833
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1837
1834
  set: (target, key, value, receiver) => {
1838
1835
  const oldValue = target[key];
1839
1836
  if (isRef(oldValue) && !isRef(value)) {
@@ -1965,8 +1962,8 @@ class ComputedRefImpl {
1965
1962
  * @internal
1966
1963
  */
1967
1964
  notify() {
1965
+ this.flags |= 16;
1968
1966
  if (activeSub !== this) {
1969
- this.flags |= 16;
1970
1967
  this.dep.notify();
1971
1968
  }
1972
1969
  }
@@ -2535,9 +2532,7 @@ function queueJob(job) {
2535
2532
  } else {
2536
2533
  queue.splice(findInsertionIndex(jobId), 0, job);
2537
2534
  }
2538
- if (!(job.flags & 4)) {
2539
- job.flags |= 1;
2540
- }
2535
+ job.flags |= 1;
2541
2536
  queueFlush();
2542
2537
  }
2543
2538
  }
@@ -2553,9 +2548,7 @@ function queuePostFlushCb(cb) {
2553
2548
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2554
2549
  } else if (!(cb.flags & 1)) {
2555
2550
  pendingPostFlushCbs.push(cb);
2556
- if (!(cb.flags & 4)) {
2557
- cb.flags |= 1;
2558
- }
2551
+ cb.flags |= 1;
2559
2552
  }
2560
2553
  } else {
2561
2554
  pendingPostFlushCbs.push(...cb);
@@ -2577,6 +2570,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2577
2570
  }
2578
2571
  queue.splice(i, 1);
2579
2572
  i--;
2573
+ if (cb.flags & 4) {
2574
+ cb.flags &= ~1;
2575
+ }
2580
2576
  cb();
2581
2577
  cb.flags &= ~1;
2582
2578
  }
@@ -2601,6 +2597,9 @@ function flushPostFlushCbs(seen) {
2601
2597
  if (checkRecursiveUpdates(seen, cb)) {
2602
2598
  continue;
2603
2599
  }
2600
+ if (cb.flags & 4) {
2601
+ cb.flags &= ~1;
2602
+ }
2604
2603
  if (!(cb.flags & 8)) cb();
2605
2604
  cb.flags &= ~1;
2606
2605
  }
@@ -2623,6 +2622,9 @@ function flushJobs(seen) {
2623
2622
  if (check(job)) {
2624
2623
  continue;
2625
2624
  }
2625
+ if (job.flags & 4) {
2626
+ job.flags &= ~1;
2627
+ }
2626
2628
  callWithErrorHandling(
2627
2629
  job,
2628
2630
  job.i,
@@ -2632,6 +2634,12 @@ function flushJobs(seen) {
2632
2634
  }
2633
2635
  }
2634
2636
  } finally {
2637
+ for (; flushIndex < queue.length; flushIndex++) {
2638
+ const job = queue[flushIndex];
2639
+ if (job) {
2640
+ job.flags &= ~1;
2641
+ }
2642
+ }
2635
2643
  flushIndex = 0;
2636
2644
  queue.length = 0;
2637
2645
  flushPostFlushCbs(seen);
@@ -3916,6 +3924,7 @@ const BaseTransitionImpl = {
3916
3924
  if (!(instance.job.flags & 8)) {
3917
3925
  instance.update();
3918
3926
  }
3927
+ delete leavingHooks.afterLeave;
3919
3928
  };
3920
3929
  return emptyPlaceholder(child);
3921
3930
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4196,6 +4205,34 @@ function markAsyncBoundary(instance) {
4196
4205
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4197
4206
  }
4198
4207
 
4208
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4209
+ function useTemplateRef(key) {
4210
+ const i = getCurrentInstance();
4211
+ const r = shallowRef(null);
4212
+ if (i) {
4213
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4214
+ let desc;
4215
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4216
+ warn$1(`useTemplateRef('${key}') already exists.`);
4217
+ } else {
4218
+ Object.defineProperty(refs, key, {
4219
+ enumerable: true,
4220
+ get: () => r.value,
4221
+ set: (val) => r.value = val
4222
+ });
4223
+ }
4224
+ } else {
4225
+ warn$1(
4226
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4227
+ );
4228
+ }
4229
+ const ret = readonly(r) ;
4230
+ {
4231
+ knownTemplateRefs.add(ret);
4232
+ }
4233
+ return ret;
4234
+ }
4235
+
4199
4236
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4200
4237
  if (isArray(rawRef)) {
4201
4238
  rawRef.forEach(
@@ -4224,7 +4261,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4224
4261
  const oldRef = oldRawRef && oldRawRef.r;
4225
4262
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4226
4263
  const setupState = owner.setupState;
4227
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
4264
+ const rawSetupState = toRaw(setupState);
4265
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4266
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4267
+ return false;
4268
+ }
4269
+ return hasOwn(rawSetupState, key);
4270
+ };
4228
4271
  if (oldRef != null && oldRef !== ref) {
4229
4272
  if (isString(oldRef)) {
4230
4273
  refs[oldRef] = null;
@@ -5281,7 +5324,7 @@ const KeepAliveImpl = {
5281
5324
  return () => {
5282
5325
  pendingCacheKey = null;
5283
5326
  if (!slots.default) {
5284
- return null;
5327
+ return current = null;
5285
5328
  }
5286
5329
  const children = slots.default();
5287
5330
  const rawVNode = children[0];
@@ -7056,7 +7099,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7056
7099
  return vm;
7057
7100
  }
7058
7101
  }
7059
- Vue.version = `2.6.14-compat:${"3.5.1"}`;
7102
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7060
7103
  Vue.config = singletonApp.config;
7061
7104
  Vue.use = (plugin, ...options) => {
7062
7105
  if (plugin && isFunction(plugin.install)) {
@@ -10169,7 +10212,8 @@ function renderComponentRoot(instance) {
10169
10212
  data,
10170
10213
  setupState,
10171
10214
  ctx,
10172
- inheritAttrs
10215
+ inheritAttrs,
10216
+ isMounted
10173
10217
  } = instance;
10174
10218
  const prev = setCurrentRenderingInstance(instance);
10175
10219
  let result;
@@ -10310,7 +10354,7 @@ function renderComponentRoot(instance) {
10310
10354
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10311
10355
  );
10312
10356
  }
10313
- root.transition = vnode.transition;
10357
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10314
10358
  }
10315
10359
  if (setRoot) {
10316
10360
  setRoot(root);
@@ -10804,7 +10848,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10804
10848
  };
10805
10849
  }
10806
10850
  if (activeBranch) {
10807
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10851
+ if (parentNode(activeBranch.el) === container2) {
10808
10852
  anchor = next(activeBranch);
10809
10853
  }
10810
10854
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11944,29 +11988,6 @@ const computed = (getterOrOptions, debugOptions) => {
11944
11988
  return c;
11945
11989
  };
11946
11990
 
11947
- function useTemplateRef(key) {
11948
- const i = getCurrentInstance();
11949
- const r = shallowRef(null);
11950
- if (i) {
11951
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11952
- let desc;
11953
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11954
- warn$1(`useTemplateRef('${key}') already exists.`);
11955
- } else {
11956
- Object.defineProperty(refs, key, {
11957
- enumerable: true,
11958
- get: () => r.value,
11959
- set: (val) => r.value = val
11960
- });
11961
- }
11962
- } else {
11963
- warn$1(
11964
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11965
- );
11966
- }
11967
- return readonly(r) ;
11968
- }
11969
-
11970
11991
  function h(type, propsOrChildren, children) {
11971
11992
  const l = arguments.length;
11972
11993
  if (l === 2) {
@@ -12192,7 +12213,7 @@ function isMemoSame(cached, memo) {
12192
12213
  return true;
12193
12214
  }
12194
12215
 
12195
- const version = "3.5.1";
12216
+ const version = "3.5.2";
12196
12217
  const warn = warn$1 ;
12197
12218
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12198
12219
  const devtools = devtools$1 ;
@@ -15982,7 +16003,7 @@ const tokenizer = new Tokenizer(stack, {
15982
16003
  rawName: raw,
15983
16004
  exp: void 0,
15984
16005
  arg: void 0,
15985
- modifiers: raw === "." ? ["prop"] : [],
16006
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
15986
16007
  loc: getLoc(start)
15987
16008
  };
15988
16009
  if (name === "pre") {
@@ -16025,7 +16046,8 @@ const tokenizer = new Tokenizer(stack, {
16025
16046
  setLocEnd(arg.loc, end);
16026
16047
  }
16027
16048
  } else {
16028
- currentProp.modifiers.push(mod);
16049
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
16050
+ currentProp.modifiers.push(exp);
16029
16051
  }
16030
16052
  },
16031
16053
  onattribdata(start, end) {
@@ -16088,7 +16110,9 @@ const tokenizer = new Tokenizer(stack, {
16088
16110
  currentProp.forParseResult = parseForExpression(currentProp.exp);
16089
16111
  }
16090
16112
  let syncIndex = -1;
16091
- if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
16113
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex(
16114
+ (mod) => mod.content === "sync"
16115
+ )) > -1 && checkCompatEnabled(
16092
16116
  "COMPILER_V_BIND_SYNC",
16093
16117
  currentOptions,
16094
16118
  currentProp.loc,
@@ -18075,7 +18099,7 @@ const transformBind = (dir, _node, context) => {
18075
18099
  } else if (!arg.isStatic) {
18076
18100
  arg.content = `${arg.content} || ""`;
18077
18101
  }
18078
- if (modifiers.includes("camel")) {
18102
+ if (modifiers.some((mod) => mod.content === "camel")) {
18079
18103
  if (arg.type === 4) {
18080
18104
  if (arg.isStatic) {
18081
18105
  arg.content = camelize(arg.content);
@@ -18088,10 +18112,10 @@ const transformBind = (dir, _node, context) => {
18088
18112
  }
18089
18113
  }
18090
18114
  if (!context.inSSR) {
18091
- if (modifiers.includes("prop")) {
18115
+ if (modifiers.some((mod) => mod.content === "prop")) {
18092
18116
  injectPrefix(arg, ".");
18093
18117
  }
18094
- if (modifiers.includes("attr")) {
18118
+ if (modifiers.some((mod) => mod.content === "attr")) {
18095
18119
  injectPrefix(arg, "^");
18096
18120
  }
18097
18121
  }
@@ -18904,7 +18928,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
18904
18928
  }
18905
18929
  continue;
18906
18930
  }
18907
- if (isVBind && modifiers.includes("prop")) {
18931
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
18908
18932
  patchFlag |= 32;
18909
18933
  }
18910
18934
  const directiveTransform = context.directiveTransforms[name];
@@ -19418,7 +19442,7 @@ const transformModel$1 = (dir, node, context) => {
19418
19442
  createObjectProperty(eventName, assignmentExp)
19419
19443
  ];
19420
19444
  if (dir.modifiers.length && node.tagType === 1) {
19421
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19445
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19422
19446
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
19423
19447
  props.push(
19424
19448
  createObjectProperty(
@@ -19967,7 +19991,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
19967
19991
  const nonKeyModifiers = [];
19968
19992
  const eventOptionModifiers = [];
19969
19993
  for (let i = 0; i < modifiers.length; i++) {
19970
- const modifier = modifiers[i];
19994
+ const modifier = modifiers[i].content;
19971
19995
  if (modifier === "native" && checkCompatEnabled(
19972
19996
  "COMPILER_V_ON_NATIVE",
19973
19997
  context,