@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
  **/
@@ -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;
@@ -1042,7 +1039,7 @@ const arrayInstrumentations = {
1042
1039
  },
1043
1040
  concat(...args) {
1044
1041
  return reactiveReadArray(this).concat(
1045
- ...args.map((x) => reactiveReadArray(x))
1042
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1046
1043
  );
1047
1044
  },
1048
1045
  entries() {
@@ -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);
@@ -3896,7 +3904,9 @@ const BaseTransitionImpl = {
3896
3904
  // #11061, ensure enterHooks is fresh after clone
3897
3905
  (hooks) => enterHooks = hooks
3898
3906
  );
3899
- setTransitionHooks(innerChild, enterHooks);
3907
+ if (innerChild.type !== Comment) {
3908
+ setTransitionHooks(innerChild, enterHooks);
3909
+ }
3900
3910
  const oldChild = instance.subTree;
3901
3911
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3902
3912
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3914,6 +3924,7 @@ const BaseTransitionImpl = {
3914
3924
  if (!(instance.job.flags & 8)) {
3915
3925
  instance.update();
3916
3926
  }
3927
+ delete leavingHooks.afterLeave;
3917
3928
  };
3918
3929
  return emptyPlaceholder(child);
3919
3930
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4194,6 +4205,34 @@ function markAsyncBoundary(instance) {
4194
4205
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4195
4206
  }
4196
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
+
4197
4236
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4198
4237
  if (isArray(rawRef)) {
4199
4238
  rawRef.forEach(
@@ -4222,10 +4261,17 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4222
4261
  const oldRef = oldRawRef && oldRawRef.r;
4223
4262
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4224
4263
  const setupState = owner.setupState;
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
+ };
4225
4271
  if (oldRef != null && oldRef !== ref) {
4226
4272
  if (isString(oldRef)) {
4227
4273
  refs[oldRef] = null;
4228
- if (hasOwn(setupState, oldRef)) {
4274
+ if (canSetSetupRef(oldRef)) {
4229
4275
  setupState[oldRef] = null;
4230
4276
  }
4231
4277
  } else if (isRef(oldRef)) {
@@ -4240,14 +4286,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4240
4286
  if (_isString || _isRef) {
4241
4287
  const doSet = () => {
4242
4288
  if (rawRef.f) {
4243
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4289
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4244
4290
  if (isUnmount) {
4245
4291
  isArray(existing) && remove(existing, refValue);
4246
4292
  } else {
4247
4293
  if (!isArray(existing)) {
4248
4294
  if (_isString) {
4249
4295
  refs[ref] = [refValue];
4250
- if (hasOwn(setupState, ref)) {
4296
+ if (canSetSetupRef(ref)) {
4251
4297
  setupState[ref] = refs[ref];
4252
4298
  }
4253
4299
  } else {
@@ -4260,7 +4306,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4260
4306
  }
4261
4307
  } else if (_isString) {
4262
4308
  refs[ref] = value;
4263
- if (hasOwn(setupState, ref)) {
4309
+ if (canSetSetupRef(ref)) {
4264
4310
  setupState[ref] = value;
4265
4311
  }
4266
4312
  } else if (_isRef) {
@@ -5278,7 +5324,7 @@ const KeepAliveImpl = {
5278
5324
  return () => {
5279
5325
  pendingCacheKey = null;
5280
5326
  if (!slots.default) {
5281
- return null;
5327
+ return current = null;
5282
5328
  }
5283
5329
  const children = slots.default();
5284
5330
  const rawVNode = children[0];
@@ -5337,10 +5383,11 @@ const KeepAliveImpl = {
5337
5383
  };
5338
5384
  }
5339
5385
  };
5340
- {
5341
- KeepAliveImpl.__isBuildIn = true;
5342
- }
5343
- const KeepAlive = KeepAliveImpl;
5386
+ const decorate$2 = (t) => {
5387
+ t.__isBuiltIn = true;
5388
+ return t;
5389
+ };
5390
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5344
5391
  function matches(pattern, name) {
5345
5392
  if (isArray(pattern)) {
5346
5393
  return pattern.some((p) => matches(p, name));
@@ -7052,7 +7099,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7052
7099
  return vm;
7053
7100
  }
7054
7101
  }
7055
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7102
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7056
7103
  Vue.config = singletonApp.config;
7057
7104
  Vue.use = (plugin, ...options) => {
7058
7105
  if (plugin && isFunction(plugin.install)) {
@@ -10165,7 +10212,8 @@ function renderComponentRoot(instance) {
10165
10212
  data,
10166
10213
  setupState,
10167
10214
  ctx,
10168
- inheritAttrs
10215
+ inheritAttrs,
10216
+ isMounted
10169
10217
  } = instance;
10170
10218
  const prev = setCurrentRenderingInstance(instance);
10171
10219
  let result;
@@ -10306,7 +10354,7 @@ function renderComponentRoot(instance) {
10306
10354
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10307
10355
  );
10308
10356
  }
10309
- root.transition = vnode.transition;
10357
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10310
10358
  }
10311
10359
  if (setRoot) {
10312
10360
  setRoot(root);
@@ -10800,7 +10848,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10800
10848
  };
10801
10849
  }
10802
10850
  if (activeBranch) {
10803
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10851
+ if (parentNode(activeBranch.el) === container2) {
10804
10852
  anchor = next(activeBranch);
10805
10853
  }
10806
10854
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11940,29 +11988,6 @@ const computed = (getterOrOptions, debugOptions) => {
11940
11988
  return c;
11941
11989
  };
11942
11990
 
11943
- function useTemplateRef(key) {
11944
- const i = getCurrentInstance();
11945
- const r = shallowRef(null);
11946
- if (i) {
11947
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11948
- let desc;
11949
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
11950
- warn$1(`useTemplateRef('${key}') already exists.`);
11951
- } else {
11952
- Object.defineProperty(refs, key, {
11953
- enumerable: true,
11954
- get: () => r.value,
11955
- set: (val) => r.value = val
11956
- });
11957
- }
11958
- } else {
11959
- warn$1(
11960
- `useTemplateRef() is called when there is no active component instance to be associated with.`
11961
- );
11962
- }
11963
- return readonly(r) ;
11964
- }
11965
-
11966
11991
  function h(type, propsOrChildren, children) {
11967
11992
  const l = arguments.length;
11968
11993
  if (l === 2) {
@@ -12188,7 +12213,7 @@ function isMemoSame(cached, memo) {
12188
12213
  return true;
12189
12214
  }
12190
12215
 
12191
- const version = "3.5.0";
12216
+ const version = "3.5.2";
12192
12217
  const warn = warn$1 ;
12193
12218
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12194
12219
  const devtools = devtools$1 ;
@@ -12299,11 +12324,6 @@ const nodeOps = {
12299
12324
  const TRANSITION$1 = "transition";
12300
12325
  const ANIMATION = "animation";
12301
12326
  const vtcKey = Symbol("_vtc");
12302
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12303
- Transition.displayName = "Transition";
12304
- {
12305
- Transition.__isBuiltIn = true;
12306
- }
12307
12327
  const DOMTransitionPropsValidators = {
12308
12328
  name: String,
12309
12329
  type: String,
@@ -12322,11 +12342,22 @@ const DOMTransitionPropsValidators = {
12322
12342
  leaveActiveClass: String,
12323
12343
  leaveToClass: String
12324
12344
  };
12325
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12345
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12326
12346
  {},
12327
12347
  BaseTransitionPropsValidators,
12328
12348
  DOMTransitionPropsValidators
12329
12349
  );
12350
+ const decorate$1 = (t) => {
12351
+ t.displayName = "Transition";
12352
+ t.props = TransitionPropsValidators;
12353
+ {
12354
+ t.__isBuiltIn = true;
12355
+ }
12356
+ return t;
12357
+ };
12358
+ const Transition = /* @__PURE__ */ decorate$1(
12359
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12360
+ );
12330
12361
  const callHook = (hook, args = []) => {
12331
12362
  if (isArray(hook)) {
12332
12363
  hook.forEach((h2) => h2(...args));
@@ -13540,7 +13571,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
13540
13571
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13541
13572
  const moveCbKey = Symbol("_moveCb");
13542
13573
  const enterCbKey = Symbol("_enterCb");
13543
- const TransitionGroupImpl = {
13574
+ const decorate = (t) => {
13575
+ delete t.props.mode;
13576
+ {
13577
+ t.__isBuiltIn = true;
13578
+ }
13579
+ return t;
13580
+ };
13581
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13544
13582
  name: "TransitionGroup",
13545
13583
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13546
13584
  tag: String,
@@ -13632,12 +13670,7 @@ const TransitionGroupImpl = {
13632
13670
  return createVNode(tag, null, children);
13633
13671
  };
13634
13672
  }
13635
- };
13636
- {
13637
- TransitionGroupImpl.__isBuiltIn = true;
13638
- }
13639
- const removeMode = (props) => delete props.mode;
13640
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13673
+ });
13641
13674
  const TransitionGroup = TransitionGroupImpl;
13642
13675
  function callPendingCbs(c) {
13643
13676
  const el = c.el;
@@ -15970,7 +16003,7 @@ const tokenizer = new Tokenizer(stack, {
15970
16003
  rawName: raw,
15971
16004
  exp: void 0,
15972
16005
  arg: void 0,
15973
- modifiers: raw === "." ? ["prop"] : [],
16006
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
15974
16007
  loc: getLoc(start)
15975
16008
  };
15976
16009
  if (name === "pre") {
@@ -16013,7 +16046,8 @@ const tokenizer = new Tokenizer(stack, {
16013
16046
  setLocEnd(arg.loc, end);
16014
16047
  }
16015
16048
  } else {
16016
- currentProp.modifiers.push(mod);
16049
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
16050
+ currentProp.modifiers.push(exp);
16017
16051
  }
16018
16052
  },
16019
16053
  onattribdata(start, end) {
@@ -16076,7 +16110,9 @@ const tokenizer = new Tokenizer(stack, {
16076
16110
  currentProp.forParseResult = parseForExpression(currentProp.exp);
16077
16111
  }
16078
16112
  let syncIndex = -1;
16079
- 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(
16080
16116
  "COMPILER_V_BIND_SYNC",
16081
16117
  currentOptions,
16082
16118
  currentProp.loc,
@@ -17163,7 +17199,7 @@ function createStructuralDirectiveTransform(name, fn) {
17163
17199
  };
17164
17200
  }
17165
17201
 
17166
- const PURE_ANNOTATION = `/*#__PURE__*/`;
17202
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
17167
17203
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
17168
17204
  function createCodegenContext(ast, {
17169
17205
  mode = "function",
@@ -18063,7 +18099,7 @@ const transformBind = (dir, _node, context) => {
18063
18099
  } else if (!arg.isStatic) {
18064
18100
  arg.content = `${arg.content} || ""`;
18065
18101
  }
18066
- if (modifiers.includes("camel")) {
18102
+ if (modifiers.some((mod) => mod.content === "camel")) {
18067
18103
  if (arg.type === 4) {
18068
18104
  if (arg.isStatic) {
18069
18105
  arg.content = camelize(arg.content);
@@ -18076,10 +18112,10 @@ const transformBind = (dir, _node, context) => {
18076
18112
  }
18077
18113
  }
18078
18114
  if (!context.inSSR) {
18079
- if (modifiers.includes("prop")) {
18115
+ if (modifiers.some((mod) => mod.content === "prop")) {
18080
18116
  injectPrefix(arg, ".");
18081
18117
  }
18082
- if (modifiers.includes("attr")) {
18118
+ if (modifiers.some((mod) => mod.content === "attr")) {
18083
18119
  injectPrefix(arg, "^");
18084
18120
  }
18085
18121
  }
@@ -18892,7 +18928,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
18892
18928
  }
18893
18929
  continue;
18894
18930
  }
18895
- if (isVBind && modifiers.includes("prop")) {
18931
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
18896
18932
  patchFlag |= 32;
18897
18933
  }
18898
18934
  const directiveTransform = context.directiveTransforms[name];
@@ -19406,7 +19442,7 @@ const transformModel$1 = (dir, node, context) => {
19406
19442
  createObjectProperty(eventName, assignmentExp)
19407
19443
  ];
19408
19444
  if (dir.modifiers.length && node.tagType === 1) {
19409
- 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(`, `);
19410
19446
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
19411
19447
  props.push(
19412
19448
  createObjectProperty(
@@ -19955,7 +19991,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
19955
19991
  const nonKeyModifiers = [];
19956
19992
  const eventOptionModifiers = [];
19957
19993
  for (let i = 0; i < modifiers.length; i++) {
19958
- const modifier = modifiers[i];
19994
+ const modifier = modifiers[i].content;
19959
19995
  if (modifier === "native" && checkCompatEnabled(
19960
19996
  "COMPILER_V_ON_NATIVE",
19961
19997
  context,