@vue/compat 3.2.21 → 3.2.25

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.
@@ -110,7 +110,7 @@ var Vue = (function () {
110
110
  const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
111
111
  /**
112
112
  * Boolean attributes should be included if the value is truthy or ''.
113
- * e.g. <select multiple> compiles to { multiple: '' }
113
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
114
114
  */
115
115
  function includeBooleanAttr(value) {
116
116
  return !!value || value === '';
@@ -344,7 +344,7 @@ var Vue = (function () {
344
344
  '' + parseInt(key, 10) === key;
345
345
  const isReservedProp = /*#__PURE__*/ makeMap(
346
346
  // the leading comma is intentional so empty string "" is also included
347
- ',key,ref,' +
347
+ ',key,ref,ref_for,ref_key,' +
348
348
  'onVnodeBeforeMount,onVnodeMounted,' +
349
349
  'onVnodeBeforeUpdate,onVnodeUpdated,' +
350
350
  'onVnodeBeforeUnmount,onVnodeUnmounted');
@@ -533,7 +533,7 @@ var Vue = (function () {
533
533
  let effectTrackDepth = 0;
534
534
  let trackOpBit = 1;
535
535
  /**
536
- * The bitwise track markers support at most 30 levels op recursion.
536
+ * The bitwise track markers support at most 30 levels of recursion.
537
537
  * This value is chosen to enable modern JS engines to use a SMI on all platforms.
538
538
  * When recursion depth is greater, fall back to using a full cleanup.
539
539
  */
@@ -854,7 +854,7 @@ var Vue = (function () {
854
854
  function createSetter(shallow = false) {
855
855
  return function set(target, key, value, receiver) {
856
856
  let oldValue = target[key];
857
- if (!shallow) {
857
+ if (!shallow && !isReadonly(value)) {
858
858
  value = toRaw(value);
859
859
  oldValue = toRaw(oldValue);
860
860
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
@@ -1439,21 +1439,25 @@ var Vue = (function () {
1439
1439
  return ret;
1440
1440
  }
1441
1441
  class ObjectRefImpl {
1442
- constructor(_object, _key) {
1442
+ constructor(_object, _key, _defaultValue) {
1443
1443
  this._object = _object;
1444
1444
  this._key = _key;
1445
+ this._defaultValue = _defaultValue;
1445
1446
  this.__v_isRef = true;
1446
1447
  }
1447
1448
  get value() {
1448
- return this._object[this._key];
1449
+ const val = this._object[this._key];
1450
+ return val === undefined ? this._defaultValue : val;
1449
1451
  }
1450
1452
  set value(newVal) {
1451
1453
  this._object[this._key] = newVal;
1452
1454
  }
1453
1455
  }
1454
- function toRef(object, key) {
1456
+ function toRef(object, key, defaultValue) {
1455
1457
  const val = object[key];
1456
- return isRef(val) ? val : new ObjectRefImpl(object, key);
1458
+ return isRef(val)
1459
+ ? val
1460
+ : new ObjectRefImpl(object, key, defaultValue);
1457
1461
  }
1458
1462
 
1459
1463
  class ComputedRefImpl {
@@ -1660,6 +1664,7 @@ var Vue = (function () {
1660
1664
  }
1661
1665
  }
1662
1666
  function setDevtoolsHook(hook, target) {
1667
+ var _a, _b;
1663
1668
  devtools = hook;
1664
1669
  if (devtools) {
1665
1670
  devtools.enabled = true;
@@ -1672,7 +1677,10 @@ var Vue = (function () {
1672
1677
  // (#4815)
1673
1678
  // eslint-disable-next-line no-restricted-globals
1674
1679
  typeof window !== 'undefined' &&
1675
- !navigator.userAgent.includes('jsdom')) {
1680
+ // some envs mock window but not fully
1681
+ window.HTMLElement &&
1682
+ // also exclude jsdom
1683
+ !((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.userAgent) === null || _b === void 0 ? void 0 : _b.includes('jsdom'))) {
1676
1684
  const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1677
1685
  target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1678
1686
  replay.push((newHook) => {
@@ -1895,11 +1903,6 @@ var Vue = (function () {
1895
1903
  `Use "${newHook}" instead.`,
1896
1904
  link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
1897
1905
  },
1898
- ["V_FOR_REF" /* V_FOR_REF */]: {
1899
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
1900
- `Consider using function refs or refactor to avoid ref usage altogether.`,
1901
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
1902
- },
1903
1906
  ["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
1904
1907
  message: `Using keyCode as v-on modifier is no longer supported. ` +
1905
1908
  `Use kebab-case key name modifiers instead.`,
@@ -3306,7 +3309,8 @@ var Vue = (function () {
3306
3309
  const rawProps = toRaw(props);
3307
3310
  const { mode } = rawProps;
3308
3311
  // check mode
3309
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3312
+ if (mode &&
3313
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3310
3314
  warn$1(`invalid <transition> mode: ${mode}`);
3311
3315
  }
3312
3316
  // at this point children has a guaranteed length of 1.
@@ -3952,7 +3956,7 @@ var Vue = (function () {
3952
3956
  }
3953
3957
  current = current.parent;
3954
3958
  }
3955
- hook();
3959
+ return hook();
3956
3960
  });
3957
3961
  injectHook(type, wrappedHook, target);
3958
3962
  // In addition to registering it on the target instance, we walk up the parent
@@ -4730,7 +4734,7 @@ var Vue = (function () {
4730
4734
  continue;
4731
4735
  }
4732
4736
  }
4733
- if (value !== attrs[key]) {
4737
+ if (!(key in attrs) || value !== attrs[key]) {
4734
4738
  attrs[key] = value;
4735
4739
  hasAttrsChanged = true;
4736
4740
  }
@@ -5311,7 +5315,7 @@ var Vue = (function () {
5311
5315
  return vm;
5312
5316
  }
5313
5317
  }
5314
- Vue.version = "3.2.21";
5318
+ Vue.version = "3.2.25";
5315
5319
  Vue.config = singletonApp.config;
5316
5320
  Vue.use = (p, ...options) => {
5317
5321
  if (p && isFunction(p.install)) {
@@ -5662,7 +5666,7 @@ var Vue = (function () {
5662
5666
  ];
5663
5667
  const patched = new WeakSet();
5664
5668
  function defineReactive(obj, key, val) {
5665
- // it's possible for the orignial object to be mutated after being defined
5669
+ // it's possible for the original object to be mutated after being defined
5666
5670
  // and expecting reactivity... we are covering it here because this seems to
5667
5671
  // be a bit more common.
5668
5672
  if (isObject(val) && !isReactive(val) && !patched.has(val)) {
@@ -5882,6 +5886,102 @@ var Vue = (function () {
5882
5886
  };
5883
5887
  }
5884
5888
 
5889
+ /**
5890
+ * Function for handling a template ref
5891
+ */
5892
+ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5893
+ if (isArray(rawRef)) {
5894
+ rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
5895
+ return;
5896
+ }
5897
+ if (isAsyncWrapper(vnode) && !isUnmount) {
5898
+ // when mounting async components, nothing needs to be done,
5899
+ // because the template ref is forwarded to inner component
5900
+ return;
5901
+ }
5902
+ const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
5903
+ ? getExposeProxy(vnode.component) || vnode.component.proxy
5904
+ : vnode.el;
5905
+ const value = isUnmount ? null : refValue;
5906
+ const { i: owner, r: ref } = rawRef;
5907
+ if (!owner) {
5908
+ warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
5909
+ `A vnode with ref must be created inside the render function.`);
5910
+ return;
5911
+ }
5912
+ const oldRef = oldRawRef && oldRawRef.r;
5913
+ const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
5914
+ const setupState = owner.setupState;
5915
+ // dynamic ref changed. unset old ref
5916
+ if (oldRef != null && oldRef !== ref) {
5917
+ if (isString(oldRef)) {
5918
+ refs[oldRef] = null;
5919
+ if (hasOwn(setupState, oldRef)) {
5920
+ setupState[oldRef] = null;
5921
+ }
5922
+ }
5923
+ else if (isRef(oldRef)) {
5924
+ oldRef.value = null;
5925
+ }
5926
+ }
5927
+ if (isFunction(ref)) {
5928
+ callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
5929
+ }
5930
+ else {
5931
+ const _isString = isString(ref);
5932
+ const _isRef = isRef(ref);
5933
+ if (_isString || _isRef) {
5934
+ const doSet = () => {
5935
+ if (rawRef.f) {
5936
+ const existing = _isString ? refs[ref] : ref.value;
5937
+ if (isUnmount) {
5938
+ isArray(existing) && remove(existing, refValue);
5939
+ }
5940
+ else {
5941
+ if (!isArray(existing)) {
5942
+ if (_isString) {
5943
+ refs[ref] = [refValue];
5944
+ }
5945
+ else {
5946
+ ref.value = [refValue];
5947
+ if (rawRef.k)
5948
+ refs[rawRef.k] = ref.value;
5949
+ }
5950
+ }
5951
+ else if (!existing.includes(refValue)) {
5952
+ existing.push(refValue);
5953
+ }
5954
+ }
5955
+ }
5956
+ else if (_isString) {
5957
+ refs[ref] = value;
5958
+ if (hasOwn(setupState, ref)) {
5959
+ setupState[ref] = value;
5960
+ }
5961
+ }
5962
+ else if (isRef(ref)) {
5963
+ ref.value = value;
5964
+ if (rawRef.k)
5965
+ refs[rawRef.k] = value;
5966
+ }
5967
+ else {
5968
+ warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
5969
+ }
5970
+ };
5971
+ if (value) {
5972
+ doSet.id = -1;
5973
+ queuePostRenderEffect(doSet, parentSuspense);
5974
+ }
5975
+ else {
5976
+ doSet();
5977
+ }
5978
+ }
5979
+ else {
5980
+ warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
5981
+ }
5982
+ }
5983
+ }
5984
+
5885
5985
  let hasMismatch = false;
5886
5986
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
5887
5987
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -6243,44 +6343,6 @@ var Vue = (function () {
6243
6343
  return supported;
6244
6344
  }
6245
6345
 
6246
- function convertLegacyRefInFor(vnode) {
6247
- // refInFor
6248
- if (vnode.props && vnode.props.refInFor) {
6249
- delete vnode.props.refInFor;
6250
- if (vnode.ref) {
6251
- if (isArray(vnode.ref)) {
6252
- vnode.ref.forEach(r => (r.f = true));
6253
- }
6254
- else {
6255
- vnode.ref.f = true;
6256
- }
6257
- }
6258
- }
6259
- }
6260
- function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
6261
- const existing = refs[key];
6262
- if (isUnmount) {
6263
- if (isArray(existing)) {
6264
- remove(existing, value);
6265
- }
6266
- else {
6267
- refs[key] = null;
6268
- }
6269
- }
6270
- else if (isInFor) {
6271
- warnDeprecation("V_FOR_REF" /* V_FOR_REF */, owner);
6272
- if (!isArray(existing)) {
6273
- refs[key] = [value];
6274
- }
6275
- else if (!existing.includes(value)) {
6276
- existing.push(value);
6277
- }
6278
- }
6279
- else {
6280
- refs[key] = value;
6281
- }
6282
- }
6283
-
6284
6346
  const queuePostRenderEffect = queueEffectWithSuspense
6285
6347
  ;
6286
6348
  /**
@@ -6552,12 +6614,15 @@ var Vue = (function () {
6552
6614
  const oldProps = n1.props || EMPTY_OBJ;
6553
6615
  const newProps = n2.props || EMPTY_OBJ;
6554
6616
  let vnodeHook;
6617
+ // disable recurse in beforeUpdate hooks
6618
+ parentComponent && toggleRecurse(parentComponent, false);
6555
6619
  if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
6556
6620
  invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6557
6621
  }
6558
6622
  if (dirs) {
6559
6623
  invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
6560
6624
  }
6625
+ parentComponent && toggleRecurse(parentComponent, true);
6561
6626
  if (isHmrUpdating) {
6562
6627
  // HMR updated, force full diff
6563
6628
  patchFlag = 0;
@@ -6841,7 +6906,7 @@ var Vue = (function () {
6841
6906
  const { el, props } = initialVNode;
6842
6907
  const { bm, m, parent } = instance;
6843
6908
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
6844
- effect.allowRecurse = false;
6909
+ toggleRecurse(instance, false);
6845
6910
  // beforeMount hook
6846
6911
  if (bm) {
6847
6912
  invokeArrayFns(bm);
@@ -6854,7 +6919,7 @@ var Vue = (function () {
6854
6919
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6855
6920
  instance.emit('hook:beforeMount');
6856
6921
  }
6857
- effect.allowRecurse = true;
6922
+ toggleRecurse(instance, true);
6858
6923
  if (el && hydrateNode) {
6859
6924
  // vnode has adopted host node - perform hydration instead of mount.
6860
6925
  const hydrateSubTree = () => {
@@ -6942,7 +7007,7 @@ var Vue = (function () {
6942
7007
  pushWarningContext(next || instance.vnode);
6943
7008
  }
6944
7009
  // Disallow component effect recursion during pre-lifecycle hooks.
6945
- effect.allowRecurse = false;
7010
+ toggleRecurse(instance, false);
6946
7011
  if (next) {
6947
7012
  next.el = vnode.el;
6948
7013
  updateComponentPreRender(instance, next, optimized);
@@ -6961,7 +7026,7 @@ var Vue = (function () {
6961
7026
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6962
7027
  instance.emit('hook:beforeUpdate');
6963
7028
  }
6964
- effect.allowRecurse = true;
7029
+ toggleRecurse(instance, true);
6965
7030
  // render
6966
7031
  {
6967
7032
  startMeasure(instance, `render`);
@@ -7010,13 +7075,13 @@ var Vue = (function () {
7010
7075
  }
7011
7076
  };
7012
7077
  // create reactive effect for rendering
7013
- const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7014
- );
7078
+ const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7079
+ ));
7015
7080
  const update = (instance.update = effect.run.bind(effect));
7016
7081
  update.id = instance.uid;
7017
7082
  // allowRecurse
7018
7083
  // #1801, #2043 component render effects should allow recursive updates
7019
- effect.allowRecurse = update.allowRecurse = true;
7084
+ toggleRecurse(instance, true);
7020
7085
  {
7021
7086
  effect.onTrack = instance.rtc
7022
7087
  ? e => invokeArrayFns(instance.rtc, e)
@@ -7546,88 +7611,8 @@ var Vue = (function () {
7546
7611
  createApp: createAppAPI(render, hydrate)
7547
7612
  };
7548
7613
  }
7549
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7550
- if (isArray(rawRef)) {
7551
- rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
7552
- return;
7553
- }
7554
- if (isAsyncWrapper(vnode) && !isUnmount) {
7555
- // when mounting async components, nothing needs to be done,
7556
- // because the template ref is forwarded to inner component
7557
- return;
7558
- }
7559
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
7560
- ? getExposeProxy(vnode.component) || vnode.component.proxy
7561
- : vnode.el;
7562
- const value = isUnmount ? null : refValue;
7563
- const { i: owner, r: ref } = rawRef;
7564
- if (!owner) {
7565
- warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
7566
- `A vnode with ref must be created inside the render function.`);
7567
- return;
7568
- }
7569
- const oldRef = oldRawRef && oldRawRef.r;
7570
- const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
7571
- const setupState = owner.setupState;
7572
- // dynamic ref changed. unset old ref
7573
- if (oldRef != null && oldRef !== ref) {
7574
- if (isString(oldRef)) {
7575
- refs[oldRef] = null;
7576
- if (hasOwn(setupState, oldRef)) {
7577
- setupState[oldRef] = null;
7578
- }
7579
- }
7580
- else if (isRef(oldRef)) {
7581
- oldRef.value = null;
7582
- }
7583
- }
7584
- if (isString(ref)) {
7585
- const doSet = () => {
7586
- if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
7587
- registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
7588
- }
7589
- else {
7590
- refs[ref] = value;
7591
- }
7592
- if (hasOwn(setupState, ref)) {
7593
- setupState[ref] = value;
7594
- }
7595
- };
7596
- // #1789: for non-null values, set them after render
7597
- // null values means this is unmount and it should not overwrite another
7598
- // ref with the same key
7599
- if (value) {
7600
- doSet.id = -1;
7601
- queuePostRenderEffect(doSet, parentSuspense);
7602
- }
7603
- else {
7604
- doSet();
7605
- }
7606
- }
7607
- else if (isRef(ref)) {
7608
- const doSet = () => {
7609
- ref.value = value;
7610
- };
7611
- if (value) {
7612
- doSet.id = -1;
7613
- queuePostRenderEffect(doSet, parentSuspense);
7614
- }
7615
- else {
7616
- doSet();
7617
- }
7618
- }
7619
- else if (isFunction(ref)) {
7620
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
7621
- }
7622
- else {
7623
- warn$1('Invalid template ref type:', value, `(${typeof value})`);
7624
- }
7625
- }
7626
- function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7627
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
7628
- vnode,
7629
- prevVNode
7630
- ]);
7614
+ function toggleRecurse({ effect, update }, allowed) {
7615
+ effect.allowRecurse = update.allowRecurse = allowed;
7631
7616
  }
7632
7617
  /**
7633
7618
  * #1156
@@ -7637,8 +7622,8 @@ var Vue = (function () {
7637
7622
  *
7638
7623
  * #2080
7639
7624
  * Inside keyed `template` fragment static children, if a fragment is moved,
7640
- * the children will always moved so that need inherit el form previous nodes
7641
- * to ensure correct moved position.
7625
+ * the children will always be moved. Therefore, in order to ensure correct move
7626
+ * position, el should be inherited from previous nodes.
7642
7627
  */
7643
7628
  function traverseStaticChildren(n1, n2, shallow = false) {
7644
7629
  const ch1 = n1.children;
@@ -8276,6 +8261,7 @@ var Vue = (function () {
8276
8261
  };
8277
8262
  Func.props = comp.props;
8278
8263
  Func.displayName = comp.name;
8264
+ Func.compatConfig = comp.compatConfig;
8279
8265
  // v2 functional components do not inherit attrs
8280
8266
  Func.inheritAttrs = false;
8281
8267
  normalizedFunctionalComponentMap.set(comp, Func);
@@ -8421,10 +8407,10 @@ var Vue = (function () {
8421
8407
  };
8422
8408
  const InternalObjectKey = `__vInternal`;
8423
8409
  const normalizeKey = ({ key }) => key != null ? key : null;
8424
- const normalizeRef = ({ ref }) => {
8410
+ const normalizeRef = ({ ref, ref_key, ref_for }) => {
8425
8411
  return (ref != null
8426
8412
  ? isString(ref) || isRef(ref) || isFunction(ref)
8427
- ? { i: currentRenderingInstance, r: ref }
8413
+ ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
8428
8414
  : ref
8429
8415
  : null);
8430
8416
  };
@@ -8492,7 +8478,6 @@ var Vue = (function () {
8492
8478
  }
8493
8479
  {
8494
8480
  convertLegacyVModelProps(vnode);
8495
- convertLegacyRefInFor(vnode);
8496
8481
  defineLegacyVNodeProperties(vnode);
8497
8482
  }
8498
8483
  return vnode;
@@ -8765,7 +8750,8 @@ var Vue = (function () {
8765
8750
  else if (isOn(key)) {
8766
8751
  const existing = ret[key];
8767
8752
  const incoming = toMerge[key];
8768
- if (existing !== incoming) {
8753
+ if (existing !== incoming &&
8754
+ !(isArray(existing) && existing.includes(incoming))) {
8769
8755
  ret[key] = existing
8770
8756
  ? [].concat(existing, incoming)
8771
8757
  : incoming;
@@ -8777,6 +8763,12 @@ var Vue = (function () {
8777
8763
  }
8778
8764
  }
8779
8765
  return ret;
8766
+ }
8767
+ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8768
+ callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
8769
+ vnode,
8770
+ prevVNode
8771
+ ]);
8780
8772
  }
8781
8773
 
8782
8774
  function getCompatChildren(instance) {
@@ -9209,23 +9201,23 @@ var Vue = (function () {
9209
9201
  const n = accessCache[key];
9210
9202
  if (n !== undefined) {
9211
9203
  switch (n) {
9212
- case 0 /* SETUP */:
9204
+ case 1 /* SETUP */:
9213
9205
  return setupState[key];
9214
- case 1 /* DATA */:
9206
+ case 2 /* DATA */:
9215
9207
  return data[key];
9216
- case 3 /* CONTEXT */:
9208
+ case 4 /* CONTEXT */:
9217
9209
  return ctx[key];
9218
- case 2 /* PROPS */:
9210
+ case 3 /* PROPS */:
9219
9211
  return props[key];
9220
9212
  // default: just fallthrough
9221
9213
  }
9222
9214
  }
9223
9215
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
9224
- accessCache[key] = 0 /* SETUP */;
9216
+ accessCache[key] = 1 /* SETUP */;
9225
9217
  return setupState[key];
9226
9218
  }
9227
9219
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
9228
- accessCache[key] = 1 /* DATA */;
9220
+ accessCache[key] = 2 /* DATA */;
9229
9221
  return data[key];
9230
9222
  }
9231
9223
  else if (
@@ -9233,15 +9225,15 @@ var Vue = (function () {
9233
9225
  // props
9234
9226
  (normalizedProps = instance.propsOptions[0]) &&
9235
9227
  hasOwn(normalizedProps, key)) {
9236
- accessCache[key] = 2 /* PROPS */;
9228
+ accessCache[key] = 3 /* PROPS */;
9237
9229
  return props[key];
9238
9230
  }
9239
9231
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9240
- accessCache[key] = 3 /* CONTEXT */;
9232
+ accessCache[key] = 4 /* CONTEXT */;
9241
9233
  return ctx[key];
9242
9234
  }
9243
9235
  else if (shouldCacheAccess) {
9244
- accessCache[key] = 4 /* OTHER */;
9236
+ accessCache[key] = 0 /* OTHER */;
9245
9237
  }
9246
9238
  }
9247
9239
  const publicGetter = publicPropertiesMap[key];
@@ -9262,7 +9254,7 @@ var Vue = (function () {
9262
9254
  }
9263
9255
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9264
9256
  // user may set custom properties to `this` that start with `$`
9265
- accessCache[key] = 3 /* CONTEXT */;
9257
+ accessCache[key] = 4 /* CONTEXT */;
9266
9258
  return ctx[key];
9267
9259
  }
9268
9260
  else if (
@@ -9330,7 +9322,7 @@ var Vue = (function () {
9330
9322
  },
9331
9323
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
9332
9324
  let normalizedProps;
9333
- return (accessCache[key] !== undefined ||
9325
+ return (!!accessCache[key] ||
9334
9326
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
9335
9327
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
9336
9328
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -9436,6 +9428,7 @@ var Vue = (function () {
9436
9428
  root: null,
9437
9429
  next: null,
9438
9430
  subTree: null,
9431
+ effect: null,
9439
9432
  update: null,
9440
9433
  scope: new EffectScope(true /* detached */),
9441
9434
  render: null,
@@ -10900,7 +10893,7 @@ var Vue = (function () {
10900
10893
  }
10901
10894
 
10902
10895
  // Core API ------------------------------------------------------------------
10903
- const version = "3.2.21";
10896
+ const version = "3.2.25";
10904
10897
  /**
10905
10898
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10906
10899
  * @internal
@@ -11167,12 +11160,19 @@ var Vue = (function () {
11167
11160
  el[key] = value == null ? '' : value;
11168
11161
  return;
11169
11162
  }
11170
- if (key === 'value' && el.tagName !== 'PROGRESS') {
11163
+ if (key === 'value' &&
11164
+ el.tagName !== 'PROGRESS' &&
11165
+ // custom elements may use _value internally
11166
+ !el.tagName.includes('-')) {
11171
11167
  // store value as _value as well since
11172
11168
  // non-string values will be stringified.
11173
11169
  el._value = value;
11174
11170
  const newValue = value == null ? '' : value;
11175
- if (el.value !== newValue) {
11171
+ if (el.value !== newValue ||
11172
+ // #4956: always set for OPTION elements because its value falls back to
11173
+ // textContent if no value attribute is present. And setting .value for
11174
+ // OPTION has no side effect
11175
+ el.tagName === 'OPTION') {
11176
11176
  el.value = newValue;
11177
11177
  }
11178
11178
  if (value == null) {
@@ -11568,7 +11568,7 @@ var Vue = (function () {
11568
11568
  // HMR
11569
11569
  {
11570
11570
  instance.ceReload = newStyles => {
11571
- // alawys reset styles
11571
+ // always reset styles
11572
11572
  if (this._styles) {
11573
11573
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
11574
11574
  this._styles.length = 0;
@@ -13292,12 +13292,12 @@ var Vue = (function () {
13292
13292
  }
13293
13293
  else if (p.name === 'bind' &&
13294
13294
  (p.exp || allowEmpty) &&
13295
- isBindKey(p.arg, name)) {
13295
+ isStaticArgOf(p.arg, name)) {
13296
13296
  return p;
13297
13297
  }
13298
13298
  }
13299
13299
  }
13300
- function isBindKey(arg, name) {
13300
+ function isStaticArgOf(arg, name) {
13301
13301
  return !!(arg && isStaticExp(arg) && arg.content === name);
13302
13302
  }
13303
13303
  function hasDynamicKeyVBind(node) {
@@ -13340,7 +13340,6 @@ var Vue = (function () {
13340
13340
  }
13341
13341
  function injectProp(node, prop, context) {
13342
13342
  let propsWithInjection;
13343
- const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13344
13343
  /**
13345
13344
  * 1. mergeProps(...)
13346
13345
  * 2. toHandlers(...)
@@ -13349,7 +13348,7 @@ var Vue = (function () {
13349
13348
  *
13350
13349
  * we need to get the real props before normalization
13351
13350
  */
13352
- let props = originalProps;
13351
+ let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13353
13352
  let callPath = [];
13354
13353
  let parentCall;
13355
13354
  if (props &&
@@ -13488,11 +13487,6 @@ var Vue = (function () {
13488
13487
  `data source.`,
13489
13488
  link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
13490
13489
  },
13491
- ["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
13492
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
13493
- `Consider using function refs or refactor to avoid ref usage altogether.`,
13494
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
13495
- },
13496
13490
  ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
13497
13491
  message: `<template> with no special directives will render as a native template ` +
13498
13492
  `element instead of its inner content in Vue 3.`
@@ -14010,7 +14004,7 @@ var Vue = (function () {
14010
14004
  else if (
14011
14005
  // :is on plain element - only treat as component in compat mode
14012
14006
  p.name === 'bind' &&
14013
- isBindKey(p.arg, 'is') &&
14007
+ isStaticArgOf(p.arg, 'is') &&
14014
14008
  true &&
14015
14009
  checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
14016
14010
  return true;
@@ -14370,15 +14364,6 @@ var Vue = (function () {
14370
14364
  !isSlotOutlet(child));
14371
14365
  }
14372
14366
  function walk$1(node, context, doNotHoistNode = false) {
14373
- // Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
14374
- // static bindings with expressions. These expressions are guaranteed to be
14375
- // constant so they are still eligible for hoisting, but they are only
14376
- // available at runtime and therefore cannot be evaluated ahead of time.
14377
- // This is only a concern for pre-stringification (via transformHoist by
14378
- // @vue/compiler-dom), but doing it here allows us to perform only one full
14379
- // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
14380
- // stringification threshold is met.
14381
- let canStringify = true;
14382
14367
  const { children } = node;
14383
14368
  const originalCount = children.length;
14384
14369
  let hoistedCount = 0;
@@ -14391,9 +14376,6 @@ var Vue = (function () {
14391
14376
  ? 0 /* NOT_CONSTANT */
14392
14377
  : getConstantType(child, context);
14393
14378
  if (constantType > 0 /* NOT_CONSTANT */) {
14394
- if (constantType < 3 /* CAN_STRINGIFY */) {
14395
- canStringify = false;
14396
- }
14397
14379
  if (constantType >= 2 /* CAN_HOIST */) {
14398
14380
  child.codegenNode.patchFlag =
14399
14381
  -1 /* HOISTED */ + (` /* HOISTED */` );
@@ -14424,17 +14406,10 @@ var Vue = (function () {
14424
14406
  }
14425
14407
  }
14426
14408
  }
14427
- else if (child.type === 12 /* TEXT_CALL */) {
14428
- const contentType = getConstantType(child.content, context);
14429
- if (contentType > 0) {
14430
- if (contentType < 3 /* CAN_STRINGIFY */) {
14431
- canStringify = false;
14432
- }
14433
- if (contentType >= 2 /* CAN_HOIST */) {
14434
- child.codegenNode = context.hoist(child.codegenNode);
14435
- hoistedCount++;
14436
- }
14437
- }
14409
+ else if (child.type === 12 /* TEXT_CALL */ &&
14410
+ getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
14411
+ child.codegenNode = context.hoist(child.codegenNode);
14412
+ hoistedCount++;
14438
14413
  }
14439
14414
  // walk further
14440
14415
  if (child.type === 1 /* ELEMENT */) {
@@ -14458,7 +14433,7 @@ var Vue = (function () {
14458
14433
  }
14459
14434
  }
14460
14435
  }
14461
- if (canStringify && hoistedCount && context.transformHoist) {
14436
+ if (hoistedCount && context.transformHoist) {
14462
14437
  context.transformHoist(children, context, node);
14463
14438
  }
14464
14439
  // all children were hoisted - the entire children array is hoistable.
@@ -14487,6 +14462,11 @@ var Vue = (function () {
14487
14462
  if (codegenNode.type !== 13 /* VNODE_CALL */) {
14488
14463
  return 0 /* NOT_CONSTANT */;
14489
14464
  }
14465
+ if (codegenNode.isBlock &&
14466
+ node.tag !== 'svg' &&
14467
+ node.tag !== 'foreignObject') {
14468
+ return 0 /* NOT_CONSTANT */;
14469
+ }
14490
14470
  const flag = getPatchFlag(codegenNode);
14491
14471
  if (!flag) {
14492
14472
  let returnType = 3 /* CAN_STRINGIFY */;
@@ -14623,7 +14603,7 @@ var Vue = (function () {
14623
14603
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
14624
14604
  // some helper calls can be hoisted,
14625
14605
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
14626
- // in this case we need to respect the ConstantType of the helper's argments
14606
+ // in this case we need to respect the ConstantType of the helper's arguments
14627
14607
  valueType = getConstantTypeOfHelperCall(value, context);
14628
14608
  }
14629
14609
  else {
@@ -16290,10 +16270,7 @@ var Vue = (function () {
16290
16270
  // updates inside get proper isSVG flag at runtime. (#639, #643)
16291
16271
  // This is technically web-specific, but splitting the logic out of core
16292
16272
  // leads to too much unnecessary complexity.
16293
- (tag === 'svg' ||
16294
- tag === 'foreignObject' ||
16295
- // #938: elements with dynamic keys should be forced into blocks
16296
- findProp(node, 'key', true)));
16273
+ (tag === 'svg' || tag === 'foreignObject'));
16297
16274
  // props
16298
16275
  if (props.length > 0) {
16299
16276
  const propsBuildResult = buildProps(node, context);
@@ -16305,6 +16282,9 @@ var Vue = (function () {
16305
16282
  directives && directives.length
16306
16283
  ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
16307
16284
  : undefined;
16285
+ if (propsBuildResult.shouldUseBlock) {
16286
+ shouldUseBlock = true;
16287
+ }
16308
16288
  }
16309
16289
  // children
16310
16290
  if (node.children.length > 0) {
@@ -16433,11 +16413,13 @@ var Vue = (function () {
16433
16413
  return toValidAssetId(tag, `component`);
16434
16414
  }
16435
16415
  function buildProps(node, context, props = node.props, ssr = false) {
16436
- const { tag, loc: elementLoc } = node;
16416
+ const { tag, loc: elementLoc, children } = node;
16437
16417
  const isComponent = node.tagType === 1 /* COMPONENT */;
16438
16418
  let properties = [];
16439
16419
  const mergeArgs = [];
16440
16420
  const runtimeDirectives = [];
16421
+ const hasChildren = children.length > 0;
16422
+ let shouldUseBlock = false;
16441
16423
  // patchFlag analysis
16442
16424
  let patchFlag = 0;
16443
16425
  let hasRef = false;
@@ -16500,9 +16482,12 @@ var Vue = (function () {
16500
16482
  const prop = props[i];
16501
16483
  if (prop.type === 6 /* ATTRIBUTE */) {
16502
16484
  const { loc, name, value } = prop;
16503
- let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
16485
+ let isStatic = true;
16504
16486
  if (name === 'ref') {
16505
16487
  hasRef = true;
16488
+ if (context.scopes.vFor > 0) {
16489
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16490
+ }
16506
16491
  }
16507
16492
  // skip is on <component>, or is="vue:xxx"
16508
16493
  if (name === 'is' &&
@@ -16511,7 +16496,7 @@ var Vue = (function () {
16511
16496
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
16512
16497
  continue;
16513
16498
  }
16514
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
16499
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
16515
16500
  }
16516
16501
  else {
16517
16502
  // directives
@@ -16532,7 +16517,7 @@ var Vue = (function () {
16532
16517
  // skip v-is and :is on <component>
16533
16518
  if (name === 'is' ||
16534
16519
  (isVBind &&
16535
- isBindKey(arg, 'is') &&
16520
+ isStaticArgOf(arg, 'is') &&
16536
16521
  (isComponentTag(tag) ||
16537
16522
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
16538
16523
  continue;
@@ -16541,6 +16526,17 @@ var Vue = (function () {
16541
16526
  if (isVOn && ssr) {
16542
16527
  continue;
16543
16528
  }
16529
+ if (
16530
+ // #938: elements with dynamic keys should be forced into blocks
16531
+ (isVBind && isStaticArgOf(arg, 'key')) ||
16532
+ // inline before-update hooks need to force block so that it is invoked
16533
+ // before children
16534
+ (isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
16535
+ shouldUseBlock = true;
16536
+ }
16537
+ if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
16538
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16539
+ }
16544
16540
  // special case for v-bind and v-on with no argument
16545
16541
  if (!arg && (isVBind || isVOn)) {
16546
16542
  hasDynamicKeys = true;
@@ -16614,14 +16610,13 @@ var Vue = (function () {
16614
16610
  else {
16615
16611
  // no built-in transform, this is a user custom directive.
16616
16612
  runtimeDirectives.push(prop);
16613
+ // custom dirs may use beforeUpdate so they need to force blocks
16614
+ // to ensure before-update gets called before children update
16615
+ if (hasChildren) {
16616
+ shouldUseBlock = true;
16617
+ }
16617
16618
  }
16618
16619
  }
16619
- if (prop.type === 6 /* ATTRIBUTE */ &&
16620
- prop.name === 'ref' &&
16621
- context.scopes.vFor > 0 &&
16622
- checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
16623
- properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
16624
- }
16625
16620
  }
16626
16621
  let propsExpression = undefined;
16627
16622
  // has v-bind="object" or v-on="object", wrap with mergeProps
@@ -16658,7 +16653,8 @@ var Vue = (function () {
16658
16653
  patchFlag |= 32 /* HYDRATE_EVENTS */;
16659
16654
  }
16660
16655
  }
16661
- if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16656
+ if (!shouldUseBlock &&
16657
+ (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16662
16658
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
16663
16659
  patchFlag |= 512 /* NEED_PATCH */;
16664
16660
  }
@@ -16725,7 +16721,8 @@ var Vue = (function () {
16725
16721
  props: propsExpression,
16726
16722
  directives: runtimeDirectives,
16727
16723
  patchFlag,
16728
- dynamicPropNames
16724
+ dynamicPropNames,
16725
+ shouldUseBlock
16729
16726
  };
16730
16727
  }
16731
16728
  // Dedupe props in an object literal.
@@ -16813,7 +16810,7 @@ var Vue = (function () {
16813
16810
  return propsNamesString + `]`;
16814
16811
  }
16815
16812
  function isComponentTag(tag) {
16816
- return tag[0].toLowerCase() + tag.slice(1) === 'component';
16813
+ return tag === 'component' || tag === 'Component';
16817
16814
  }
16818
16815
 
16819
16816
  const transformSlotOutlet = (node, context) => {
@@ -16861,7 +16858,7 @@ var Vue = (function () {
16861
16858
  }
16862
16859
  }
16863
16860
  else {
16864
- if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
16861
+ if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
16865
16862
  if (p.exp)
16866
16863
  slotName = p.exp;
16867
16864
  }
@@ -16895,7 +16892,11 @@ var Vue = (function () {
16895
16892
  let eventName;
16896
16893
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
16897
16894
  if (arg.isStatic) {
16898
- const rawName = arg.content;
16895
+ let rawName = arg.content;
16896
+ // TODO deprecate @vnodeXXX usage
16897
+ if (rawName.startsWith('vue:')) {
16898
+ rawName = `vnode-${rawName.slice(4)}`;
16899
+ }
16899
16900
  // for all event listeners, auto convert it to camelCase. See issue #2249
16900
16901
  eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
16901
16902
  }