@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
  **/
@@ -691,9 +691,6 @@ var Vue = (function () {
691
691
  return false;
692
692
  }
693
693
  function refreshComputed(computed) {
694
- if (computed.flags & 2) {
695
- return false;
696
- }
697
694
  if (computed.flags & 4 && !(computed.flags & 16)) {
698
695
  return;
699
696
  }
@@ -714,7 +711,7 @@ var Vue = (function () {
714
711
  shouldTrack = true;
715
712
  try {
716
713
  prepareDeps(computed);
717
- const value = computed.fn();
714
+ const value = computed.fn(computed._value);
718
715
  if (dep.version === 0 || hasChanged(value, computed._value)) {
719
716
  computed._value = value;
720
717
  dep.version++;
@@ -823,7 +820,7 @@ var Vue = (function () {
823
820
  }
824
821
  }
825
822
  track(debugInfo) {
826
- if (!activeSub || !shouldTrack) {
823
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
827
824
  return;
828
825
  }
829
826
  let link = this.activeLink;
@@ -1045,7 +1042,7 @@ var Vue = (function () {
1045
1042
  },
1046
1043
  concat(...args) {
1047
1044
  return reactiveReadArray(this).concat(
1048
- ...args.map((x) => reactiveReadArray(x))
1045
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1049
1046
  );
1050
1047
  },
1051
1048
  entries() {
@@ -1836,7 +1833,7 @@ var Vue = (function () {
1836
1833
  return isFunction(source) ? source() : unref(source);
1837
1834
  }
1838
1835
  const shallowUnwrapHandlers = {
1839
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1836
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1840
1837
  set: (target, key, value, receiver) => {
1841
1838
  const oldValue = target[key];
1842
1839
  if (isRef(oldValue) && !isRef(value)) {
@@ -1968,8 +1965,8 @@ var Vue = (function () {
1968
1965
  * @internal
1969
1966
  */
1970
1967
  notify() {
1968
+ this.flags |= 16;
1971
1969
  if (activeSub !== this) {
1972
- this.flags |= 16;
1973
1970
  this.dep.notify();
1974
1971
  }
1975
1972
  }
@@ -2538,9 +2535,7 @@ var Vue = (function () {
2538
2535
  } else {
2539
2536
  queue.splice(findInsertionIndex(jobId), 0, job);
2540
2537
  }
2541
- if (!(job.flags & 4)) {
2542
- job.flags |= 1;
2543
- }
2538
+ job.flags |= 1;
2544
2539
  queueFlush();
2545
2540
  }
2546
2541
  }
@@ -2556,9 +2551,7 @@ var Vue = (function () {
2556
2551
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2557
2552
  } else if (!(cb.flags & 1)) {
2558
2553
  pendingPostFlushCbs.push(cb);
2559
- if (!(cb.flags & 4)) {
2560
- cb.flags |= 1;
2561
- }
2554
+ cb.flags |= 1;
2562
2555
  }
2563
2556
  } else {
2564
2557
  pendingPostFlushCbs.push(...cb);
@@ -2580,6 +2573,9 @@ var Vue = (function () {
2580
2573
  }
2581
2574
  queue.splice(i, 1);
2582
2575
  i--;
2576
+ if (cb.flags & 4) {
2577
+ cb.flags &= ~1;
2578
+ }
2583
2579
  cb();
2584
2580
  cb.flags &= ~1;
2585
2581
  }
@@ -2604,6 +2600,9 @@ var Vue = (function () {
2604
2600
  if (checkRecursiveUpdates(seen, cb)) {
2605
2601
  continue;
2606
2602
  }
2603
+ if (cb.flags & 4) {
2604
+ cb.flags &= ~1;
2605
+ }
2607
2606
  if (!(cb.flags & 8)) cb();
2608
2607
  cb.flags &= ~1;
2609
2608
  }
@@ -2626,6 +2625,9 @@ var Vue = (function () {
2626
2625
  if (check(job)) {
2627
2626
  continue;
2628
2627
  }
2628
+ if (job.flags & 4) {
2629
+ job.flags &= ~1;
2630
+ }
2629
2631
  callWithErrorHandling(
2630
2632
  job,
2631
2633
  job.i,
@@ -2635,6 +2637,12 @@ var Vue = (function () {
2635
2637
  }
2636
2638
  }
2637
2639
  } finally {
2640
+ for (; flushIndex < queue.length; flushIndex++) {
2641
+ const job = queue[flushIndex];
2642
+ if (job) {
2643
+ job.flags &= ~1;
2644
+ }
2645
+ }
2638
2646
  flushIndex = 0;
2639
2647
  queue.length = 0;
2640
2648
  flushPostFlushCbs(seen);
@@ -3899,7 +3907,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3899
3907
  // #11061, ensure enterHooks is fresh after clone
3900
3908
  (hooks) => enterHooks = hooks
3901
3909
  );
3902
- setTransitionHooks(innerChild, enterHooks);
3910
+ if (innerChild.type !== Comment) {
3911
+ setTransitionHooks(innerChild, enterHooks);
3912
+ }
3903
3913
  const oldChild = instance.subTree;
3904
3914
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3905
3915
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3917,6 +3927,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3917
3927
  if (!(instance.job.flags & 8)) {
3918
3928
  instance.update();
3919
3929
  }
3930
+ delete leavingHooks.afterLeave;
3920
3931
  };
3921
3932
  return emptyPlaceholder(child);
3922
3933
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4197,6 +4208,34 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4197
4208
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4198
4209
  }
4199
4210
 
4211
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4212
+ function useTemplateRef(key) {
4213
+ const i = getCurrentInstance();
4214
+ const r = shallowRef(null);
4215
+ if (i) {
4216
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4217
+ let desc;
4218
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4219
+ warn$1(`useTemplateRef('${key}') already exists.`);
4220
+ } else {
4221
+ Object.defineProperty(refs, key, {
4222
+ enumerable: true,
4223
+ get: () => r.value,
4224
+ set: (val) => r.value = val
4225
+ });
4226
+ }
4227
+ } else {
4228
+ warn$1(
4229
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4230
+ );
4231
+ }
4232
+ const ret = readonly(r) ;
4233
+ {
4234
+ knownTemplateRefs.add(ret);
4235
+ }
4236
+ return ret;
4237
+ }
4238
+
4200
4239
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4201
4240
  if (isArray(rawRef)) {
4202
4241
  rawRef.forEach(
@@ -4225,10 +4264,17 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4225
4264
  const oldRef = oldRawRef && oldRawRef.r;
4226
4265
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4227
4266
  const setupState = owner.setupState;
4267
+ const rawSetupState = toRaw(setupState);
4268
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4269
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4270
+ return false;
4271
+ }
4272
+ return hasOwn(rawSetupState, key);
4273
+ };
4228
4274
  if (oldRef != null && oldRef !== ref) {
4229
4275
  if (isString(oldRef)) {
4230
4276
  refs[oldRef] = null;
4231
- if (hasOwn(setupState, oldRef)) {
4277
+ if (canSetSetupRef(oldRef)) {
4232
4278
  setupState[oldRef] = null;
4233
4279
  }
4234
4280
  } else if (isRef(oldRef)) {
@@ -4243,14 +4289,14 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4243
4289
  if (_isString || _isRef) {
4244
4290
  const doSet = () => {
4245
4291
  if (rawRef.f) {
4246
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4292
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4247
4293
  if (isUnmount) {
4248
4294
  isArray(existing) && remove(existing, refValue);
4249
4295
  } else {
4250
4296
  if (!isArray(existing)) {
4251
4297
  if (_isString) {
4252
4298
  refs[ref] = [refValue];
4253
- if (hasOwn(setupState, ref)) {
4299
+ if (canSetSetupRef(ref)) {
4254
4300
  setupState[ref] = refs[ref];
4255
4301
  }
4256
4302
  } else {
@@ -4263,7 +4309,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4263
4309
  }
4264
4310
  } else if (_isString) {
4265
4311
  refs[ref] = value;
4266
- if (hasOwn(setupState, ref)) {
4312
+ if (canSetSetupRef(ref)) {
4267
4313
  setupState[ref] = value;
4268
4314
  }
4269
4315
  } else if (_isRef) {
@@ -5275,7 +5321,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5275
5321
  return () => {
5276
5322
  pendingCacheKey = null;
5277
5323
  if (!slots.default) {
5278
- return null;
5324
+ return current = null;
5279
5325
  }
5280
5326
  const children = slots.default();
5281
5327
  const rawVNode = children[0];
@@ -5334,10 +5380,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5334
5380
  };
5335
5381
  }
5336
5382
  };
5337
- {
5338
- KeepAliveImpl.__isBuildIn = true;
5339
- }
5340
- const KeepAlive = KeepAliveImpl;
5383
+ const decorate$2 = (t) => {
5384
+ t.__isBuiltIn = true;
5385
+ return t;
5386
+ };
5387
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5341
5388
  function matches(pattern, name) {
5342
5389
  if (isArray(pattern)) {
5343
5390
  return pattern.some((p) => matches(p, name));
@@ -7046,7 +7093,7 @@ If this is a native custom element, make sure to exclude it from component resol
7046
7093
  return vm;
7047
7094
  }
7048
7095
  }
7049
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7096
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7050
7097
  Vue.config = singletonApp.config;
7051
7098
  Vue.use = (plugin, ...options) => {
7052
7099
  if (plugin && isFunction(plugin.install)) {
@@ -10137,7 +10184,8 @@ If you want to remount the same app, move your app creation logic into a factory
10137
10184
  data,
10138
10185
  setupState,
10139
10186
  ctx,
10140
- inheritAttrs
10187
+ inheritAttrs,
10188
+ isMounted
10141
10189
  } = instance;
10142
10190
  const prev = setCurrentRenderingInstance(instance);
10143
10191
  let result;
@@ -10278,7 +10326,7 @@ If you want to remount the same app, move your app creation logic into a factory
10278
10326
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10279
10327
  );
10280
10328
  }
10281
- root.transition = vnode.transition;
10329
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10282
10330
  }
10283
10331
  if (setRoot) {
10284
10332
  setRoot(root);
@@ -10772,7 +10820,7 @@ If you want to remount the same app, move your app creation logic into a factory
10772
10820
  };
10773
10821
  }
10774
10822
  if (activeBranch) {
10775
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10823
+ if (parentNode(activeBranch.el) === container2) {
10776
10824
  anchor = next(activeBranch);
10777
10825
  }
10778
10826
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11898,29 +11946,6 @@ Component that was made reactive: `,
11898
11946
  return c;
11899
11947
  };
11900
11948
 
11901
- function useTemplateRef(key) {
11902
- const i = getCurrentInstance();
11903
- const r = shallowRef(null);
11904
- if (i) {
11905
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11906
- let desc;
11907
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11908
- warn$1(`useTemplateRef('${key}') already exists.`);
11909
- } else {
11910
- Object.defineProperty(refs, key, {
11911
- enumerable: true,
11912
- get: () => r.value,
11913
- set: (val) => r.value = val
11914
- });
11915
- }
11916
- } else {
11917
- warn$1(
11918
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11919
- );
11920
- }
11921
- return readonly(r) ;
11922
- }
11923
-
11924
11949
  function h(type, propsOrChildren, children) {
11925
11950
  const l = arguments.length;
11926
11951
  if (l === 2) {
@@ -12146,7 +12171,7 @@ Component that was made reactive: `,
12146
12171
  return true;
12147
12172
  }
12148
12173
 
12149
- const version = "3.5.0";
12174
+ const version = "3.5.2";
12150
12175
  const warn = warn$1 ;
12151
12176
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12152
12177
  const devtools = devtools$1 ;
@@ -12247,11 +12272,6 @@ Component that was made reactive: `,
12247
12272
  const TRANSITION$1 = "transition";
12248
12273
  const ANIMATION = "animation";
12249
12274
  const vtcKey = Symbol("_vtc");
12250
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12251
- Transition.displayName = "Transition";
12252
- {
12253
- Transition.__isBuiltIn = true;
12254
- }
12255
12275
  const DOMTransitionPropsValidators = {
12256
12276
  name: String,
12257
12277
  type: String,
@@ -12270,11 +12290,22 @@ Component that was made reactive: `,
12270
12290
  leaveActiveClass: String,
12271
12291
  leaveToClass: String
12272
12292
  };
12273
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12293
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12274
12294
  {},
12275
12295
  BaseTransitionPropsValidators,
12276
12296
  DOMTransitionPropsValidators
12277
12297
  );
12298
+ const decorate$1 = (t) => {
12299
+ t.displayName = "Transition";
12300
+ t.props = TransitionPropsValidators;
12301
+ {
12302
+ t.__isBuiltIn = true;
12303
+ }
12304
+ return t;
12305
+ };
12306
+ const Transition = /* @__PURE__ */ decorate$1(
12307
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12308
+ );
12278
12309
  const callHook = (hook, args = []) => {
12279
12310
  if (isArray(hook)) {
12280
12311
  hook.forEach((h2) => h2(...args));
@@ -13469,7 +13500,14 @@ Expected function or array of functions, received type ${typeof value}.`
13469
13500
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13470
13501
  const moveCbKey = Symbol("_moveCb");
13471
13502
  const enterCbKey = Symbol("_enterCb");
13472
- const TransitionGroupImpl = {
13503
+ const decorate = (t) => {
13504
+ delete t.props.mode;
13505
+ {
13506
+ t.__isBuiltIn = true;
13507
+ }
13508
+ return t;
13509
+ };
13510
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13473
13511
  name: "TransitionGroup",
13474
13512
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13475
13513
  tag: String,
@@ -13561,12 +13599,7 @@ Expected function or array of functions, received type ${typeof value}.`
13561
13599
  return createVNode(tag, null, children);
13562
13600
  };
13563
13601
  }
13564
- };
13565
- {
13566
- TransitionGroupImpl.__isBuiltIn = true;
13567
- }
13568
- const removeMode = (props) => delete props.mode;
13569
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13602
+ });
13570
13603
  const TransitionGroup = TransitionGroupImpl;
13571
13604
  function callPendingCbs(c) {
13572
13605
  const el = c.el;
@@ -15858,7 +15891,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15858
15891
  rawName: raw,
15859
15892
  exp: void 0,
15860
15893
  arg: void 0,
15861
- modifiers: raw === "." ? ["prop"] : [],
15894
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
15862
15895
  loc: getLoc(start)
15863
15896
  };
15864
15897
  if (name === "pre") {
@@ -15901,7 +15934,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15901
15934
  setLocEnd(arg.loc, end);
15902
15935
  }
15903
15936
  } else {
15904
- currentProp.modifiers.push(mod);
15937
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
15938
+ currentProp.modifiers.push(exp);
15905
15939
  }
15906
15940
  },
15907
15941
  onattribdata(start, end) {
@@ -15964,7 +15998,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15964
15998
  currentProp.forParseResult = parseForExpression(currentProp.exp);
15965
15999
  }
15966
16000
  let syncIndex = -1;
15967
- if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
16001
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex(
16002
+ (mod) => mod.content === "sync"
16003
+ )) > -1 && checkCompatEnabled(
15968
16004
  "COMPILER_V_BIND_SYNC",
15969
16005
  currentOptions,
15970
16006
  currentProp.loc,
@@ -17051,7 +17087,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17051
17087
  };
17052
17088
  }
17053
17089
 
17054
- const PURE_ANNOTATION = `/*#__PURE__*/`;
17090
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
17055
17091
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
17056
17092
  function createCodegenContext(ast, {
17057
17093
  mode = "function",
@@ -17951,7 +17987,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17951
17987
  } else if (!arg.isStatic) {
17952
17988
  arg.content = `${arg.content} || ""`;
17953
17989
  }
17954
- if (modifiers.includes("camel")) {
17990
+ if (modifiers.some((mod) => mod.content === "camel")) {
17955
17991
  if (arg.type === 4) {
17956
17992
  if (arg.isStatic) {
17957
17993
  arg.content = camelize(arg.content);
@@ -17964,10 +18000,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17964
18000
  }
17965
18001
  }
17966
18002
  if (!context.inSSR) {
17967
- if (modifiers.includes("prop")) {
18003
+ if (modifiers.some((mod) => mod.content === "prop")) {
17968
18004
  injectPrefix(arg, ".");
17969
18005
  }
17970
- if (modifiers.includes("attr")) {
18006
+ if (modifiers.some((mod) => mod.content === "attr")) {
17971
18007
  injectPrefix(arg, "^");
17972
18008
  }
17973
18009
  }
@@ -18780,7 +18816,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18780
18816
  }
18781
18817
  continue;
18782
18818
  }
18783
- if (isVBind && modifiers.includes("prop")) {
18819
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
18784
18820
  patchFlag |= 32;
18785
18821
  }
18786
18822
  const directiveTransform = context.directiveTransforms[name];
@@ -19294,7 +19330,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19294
19330
  createObjectProperty(eventName, assignmentExp)
19295
19331
  ];
19296
19332
  if (dir.modifiers.length && node.tagType === 1) {
19297
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19333
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19298
19334
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
19299
19335
  props.push(
19300
19336
  createObjectProperty(
@@ -19843,7 +19879,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19843
19879
  const nonKeyModifiers = [];
19844
19880
  const eventOptionModifiers = [];
19845
19881
  for (let i = 0; i < modifiers.length; i++) {
19846
- const modifier = modifiers[i];
19882
+ const modifier = modifiers[i].content;
19847
19883
  if (modifier === "native" && checkCompatEnabled(
19848
19884
  "COMPILER_V_ON_NATIVE",
19849
19885
  context,