vue 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.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vue v3.5.1
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.1
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.1
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;
@@ -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);
@@ -3388,6 +3396,7 @@ const BaseTransitionImpl = {
3388
3396
  if (!(instance.job.flags & 8)) {
3389
3397
  instance.update();
3390
3398
  }
3399
+ delete leavingHooks.afterLeave;
3391
3400
  };
3392
3401
  return emptyPlaceholder(child);
3393
3402
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3665,6 +3674,34 @@ function markAsyncBoundary(instance) {
3665
3674
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3666
3675
  }
3667
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
+
3668
3705
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3669
3706
  if (isArray(rawRef)) {
3670
3707
  rawRef.forEach(
@@ -3693,7 +3730,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3693
3730
  const oldRef = oldRawRef && oldRawRef.r;
3694
3731
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3695
3732
  const setupState = owner.setupState;
3696
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
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
+ };
3697
3740
  if (oldRef != null && oldRef !== ref) {
3698
3741
  if (isString(oldRef)) {
3699
3742
  refs[oldRef] = null;
@@ -4750,7 +4793,7 @@ const KeepAliveImpl = {
4750
4793
  return () => {
4751
4794
  pendingCacheKey = null;
4752
4795
  if (!slots.default) {
4753
- return null;
4796
+ return current = null;
4754
4797
  }
4755
4798
  const children = slots.default();
4756
4799
  const rawVNode = children[0];
@@ -8507,7 +8550,8 @@ function renderComponentRoot(instance) {
8507
8550
  data,
8508
8551
  setupState,
8509
8552
  ctx,
8510
- inheritAttrs
8553
+ inheritAttrs,
8554
+ isMounted
8511
8555
  } = instance;
8512
8556
  const prev = setCurrentRenderingInstance(instance);
8513
8557
  let result;
@@ -8627,7 +8671,7 @@ function renderComponentRoot(instance) {
8627
8671
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8628
8672
  );
8629
8673
  }
8630
- root.transition = vnode.transition;
8674
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
8631
8675
  }
8632
8676
  if (setRoot) {
8633
8677
  setRoot(root);
@@ -9121,7 +9165,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9121
9165
  };
9122
9166
  }
9123
9167
  if (activeBranch) {
9124
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
9168
+ if (parentNode(activeBranch.el) === container2) {
9125
9169
  anchor = next(activeBranch);
9126
9170
  }
9127
9171
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -10182,29 +10226,6 @@ const computed = (getterOrOptions, debugOptions) => {
10182
10226
  return c;
10183
10227
  };
10184
10228
 
10185
- function useTemplateRef(key) {
10186
- const i = getCurrentInstance();
10187
- const r = shallowRef(null);
10188
- if (i) {
10189
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
10190
- let desc;
10191
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
10192
- warn$1(`useTemplateRef('${key}') already exists.`);
10193
- } else {
10194
- Object.defineProperty(refs, key, {
10195
- enumerable: true,
10196
- get: () => r.value,
10197
- set: (val) => r.value = val
10198
- });
10199
- }
10200
- } else {
10201
- warn$1(
10202
- `useTemplateRef() is called when there is no active component instance to be associated with.`
10203
- );
10204
- }
10205
- return readonly(r) ;
10206
- }
10207
-
10208
10229
  function h(type, propsOrChildren, children) {
10209
10230
  const l = arguments.length;
10210
10231
  if (l === 2) {
@@ -10430,7 +10451,7 @@ function isMemoSame(cached, memo) {
10430
10451
  return true;
10431
10452
  }
10432
10453
 
10433
- const version = "3.5.1";
10454
+ const version = "3.5.2";
10434
10455
  const warn = warn$1 ;
10435
10456
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10436
10457
  const devtools = devtools$1 ;
@@ -13988,7 +14009,7 @@ const tokenizer = new Tokenizer(stack, {
13988
14009
  rawName: raw,
13989
14010
  exp: void 0,
13990
14011
  arg: void 0,
13991
- modifiers: raw === "." ? ["prop"] : [],
14012
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
13992
14013
  loc: getLoc(start)
13993
14014
  };
13994
14015
  if (name === "pre") {
@@ -14031,7 +14052,8 @@ const tokenizer = new Tokenizer(stack, {
14031
14052
  setLocEnd(arg.loc, end);
14032
14053
  }
14033
14054
  } else {
14034
- currentProp.modifiers.push(mod);
14055
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
14056
+ currentProp.modifiers.push(exp);
14035
14057
  }
14036
14058
  },
14037
14059
  onattribdata(start, end) {
@@ -15986,7 +16008,7 @@ const transformBind = (dir, _node, context) => {
15986
16008
  } else if (!arg.isStatic) {
15987
16009
  arg.content = `${arg.content} || ""`;
15988
16010
  }
15989
- if (modifiers.includes("camel")) {
16011
+ if (modifiers.some((mod) => mod.content === "camel")) {
15990
16012
  if (arg.type === 4) {
15991
16013
  if (arg.isStatic) {
15992
16014
  arg.content = camelize(arg.content);
@@ -15999,10 +16021,10 @@ const transformBind = (dir, _node, context) => {
15999
16021
  }
16000
16022
  }
16001
16023
  if (!context.inSSR) {
16002
- if (modifiers.includes("prop")) {
16024
+ if (modifiers.some((mod) => mod.content === "prop")) {
16003
16025
  injectPrefix(arg, ".");
16004
16026
  }
16005
- if (modifiers.includes("attr")) {
16027
+ if (modifiers.some((mod) => mod.content === "attr")) {
16006
16028
  injectPrefix(arg, "^");
16007
16029
  }
16008
16030
  }
@@ -16773,7 +16795,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16773
16795
  }
16774
16796
  continue;
16775
16797
  }
16776
- if (isVBind && modifiers.includes("prop")) {
16798
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
16777
16799
  patchFlag |= 32;
16778
16800
  }
16779
16801
  const directiveTransform = context.directiveTransforms[name];
@@ -17287,7 +17309,7 @@ const transformModel$1 = (dir, node, context) => {
17287
17309
  createObjectProperty(eventName, assignmentExp)
17288
17310
  ];
17289
17311
  if (dir.modifiers.length && node.tagType === 1) {
17290
- 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(`, `);
17291
17313
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
17292
17314
  props.push(
17293
17315
  createObjectProperty(
@@ -17687,7 +17709,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
17687
17709
  const nonKeyModifiers = [];
17688
17710
  const eventOptionModifiers = [];
17689
17711
  for (let i = 0; i < modifiers.length; i++) {
17690
- const modifier = modifiers[i];
17712
+ const modifier = modifiers[i].content;
17691
17713
  if (isEventOptionModifier(modifier)) {
17692
17714
  eventOptionModifiers.push(modifier);
17693
17715
  } else {