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.
@@ -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
  **/
@@ -691,9 +691,6 @@ var Vue = (function (exports) {
691
691
  return false;
692
692
  }
693
693
  function refreshComputed(computed) {
694
- if (computed.flags & 2) {
695
- return false;
696
- }
697
694
  if (computed.flags & 4 && !(computed.flags & 16)) {
698
695
  return;
699
696
  }
@@ -714,7 +711,7 @@ var Vue = (function (exports) {
714
711
  shouldTrack = true;
715
712
  try {
716
713
  prepareDeps(computed);
717
- const value = computed.fn();
714
+ const value = computed.fn(computed._value);
718
715
  if (dep.version === 0 || hasChanged(value, computed._value)) {
719
716
  computed._value = value;
720
717
  dep.version++;
@@ -823,7 +820,7 @@ var Vue = (function (exports) {
823
820
  }
824
821
  }
825
822
  track(debugInfo) {
826
- if (!activeSub || !shouldTrack) {
823
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
827
824
  return;
828
825
  }
829
826
  let link = this.activeLink;
@@ -1045,7 +1042,7 @@ var Vue = (function (exports) {
1045
1042
  },
1046
1043
  concat(...args) {
1047
1044
  return reactiveReadArray(this).concat(
1048
- ...args.map((x) => reactiveReadArray(x))
1045
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
1049
1046
  );
1050
1047
  },
1051
1048
  entries() {
@@ -1836,7 +1833,7 @@ var Vue = (function (exports) {
1836
1833
  return isFunction(source) ? source() : unref(source);
1837
1834
  }
1838
1835
  const shallowUnwrapHandlers = {
1839
- 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)),
1840
1837
  set: (target, key, value, receiver) => {
1841
1838
  const oldValue = target[key];
1842
1839
  if (isRef(oldValue) && !isRef(value)) {
@@ -1968,8 +1965,8 @@ var Vue = (function (exports) {
1968
1965
  * @internal
1969
1966
  */
1970
1967
  notify() {
1968
+ this.flags |= 16;
1971
1969
  if (activeSub !== this) {
1972
- this.flags |= 16;
1973
1970
  this.dep.notify();
1974
1971
  }
1975
1972
  }
@@ -2538,9 +2535,7 @@ var Vue = (function (exports) {
2538
2535
  } else {
2539
2536
  queue.splice(findInsertionIndex(jobId), 0, job);
2540
2537
  }
2541
- if (!(job.flags & 4)) {
2542
- job.flags |= 1;
2543
- }
2538
+ job.flags |= 1;
2544
2539
  queueFlush();
2545
2540
  }
2546
2541
  }
@@ -2556,9 +2551,7 @@ var Vue = (function (exports) {
2556
2551
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2557
2552
  } else if (!(cb.flags & 1)) {
2558
2553
  pendingPostFlushCbs.push(cb);
2559
- if (!(cb.flags & 4)) {
2560
- cb.flags |= 1;
2561
- }
2554
+ cb.flags |= 1;
2562
2555
  }
2563
2556
  } else {
2564
2557
  pendingPostFlushCbs.push(...cb);
@@ -2580,6 +2573,9 @@ var Vue = (function (exports) {
2580
2573
  }
2581
2574
  queue.splice(i, 1);
2582
2575
  i--;
2576
+ if (cb.flags & 4) {
2577
+ cb.flags &= ~1;
2578
+ }
2583
2579
  cb();
2584
2580
  cb.flags &= ~1;
2585
2581
  }
@@ -2604,6 +2600,9 @@ var Vue = (function (exports) {
2604
2600
  if (checkRecursiveUpdates(seen, cb)) {
2605
2601
  continue;
2606
2602
  }
2603
+ if (cb.flags & 4) {
2604
+ cb.flags &= ~1;
2605
+ }
2607
2606
  if (!(cb.flags & 8)) cb();
2608
2607
  cb.flags &= ~1;
2609
2608
  }
@@ -2626,6 +2625,9 @@ var Vue = (function (exports) {
2626
2625
  if (check(job)) {
2627
2626
  continue;
2628
2627
  }
2628
+ if (job.flags & 4) {
2629
+ job.flags &= ~1;
2630
+ }
2629
2631
  callWithErrorHandling(
2630
2632
  job,
2631
2633
  job.i,
@@ -2635,6 +2637,12 @@ var Vue = (function (exports) {
2635
2637
  }
2636
2638
  }
2637
2639
  } finally {
2640
+ for (; flushIndex < queue.length; flushIndex++) {
2641
+ const job = queue[flushIndex];
2642
+ if (job) {
2643
+ job.flags &= ~1;
2644
+ }
2645
+ }
2638
2646
  flushIndex = 0;
2639
2647
  queue.length = 0;
2640
2648
  flushPostFlushCbs(seen);
@@ -3371,7 +3379,9 @@ var Vue = (function (exports) {
3371
3379
  // #11061, ensure enterHooks is fresh after clone
3372
3380
  (hooks) => enterHooks = hooks
3373
3381
  );
3374
- setTransitionHooks(innerChild, enterHooks);
3382
+ if (innerChild.type !== Comment) {
3383
+ setTransitionHooks(innerChild, enterHooks);
3384
+ }
3375
3385
  const oldChild = instance.subTree;
3376
3386
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3377
3387
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3389,6 +3399,7 @@ var Vue = (function (exports) {
3389
3399
  if (!(instance.job.flags & 8)) {
3390
3400
  instance.update();
3391
3401
  }
3402
+ delete leavingHooks.afterLeave;
3392
3403
  };
3393
3404
  return emptyPlaceholder(child);
3394
3405
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3666,6 +3677,34 @@ var Vue = (function (exports) {
3666
3677
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3667
3678
  }
3668
3679
 
3680
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3681
+ function useTemplateRef(key) {
3682
+ const i = getCurrentInstance();
3683
+ const r = shallowRef(null);
3684
+ if (i) {
3685
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3686
+ let desc;
3687
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3688
+ warn$1(`useTemplateRef('${key}') already exists.`);
3689
+ } else {
3690
+ Object.defineProperty(refs, key, {
3691
+ enumerable: true,
3692
+ get: () => r.value,
3693
+ set: (val) => r.value = val
3694
+ });
3695
+ }
3696
+ } else {
3697
+ warn$1(
3698
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
3699
+ );
3700
+ }
3701
+ const ret = readonly(r) ;
3702
+ {
3703
+ knownTemplateRefs.add(ret);
3704
+ }
3705
+ return ret;
3706
+ }
3707
+
3669
3708
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3670
3709
  if (isArray(rawRef)) {
3671
3710
  rawRef.forEach(
@@ -3694,10 +3733,17 @@ var Vue = (function (exports) {
3694
3733
  const oldRef = oldRawRef && oldRawRef.r;
3695
3734
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3696
3735
  const setupState = owner.setupState;
3736
+ const rawSetupState = toRaw(setupState);
3737
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3738
+ if (knownTemplateRefs.has(rawSetupState[key])) {
3739
+ return false;
3740
+ }
3741
+ return hasOwn(rawSetupState, key);
3742
+ };
3697
3743
  if (oldRef != null && oldRef !== ref) {
3698
3744
  if (isString(oldRef)) {
3699
3745
  refs[oldRef] = null;
3700
- if (hasOwn(setupState, oldRef)) {
3746
+ if (canSetSetupRef(oldRef)) {
3701
3747
  setupState[oldRef] = null;
3702
3748
  }
3703
3749
  } else if (isRef(oldRef)) {
@@ -3712,14 +3758,14 @@ var Vue = (function (exports) {
3712
3758
  if (_isString || _isRef) {
3713
3759
  const doSet = () => {
3714
3760
  if (rawRef.f) {
3715
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3761
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3716
3762
  if (isUnmount) {
3717
3763
  isArray(existing) && remove(existing, refValue);
3718
3764
  } else {
3719
3765
  if (!isArray(existing)) {
3720
3766
  if (_isString) {
3721
3767
  refs[ref] = [refValue];
3722
- if (hasOwn(setupState, ref)) {
3768
+ if (canSetSetupRef(ref)) {
3723
3769
  setupState[ref] = refs[ref];
3724
3770
  }
3725
3771
  } else {
@@ -3732,7 +3778,7 @@ var Vue = (function (exports) {
3732
3778
  }
3733
3779
  } else if (_isString) {
3734
3780
  refs[ref] = value;
3735
- if (hasOwn(setupState, ref)) {
3781
+ if (canSetSetupRef(ref)) {
3736
3782
  setupState[ref] = value;
3737
3783
  }
3738
3784
  } else if (_isRef) {
@@ -4744,7 +4790,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4744
4790
  return () => {
4745
4791
  pendingCacheKey = null;
4746
4792
  if (!slots.default) {
4747
- return null;
4793
+ return current = null;
4748
4794
  }
4749
4795
  const children = slots.default();
4750
4796
  const rawVNode = children[0];
@@ -8476,7 +8522,8 @@ If you want to remount the same app, move your app creation logic into a factory
8476
8522
  data,
8477
8523
  setupState,
8478
8524
  ctx,
8479
- inheritAttrs
8525
+ inheritAttrs,
8526
+ isMounted
8480
8527
  } = instance;
8481
8528
  const prev = setCurrentRenderingInstance(instance);
8482
8529
  let result;
@@ -8596,7 +8643,7 @@ If you want to remount the same app, move your app creation logic into a factory
8596
8643
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8597
8644
  );
8598
8645
  }
8599
- root.transition = vnode.transition;
8646
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
8600
8647
  }
8601
8648
  if (setRoot) {
8602
8649
  setRoot(root);
@@ -9090,7 +9137,7 @@ If you want to remount the same app, move your app creation logic into a factory
9090
9137
  };
9091
9138
  }
9092
9139
  if (activeBranch) {
9093
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
9140
+ if (parentNode(activeBranch.el) === container2) {
9094
9141
  anchor = next(activeBranch);
9095
9142
  }
9096
9143
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -10137,29 +10184,6 @@ Component that was made reactive: `,
10137
10184
  return c;
10138
10185
  };
10139
10186
 
10140
- function useTemplateRef(key) {
10141
- const i = getCurrentInstance();
10142
- const r = shallowRef(null);
10143
- if (i) {
10144
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
10145
- let desc;
10146
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
10147
- warn$1(`useTemplateRef('${key}') already exists.`);
10148
- } else {
10149
- Object.defineProperty(refs, key, {
10150
- enumerable: true,
10151
- get: () => r.value,
10152
- set: (val) => r.value = val
10153
- });
10154
- }
10155
- } else {
10156
- warn$1(
10157
- `useTemplateRef() is called when there is no active component instance to be associated with.`
10158
- );
10159
- }
10160
- return readonly(r) ;
10161
- }
10162
-
10163
10187
  function h(type, propsOrChildren, children) {
10164
10188
  const l = arguments.length;
10165
10189
  if (l === 2) {
@@ -10385,7 +10409,7 @@ Component that was made reactive: `,
10385
10409
  return true;
10386
10410
  }
10387
10411
 
10388
- const version = "3.5.0";
10412
+ const version = "3.5.2";
10389
10413
  const warn = warn$1 ;
10390
10414
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10391
10415
  const devtools = devtools$1 ;
@@ -10479,8 +10503,6 @@ Component that was made reactive: `,
10479
10503
  const TRANSITION$1 = "transition";
10480
10504
  const ANIMATION = "animation";
10481
10505
  const vtcKey = Symbol("_vtc");
10482
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
10483
- Transition.displayName = "Transition";
10484
10506
  const DOMTransitionPropsValidators = {
10485
10507
  name: String,
10486
10508
  type: String,
@@ -10499,11 +10521,19 @@ Component that was made reactive: `,
10499
10521
  leaveActiveClass: String,
10500
10522
  leaveToClass: String
10501
10523
  };
10502
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
10524
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
10503
10525
  {},
10504
10526
  BaseTransitionPropsValidators,
10505
10527
  DOMTransitionPropsValidators
10506
10528
  );
10529
+ const decorate$1 = (t) => {
10530
+ t.displayName = "Transition";
10531
+ t.props = TransitionPropsValidators;
10532
+ return t;
10533
+ };
10534
+ const Transition = /* @__PURE__ */ decorate$1(
10535
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10536
+ );
10507
10537
  const callHook = (hook, args = []) => {
10508
10538
  if (isArray(hook)) {
10509
10539
  hook.forEach((h2) => h2(...args));
@@ -11620,7 +11650,11 @@ Expected function or array of functions, received type ${typeof value}.`
11620
11650
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11621
11651
  const moveCbKey = Symbol("_moveCb");
11622
11652
  const enterCbKey = Symbol("_enterCb");
11623
- const TransitionGroupImpl = {
11653
+ const decorate = (t) => {
11654
+ delete t.props.mode;
11655
+ return t;
11656
+ };
11657
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11624
11658
  name: "TransitionGroup",
11625
11659
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11626
11660
  tag: String,
@@ -11706,9 +11740,7 @@ Expected function or array of functions, received type ${typeof value}.`
11706
11740
  return createVNode(tag, null, children);
11707
11741
  };
11708
11742
  }
11709
- };
11710
- const removeMode = (props) => delete props.mode;
11711
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
11743
+ });
11712
11744
  const TransitionGroup = TransitionGroupImpl;
11713
11745
  function callPendingCbs(c) {
11714
11746
  const el = c.el;
@@ -13693,7 +13725,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13693
13725
  rawName: raw,
13694
13726
  exp: void 0,
13695
13727
  arg: void 0,
13696
- modifiers: raw === "." ? ["prop"] : [],
13728
+ modifiers: raw === "." ? [createSimpleExpression("prop")] : [],
13697
13729
  loc: getLoc(start)
13698
13730
  };
13699
13731
  if (name === "pre") {
@@ -13736,7 +13768,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13736
13768
  setLocEnd(arg.loc, end);
13737
13769
  }
13738
13770
  } else {
13739
- currentProp.modifiers.push(mod);
13771
+ const exp = createSimpleExpression(mod, true, getLoc(start, end));
13772
+ currentProp.modifiers.push(exp);
13740
13773
  }
13741
13774
  },
13742
13775
  onattribdata(start, end) {
@@ -14799,7 +14832,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14799
14832
  };
14800
14833
  }
14801
14834
 
14802
- const PURE_ANNOTATION = `/*#__PURE__*/`;
14835
+ const PURE_ANNOTATION = `/*@__PURE__*/`;
14803
14836
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
14804
14837
  function createCodegenContext(ast, {
14805
14838
  mode = "function",
@@ -15691,7 +15724,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15691
15724
  } else if (!arg.isStatic) {
15692
15725
  arg.content = `${arg.content} || ""`;
15693
15726
  }
15694
- if (modifiers.includes("camel")) {
15727
+ if (modifiers.some((mod) => mod.content === "camel")) {
15695
15728
  if (arg.type === 4) {
15696
15729
  if (arg.isStatic) {
15697
15730
  arg.content = camelize(arg.content);
@@ -15704,10 +15737,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15704
15737
  }
15705
15738
  }
15706
15739
  if (!context.inSSR) {
15707
- if (modifiers.includes("prop")) {
15740
+ if (modifiers.some((mod) => mod.content === "prop")) {
15708
15741
  injectPrefix(arg, ".");
15709
15742
  }
15710
- if (modifiers.includes("attr")) {
15743
+ if (modifiers.some((mod) => mod.content === "attr")) {
15711
15744
  injectPrefix(arg, "^");
15712
15745
  }
15713
15746
  }
@@ -16478,7 +16511,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16478
16511
  }
16479
16512
  continue;
16480
16513
  }
16481
- if (isVBind && modifiers.includes("prop")) {
16514
+ if (isVBind && modifiers.some((mod) => mod.content === "prop")) {
16482
16515
  patchFlag |= 32;
16483
16516
  }
16484
16517
  const directiveTransform = context.directiveTransforms[name];
@@ -16992,7 +17025,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16992
17025
  createObjectProperty(eventName, assignmentExp)
16993
17026
  ];
16994
17027
  if (dir.modifiers.length && node.tagType === 1) {
16995
- const modifiers = dir.modifiers.map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
17028
+ const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
16996
17029
  const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
16997
17030
  props.push(
16998
17031
  createObjectProperty(
@@ -17392,7 +17425,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17392
17425
  const nonKeyModifiers = [];
17393
17426
  const eventOptionModifiers = [];
17394
17427
  for (let i = 0; i < modifiers.length; i++) {
17395
- const modifier = modifiers[i];
17428
+ const modifier = modifiers[i].content;
17396
17429
  if (isEventOptionModifier(modifier)) {
17397
17430
  eventOptionModifiers.push(modifier);
17398
17431
  } else {