@vue/runtime-dom 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,9 +1,9 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.0
2
+ * @vue/runtime-dom v3.5.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { warn, h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
6
+ import { warn, h, BaseTransition, assertNumber, BaseTransitionPropsValidators, getCurrentInstance, onBeforeMount, watchPostEffect, onMounted, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, unref, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
7
7
  export * from '@vue/runtime-core';
8
8
  import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSymbol, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, isPlainObject, hasOwn, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
9
9
 
@@ -91,8 +91,6 @@ const nodeOps = {
91
91
  const TRANSITION = "transition";
92
92
  const ANIMATION = "animation";
93
93
  const vtcKey = Symbol("_vtc");
94
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
95
- Transition.displayName = "Transition";
96
94
  const DOMTransitionPropsValidators = {
97
95
  name: String,
98
96
  type: String,
@@ -111,11 +109,19 @@ const DOMTransitionPropsValidators = {
111
109
  leaveActiveClass: String,
112
110
  leaveToClass: String
113
111
  };
114
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
112
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
115
113
  {},
116
114
  BaseTransitionPropsValidators,
117
115
  DOMTransitionPropsValidators
118
116
  );
117
+ const decorate$1 = (t) => {
118
+ t.displayName = "Transition";
119
+ t.props = TransitionPropsValidators;
120
+ return t;
121
+ };
122
+ const Transition = /* @__PURE__ */ decorate$1(
123
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
124
+ );
119
125
  const callHook = (hook, args = []) => {
120
126
  if (isArray(hook)) {
121
127
  hook.forEach((h2) => h2(...args));
@@ -1251,7 +1257,11 @@ const positionMap = /* @__PURE__ */ new WeakMap();
1251
1257
  const newPositionMap = /* @__PURE__ */ new WeakMap();
1252
1258
  const moveCbKey = Symbol("_moveCb");
1253
1259
  const enterCbKey = Symbol("_enterCb");
1254
- const TransitionGroupImpl = {
1260
+ const decorate = (t) => {
1261
+ delete t.props.mode;
1262
+ return t;
1263
+ };
1264
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
1255
1265
  name: "TransitionGroup",
1256
1266
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
1257
1267
  tag: String,
@@ -1337,9 +1347,7 @@ const TransitionGroupImpl = {
1337
1347
  return createVNode(tag, null, children);
1338
1348
  };
1339
1349
  }
1340
- };
1341
- const removeMode = (props) => delete props.mode;
1342
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
1350
+ });
1343
1351
  const TransitionGroup = TransitionGroupImpl;
1344
1352
  function callPendingCbs(c) {
1345
1353
  const el = c.el;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-dom v3.5.0
2
+ * @vue/runtime-dom v3.5.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -624,9 +624,6 @@ var VueRuntimeDOM = (function (exports) {
624
624
  return false;
625
625
  }
626
626
  function refreshComputed(computed) {
627
- if (computed.flags & 2) {
628
- return false;
629
- }
630
627
  if (computed.flags & 4 && !(computed.flags & 16)) {
631
628
  return;
632
629
  }
@@ -647,7 +644,7 @@ var VueRuntimeDOM = (function (exports) {
647
644
  shouldTrack = true;
648
645
  try {
649
646
  prepareDeps(computed);
650
- const value = computed.fn();
647
+ const value = computed.fn(computed._value);
651
648
  if (dep.version === 0 || hasChanged(value, computed._value)) {
652
649
  computed._value = value;
653
650
  dep.version++;
@@ -756,7 +753,7 @@ var VueRuntimeDOM = (function (exports) {
756
753
  }
757
754
  }
758
755
  track(debugInfo) {
759
- if (!activeSub || !shouldTrack) {
756
+ if (!activeSub || !shouldTrack || activeSub === this.computed) {
760
757
  return;
761
758
  }
762
759
  let link = this.activeLink;
@@ -978,7 +975,7 @@ var VueRuntimeDOM = (function (exports) {
978
975
  },
979
976
  concat(...args) {
980
977
  return reactiveReadArray(this).concat(
981
- ...args.map((x) => reactiveReadArray(x))
978
+ ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
982
979
  );
983
980
  },
984
981
  entries() {
@@ -1769,7 +1766,7 @@ var VueRuntimeDOM = (function (exports) {
1769
1766
  return isFunction(source) ? source() : unref(source);
1770
1767
  }
1771
1768
  const shallowUnwrapHandlers = {
1772
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1769
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1773
1770
  set: (target, key, value, receiver) => {
1774
1771
  const oldValue = target[key];
1775
1772
  if (isRef(oldValue) && !isRef(value)) {
@@ -1901,8 +1898,8 @@ var VueRuntimeDOM = (function (exports) {
1901
1898
  * @internal
1902
1899
  */
1903
1900
  notify() {
1901
+ this.flags |= 16;
1904
1902
  if (activeSub !== this) {
1905
- this.flags |= 16;
1906
1903
  this.dep.notify();
1907
1904
  }
1908
1905
  }
@@ -2471,9 +2468,7 @@ var VueRuntimeDOM = (function (exports) {
2471
2468
  } else {
2472
2469
  queue.splice(findInsertionIndex(jobId), 0, job);
2473
2470
  }
2474
- if (!(job.flags & 4)) {
2475
- job.flags |= 1;
2476
- }
2471
+ job.flags |= 1;
2477
2472
  queueFlush();
2478
2473
  }
2479
2474
  }
@@ -2489,9 +2484,7 @@ var VueRuntimeDOM = (function (exports) {
2489
2484
  activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
2490
2485
  } else if (!(cb.flags & 1)) {
2491
2486
  pendingPostFlushCbs.push(cb);
2492
- if (!(cb.flags & 4)) {
2493
- cb.flags |= 1;
2494
- }
2487
+ cb.flags |= 1;
2495
2488
  }
2496
2489
  } else {
2497
2490
  pendingPostFlushCbs.push(...cb);
@@ -2513,6 +2506,9 @@ var VueRuntimeDOM = (function (exports) {
2513
2506
  }
2514
2507
  queue.splice(i, 1);
2515
2508
  i--;
2509
+ if (cb.flags & 4) {
2510
+ cb.flags &= ~1;
2511
+ }
2516
2512
  cb();
2517
2513
  cb.flags &= ~1;
2518
2514
  }
@@ -2537,6 +2533,9 @@ var VueRuntimeDOM = (function (exports) {
2537
2533
  if (checkRecursiveUpdates(seen, cb)) {
2538
2534
  continue;
2539
2535
  }
2536
+ if (cb.flags & 4) {
2537
+ cb.flags &= ~1;
2538
+ }
2540
2539
  if (!(cb.flags & 8)) cb();
2541
2540
  cb.flags &= ~1;
2542
2541
  }
@@ -2559,6 +2558,9 @@ var VueRuntimeDOM = (function (exports) {
2559
2558
  if (check(job)) {
2560
2559
  continue;
2561
2560
  }
2561
+ if (job.flags & 4) {
2562
+ job.flags &= ~1;
2563
+ }
2562
2564
  callWithErrorHandling(
2563
2565
  job,
2564
2566
  job.i,
@@ -2568,6 +2570,12 @@ var VueRuntimeDOM = (function (exports) {
2568
2570
  }
2569
2571
  }
2570
2572
  } finally {
2573
+ for (; flushIndex < queue.length; flushIndex++) {
2574
+ const job = queue[flushIndex];
2575
+ if (job) {
2576
+ job.flags &= ~1;
2577
+ }
2578
+ }
2571
2579
  flushIndex = 0;
2572
2580
  queue.length = 0;
2573
2581
  flushPostFlushCbs(seen);
@@ -3304,7 +3312,9 @@ var VueRuntimeDOM = (function (exports) {
3304
3312
  // #11061, ensure enterHooks is fresh after clone
3305
3313
  (hooks) => enterHooks = hooks
3306
3314
  );
3307
- setTransitionHooks(innerChild, enterHooks);
3315
+ if (innerChild.type !== Comment) {
3316
+ setTransitionHooks(innerChild, enterHooks);
3317
+ }
3308
3318
  const oldChild = instance.subTree;
3309
3319
  const oldInnerChild = oldChild && getInnerChild$1(oldChild);
3310
3320
  if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
@@ -3322,6 +3332,7 @@ var VueRuntimeDOM = (function (exports) {
3322
3332
  if (!(instance.job.flags & 8)) {
3323
3333
  instance.update();
3324
3334
  }
3335
+ delete leavingHooks.afterLeave;
3325
3336
  };
3326
3337
  return emptyPlaceholder(child);
3327
3338
  } else if (mode === "in-out" && innerChild.type !== Comment) {
@@ -3599,6 +3610,34 @@ var VueRuntimeDOM = (function (exports) {
3599
3610
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
3600
3611
  }
3601
3612
 
3613
+ const knownTemplateRefs = /* @__PURE__ */ new WeakSet();
3614
+ function useTemplateRef(key) {
3615
+ const i = getCurrentInstance();
3616
+ const r = shallowRef(null);
3617
+ if (i) {
3618
+ const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
3619
+ let desc;
3620
+ if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
3621
+ warn$1(`useTemplateRef('${key}') already exists.`);
3622
+ } else {
3623
+ Object.defineProperty(refs, key, {
3624
+ enumerable: true,
3625
+ get: () => r.value,
3626
+ set: (val) => r.value = val
3627
+ });
3628
+ }
3629
+ } else {
3630
+ warn$1(
3631
+ `useTemplateRef() is called when there is no active component instance to be associated with.`
3632
+ );
3633
+ }
3634
+ const ret = readonly(r) ;
3635
+ {
3636
+ knownTemplateRefs.add(ret);
3637
+ }
3638
+ return ret;
3639
+ }
3640
+
3602
3641
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3603
3642
  if (isArray(rawRef)) {
3604
3643
  rawRef.forEach(
@@ -3627,10 +3666,17 @@ var VueRuntimeDOM = (function (exports) {
3627
3666
  const oldRef = oldRawRef && oldRawRef.r;
3628
3667
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3629
3668
  const setupState = owner.setupState;
3669
+ const rawSetupState = toRaw(setupState);
3670
+ const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3671
+ if (knownTemplateRefs.has(rawSetupState[key])) {
3672
+ return false;
3673
+ }
3674
+ return hasOwn(rawSetupState, key);
3675
+ };
3630
3676
  if (oldRef != null && oldRef !== ref) {
3631
3677
  if (isString(oldRef)) {
3632
3678
  refs[oldRef] = null;
3633
- if (hasOwn(setupState, oldRef)) {
3679
+ if (canSetSetupRef(oldRef)) {
3634
3680
  setupState[oldRef] = null;
3635
3681
  }
3636
3682
  } else if (isRef(oldRef)) {
@@ -3645,14 +3691,14 @@ var VueRuntimeDOM = (function (exports) {
3645
3691
  if (_isString || _isRef) {
3646
3692
  const doSet = () => {
3647
3693
  if (rawRef.f) {
3648
- const existing = _isString ? hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
3694
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3649
3695
  if (isUnmount) {
3650
3696
  isArray(existing) && remove(existing, refValue);
3651
3697
  } else {
3652
3698
  if (!isArray(existing)) {
3653
3699
  if (_isString) {
3654
3700
  refs[ref] = [refValue];
3655
- if (hasOwn(setupState, ref)) {
3701
+ if (canSetSetupRef(ref)) {
3656
3702
  setupState[ref] = refs[ref];
3657
3703
  }
3658
3704
  } else {
@@ -3665,7 +3711,7 @@ var VueRuntimeDOM = (function (exports) {
3665
3711
  }
3666
3712
  } else if (_isString) {
3667
3713
  refs[ref] = value;
3668
- if (hasOwn(setupState, ref)) {
3714
+ if (canSetSetupRef(ref)) {
3669
3715
  setupState[ref] = value;
3670
3716
  }
3671
3717
  } else if (_isRef) {
@@ -4677,7 +4723,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4677
4723
  return () => {
4678
4724
  pendingCacheKey = null;
4679
4725
  if (!slots.default) {
4680
- return null;
4726
+ return current = null;
4681
4727
  }
4682
4728
  const children = slots.default();
4683
4729
  const rawVNode = children[0];
@@ -8409,7 +8455,8 @@ If you want to remount the same app, move your app creation logic into a factory
8409
8455
  data,
8410
8456
  setupState,
8411
8457
  ctx,
8412
- inheritAttrs
8458
+ inheritAttrs,
8459
+ isMounted
8413
8460
  } = instance;
8414
8461
  const prev = setCurrentRenderingInstance(instance);
8415
8462
  let result;
@@ -8529,7 +8576,7 @@ If you want to remount the same app, move your app creation logic into a factory
8529
8576
  `Component inside <Transition> renders non-element root node that cannot be animated.`
8530
8577
  );
8531
8578
  }
8532
- root.transition = vnode.transition;
8579
+ root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
8533
8580
  }
8534
8581
  if (setRoot) {
8535
8582
  setRoot(root);
@@ -9023,7 +9070,7 @@ If you want to remount the same app, move your app creation logic into a factory
9023
9070
  };
9024
9071
  }
9025
9072
  if (activeBranch) {
9026
- if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
9073
+ if (parentNode(activeBranch.el) === container2) {
9027
9074
  anchor = next(activeBranch);
9028
9075
  }
9029
9076
  unmount(activeBranch, parentComponent2, suspense, true);
@@ -10070,29 +10117,6 @@ Component that was made reactive: `,
10070
10117
  return c;
10071
10118
  };
10072
10119
 
10073
- function useTemplateRef(key) {
10074
- const i = getCurrentInstance();
10075
- const r = shallowRef(null);
10076
- if (i) {
10077
- const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;
10078
- let desc;
10079
- if ((desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {
10080
- warn$1(`useTemplateRef('${key}') already exists.`);
10081
- } else {
10082
- Object.defineProperty(refs, key, {
10083
- enumerable: true,
10084
- get: () => r.value,
10085
- set: (val) => r.value = val
10086
- });
10087
- }
10088
- } else {
10089
- warn$1(
10090
- `useTemplateRef() is called when there is no active component instance to be associated with.`
10091
- );
10092
- }
10093
- return readonly(r) ;
10094
- }
10095
-
10096
10120
  function h(type, propsOrChildren, children) {
10097
10121
  const l = arguments.length;
10098
10122
  if (l === 2) {
@@ -10318,7 +10342,7 @@ Component that was made reactive: `,
10318
10342
  return true;
10319
10343
  }
10320
10344
 
10321
- const version = "3.5.0";
10345
+ const version = "3.5.2";
10322
10346
  const warn = warn$1 ;
10323
10347
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10324
10348
  const devtools = devtools$1 ;
@@ -10412,8 +10436,6 @@ Component that was made reactive: `,
10412
10436
  const TRANSITION = "transition";
10413
10437
  const ANIMATION = "animation";
10414
10438
  const vtcKey = Symbol("_vtc");
10415
- const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots);
10416
- Transition.displayName = "Transition";
10417
10439
  const DOMTransitionPropsValidators = {
10418
10440
  name: String,
10419
10441
  type: String,
@@ -10432,11 +10454,19 @@ Component that was made reactive: `,
10432
10454
  leaveActiveClass: String,
10433
10455
  leaveToClass: String
10434
10456
  };
10435
- const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend(
10457
+ const TransitionPropsValidators = /* @__PURE__ */ extend(
10436
10458
  {},
10437
10459
  BaseTransitionPropsValidators,
10438
10460
  DOMTransitionPropsValidators
10439
10461
  );
10462
+ const decorate$1 = (t) => {
10463
+ t.displayName = "Transition";
10464
+ t.props = TransitionPropsValidators;
10465
+ return t;
10466
+ };
10467
+ const Transition = /* @__PURE__ */ decorate$1(
10468
+ (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots)
10469
+ );
10440
10470
  const callHook = (hook, args = []) => {
10441
10471
  if (isArray(hook)) {
10442
10472
  hook.forEach((h2) => h2(...args));
@@ -11553,7 +11583,11 @@ Expected function or array of functions, received type ${typeof value}.`
11553
11583
  const newPositionMap = /* @__PURE__ */ new WeakMap();
11554
11584
  const moveCbKey = Symbol("_moveCb");
11555
11585
  const enterCbKey = Symbol("_enterCb");
11556
- const TransitionGroupImpl = {
11586
+ const decorate = (t) => {
11587
+ delete t.props.mode;
11588
+ return t;
11589
+ };
11590
+ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11557
11591
  name: "TransitionGroup",
11558
11592
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
11559
11593
  tag: String,
@@ -11639,9 +11673,7 @@ Expected function or array of functions, received type ${typeof value}.`
11639
11673
  return createVNode(tag, null, children);
11640
11674
  };
11641
11675
  }
11642
- };
11643
- const removeMode = (props) => delete props.mode;
11644
- /* @__PURE__ */ removeMode(TransitionGroupImpl.props);
11676
+ });
11645
11677
  const TransitionGroup = TransitionGroupImpl;
11646
11678
  function callPendingCbs(c) {
11647
11679
  const el = c.el;