@vue/compat 3.2.22 → 3.2.26

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 {
@@ -1899,11 +1903,6 @@ var Vue = (function () {
1899
1903
  `Use "${newHook}" instead.`,
1900
1904
  link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
1901
1905
  },
1902
- ["V_FOR_REF" /* V_FOR_REF */]: {
1903
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
1904
- `Consider using function refs or refactor to avoid ref usage altogether.`,
1905
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
1906
- },
1907
1906
  ["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
1908
1907
  message: `Using keyCode as v-on modifier is no longer supported. ` +
1909
1908
  `Use kebab-case key name modifiers instead.`,
@@ -3310,7 +3309,8 @@ var Vue = (function () {
3310
3309
  const rawProps = toRaw(props);
3311
3310
  const { mode } = rawProps;
3312
3311
  // check mode
3313
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3312
+ if (mode &&
3313
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3314
3314
  warn$1(`invalid <transition> mode: ${mode}`);
3315
3315
  }
3316
3316
  // at this point children has a guaranteed length of 1.
@@ -3956,7 +3956,7 @@ var Vue = (function () {
3956
3956
  }
3957
3957
  current = current.parent;
3958
3958
  }
3959
- hook();
3959
+ return hook();
3960
3960
  });
3961
3961
  injectHook(type, wrappedHook, target);
3962
3962
  // In addition to registering it on the target instance, we walk up the parent
@@ -4734,7 +4734,7 @@ var Vue = (function () {
4734
4734
  continue;
4735
4735
  }
4736
4736
  }
4737
- if (value !== attrs[key]) {
4737
+ if (!(key in attrs) || value !== attrs[key]) {
4738
4738
  attrs[key] = value;
4739
4739
  hasAttrsChanged = true;
4740
4740
  }
@@ -5315,7 +5315,7 @@ var Vue = (function () {
5315
5315
  return vm;
5316
5316
  }
5317
5317
  }
5318
- Vue.version = "3.2.22";
5318
+ Vue.version = "3.2.26";
5319
5319
  Vue.config = singletonApp.config;
5320
5320
  Vue.use = (p, ...options) => {
5321
5321
  if (p && isFunction(p.install)) {
@@ -5666,7 +5666,7 @@ var Vue = (function () {
5666
5666
  ];
5667
5667
  const patched = new WeakSet();
5668
5668
  function defineReactive(obj, key, val) {
5669
- // 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
5670
5670
  // and expecting reactivity... we are covering it here because this seems to
5671
5671
  // be a bit more common.
5672
5672
  if (isObject(val) && !isReactive(val) && !patched.has(val)) {
@@ -5886,6 +5886,102 @@ var Vue = (function () {
5886
5886
  };
5887
5887
  }
5888
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
+
5889
5985
  let hasMismatch = false;
5890
5986
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
5891
5987
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -6247,44 +6343,6 @@ var Vue = (function () {
6247
6343
  return supported;
6248
6344
  }
6249
6345
 
6250
- function convertLegacyRefInFor(vnode) {
6251
- // refInFor
6252
- if (vnode.props && vnode.props.refInFor) {
6253
- delete vnode.props.refInFor;
6254
- if (vnode.ref) {
6255
- if (isArray(vnode.ref)) {
6256
- vnode.ref.forEach(r => (r.f = true));
6257
- }
6258
- else {
6259
- vnode.ref.f = true;
6260
- }
6261
- }
6262
- }
6263
- }
6264
- function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
6265
- const existing = refs[key];
6266
- if (isUnmount) {
6267
- if (isArray(existing)) {
6268
- remove(existing, value);
6269
- }
6270
- else {
6271
- refs[key] = null;
6272
- }
6273
- }
6274
- else if (isInFor) {
6275
- warnDeprecation("V_FOR_REF" /* V_FOR_REF */, owner);
6276
- if (!isArray(existing)) {
6277
- refs[key] = [value];
6278
- }
6279
- else if (!existing.includes(value)) {
6280
- existing.push(value);
6281
- }
6282
- }
6283
- else {
6284
- refs[key] = value;
6285
- }
6286
- }
6287
-
6288
6346
  const queuePostRenderEffect = queueEffectWithSuspense
6289
6347
  ;
6290
6348
  /**
@@ -6556,12 +6614,15 @@ var Vue = (function () {
6556
6614
  const oldProps = n1.props || EMPTY_OBJ;
6557
6615
  const newProps = n2.props || EMPTY_OBJ;
6558
6616
  let vnodeHook;
6617
+ // disable recurse in beforeUpdate hooks
6618
+ parentComponent && toggleRecurse(parentComponent, false);
6559
6619
  if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
6560
6620
  invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6561
6621
  }
6562
6622
  if (dirs) {
6563
6623
  invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
6564
6624
  }
6625
+ parentComponent && toggleRecurse(parentComponent, true);
6565
6626
  if (isHmrUpdating) {
6566
6627
  // HMR updated, force full diff
6567
6628
  patchFlag = 0;
@@ -6845,7 +6906,7 @@ var Vue = (function () {
6845
6906
  const { el, props } = initialVNode;
6846
6907
  const { bm, m, parent } = instance;
6847
6908
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
6848
- effect.allowRecurse = false;
6909
+ toggleRecurse(instance, false);
6849
6910
  // beforeMount hook
6850
6911
  if (bm) {
6851
6912
  invokeArrayFns(bm);
@@ -6858,7 +6919,7 @@ var Vue = (function () {
6858
6919
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6859
6920
  instance.emit('hook:beforeMount');
6860
6921
  }
6861
- effect.allowRecurse = true;
6922
+ toggleRecurse(instance, true);
6862
6923
  if (el && hydrateNode) {
6863
6924
  // vnode has adopted host node - perform hydration instead of mount.
6864
6925
  const hydrateSubTree = () => {
@@ -6946,7 +7007,7 @@ var Vue = (function () {
6946
7007
  pushWarningContext(next || instance.vnode);
6947
7008
  }
6948
7009
  // Disallow component effect recursion during pre-lifecycle hooks.
6949
- effect.allowRecurse = false;
7010
+ toggleRecurse(instance, false);
6950
7011
  if (next) {
6951
7012
  next.el = vnode.el;
6952
7013
  updateComponentPreRender(instance, next, optimized);
@@ -6965,7 +7026,7 @@ var Vue = (function () {
6965
7026
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6966
7027
  instance.emit('hook:beforeUpdate');
6967
7028
  }
6968
- effect.allowRecurse = true;
7029
+ toggleRecurse(instance, true);
6969
7030
  // render
6970
7031
  {
6971
7032
  startMeasure(instance, `render`);
@@ -7014,13 +7075,13 @@ var Vue = (function () {
7014
7075
  }
7015
7076
  };
7016
7077
  // create reactive effect for rendering
7017
- const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7018
- );
7078
+ const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7079
+ ));
7019
7080
  const update = (instance.update = effect.run.bind(effect));
7020
7081
  update.id = instance.uid;
7021
7082
  // allowRecurse
7022
7083
  // #1801, #2043 component render effects should allow recursive updates
7023
- effect.allowRecurse = update.allowRecurse = true;
7084
+ toggleRecurse(instance, true);
7024
7085
  {
7025
7086
  effect.onTrack = instance.rtc
7026
7087
  ? e => invokeArrayFns(instance.rtc, e)
@@ -7550,88 +7611,8 @@ var Vue = (function () {
7550
7611
  createApp: createAppAPI(render, hydrate)
7551
7612
  };
7552
7613
  }
7553
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7554
- if (isArray(rawRef)) {
7555
- rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
7556
- return;
7557
- }
7558
- if (isAsyncWrapper(vnode) && !isUnmount) {
7559
- // when mounting async components, nothing needs to be done,
7560
- // because the template ref is forwarded to inner component
7561
- return;
7562
- }
7563
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
7564
- ? getExposeProxy(vnode.component) || vnode.component.proxy
7565
- : vnode.el;
7566
- const value = isUnmount ? null : refValue;
7567
- const { i: owner, r: ref } = rawRef;
7568
- if (!owner) {
7569
- warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
7570
- `A vnode with ref must be created inside the render function.`);
7571
- return;
7572
- }
7573
- const oldRef = oldRawRef && oldRawRef.r;
7574
- const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
7575
- const setupState = owner.setupState;
7576
- // dynamic ref changed. unset old ref
7577
- if (oldRef != null && oldRef !== ref) {
7578
- if (isString(oldRef)) {
7579
- refs[oldRef] = null;
7580
- if (hasOwn(setupState, oldRef)) {
7581
- setupState[oldRef] = null;
7582
- }
7583
- }
7584
- else if (isRef(oldRef)) {
7585
- oldRef.value = null;
7586
- }
7587
- }
7588
- if (isString(ref)) {
7589
- const doSet = () => {
7590
- if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
7591
- registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
7592
- }
7593
- else {
7594
- refs[ref] = value;
7595
- }
7596
- if (hasOwn(setupState, ref)) {
7597
- setupState[ref] = value;
7598
- }
7599
- };
7600
- // #1789: for non-null values, set them after render
7601
- // null values means this is unmount and it should not overwrite another
7602
- // ref with the same key
7603
- if (value) {
7604
- doSet.id = -1;
7605
- queuePostRenderEffect(doSet, parentSuspense);
7606
- }
7607
- else {
7608
- doSet();
7609
- }
7610
- }
7611
- else if (isRef(ref)) {
7612
- const doSet = () => {
7613
- ref.value = value;
7614
- };
7615
- if (value) {
7616
- doSet.id = -1;
7617
- queuePostRenderEffect(doSet, parentSuspense);
7618
- }
7619
- else {
7620
- doSet();
7621
- }
7622
- }
7623
- else if (isFunction(ref)) {
7624
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
7625
- }
7626
- else {
7627
- warn$1('Invalid template ref type:', value, `(${typeof value})`);
7628
- }
7629
- }
7630
- function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7631
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
7632
- vnode,
7633
- prevVNode
7634
- ]);
7614
+ function toggleRecurse({ effect, update }, allowed) {
7615
+ effect.allowRecurse = update.allowRecurse = allowed;
7635
7616
  }
7636
7617
  /**
7637
7618
  * #1156
@@ -8280,6 +8261,7 @@ var Vue = (function () {
8280
8261
  };
8281
8262
  Func.props = comp.props;
8282
8263
  Func.displayName = comp.name;
8264
+ Func.compatConfig = comp.compatConfig;
8283
8265
  // v2 functional components do not inherit attrs
8284
8266
  Func.inheritAttrs = false;
8285
8267
  normalizedFunctionalComponentMap.set(comp, Func);
@@ -8425,10 +8407,10 @@ var Vue = (function () {
8425
8407
  };
8426
8408
  const InternalObjectKey = `__vInternal`;
8427
8409
  const normalizeKey = ({ key }) => key != null ? key : null;
8428
- const normalizeRef = ({ ref }) => {
8410
+ const normalizeRef = ({ ref, ref_key, ref_for }) => {
8429
8411
  return (ref != null
8430
8412
  ? isString(ref) || isRef(ref) || isFunction(ref)
8431
- ? { i: currentRenderingInstance, r: ref }
8413
+ ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
8432
8414
  : ref
8433
8415
  : null);
8434
8416
  };
@@ -8496,7 +8478,6 @@ var Vue = (function () {
8496
8478
  }
8497
8479
  {
8498
8480
  convertLegacyVModelProps(vnode);
8499
- convertLegacyRefInFor(vnode);
8500
8481
  defineLegacyVNodeProperties(vnode);
8501
8482
  }
8502
8483
  return vnode;
@@ -8782,6 +8763,12 @@ var Vue = (function () {
8782
8763
  }
8783
8764
  }
8784
8765
  return ret;
8766
+ }
8767
+ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8768
+ callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
8769
+ vnode,
8770
+ prevVNode
8771
+ ]);
8785
8772
  }
8786
8773
 
8787
8774
  function getCompatChildren(instance) {
@@ -9214,23 +9201,23 @@ var Vue = (function () {
9214
9201
  const n = accessCache[key];
9215
9202
  if (n !== undefined) {
9216
9203
  switch (n) {
9217
- case 0 /* SETUP */:
9204
+ case 1 /* SETUP */:
9218
9205
  return setupState[key];
9219
- case 1 /* DATA */:
9206
+ case 2 /* DATA */:
9220
9207
  return data[key];
9221
- case 3 /* CONTEXT */:
9208
+ case 4 /* CONTEXT */:
9222
9209
  return ctx[key];
9223
- case 2 /* PROPS */:
9210
+ case 3 /* PROPS */:
9224
9211
  return props[key];
9225
9212
  // default: just fallthrough
9226
9213
  }
9227
9214
  }
9228
9215
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
9229
- accessCache[key] = 0 /* SETUP */;
9216
+ accessCache[key] = 1 /* SETUP */;
9230
9217
  return setupState[key];
9231
9218
  }
9232
9219
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
9233
- accessCache[key] = 1 /* DATA */;
9220
+ accessCache[key] = 2 /* DATA */;
9234
9221
  return data[key];
9235
9222
  }
9236
9223
  else if (
@@ -9238,15 +9225,15 @@ var Vue = (function () {
9238
9225
  // props
9239
9226
  (normalizedProps = instance.propsOptions[0]) &&
9240
9227
  hasOwn(normalizedProps, key)) {
9241
- accessCache[key] = 2 /* PROPS */;
9228
+ accessCache[key] = 3 /* PROPS */;
9242
9229
  return props[key];
9243
9230
  }
9244
9231
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9245
- accessCache[key] = 3 /* CONTEXT */;
9232
+ accessCache[key] = 4 /* CONTEXT */;
9246
9233
  return ctx[key];
9247
9234
  }
9248
9235
  else if (shouldCacheAccess) {
9249
- accessCache[key] = 4 /* OTHER */;
9236
+ accessCache[key] = 0 /* OTHER */;
9250
9237
  }
9251
9238
  }
9252
9239
  const publicGetter = publicPropertiesMap[key];
@@ -9267,7 +9254,7 @@ var Vue = (function () {
9267
9254
  }
9268
9255
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9269
9256
  // user may set custom properties to `this` that start with `$`
9270
- accessCache[key] = 3 /* CONTEXT */;
9257
+ accessCache[key] = 4 /* CONTEXT */;
9271
9258
  return ctx[key];
9272
9259
  }
9273
9260
  else if (
@@ -9335,7 +9322,7 @@ var Vue = (function () {
9335
9322
  },
9336
9323
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
9337
9324
  let normalizedProps;
9338
- return (accessCache[key] !== undefined ||
9325
+ return (!!accessCache[key] ||
9339
9326
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
9340
9327
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
9341
9328
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -9441,6 +9428,7 @@ var Vue = (function () {
9441
9428
  root: null,
9442
9429
  next: null,
9443
9430
  subTree: null,
9431
+ effect: null,
9444
9432
  update: null,
9445
9433
  scope: new EffectScope(true /* detached */),
9446
9434
  render: null,
@@ -10905,7 +10893,7 @@ var Vue = (function () {
10905
10893
  }
10906
10894
 
10907
10895
  // Core API ------------------------------------------------------------------
10908
- const version = "3.2.22";
10896
+ const version = "3.2.26";
10909
10897
  /**
10910
10898
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10911
10899
  * @internal
@@ -11172,12 +11160,19 @@ var Vue = (function () {
11172
11160
  el[key] = value == null ? '' : value;
11173
11161
  return;
11174
11162
  }
11175
- 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('-')) {
11176
11167
  // store value as _value as well since
11177
11168
  // non-string values will be stringified.
11178
11169
  el._value = value;
11179
11170
  const newValue = value == null ? '' : value;
11180
- 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') {
11181
11176
  el.value = newValue;
11182
11177
  }
11183
11178
  if (value == null) {
@@ -11573,7 +11568,7 @@ var Vue = (function () {
11573
11568
  // HMR
11574
11569
  {
11575
11570
  instance.ceReload = newStyles => {
11576
- // alawys reset styles
11571
+ // always reset styles
11577
11572
  if (this._styles) {
11578
11573
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
11579
11574
  this._styles.length = 0;
@@ -13297,12 +13292,12 @@ var Vue = (function () {
13297
13292
  }
13298
13293
  else if (p.name === 'bind' &&
13299
13294
  (p.exp || allowEmpty) &&
13300
- isBindKey(p.arg, name)) {
13295
+ isStaticArgOf(p.arg, name)) {
13301
13296
  return p;
13302
13297
  }
13303
13298
  }
13304
13299
  }
13305
- function isBindKey(arg, name) {
13300
+ function isStaticArgOf(arg, name) {
13306
13301
  return !!(arg && isStaticExp(arg) && arg.content === name);
13307
13302
  }
13308
13303
  function hasDynamicKeyVBind(node) {
@@ -13345,7 +13340,6 @@ var Vue = (function () {
13345
13340
  }
13346
13341
  function injectProp(node, prop, context) {
13347
13342
  let propsWithInjection;
13348
- const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13349
13343
  /**
13350
13344
  * 1. mergeProps(...)
13351
13345
  * 2. toHandlers(...)
@@ -13354,7 +13348,7 @@ var Vue = (function () {
13354
13348
  *
13355
13349
  * we need to get the real props before normalization
13356
13350
  */
13357
- let props = originalProps;
13351
+ let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13358
13352
  let callPath = [];
13359
13353
  let parentCall;
13360
13354
  if (props &&
@@ -13493,11 +13487,6 @@ var Vue = (function () {
13493
13487
  `data source.`,
13494
13488
  link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
13495
13489
  },
13496
- ["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
13497
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
13498
- `Consider using function refs or refactor to avoid ref usage altogether.`,
13499
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
13500
- },
13501
13490
  ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
13502
13491
  message: `<template> with no special directives will render as a native template ` +
13503
13492
  `element instead of its inner content in Vue 3.`
@@ -14015,7 +14004,7 @@ var Vue = (function () {
14015
14004
  else if (
14016
14005
  // :is on plain element - only treat as component in compat mode
14017
14006
  p.name === 'bind' &&
14018
- isBindKey(p.arg, 'is') &&
14007
+ isStaticArgOf(p.arg, 'is') &&
14019
14008
  true &&
14020
14009
  checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
14021
14010
  return true;
@@ -14375,15 +14364,6 @@ var Vue = (function () {
14375
14364
  !isSlotOutlet(child));
14376
14365
  }
14377
14366
  function walk$1(node, context, doNotHoistNode = false) {
14378
- // Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
14379
- // static bindings with expressions. These expressions are guaranteed to be
14380
- // constant so they are still eligible for hoisting, but they are only
14381
- // available at runtime and therefore cannot be evaluated ahead of time.
14382
- // This is only a concern for pre-stringification (via transformHoist by
14383
- // @vue/compiler-dom), but doing it here allows us to perform only one full
14384
- // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
14385
- // stringification threshold is met.
14386
- let canStringify = true;
14387
14367
  const { children } = node;
14388
14368
  const originalCount = children.length;
14389
14369
  let hoistedCount = 0;
@@ -14396,9 +14376,6 @@ var Vue = (function () {
14396
14376
  ? 0 /* NOT_CONSTANT */
14397
14377
  : getConstantType(child, context);
14398
14378
  if (constantType > 0 /* NOT_CONSTANT */) {
14399
- if (constantType < 3 /* CAN_STRINGIFY */) {
14400
- canStringify = false;
14401
- }
14402
14379
  if (constantType >= 2 /* CAN_HOIST */) {
14403
14380
  child.codegenNode.patchFlag =
14404
14381
  -1 /* HOISTED */ + (` /* HOISTED */` );
@@ -14429,17 +14406,10 @@ var Vue = (function () {
14429
14406
  }
14430
14407
  }
14431
14408
  }
14432
- else if (child.type === 12 /* TEXT_CALL */) {
14433
- const contentType = getConstantType(child.content, context);
14434
- if (contentType > 0) {
14435
- if (contentType < 3 /* CAN_STRINGIFY */) {
14436
- canStringify = false;
14437
- }
14438
- if (contentType >= 2 /* CAN_HOIST */) {
14439
- child.codegenNode = context.hoist(child.codegenNode);
14440
- hoistedCount++;
14441
- }
14442
- }
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++;
14443
14413
  }
14444
14414
  // walk further
14445
14415
  if (child.type === 1 /* ELEMENT */) {
@@ -14463,7 +14433,7 @@ var Vue = (function () {
14463
14433
  }
14464
14434
  }
14465
14435
  }
14466
- if (canStringify && hoistedCount && context.transformHoist) {
14436
+ if (hoistedCount && context.transformHoist) {
14467
14437
  context.transformHoist(children, context, node);
14468
14438
  }
14469
14439
  // all children were hoisted - the entire children array is hoistable.
@@ -14492,6 +14462,11 @@ var Vue = (function () {
14492
14462
  if (codegenNode.type !== 13 /* VNODE_CALL */) {
14493
14463
  return 0 /* NOT_CONSTANT */;
14494
14464
  }
14465
+ if (codegenNode.isBlock &&
14466
+ node.tag !== 'svg' &&
14467
+ node.tag !== 'foreignObject') {
14468
+ return 0 /* NOT_CONSTANT */;
14469
+ }
14495
14470
  const flag = getPatchFlag(codegenNode);
14496
14471
  if (!flag) {
14497
14472
  let returnType = 3 /* CAN_STRINGIFY */;
@@ -14628,7 +14603,7 @@ var Vue = (function () {
14628
14603
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
14629
14604
  // some helper calls can be hoisted,
14630
14605
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
14631
- // 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
14632
14607
  valueType = getConstantTypeOfHelperCall(value, context);
14633
14608
  }
14634
14609
  else {
@@ -16295,10 +16270,7 @@ var Vue = (function () {
16295
16270
  // updates inside get proper isSVG flag at runtime. (#639, #643)
16296
16271
  // This is technically web-specific, but splitting the logic out of core
16297
16272
  // leads to too much unnecessary complexity.
16298
- (tag === 'svg' ||
16299
- tag === 'foreignObject' ||
16300
- // #938: elements with dynamic keys should be forced into blocks
16301
- findProp(node, 'key', true)));
16273
+ (tag === 'svg' || tag === 'foreignObject'));
16302
16274
  // props
16303
16275
  if (props.length > 0) {
16304
16276
  const propsBuildResult = buildProps(node, context);
@@ -16310,6 +16282,9 @@ var Vue = (function () {
16310
16282
  directives && directives.length
16311
16283
  ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
16312
16284
  : undefined;
16285
+ if (propsBuildResult.shouldUseBlock) {
16286
+ shouldUseBlock = true;
16287
+ }
16313
16288
  }
16314
16289
  // children
16315
16290
  if (node.children.length > 0) {
@@ -16438,11 +16413,13 @@ var Vue = (function () {
16438
16413
  return toValidAssetId(tag, `component`);
16439
16414
  }
16440
16415
  function buildProps(node, context, props = node.props, ssr = false) {
16441
- const { tag, loc: elementLoc } = node;
16416
+ const { tag, loc: elementLoc, children } = node;
16442
16417
  const isComponent = node.tagType === 1 /* COMPONENT */;
16443
16418
  let properties = [];
16444
16419
  const mergeArgs = [];
16445
16420
  const runtimeDirectives = [];
16421
+ const hasChildren = children.length > 0;
16422
+ let shouldUseBlock = false;
16446
16423
  // patchFlag analysis
16447
16424
  let patchFlag = 0;
16448
16425
  let hasRef = false;
@@ -16505,9 +16482,12 @@ var Vue = (function () {
16505
16482
  const prop = props[i];
16506
16483
  if (prop.type === 6 /* ATTRIBUTE */) {
16507
16484
  const { loc, name, value } = prop;
16508
- let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
16485
+ let isStatic = true;
16509
16486
  if (name === 'ref') {
16510
16487
  hasRef = true;
16488
+ if (context.scopes.vFor > 0) {
16489
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16490
+ }
16511
16491
  }
16512
16492
  // skip is on <component>, or is="vue:xxx"
16513
16493
  if (name === 'is' &&
@@ -16516,7 +16496,7 @@ var Vue = (function () {
16516
16496
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
16517
16497
  continue;
16518
16498
  }
16519
- 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)));
16520
16500
  }
16521
16501
  else {
16522
16502
  // directives
@@ -16537,7 +16517,7 @@ var Vue = (function () {
16537
16517
  // skip v-is and :is on <component>
16538
16518
  if (name === 'is' ||
16539
16519
  (isVBind &&
16540
- isBindKey(arg, 'is') &&
16520
+ isStaticArgOf(arg, 'is') &&
16541
16521
  (isComponentTag(tag) ||
16542
16522
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
16543
16523
  continue;
@@ -16546,6 +16526,17 @@ var Vue = (function () {
16546
16526
  if (isVOn && ssr) {
16547
16527
  continue;
16548
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
+ }
16549
16540
  // special case for v-bind and v-on with no argument
16550
16541
  if (!arg && (isVBind || isVOn)) {
16551
16542
  hasDynamicKeys = true;
@@ -16619,14 +16610,13 @@ var Vue = (function () {
16619
16610
  else {
16620
16611
  // no built-in transform, this is a user custom directive.
16621
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
+ }
16622
16618
  }
16623
16619
  }
16624
- if (prop.type === 6 /* ATTRIBUTE */ &&
16625
- prop.name === 'ref' &&
16626
- context.scopes.vFor > 0 &&
16627
- checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
16628
- properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
16629
- }
16630
16620
  }
16631
16621
  let propsExpression = undefined;
16632
16622
  // has v-bind="object" or v-on="object", wrap with mergeProps
@@ -16663,7 +16653,8 @@ var Vue = (function () {
16663
16653
  patchFlag |= 32 /* HYDRATE_EVENTS */;
16664
16654
  }
16665
16655
  }
16666
- if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16656
+ if (!shouldUseBlock &&
16657
+ (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16667
16658
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
16668
16659
  patchFlag |= 512 /* NEED_PATCH */;
16669
16660
  }
@@ -16730,7 +16721,8 @@ var Vue = (function () {
16730
16721
  props: propsExpression,
16731
16722
  directives: runtimeDirectives,
16732
16723
  patchFlag,
16733
- dynamicPropNames
16724
+ dynamicPropNames,
16725
+ shouldUseBlock
16734
16726
  };
16735
16727
  }
16736
16728
  // Dedupe props in an object literal.
@@ -16866,7 +16858,7 @@ var Vue = (function () {
16866
16858
  }
16867
16859
  }
16868
16860
  else {
16869
- if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
16861
+ if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
16870
16862
  if (p.exp)
16871
16863
  slotName = p.exp;
16872
16864
  }
@@ -16900,7 +16892,11 @@ var Vue = (function () {
16900
16892
  let eventName;
16901
16893
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
16902
16894
  if (arg.isStatic) {
16903
- 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
+ }
16904
16900
  // for all event listeners, auto convert it to camelCase. See issue #2249
16905
16901
  eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
16906
16902
  }