vue 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 v3.5.0
2
+ * vue v3.5.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.0
2
+ * vue v3.5.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.0
2
+ * vue 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);
@@ -3368,7 +3376,9 @@ const BaseTransitionImpl = {
3368
3376
  // #11061, ensure enterHooks is fresh after clone
3369
3377
  (hooks) => enterHooks = hooks
3370
3378
  );
3371
- setTransitionHooks(innerChild, enterHooks);
3379
+ if (innerChild.type !== Comment) {
3380
+ setTransitionHooks(innerChild, enterHooks);
3381
+ }
3372
3382
  const oldChild = instance.subTree;
3373
3383
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3374
3384
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3386,6 +3396,7 @@ const BaseTransitionImpl = {
3386
3396
  if (!(instance.job.flags & 8)) {
3387
3397
  instance.update();
3388
3398
  }
3399
+ delete leavingHooks.afterLeave;
3389
3400
  };
3390
3401
  return emptyPlaceholder(child);
3391
3402
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3663,6 +3674,34 @@ function markAsyncBoundary(instance) {
3663
3674
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3664
3675
  }
3665
3676
 
3677
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3678
+ function useTemplateRef(key) {
3679
+ const i = getCurrentInstance();
3680
+ const r = shallowRef(null);
3681
+ if (i) {
3682
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3683
+ let desc;
3684
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3685
+ warn$1(`useTemplateRef('${key}') already exists.`);
3686
+ } else {
3687
+ Object.defineProperty(refs, key, {
3688
+ enumerable: true,
3689
+ get: () => r.value,
3690
+ set: (val) => r.value = val
3691
+ });
3692
+ }
3693
+ } else {
3694
+ warn$1(
3695
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
3696
+ );
3697
+ }
3698
+ const ret = readonly(r) ;
3699
+ {
3700
+ knownTemplateRefs.add(ret);
3701
+ }
3702
+ return ret;
3703
+ }
3704
+
3666
3705
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3667
3706
  if (isArray(rawRef)) {
3668
3707
  rawRef.forEach(
@@ -3691,10 +3730,17 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3691
3730
  const oldRef = oldRawRef && oldRawRef.r;
3692
3731
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3693
3732
  const setupState = owner.setupState;
3733
+ const rawSetupState = toRaw(setupState);
3734
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3735
+ if (knownTemplateRefs.has(rawSetupState[key])) {
3736
+ return false;
3737
+ }
3738
+ return hasOwn(rawSetupState, key);
3739
+ };
3694
3740
  if (oldRef != null && oldRef !== ref) {
3695
3741
  if (isString(oldRef)) {
3696
3742
  refs[oldRef] = null;
3697
- if (hasOwn(setupState, oldRef)) {
3743
+ if (canSetSetupRef(oldRef)) {
3698
3744
  setupState[oldRef] = null;
3699
3745
  }
3700
3746
  } else if (isRef(oldRef)) {
@@ -3709,14 +3755,14 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3709
3755
  if (_isString || _isRef) {
3710
3756
  const doSet = () => {
3711
3757
  if (rawRef.f) {
3712
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3758
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3713
3759
  if (isUnmount) {
3714
3760
  isArray(existing) && remove(existing, refValue);
3715
3761
  } else {
3716
3762
  if (!isArray(existing)) {
3717
3763
  if (_isString) {
3718
3764
  refs[ref] = [refValue];
3719
- if (hasOwn(setupState, ref)) {
3765
+ if (canSetSetupRef(ref)) {
3720
3766
  setupState[ref] = refs[ref];
3721
3767
  }
3722
3768
  } else {
@@ -3729,7 +3775,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3729
3775
  }
3730
3776
  } else if (_isString) {
3731
3777
  refs[ref] = value;
3732
- if (hasOwn(setupState, ref)) {
3778
+ if (canSetSetupRef(ref)) {
3733
3779
  setupState[ref] = value;
3734
3780
  }
3735
3781
  } else if (_isRef) {
@@ -4747,7 +4793,7 @@ const KeepAliveImpl = {
4747
4793
  return () => {
4748
4794
  pendingCacheKey = null;
4749
4795
  if (!slots.default) {
4750
- return null;
4796
+ return current = null;
4751
4797
  }
4752
4798
  const children = slots.default();
4753
4799
  const rawVNode = children[0];
@@ -8504,7 +8550,8 @@ function renderComponentRoot(instance) {
8504
8550
  data,
8505
8551
  setupState,
8506
8552
  ctx,
8507
- inheritAttrs
8553
+ inheritAttrs,
8554
+ isMounted
8508
8555
  } = instance;
8509
8556
  const prev = setCurrentRenderingInstance(instance);
8510
8557
  let result;
@@ -8624,7 +8671,7 @@ function renderComponentRoot(instance) {
8624
8671
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8625
8672
  );
8626
8673
  }
8627
- root.transition = vnode.transition;
8674
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
8628
8675
  }
8629
8676
  if (setRoot) {
8630
8677
  setRoot(root);
@@ -9118,7 +9165,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9118
9165
  };
9119
9166
  }
9120
9167
  if (activeBranch) {
9121
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
9168
+ if (parentNode(activeBranch.el) === container2) {
9122
9169
  anchor = next(activeBranch);
9123
9170
  }
9124
9171
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -10179,29 +10226,6 @@ const computed = (getterOrOptions, debugOptions) => {
10179
10226
  return c;
10180
10227
  };
10181
10228
 
10182
- function useTemplateRef(key) {
10183
- const i = getCurrentInstance();
10184
- const r = shallowRef(null);
10185
- if (i) {
10186
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
10187
- let desc;
10188
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
10189
- warn$1(`useTemplateRef('${key}') already exists.`);
10190
- } else {
10191
- Object.defineProperty(refs, key, {
10192
- enumerable: true,
10193
- get: () => r.value,
10194
- set: (val) => r.value = val
10195
- });
10196
- }
10197
- } else {
10198
- warn$1(
10199
- `useTemplateRef() is called when there is no active component instance to be associated with.`
10200
- );
10201
- }
10202
- return readonly(r) ;
10203
- }
10204
-
10205
10229
  function h(type, propsOrChildren, children) {
10206
10230
  const l = arguments.length;
10207
10231
  if (l === 2) {
@@ -10427,7 +10451,7 @@ function isMemoSame(cached, memo) {
10427
10451
  return true;
10428
10452
  }
10429
10453
 
10430
- const version = "3.5.0";
10454
+ const version = "3.5.2";
10431
10455
  const warn = warn$1 ;
10432
10456
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10433
10457
  const devtools = devtools$1 ;
@@ -10531,8 +10555,6 @@ const nodeOps = {
10531
10555
  const TRANSITION$1 = "transition";
10532
10556
  const ANIMATION = "animation";
10533
10557
  const vtcKey = Symbol("_vtc");
10534
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
10535
- Transition.displayName = "Transition";
10536
10558
  const DOMTransitionPropsValidators = {
10537
10559
  name: String,
10538
10560
  type: String,
@@ -10551,11 +10573,19 @@ const DOMTransitionPropsValidators = {
10551
10573
  leaveActiveClass: String,
10552
10574
  leaveToClass: String
10553
10575
  };
10554
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
10576
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
10555
10577
  {},
10556
10578
  BaseTransitionPropsValidators,
10557
10579
  DOMTransitionPropsValidators
10558
10580
  );
10581
+ const decorate$1 = (t) => {
10582
+ t.displayName = "Transition";
10583
+ t.props = TransitionPropsValidators;
10584
+ return t;
10585
+ };
10586
+ const Transition = /* @__PURE__ */ decorate$1(
10587
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10588
+ );
10559
10589
  const callHook = (hook, args = []) => {
10560
10590
  if (isArray(hook)) {
10561
10591
  hook.forEach((h2) => h2(...args));
@@ -11691,7 +11721,11 @@ const positionMap = /* @__PURE__ */ new WeakMap();
11691
11721
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11692
11722
  const moveCbKey = Symbol("_moveCb");
11693
11723
  const enterCbKey = Symbol("_enterCb");
11694
- const TransitionGroupImpl = {
11724
+ const decorate = (t) => {
11725
+ delete t.props.mode;
11726
+ return t;
11727
+ };
11728
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11695
11729
  name: "TransitionGroup",
11696
11730
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11697
11731
  tag: String,
@@ -11777,9 +11811,7 @@ const TransitionGroupImpl = {
11777
11811
  return createVNode(tag, null, children);
11778
11812
  };
11779
11813
  }
11780
- };
11781
- const removeMode = (props) => delete props.mode;
11782
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
11814
+ });
11783
11815
  const TransitionGroup = TransitionGroupImpl;
11784
11816
  function callPendingCbs(c) {
11785
11817
  const el = c.el;
@@ -13977,7 +14009,7 @@ const tokenizer = new Tokenizer(stack, {
13977
14009
  rawName: raw,
13978
14010
  exp: void 0,
13979
14011
  arg: void 0,
13980
- modifiers: raw === "." ? ["prop"] : [],
14012
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
13981
14013
  loc: getLoc(start)
13982
14014
  };
13983
14015
  if (name === "pre") {
@@ -14020,7 +14052,8 @@ const tokenizer = new Tokenizer(stack, {
14020
14052
  setLocEnd(arg.loc, end);
14021
14053
  }
14022
14054
  } else {
14023
- currentProp.modifiers.push(mod);
14055
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
14056
+ currentProp.modifiers.push(exp);
14024
14057
  }
14025
14058
  },
14026
14059
  onattribdata(start, end) {
@@ -15083,7 +15116,7 @@ function createStructuralDirectiveTransform(name, fn) {
15083
15116
  };
15084
15117
  }
15085
15118
 
15086
- const PURE_ANNOTATION = `/*#__PURE__*/`;
15119
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
15087
15120
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
15088
15121
  function createCodegenContext(ast, {
15089
15122
  mode = "function",
@@ -15975,7 +16008,7 @@ const transformBind = (dir, _node, context) => {
15975
16008
  } else if (!arg.isStatic) {
15976
16009
  arg.content = `${arg.content} || ""`;
15977
16010
  }
15978
- if (modifiers.includes("camel")) {
16011
+ if (modifiers.some((mod) => mod.content === "camel")) {
15979
16012
  if (arg.type === 4) {
15980
16013
  if (arg.isStatic) {
15981
16014
  arg.content = camelize(arg.content);
@@ -15988,10 +16021,10 @@ const transformBind = (dir, _node, context) => {
15988
16021
  }
15989
16022
  }
15990
16023
  if (!context.inSSR) {
15991
- if (modifiers.includes("prop")) {
16024
+ if (modifiers.some((mod) => mod.content === "prop")) {
15992
16025
  injectPrefix(arg, ".");
15993
16026
  }
15994
- if (modifiers.includes("attr")) {
16027
+ if (modifiers.some((mod) => mod.content === "attr")) {
15995
16028
  injectPrefix(arg, "^");
15996
16029
  }
15997
16030
  }
@@ -16762,7 +16795,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16762
16795
  }
16763
16796
  continue;
16764
16797
  }
16765
- if (isVBind && modifiers.includes("prop")) {
16798
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
16766
16799
  patchFlag |= 32;
16767
16800
  }
16768
16801
  const directiveTransform = context.directiveTransforms[name];
@@ -17276,7 +17309,7 @@ const transformModel$1 = (dir, node, context) => {
17276
17309
  createObjectProperty(eventName, assignmentExp)
17277
17310
  ];
17278
17311
  if (dir.modifiers.length && node.tagType === 1) {
17279
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17312
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17280
17313
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
17281
17314
  props.push(
17282
17315
  createObjectProperty(
@@ -17676,7 +17709,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
17676
17709
  const nonKeyModifiers = [];
17677
17710
  const eventOptionModifiers = [];
17678
17711
  for (let i = 0; i < modifiers.length; i++) {
17679
- const modifier = modifiers[i];
17712
+ const modifier = modifiers[i].content;
17680
17713
  if (isEventOptionModifier(modifier)) {
17681
17714
  eventOptionModifiers.push(modifier);
17682
17715
  } else {