vue 3.5.1 → 3.5.3

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.3
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.3
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.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -711,7 +711,7 @@ function refreshComputed(computed) {
711
711
  shouldTrack = true;
712
712
  try {
713
713
  prepareDeps(computed);
714
- const value = computed.fn();
714
+ const value = computed.fn(computed._value);
715
715
  if (dep.version === 0 || hasChanged(value, computed._value)) {
716
716
  computed._value = value;
717
717
  dep.version++;
@@ -820,7 +820,7 @@ class Dep {
820
820
  }
821
821
  }
822
822
  track(debugInfo) {
823
- if (!activeSub || !shouldTrack) {
823
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
824
824
  return;
825
825
  }
826
826
  let link = this.activeLink;
@@ -1833,7 +1833,7 @@ function toValue(source) {
1833
1833
  return isFunction(source) ? source() : unref(source);
1834
1834
  }
1835
1835
  const shallowUnwrapHandlers = {
1836
- 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)),
1837
1837
  set: (target, key, value, receiver) => {
1838
1838
  const oldValue = target[key];
1839
1839
  if (isRef(oldValue) && !isRef(value)) {
@@ -2535,9 +2535,7 @@ function queueJob(job) {
2535
2535
  } else {
2536
2536
  queue.splice(findInsertionIndex(jobId), 0, job);
2537
2537
  }
2538
- if (!(job.flags & 4)) {
2539
- job.flags |= 1;
2540
- }
2538
+ job.flags |= 1;
2541
2539
  queueFlush();
2542
2540
  }
2543
2541
  }
@@ -2553,9 +2551,7 @@ function queuePostFlushCb(cb) {
2553
2551
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2554
2552
  } else if (!(cb.flags & 1)) {
2555
2553
  pendingPostFlushCbs.push(cb);
2556
- if (!(cb.flags & 4)) {
2557
- cb.flags |= 1;
2558
- }
2554
+ cb.flags |= 1;
2559
2555
  }
2560
2556
  } else {
2561
2557
  pendingPostFlushCbs.push(...cb);
@@ -2577,6 +2573,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
2577
2573
  }
2578
2574
  queue.splice(i, 1);
2579
2575
  i--;
2576
+ if (cb.flags & 4) {
2577
+ cb.flags &= ~1;
2578
+ }
2580
2579
  cb();
2581
2580
  cb.flags &= ~1;
2582
2581
  }
@@ -2601,6 +2600,9 @@ function flushPostFlushCbs(seen) {
2601
2600
  if (checkRecursiveUpdates(seen, cb)) {
2602
2601
  continue;
2603
2602
  }
2603
+ if (cb.flags & 4) {
2604
+ cb.flags &= ~1;
2605
+ }
2604
2606
  if (!(cb.flags & 8)) cb();
2605
2607
  cb.flags &= ~1;
2606
2608
  }
@@ -2623,6 +2625,9 @@ function flushJobs(seen) {
2623
2625
  if (check(job)) {
2624
2626
  continue;
2625
2627
  }
2628
+ if (job.flags & 4) {
2629
+ job.flags &= ~1;
2630
+ }
2626
2631
  callWithErrorHandling(
2627
2632
  job,
2628
2633
  job.i,
@@ -2632,6 +2637,12 @@ function flushJobs(seen) {
2632
2637
  }
2633
2638
  }
2634
2639
  } finally {
2640
+ for (; flushIndex < queue.length; flushIndex++) {
2641
+ const job = queue[flushIndex];
2642
+ if (job) {
2643
+ job.flags &= ~1;
2644
+ }
2645
+ }
2635
2646
  flushIndex = 0;
2636
2647
  queue.length = 0;
2637
2648
  flushPostFlushCbs(seen);
@@ -3388,6 +3399,7 @@ const BaseTransitionImpl = {
3388
3399
  if (!(instance.job.flags & 8)) {
3389
3400
  instance.update();
3390
3401
  }
3402
+ delete leavingHooks.afterLeave;
3391
3403
  };
3392
3404
  return emptyPlaceholder(child);
3393
3405
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3610,6 +3622,7 @@ function getInnerChild$1(vnode) {
3610
3622
  }
3611
3623
  function setTransitionHooks(vnode, hooks) {
3612
3624
  if (vnode.shapeFlag & 6 && vnode.component) {
3625
+ vnode.transition = hooks;
3613
3626
  setTransitionHooks(vnode.component.subTree, hooks);
3614
3627
  } else if (vnode.shapeFlag & 128) {
3615
3628
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
@@ -3654,7 +3667,7 @@ function defineComponent(options, extraOptions) {
3654
3667
  function useId() {
3655
3668
  const i = getCurrentInstance();
3656
3669
  if (i) {
3657
- return (i.appContext.config.idPrefix || "v") + ":" + i.ids[0] + i.ids[1]++;
3670
+ return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3658
3671
  } else {
3659
3672
  warn$1(
3660
3673
  `useId() is called when there is no active component instance to be associated with.`
@@ -3665,6 +3678,34 @@ function markAsyncBoundary(instance) {
3665
3678
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3666
3679
  }
3667
3680
 
3681
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3682
+ function useTemplateRef(key) {
3683
+ const i = getCurrentInstance();
3684
+ const r = shallowRef(null);
3685
+ if (i) {
3686
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3687
+ let desc;
3688
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3689
+ warn$1(`useTemplateRef('${key}') already exists.`);
3690
+ } else {
3691
+ Object.defineProperty(refs, key, {
3692
+ enumerable: true,
3693
+ get: () => r.value,
3694
+ set: (val) => r.value = val
3695
+ });
3696
+ }
3697
+ } else {
3698
+ warn$1(
3699
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
3700
+ );
3701
+ }
3702
+ const ret = readonly(r) ;
3703
+ {
3704
+ knownTemplateRefs.add(ret);
3705
+ }
3706
+ return ret;
3707
+ }
3708
+
3668
3709
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3669
3710
  if (isArray(rawRef)) {
3670
3711
  rawRef.forEach(
@@ -3693,7 +3734,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3693
3734
  const oldRef = oldRawRef && oldRawRef.r;
3694
3735
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3695
3736
  const setupState = owner.setupState;
3696
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => hasOwn(setupState, key) && !(Object.getOwnPropertyDescriptor(refs, key) || EMPTY_OBJ).get;
3737
+ const rawSetupState = toRaw(setupState);
3738
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3739
+ if (knownTemplateRefs.has(rawSetupState[key])) {
3740
+ return false;
3741
+ }
3742
+ return hasOwn(rawSetupState, key);
3743
+ };
3697
3744
  if (oldRef != null && oldRef !== ref) {
3698
3745
  if (isString(oldRef)) {
3699
3746
  refs[oldRef] = null;
@@ -4750,7 +4797,7 @@ const KeepAliveImpl = {
4750
4797
  return () => {
4751
4798
  pendingCacheKey = null;
4752
4799
  if (!slots.default) {
4753
- return null;
4800
+ return current = null;
4754
4801
  }
4755
4802
  const children = slots.default();
4756
4803
  const rawVNode = children[0];
@@ -7336,7 +7383,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7336
7383
  endMeasure(instance, `hydrate`);
7337
7384
  }
7338
7385
  };
7339
- if (isAsyncWrapperVNode) {
7386
+ if (isAsyncWrapperVNode && type.__asyncHydrate) {
7340
7387
  type.__asyncHydrate(
7341
7388
  el,
7342
7389
  instance,
@@ -8627,7 +8674,7 @@ function renderComponentRoot(instance) {
8627
8674
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8628
8675
  );
8629
8676
  }
8630
- root.transition = vnode.transition;
8677
+ setTransitionHooks(root, vnode.transition);
8631
8678
  }
8632
8679
  if (setRoot) {
8633
8680
  setRoot(root);
@@ -9121,7 +9168,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9121
9168
  };
9122
9169
  }
9123
9170
  if (activeBranch) {
9124
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
9171
+ if (parentNode(activeBranch.el) === container2) {
9125
9172
  anchor = next(activeBranch);
9126
9173
  }
9127
9174
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -10182,29 +10229,6 @@ const computed = (getterOrOptions, debugOptions) => {
10182
10229
  return c;
10183
10230
  };
10184
10231
 
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
10232
  function h(type, propsOrChildren, children) {
10209
10233
  const l = arguments.length;
10210
10234
  if (l === 2) {
@@ -10430,7 +10454,7 @@ function isMemoSame(cached, memo) {
10430
10454
  return true;
10431
10455
  }
10432
10456
 
10433
- const version = "3.5.1";
10457
+ const version = "3.5.3";
10434
10458
  const warn = warn$1 ;
10435
10459
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10436
10460
  const devtools = devtools$1 ;
@@ -10443,7 +10467,9 @@ const _ssrUtils = {
10443
10467
  isVNode: isVNode,
10444
10468
  normalizeVNode,
10445
10469
  getComponentPublicInstance,
10446
- ensureValidVNode
10470
+ ensureValidVNode,
10471
+ pushWarningContext,
10472
+ popWarningContext
10447
10473
  };
10448
10474
  const ssrUtils = _ssrUtils ;
10449
10475
  const resolveFilter = null;
@@ -13988,7 +14014,7 @@ const tokenizer = new Tokenizer(stack, {
13988
14014
  rawName: raw,
13989
14015
  exp: void 0,
13990
14016
  arg: void 0,
13991
- modifiers: raw === "." ? ["prop"] : [],
14017
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
13992
14018
  loc: getLoc(start)
13993
14019
  };
13994
14020
  if (name === "pre") {
@@ -14031,7 +14057,8 @@ const tokenizer = new Tokenizer(stack, {
14031
14057
  setLocEnd(arg.loc, end);
14032
14058
  }
14033
14059
  } else {
14034
- currentProp.modifiers.push(mod);
14060
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
14061
+ currentProp.modifiers.push(exp);
14035
14062
  }
14036
14063
  },
14037
14064
  onattribdata(start, end) {
@@ -15986,7 +16013,7 @@ const transformBind = (dir, _node, context) => {
15986
16013
  } else if (!arg.isStatic) {
15987
16014
  arg.content = `${arg.content} || ""`;
15988
16015
  }
15989
- if (modifiers.includes("camel")) {
16016
+ if (modifiers.some((mod) => mod.content === "camel")) {
15990
16017
  if (arg.type === 4) {
15991
16018
  if (arg.isStatic) {
15992
16019
  arg.content = camelize(arg.content);
@@ -15999,10 +16026,10 @@ const transformBind = (dir, _node, context) => {
15999
16026
  }
16000
16027
  }
16001
16028
  if (!context.inSSR) {
16002
- if (modifiers.includes("prop")) {
16029
+ if (modifiers.some((mod) => mod.content === "prop")) {
16003
16030
  injectPrefix(arg, ".");
16004
16031
  }
16005
- if (modifiers.includes("attr")) {
16032
+ if (modifiers.some((mod) => mod.content === "attr")) {
16006
16033
  injectPrefix(arg, "^");
16007
16034
  }
16008
16035
  }
@@ -16773,7 +16800,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16773
16800
  }
16774
16801
  continue;
16775
16802
  }
16776
- if (isVBind && modifiers.includes("prop")) {
16803
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
16777
16804
  patchFlag |= 32;
16778
16805
  }
16779
16806
  const directiveTransform = context.directiveTransforms[name];
@@ -17287,7 +17314,7 @@ const transformModel$1 = (dir, node, context) => {
17287
17314
  createObjectProperty(eventName, assignmentExp)
17288
17315
  ];
17289
17316
  if (dir.modifiers.length && node.tagType === 1) {
17290
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17317
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17291
17318
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
17292
17319
  props.push(
17293
17320
  createObjectProperty(
@@ -17687,7 +17714,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
17687
17714
  const nonKeyModifiers = [];
17688
17715
  const eventOptionModifiers = [];
17689
17716
  for (let i = 0; i < modifiers.length; i++) {
17690
- const modifier = modifiers[i];
17717
+ const modifier = modifiers[i].content;
17691
17718
  if (isEventOptionModifier(modifier)) {
17692
17719
  eventOptionModifiers.push(modifier);
17693
17720
  } else {