@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -738,9 +738,6 @@ function isDirty(sub) {
738
738
  return false;
739
739
  }
740
740
  function refreshComputed(computed) {
741
- if (computed.flags & 2) {
742
- return false;
743
- }
744
741
  if (computed.flags & 4 && !(computed.flags & 16)) {
745
742
  return;
746
743
  }
@@ -761,7 +758,7 @@ function refreshComputed(computed) {
761
758
  shouldTrack = true;
762
759
  try {
763
760
  prepareDeps(computed);
764
- const value = computed.fn();
761
+ const value = computed.fn(computed._value);
765
762
  if (dep.version === 0 || hasChanged(value, computed._value)) {
766
763
  computed._value = value;
767
764
  dep.version++;
@@ -870,7 +867,7 @@ class Dep {
870
867
  }
871
868
  }
872
869
  track(debugInfo) {
873
- if (!activeSub || !shouldTrack) {
870
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
874
871
  return;
875
872
  }
876
873
  let link = this.activeLink;
@@ -1092,7 +1089,7 @@ const arrayInstrumentations = {
1092
1089
  },
1093
1090
  concat(...args) {
1094
1091
  return reactiveReadArray(this).concat(
1095
- ...args.map((x) => reactiveReadArray(x))
1092
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1096
1093
  );
1097
1094
  },
1098
1095
  entries() {
@@ -1883,7 +1880,7 @@ function toValue(source) {
1883
1880
  return isFunction(source) ? source() : unref(source);
1884
1881
  }
1885
1882
  const shallowUnwrapHandlers = {
1886
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1883
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1887
1884
  set: (target, key, value, receiver) => {
1888
1885
  const oldValue = target[key];
1889
1886
  if (isRef(oldValue) && !isRef(value)) {
@@ -2015,8 +2012,8 @@ class ComputedRefImpl {
2015
2012
  * @internal
2016
2013
  */
2017
2014
  notify() {
2015
+ this.flags |= 16;
2018
2016
  if (activeSub !== this) {
2019
- this.flags |= 16;
2020
2017
  this.dep.notify();
2021
2018
  }
2022
2019
  }
@@ -2585,9 +2582,7 @@ function queueJob(job) {
2585
2582
  } else {
2586
2583
  queue.splice(findInsertionIndex(jobId), 0, job);
2587
2584
  }
2588
- if (!(job.flags & 4)) {
2589
- job.flags |= 1;
2590
- }
2585
+ job.flags |= 1;
2591
2586
  queueFlush();
2592
2587
  }
2593
2588
  }
@@ -2603,9 +2598,7 @@ function queuePostFlushCb(cb) {
2603
2598
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2604
2599
  } else if (!(cb.flags & 1)) {
2605
2600
  pendingPostFlushCbs.push(cb);
2606
- if (!(cb.flags & 4)) {
2607
- cb.flags |= 1;
2608
- }
2601
+ cb.flags |= 1;
2609
2602
  }
2610
2603
  } else {
2611
2604
  pendingPostFlushCbs.push(...cb);
@@ -2627,6 +2620,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2627
2620
  }
2628
2621
  queue.splice(i, 1);
2629
2622
  i--;
2623
+ if (cb.flags & 4) {
2624
+ cb.flags &= ~1;
2625
+ }
2630
2626
  cb();
2631
2627
  cb.flags &= ~1;
2632
2628
  }
@@ -2651,6 +2647,9 @@ function flushPostFlushCbs(seen) {
2651
2647
  if (checkRecursiveUpdates(seen, cb)) {
2652
2648
  continue;
2653
2649
  }
2650
+ if (cb.flags & 4) {
2651
+ cb.flags &= ~1;
2652
+ }
2654
2653
  if (!(cb.flags & 8)) cb();
2655
2654
  cb.flags &= ~1;
2656
2655
  }
@@ -2673,6 +2672,9 @@ function flushJobs(seen) {
2673
2672
  if (check(job)) {
2674
2673
  continue;
2675
2674
  }
2675
+ if (job.flags & 4) {
2676
+ job.flags &= ~1;
2677
+ }
2676
2678
  callWithErrorHandling(
2677
2679
  job,
2678
2680
  job.i,
@@ -2682,6 +2684,12 @@ function flushJobs(seen) {
2682
2684
  }
2683
2685
  }
2684
2686
  } finally {
2687
+ for (; flushIndex < queue.length; flushIndex++) {
2688
+ const job = queue[flushIndex];
2689
+ if (job) {
2690
+ job.flags &= ~1;
2691
+ }
2692
+ }
2685
2693
  flushIndex = 0;
2686
2694
  queue.length = 0;
2687
2695
  flushPostFlushCbs(seen);
@@ -3946,7 +3954,9 @@ const BaseTransitionImpl = {
3946
3954
  // #11061, ensure enterHooks is fresh after clone
3947
3955
  (hooks) => enterHooks = hooks
3948
3956
  );
3949
- setTransitionHooks(innerChild, enterHooks);
3957
+ if (innerChild.type !== Comment) {
3958
+ setTransitionHooks(innerChild, enterHooks);
3959
+ }
3950
3960
  const oldChild = instance.subTree;
3951
3961
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3952
3962
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3964,6 +3974,7 @@ const BaseTransitionImpl = {
3964
3974
  if (!(instance.job.flags & 8)) {
3965
3975
  instance.update();
3966
3976
  }
3977
+ delete leavingHooks.afterLeave;
3967
3978
  };
3968
3979
  return emptyPlaceholder(child);
3969
3980
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -4244,6 +4255,34 @@ function markAsyncBoundary(instance) {
4244
4255
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
4245
4256
  }
4246
4257
 
4258
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
4259
+ function useTemplateRef(key) {
4260
+ const i = getCurrentInstance();
4261
+ const r = shallowRef(null);
4262
+ if (i) {
4263
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
4264
+ let desc;
4265
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
4266
+ warn$1(`useTemplateRef('${key}') already exists.`);
4267
+ } else {
4268
+ Object.defineProperty(refs, key, {
4269
+ enumerable: true,
4270
+ get: () => r.value,
4271
+ set: (val) => r.value = val
4272
+ });
4273
+ }
4274
+ } else {
4275
+ warn$1(
4276
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
4277
+ );
4278
+ }
4279
+ const ret = readonly(r) ;
4280
+ {
4281
+ knownTemplateRefs.add(ret);
4282
+ }
4283
+ return ret;
4284
+ }
4285
+
4247
4286
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4248
4287
  if (isArray(rawRef)) {
4249
4288
  rawRef.forEach(
@@ -4272,10 +4311,17 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4272
4311
  const oldRef = oldRawRef && oldRawRef.r;
4273
4312
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4274
4313
  const setupState = owner.setupState;
4314
+ const rawSetupState = toRaw(setupState);
4315
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4316
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4317
+ return false;
4318
+ }
4319
+ return hasOwn(rawSetupState, key);
4320
+ };
4275
4321
  if (oldRef != null && oldRef !== ref) {
4276
4322
  if (isString(oldRef)) {
4277
4323
  refs[oldRef] = null;
4278
- if (hasOwn(setupState, oldRef)) {
4324
+ if (canSetSetupRef(oldRef)) {
4279
4325
  setupState[oldRef] = null;
4280
4326
  }
4281
4327
  } else if (isRef(oldRef)) {
@@ -4290,14 +4336,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4290
4336
  if (_isString || _isRef) {
4291
4337
  const doSet = () => {
4292
4338
  if (rawRef.f) {
4293
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
4339
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4294
4340
  if (isUnmount) {
4295
4341
  isArray(existing) && remove(existing, refValue);
4296
4342
  } else {
4297
4343
  if (!isArray(existing)) {
4298
4344
  if (_isString) {
4299
4345
  refs[ref] = [refValue];
4300
- if (hasOwn(setupState, ref)) {
4346
+ if (canSetSetupRef(ref)) {
4301
4347
  setupState[ref] = refs[ref];
4302
4348
  }
4303
4349
  } else {
@@ -4310,7 +4356,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4310
4356
  }
4311
4357
  } else if (_isString) {
4312
4358
  refs[ref] = value;
4313
- if (hasOwn(setupState, ref)) {
4359
+ if (canSetSetupRef(ref)) {
4314
4360
  setupState[ref] = value;
4315
4361
  }
4316
4362
  } else if (_isRef) {
@@ -5328,7 +5374,7 @@ const KeepAliveImpl = {
5328
5374
  return () => {
5329
5375
  pendingCacheKey = null;
5330
5376
  if (!slots.default) {
5331
- return null;
5377
+ return current = null;
5332
5378
  }
5333
5379
  const children = slots.default();
5334
5380
  const rawVNode = children[0];
@@ -5387,10 +5433,11 @@ const KeepAliveImpl = {
5387
5433
  };
5388
5434
  }
5389
5435
  };
5390
- {
5391
- KeepAliveImpl.__isBuildIn = true;
5392
- }
5393
- const KeepAlive = KeepAliveImpl;
5436
+ const decorate$2 = (t) => {
5437
+ t.__isBuiltIn = true;
5438
+ return t;
5439
+ };
5440
+ const KeepAlive = /* @__PURE__ */ decorate$2(KeepAliveImpl) ;
5394
5441
  function matches(pattern, name) {
5395
5442
  if (isArray(pattern)) {
5396
5443
  return pattern.some((p) => matches(p, name));
@@ -7102,7 +7149,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7102
7149
  return vm;
7103
7150
  }
7104
7151
  }
7105
- Vue.version = `2.6.14-compat:${"3.5.0"}`;
7152
+ Vue.version = `2.6.14-compat:${"3.5.2"}`;
7106
7153
  Vue.config = singletonApp.config;
7107
7154
  Vue.use = (plugin, ...options) => {
7108
7155
  if (plugin && isFunction(plugin.install)) {
@@ -10215,7 +10262,8 @@ function renderComponentRoot(instance) {
10215
10262
  data,
10216
10263
  setupState,
10217
10264
  ctx,
10218
- inheritAttrs
10265
+ inheritAttrs,
10266
+ isMounted
10219
10267
  } = instance;
10220
10268
  const prev = setCurrentRenderingInstance(instance);
10221
10269
  let result;
@@ -10356,7 +10404,7 @@ function renderComponentRoot(instance) {
10356
10404
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10357
10405
  );
10358
10406
  }
10359
- root.transition = vnode.transition;
10407
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10360
10408
  }
10361
10409
  if (setRoot) {
10362
10410
  setRoot(root);
@@ -10850,7 +10898,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10850
10898
  };
10851
10899
  }
10852
10900
  if (activeBranch) {
10853
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
10901
+ if (parentNode(activeBranch.el) === container2) {
10854
10902
  anchor = next(activeBranch);
10855
10903
  }
10856
10904
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -11990,29 +12038,6 @@ const computed = (getterOrOptions, debugOptions) => {
11990
12038
  return c;
11991
12039
  };
11992
12040
 
11993
- function useTemplateRef(key) {
11994
- const i = getCurrentInstance();
11995
- const r = shallowRef(null);
11996
- if (i) {
11997
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
11998
- let desc;
11999
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
12000
- warn$1(`useTemplateRef('${key}') already exists.`);
12001
- } else {
12002
- Object.defineProperty(refs, key, {
12003
- enumerable: true,
12004
- get: () => r.value,
12005
- set: (val) => r.value = val
12006
- });
12007
- }
12008
- } else {
12009
- warn$1(
12010
- `useTemplateRef() is called when there is no active component instance to be associated with.`
12011
- );
12012
- }
12013
- return readonly(r) ;
12014
- }
12015
-
12016
12041
  function h(type, propsOrChildren, children) {
12017
12042
  const l = arguments.length;
12018
12043
  if (l === 2) {
@@ -12238,7 +12263,7 @@ function isMemoSame(cached, memo) {
12238
12263
  return true;
12239
12264
  }
12240
12265
 
12241
- const version = "3.5.0";
12266
+ const version = "3.5.2";
12242
12267
  const warn = warn$1 ;
12243
12268
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12244
12269
  const devtools = devtools$1 ;
@@ -12349,11 +12374,6 @@ const nodeOps = {
12349
12374
  const TRANSITION$1 = "transition";
12350
12375
  const ANIMATION = "animation";
12351
12376
  const vtcKey = Symbol("_vtc");
12352
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
12353
- Transition.displayName = "Transition";
12354
- {
12355
- Transition.__isBuiltIn = true;
12356
- }
12357
12377
  const DOMTransitionPropsValidators = {
12358
12378
  name: String,
12359
12379
  type: String,
@@ -12372,11 +12392,22 @@ const DOMTransitionPropsValidators = {
12372
12392
  leaveActiveClass: String,
12373
12393
  leaveToClass: String
12374
12394
  };
12375
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
12395
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
12376
12396
  {},
12377
12397
  BaseTransitionPropsValidators,
12378
12398
  DOMTransitionPropsValidators
12379
12399
  );
12400
+ const decorate$1 = (t) => {
12401
+ t.displayName = "Transition";
12402
+ t.props = TransitionPropsValidators;
12403
+ {
12404
+ t.__isBuiltIn = true;
12405
+ }
12406
+ return t;
12407
+ };
12408
+ const Transition = /* @__PURE__ */ decorate$1(
12409
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
12410
+ );
12380
12411
  const callHook = (hook, args = []) => {
12381
12412
  if (isArray(hook)) {
12382
12413
  hook.forEach((h2) => h2(...args));
@@ -13524,7 +13555,14 @@ const positionMap = /* @__PURE__ */ new WeakMap();
13524
13555
  const newPositionMap = /* @__PURE__ */ new WeakMap();
13525
13556
  const moveCbKey = Symbol("_moveCb");
13526
13557
  const enterCbKey = Symbol("_enterCb");
13527
- const TransitionGroupImpl = {
13558
+ const decorate = (t) => {
13559
+ delete t.props.mode;
13560
+ {
13561
+ t.__isBuiltIn = true;
13562
+ }
13563
+ return t;
13564
+ };
13565
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13528
13566
  name: "TransitionGroup",
13529
13567
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
13530
13568
  tag: String,
@@ -13616,12 +13654,7 @@ const TransitionGroupImpl = {
13616
13654
  return createVNode(tag, null, children);
13617
13655
  };
13618
13656
  }
13619
- };
13620
- {
13621
- TransitionGroupImpl.__isBuiltIn = true;
13622
- }
13623
- const removeMode = (props) => delete props.mode;
13624
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
13657
+ });
13625
13658
  const TransitionGroup = TransitionGroupImpl;
13626
13659
  function callPendingCbs(c) {
13627
13660
  const el = c.el;
@@ -16383,7 +16416,7 @@ const tokenizer = new Tokenizer(stack, {
16383
16416
  rawName: raw,
16384
16417
  exp: void 0,
16385
16418
  arg: void 0,
16386
- modifiers: raw === "." ? ["prop"] : [],
16419
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
16387
16420
  loc: getLoc(start)
16388
16421
  };
16389
16422
  if (name === "pre") {
@@ -16426,7 +16459,8 @@ const tokenizer = new Tokenizer(stack, {
16426
16459
  setLocEnd(arg.loc, end);
16427
16460
  }
16428
16461
  } else {
16429
- currentProp.modifiers.push(mod);
16462
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
16463
+ currentProp.modifiers.push(exp);
16430
16464
  }
16431
16465
  },
16432
16466
  onattribdata(start, end) {
@@ -16492,7 +16526,9 @@ const tokenizer = new Tokenizer(stack, {
16492
16526
  currentProp.forParseResult = parseForExpression(currentProp.exp);
16493
16527
  }
16494
16528
  let syncIndex = -1;
16495
- if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
16529
+ if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex(
16530
+ (mod) => mod.content === "sync"
16531
+ )) > -1 && checkCompatEnabled(
16496
16532
  "COMPILER_V_BIND_SYNC",
16497
16533
  currentOptions,
16498
16534
  currentProp.loc,
@@ -17623,7 +17659,7 @@ function createStructuralDirectiveTransform(name, fn) {
17623
17659
  };
17624
17660
  }
17625
17661
 
17626
- const PURE_ANNOTATION = `/*#__PURE__*/`;
17662
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
17627
17663
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
17628
17664
  function createCodegenContext(ast, {
17629
17665
  mode = "function",
@@ -18884,7 +18920,7 @@ const transformBind = (dir, _node, context) => {
18884
18920
  } else if (!arg.isStatic) {
18885
18921
  arg.content = `${arg.content} || ""`;
18886
18922
  }
18887
- if (modifiers.includes("camel")) {
18923
+ if (modifiers.some((mod) => mod.content === "camel")) {
18888
18924
  if (arg.type === 4) {
18889
18925
  if (arg.isStatic) {
18890
18926
  arg.content = camelize(arg.content);
@@ -18897,10 +18933,10 @@ const transformBind = (dir, _node, context) => {
18897
18933
  }
18898
18934
  }
18899
18935
  if (!context.inSSR) {
18900
- if (modifiers.includes("prop")) {
18936
+ if (modifiers.some((mod) => mod.content === "prop")) {
18901
18937
  injectPrefix(arg, ".");
18902
18938
  }
18903
- if (modifiers.includes("attr")) {
18939
+ if (modifiers.some((mod) => mod.content === "attr")) {
18904
18940
  injectPrefix(arg, "^");
18905
18941
  }
18906
18942
  }
@@ -19841,7 +19877,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
19841
19877
  }
19842
19878
  continue;
19843
19879
  }
19844
- if (isVBind && modifiers.includes("prop")) {
19880
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
19845
19881
  patchFlag |= 32;
19846
19882
  }
19847
19883
  const directiveTransform = context.directiveTransforms[name];
@@ -20407,7 +20443,7 @@ const transformModel$1 = (dir, node, context) => {
20407
20443
  props[1].value = context.cache(props[1].value);
20408
20444
  }
20409
20445
  if (dir.modifiers.length && node.tagType === 1) {
20410
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
20446
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
20411
20447
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
20412
20448
  props.push(
20413
20449
  createObjectProperty(
@@ -20945,7 +20981,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
20945
20981
  const nonKeyModifiers = [];
20946
20982
  const eventOptionModifiers = [];
20947
20983
  for (let i = 0; i < modifiers.length; i++) {
20948
- const modifier = modifiers[i];
20984
+ const modifier = modifiers[i].content;
20949
20985
  if (modifier === "native" && checkCompatEnabled(
20950
20986
  "COMPILER_V_ON_NATIVE",
20951
20987
  context,