@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.
@@ -107,7 +107,7 @@ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomo
107
107
  const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
108
108
  /**
109
109
  * Boolean attributes should be included if the value is truthy or ''.
110
- * e.g. <select multiple> compiles to { multiple: '' }
110
+ * e.g. `<select multiple>` compiles to `{ multiple: '' }`
111
111
  */
112
112
  function includeBooleanAttr(value) {
113
113
  return !!value || value === '';
@@ -341,7 +341,7 @@ const isIntegerKey = (key) => isString(key) &&
341
341
  '' + parseInt(key, 10) === key;
342
342
  const isReservedProp = /*#__PURE__*/ makeMap(
343
343
  // the leading comma is intentional so empty string "" is also included
344
- ',key,ref,' +
344
+ ',key,ref,ref_for,ref_key,' +
345
345
  'onVnodeBeforeMount,onVnodeMounted,' +
346
346
  'onVnodeBeforeUpdate,onVnodeUpdated,' +
347
347
  'onVnodeBeforeUnmount,onVnodeUnmounted');
@@ -530,7 +530,7 @@ const targetMap = new WeakMap();
530
530
  let effectTrackDepth = 0;
531
531
  let trackOpBit = 1;
532
532
  /**
533
- * The bitwise track markers support at most 30 levels op recursion.
533
+ * The bitwise track markers support at most 30 levels of recursion.
534
534
  * This value is chosen to enable modern JS engines to use a SMI on all platforms.
535
535
  * When recursion depth is greater, fall back to using a full cleanup.
536
536
  */
@@ -851,7 +851,7 @@ const shallowSet = /*#__PURE__*/ createSetter(true);
851
851
  function createSetter(shallow = false) {
852
852
  return function set(target, key, value, receiver) {
853
853
  let oldValue = target[key];
854
- if (!shallow) {
854
+ if (!shallow && !isReadonly(value)) {
855
855
  value = toRaw(value);
856
856
  oldValue = toRaw(oldValue);
857
857
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
@@ -1436,21 +1436,25 @@ function toRefs(object) {
1436
1436
  return ret;
1437
1437
  }
1438
1438
  class ObjectRefImpl {
1439
- constructor(_object, _key) {
1439
+ constructor(_object, _key, _defaultValue) {
1440
1440
  this._object = _object;
1441
1441
  this._key = _key;
1442
+ this._defaultValue = _defaultValue;
1442
1443
  this.__v_isRef = true;
1443
1444
  }
1444
1445
  get value() {
1445
- return this._object[this._key];
1446
+ const val = this._object[this._key];
1447
+ return val === undefined ? this._defaultValue : val;
1446
1448
  }
1447
1449
  set value(newVal) {
1448
1450
  this._object[this._key] = newVal;
1449
1451
  }
1450
1452
  }
1451
- function toRef(object, key) {
1453
+ function toRef(object, key, defaultValue) {
1452
1454
  const val = object[key];
1453
- return isRef(val) ? val : new ObjectRefImpl(object, key);
1455
+ return isRef(val)
1456
+ ? val
1457
+ : new ObjectRefImpl(object, key, defaultValue);
1454
1458
  }
1455
1459
 
1456
1460
  class ComputedRefImpl {
@@ -1896,11 +1900,6 @@ const deprecationData = {
1896
1900
  `Use "${newHook}" instead.`,
1897
1901
  link: `https://v3.vuejs.org/guide/migration/custom-directives.html`
1898
1902
  },
1899
- ["V_FOR_REF" /* V_FOR_REF */]: {
1900
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
1901
- `Consider using function refs or refactor to avoid ref usage altogether.`,
1902
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
1903
- },
1904
1903
  ["V_ON_KEYCODE_MODIFIER" /* V_ON_KEYCODE_MODIFIER */]: {
1905
1904
  message: `Using keyCode as v-on modifier is no longer supported. ` +
1906
1905
  `Use kebab-case key name modifiers instead.`,
@@ -3307,7 +3306,8 @@ const BaseTransitionImpl = {
3307
3306
  const rawProps = toRaw(props);
3308
3307
  const { mode } = rawProps;
3309
3308
  // check mode
3310
- if (mode && !['in-out', 'out-in', 'default'].includes(mode)) {
3309
+ if (mode &&
3310
+ mode !== 'in-out' && mode !== 'out-in' && mode !== 'default') {
3311
3311
  warn$1(`invalid <transition> mode: ${mode}`);
3312
3312
  }
3313
3313
  // at this point children has a guaranteed length of 1.
@@ -3953,7 +3953,7 @@ function registerKeepAliveHook(hook, type, target = currentInstance) {
3953
3953
  }
3954
3954
  current = current.parent;
3955
3955
  }
3956
- hook();
3956
+ return hook();
3957
3957
  });
3958
3958
  injectHook(type, wrappedHook, target);
3959
3959
  // In addition to registering it on the target instance, we walk up the parent
@@ -4731,7 +4731,7 @@ function setFullProps(instance, rawProps, props, attrs) {
4731
4731
  continue;
4732
4732
  }
4733
4733
  }
4734
- if (value !== attrs[key]) {
4734
+ if (!(key in attrs) || value !== attrs[key]) {
4735
4735
  attrs[key] = value;
4736
4736
  hasAttrsChanged = true;
4737
4737
  }
@@ -5312,7 +5312,7 @@ function createCompatVue(createApp, createSingletonApp) {
5312
5312
  return vm;
5313
5313
  }
5314
5314
  }
5315
- Vue.version = "3.2.22";
5315
+ Vue.version = "3.2.26";
5316
5316
  Vue.config = singletonApp.config;
5317
5317
  Vue.use = (p, ...options) => {
5318
5318
  if (p && isFunction(p.install)) {
@@ -5663,7 +5663,7 @@ const methodsToPatch = [
5663
5663
  ];
5664
5664
  const patched = new WeakSet();
5665
5665
  function defineReactive(obj, key, val) {
5666
- // it's possible for the orignial object to be mutated after being defined
5666
+ // it's possible for the original object to be mutated after being defined
5667
5667
  // and expecting reactivity... we are covering it here because this seems to
5668
5668
  // be a bit more common.
5669
5669
  if (isObject(val) && !isReactive(val) && !patched.has(val)) {
@@ -5883,6 +5883,102 @@ function createAppAPI(render, hydrate) {
5883
5883
  };
5884
5884
  }
5885
5885
 
5886
+ /**
5887
+ * Function for handling a template ref
5888
+ */
5889
+ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5890
+ if (isArray(rawRef)) {
5891
+ rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
5892
+ return;
5893
+ }
5894
+ if (isAsyncWrapper(vnode) && !isUnmount) {
5895
+ // when mounting async components, nothing needs to be done,
5896
+ // because the template ref is forwarded to inner component
5897
+ return;
5898
+ }
5899
+ const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
5900
+ ? getExposeProxy(vnode.component) || vnode.component.proxy
5901
+ : vnode.el;
5902
+ const value = isUnmount ? null : refValue;
5903
+ const { i: owner, r: ref } = rawRef;
5904
+ if (!owner) {
5905
+ warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
5906
+ `A vnode with ref must be created inside the render function.`);
5907
+ return;
5908
+ }
5909
+ const oldRef = oldRawRef && oldRawRef.r;
5910
+ const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
5911
+ const setupState = owner.setupState;
5912
+ // dynamic ref changed. unset old ref
5913
+ if (oldRef != null && oldRef !== ref) {
5914
+ if (isString(oldRef)) {
5915
+ refs[oldRef] = null;
5916
+ if (hasOwn(setupState, oldRef)) {
5917
+ setupState[oldRef] = null;
5918
+ }
5919
+ }
5920
+ else if (isRef(oldRef)) {
5921
+ oldRef.value = null;
5922
+ }
5923
+ }
5924
+ if (isFunction(ref)) {
5925
+ callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
5926
+ }
5927
+ else {
5928
+ const _isString = isString(ref);
5929
+ const _isRef = isRef(ref);
5930
+ if (_isString || _isRef) {
5931
+ const doSet = () => {
5932
+ if (rawRef.f) {
5933
+ const existing = _isString ? refs[ref] : ref.value;
5934
+ if (isUnmount) {
5935
+ isArray(existing) && remove(existing, refValue);
5936
+ }
5937
+ else {
5938
+ if (!isArray(existing)) {
5939
+ if (_isString) {
5940
+ refs[ref] = [refValue];
5941
+ }
5942
+ else {
5943
+ ref.value = [refValue];
5944
+ if (rawRef.k)
5945
+ refs[rawRef.k] = ref.value;
5946
+ }
5947
+ }
5948
+ else if (!existing.includes(refValue)) {
5949
+ existing.push(refValue);
5950
+ }
5951
+ }
5952
+ }
5953
+ else if (_isString) {
5954
+ refs[ref] = value;
5955
+ if (hasOwn(setupState, ref)) {
5956
+ setupState[ref] = value;
5957
+ }
5958
+ }
5959
+ else if (isRef(ref)) {
5960
+ ref.value = value;
5961
+ if (rawRef.k)
5962
+ refs[rawRef.k] = value;
5963
+ }
5964
+ else {
5965
+ warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
5966
+ }
5967
+ };
5968
+ if (value) {
5969
+ doSet.id = -1;
5970
+ queuePostRenderEffect(doSet, parentSuspense);
5971
+ }
5972
+ else {
5973
+ doSet();
5974
+ }
5975
+ }
5976
+ else {
5977
+ warn$1('Invalid template ref type:', ref, `(${typeof ref})`);
5978
+ }
5979
+ }
5980
+ }
5981
+
5886
5982
  let hasMismatch = false;
5887
5983
  const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
5888
5984
  const isComment = (node) => node.nodeType === 8 /* COMMENT */;
@@ -6244,44 +6340,6 @@ function isSupported() {
6244
6340
  return supported;
6245
6341
  }
6246
6342
 
6247
- function convertLegacyRefInFor(vnode) {
6248
- // refInFor
6249
- if (vnode.props && vnode.props.refInFor) {
6250
- delete vnode.props.refInFor;
6251
- if (vnode.ref) {
6252
- if (isArray(vnode.ref)) {
6253
- vnode.ref.forEach(r => (r.f = true));
6254
- }
6255
- else {
6256
- vnode.ref.f = true;
6257
- }
6258
- }
6259
- }
6260
- }
6261
- function registerLegacyRef(refs, key, value, owner, isInFor, isUnmount) {
6262
- const existing = refs[key];
6263
- if (isUnmount) {
6264
- if (isArray(existing)) {
6265
- remove(existing, value);
6266
- }
6267
- else {
6268
- refs[key] = null;
6269
- }
6270
- }
6271
- else if (isInFor) {
6272
- warnDeprecation("V_FOR_REF" /* V_FOR_REF */, owner);
6273
- if (!isArray(existing)) {
6274
- refs[key] = [value];
6275
- }
6276
- else if (!existing.includes(value)) {
6277
- existing.push(value);
6278
- }
6279
- }
6280
- else {
6281
- refs[key] = value;
6282
- }
6283
- }
6284
-
6285
6343
  const queuePostRenderEffect = queueEffectWithSuspense
6286
6344
  ;
6287
6345
  /**
@@ -6553,12 +6611,15 @@ function baseCreateRenderer(options, createHydrationFns) {
6553
6611
  const oldProps = n1.props || EMPTY_OBJ;
6554
6612
  const newProps = n2.props || EMPTY_OBJ;
6555
6613
  let vnodeHook;
6614
+ // disable recurse in beforeUpdate hooks
6615
+ parentComponent && toggleRecurse(parentComponent, false);
6556
6616
  if ((vnodeHook = newProps.onVnodeBeforeUpdate)) {
6557
6617
  invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
6558
6618
  }
6559
6619
  if (dirs) {
6560
6620
  invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate');
6561
6621
  }
6622
+ parentComponent && toggleRecurse(parentComponent, true);
6562
6623
  if (isHmrUpdating) {
6563
6624
  // HMR updated, force full diff
6564
6625
  patchFlag = 0;
@@ -6842,7 +6903,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6842
6903
  const { el, props } = initialVNode;
6843
6904
  const { bm, m, parent } = instance;
6844
6905
  const isAsyncWrapperVNode = isAsyncWrapper(initialVNode);
6845
- effect.allowRecurse = false;
6906
+ toggleRecurse(instance, false);
6846
6907
  // beforeMount hook
6847
6908
  if (bm) {
6848
6909
  invokeArrayFns(bm);
@@ -6855,7 +6916,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6855
6916
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6856
6917
  instance.emit('hook:beforeMount');
6857
6918
  }
6858
- effect.allowRecurse = true;
6919
+ toggleRecurse(instance, true);
6859
6920
  if (el && hydrateNode) {
6860
6921
  // vnode has adopted host node - perform hydration instead of mount.
6861
6922
  const hydrateSubTree = () => {
@@ -6943,7 +7004,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6943
7004
  pushWarningContext(next || instance.vnode);
6944
7005
  }
6945
7006
  // Disallow component effect recursion during pre-lifecycle hooks.
6946
- effect.allowRecurse = false;
7007
+ toggleRecurse(instance, false);
6947
7008
  if (next) {
6948
7009
  next.el = vnode.el;
6949
7010
  updateComponentPreRender(instance, next, optimized);
@@ -6962,7 +7023,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6962
7023
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS" /* INSTANCE_EVENT_HOOKS */, instance)) {
6963
7024
  instance.emit('hook:beforeUpdate');
6964
7025
  }
6965
- effect.allowRecurse = true;
7026
+ toggleRecurse(instance, true);
6966
7027
  // render
6967
7028
  {
6968
7029
  startMeasure(instance, `render`);
@@ -7011,13 +7072,13 @@ function baseCreateRenderer(options, createHydrationFns) {
7011
7072
  }
7012
7073
  };
7013
7074
  // create reactive effect for rendering
7014
- const effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7015
- );
7075
+ const effect = (instance.effect = new ReactiveEffect(componentUpdateFn, () => queueJob(instance.update), instance.scope // track it in component's effect scope
7076
+ ));
7016
7077
  const update = (instance.update = effect.run.bind(effect));
7017
7078
  update.id = instance.uid;
7018
7079
  // allowRecurse
7019
7080
  // #1801, #2043 component render effects should allow recursive updates
7020
- effect.allowRecurse = update.allowRecurse = true;
7081
+ toggleRecurse(instance, true);
7021
7082
  {
7022
7083
  effect.onTrack = instance.rtc
7023
7084
  ? e => invokeArrayFns(instance.rtc, e)
@@ -7547,88 +7608,8 @@ function baseCreateRenderer(options, createHydrationFns) {
7547
7608
  createApp: createAppAPI(render, hydrate)
7548
7609
  };
7549
7610
  }
7550
- function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7551
- if (isArray(rawRef)) {
7552
- rawRef.forEach((r, i) => setRef(r, oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef), parentSuspense, vnode, isUnmount));
7553
- return;
7554
- }
7555
- if (isAsyncWrapper(vnode) && !isUnmount) {
7556
- // when mounting async components, nothing needs to be done,
7557
- // because the template ref is forwarded to inner component
7558
- return;
7559
- }
7560
- const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
7561
- ? getExposeProxy(vnode.component) || vnode.component.proxy
7562
- : vnode.el;
7563
- const value = isUnmount ? null : refValue;
7564
- const { i: owner, r: ref } = rawRef;
7565
- if (!owner) {
7566
- warn$1(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
7567
- `A vnode with ref must be created inside the render function.`);
7568
- return;
7569
- }
7570
- const oldRef = oldRawRef && oldRawRef.r;
7571
- const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs;
7572
- const setupState = owner.setupState;
7573
- // dynamic ref changed. unset old ref
7574
- if (oldRef != null && oldRef !== ref) {
7575
- if (isString(oldRef)) {
7576
- refs[oldRef] = null;
7577
- if (hasOwn(setupState, oldRef)) {
7578
- setupState[oldRef] = null;
7579
- }
7580
- }
7581
- else if (isRef(oldRef)) {
7582
- oldRef.value = null;
7583
- }
7584
- }
7585
- if (isString(ref)) {
7586
- const doSet = () => {
7587
- if (isCompatEnabled("V_FOR_REF" /* V_FOR_REF */, owner)) {
7588
- registerLegacyRef(refs, ref, refValue, owner, rawRef.f, isUnmount);
7589
- }
7590
- else {
7591
- refs[ref] = value;
7592
- }
7593
- if (hasOwn(setupState, ref)) {
7594
- setupState[ref] = value;
7595
- }
7596
- };
7597
- // #1789: for non-null values, set them after render
7598
- // null values means this is unmount and it should not overwrite another
7599
- // ref with the same key
7600
- if (value) {
7601
- doSet.id = -1;
7602
- queuePostRenderEffect(doSet, parentSuspense);
7603
- }
7604
- else {
7605
- doSet();
7606
- }
7607
- }
7608
- else if (isRef(ref)) {
7609
- const doSet = () => {
7610
- ref.value = value;
7611
- };
7612
- if (value) {
7613
- doSet.id = -1;
7614
- queuePostRenderEffect(doSet, parentSuspense);
7615
- }
7616
- else {
7617
- doSet();
7618
- }
7619
- }
7620
- else if (isFunction(ref)) {
7621
- callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
7622
- }
7623
- else {
7624
- warn$1('Invalid template ref type:', value, `(${typeof value})`);
7625
- }
7626
- }
7627
- function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
7628
- callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
7629
- vnode,
7630
- prevVNode
7631
- ]);
7611
+ function toggleRecurse({ effect, update }, allowed) {
7612
+ effect.allowRecurse = update.allowRecurse = allowed;
7632
7613
  }
7633
7614
  /**
7634
7615
  * #1156
@@ -8277,6 +8258,7 @@ function convertLegacyFunctionalComponent(comp) {
8277
8258
  };
8278
8259
  Func.props = comp.props;
8279
8260
  Func.displayName = comp.name;
8261
+ Func.compatConfig = comp.compatConfig;
8280
8262
  // v2 functional components do not inherit attrs
8281
8263
  Func.inheritAttrs = false;
8282
8264
  normalizedFunctionalComponentMap.set(comp, Func);
@@ -8422,10 +8404,10 @@ const createVNodeWithArgsTransform = (...args) => {
8422
8404
  };
8423
8405
  const InternalObjectKey = `__vInternal`;
8424
8406
  const normalizeKey = ({ key }) => key != null ? key : null;
8425
- const normalizeRef = ({ ref }) => {
8407
+ const normalizeRef = ({ ref, ref_key, ref_for }) => {
8426
8408
  return (ref != null
8427
8409
  ? isString(ref) || isRef(ref) || isFunction(ref)
8428
- ? { i: currentRenderingInstance, r: ref }
8410
+ ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for }
8429
8411
  : ref
8430
8412
  : null);
8431
8413
  };
@@ -8493,7 +8475,6 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8493
8475
  }
8494
8476
  {
8495
8477
  convertLegacyVModelProps(vnode);
8496
- convertLegacyRefInFor(vnode);
8497
8478
  defineLegacyVNodeProperties(vnode);
8498
8479
  }
8499
8480
  return vnode;
@@ -8779,6 +8760,12 @@ function mergeProps(...args) {
8779
8760
  }
8780
8761
  }
8781
8762
  return ret;
8763
+ }
8764
+ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
8765
+ callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
8766
+ vnode,
8767
+ prevVNode
8768
+ ]);
8782
8769
  }
8783
8770
 
8784
8771
  function getCompatChildren(instance) {
@@ -9211,23 +9198,23 @@ const PublicInstanceProxyHandlers = {
9211
9198
  const n = accessCache[key];
9212
9199
  if (n !== undefined) {
9213
9200
  switch (n) {
9214
- case 0 /* SETUP */:
9201
+ case 1 /* SETUP */:
9215
9202
  return setupState[key];
9216
- case 1 /* DATA */:
9203
+ case 2 /* DATA */:
9217
9204
  return data[key];
9218
- case 3 /* CONTEXT */:
9205
+ case 4 /* CONTEXT */:
9219
9206
  return ctx[key];
9220
- case 2 /* PROPS */:
9207
+ case 3 /* PROPS */:
9221
9208
  return props[key];
9222
9209
  // default: just fallthrough
9223
9210
  }
9224
9211
  }
9225
9212
  else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
9226
- accessCache[key] = 0 /* SETUP */;
9213
+ accessCache[key] = 1 /* SETUP */;
9227
9214
  return setupState[key];
9228
9215
  }
9229
9216
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
9230
- accessCache[key] = 1 /* DATA */;
9217
+ accessCache[key] = 2 /* DATA */;
9231
9218
  return data[key];
9232
9219
  }
9233
9220
  else if (
@@ -9235,15 +9222,15 @@ const PublicInstanceProxyHandlers = {
9235
9222
  // props
9236
9223
  (normalizedProps = instance.propsOptions[0]) &&
9237
9224
  hasOwn(normalizedProps, key)) {
9238
- accessCache[key] = 2 /* PROPS */;
9225
+ accessCache[key] = 3 /* PROPS */;
9239
9226
  return props[key];
9240
9227
  }
9241
9228
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9242
- accessCache[key] = 3 /* CONTEXT */;
9229
+ accessCache[key] = 4 /* CONTEXT */;
9243
9230
  return ctx[key];
9244
9231
  }
9245
9232
  else if (shouldCacheAccess) {
9246
- accessCache[key] = 4 /* OTHER */;
9233
+ accessCache[key] = 0 /* OTHER */;
9247
9234
  }
9248
9235
  }
9249
9236
  const publicGetter = publicPropertiesMap[key];
@@ -9264,7 +9251,7 @@ const PublicInstanceProxyHandlers = {
9264
9251
  }
9265
9252
  else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
9266
9253
  // user may set custom properties to `this` that start with `$`
9267
- accessCache[key] = 3 /* CONTEXT */;
9254
+ accessCache[key] = 4 /* CONTEXT */;
9268
9255
  return ctx[key];
9269
9256
  }
9270
9257
  else if (
@@ -9332,7 +9319,7 @@ const PublicInstanceProxyHandlers = {
9332
9319
  },
9333
9320
  has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
9334
9321
  let normalizedProps;
9335
- return (accessCache[key] !== undefined ||
9322
+ return (!!accessCache[key] ||
9336
9323
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
9337
9324
  (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
9338
9325
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
@@ -9438,6 +9425,7 @@ function createComponentInstance(vnode, parent, suspense) {
9438
9425
  root: null,
9439
9426
  next: null,
9440
9427
  subTree: null,
9428
+ effect: null,
9441
9429
  update: null,
9442
9430
  scope: new EffectScope(true /* detached */),
9443
9431
  render: null,
@@ -10907,7 +10895,7 @@ function isMemoSame(cached, memo) {
10907
10895
  }
10908
10896
 
10909
10897
  // Core API ------------------------------------------------------------------
10910
- const version = "3.2.22";
10898
+ const version = "3.2.26";
10911
10899
  /**
10912
10900
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10913
10901
  * @internal
@@ -11174,12 +11162,19 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
11174
11162
  el[key] = value == null ? '' : value;
11175
11163
  return;
11176
11164
  }
11177
- if (key === 'value' && el.tagName !== 'PROGRESS') {
11165
+ if (key === 'value' &&
11166
+ el.tagName !== 'PROGRESS' &&
11167
+ // custom elements may use _value internally
11168
+ !el.tagName.includes('-')) {
11178
11169
  // store value as _value as well since
11179
11170
  // non-string values will be stringified.
11180
11171
  el._value = value;
11181
11172
  const newValue = value == null ? '' : value;
11182
- if (el.value !== newValue) {
11173
+ if (el.value !== newValue ||
11174
+ // #4956: always set for OPTION elements because its value falls back to
11175
+ // textContent if no value attribute is present. And setting .value for
11176
+ // OPTION has no side effect
11177
+ el.tagName === 'OPTION') {
11183
11178
  el.value = newValue;
11184
11179
  }
11185
11180
  if (value == null) {
@@ -11575,7 +11570,7 @@ class VueElement extends BaseClass {
11575
11570
  // HMR
11576
11571
  {
11577
11572
  instance.ceReload = newStyles => {
11578
- // alawys reset styles
11573
+ // always reset styles
11579
11574
  if (this._styles) {
11580
11575
  this._styles.forEach(s => this.shadowRoot.removeChild(s));
11581
11576
  this._styles.length = 0;
@@ -13311,12 +13306,12 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
13311
13306
  }
13312
13307
  else if (p.name === 'bind' &&
13313
13308
  (p.exp || allowEmpty) &&
13314
- isBindKey(p.arg, name)) {
13309
+ isStaticArgOf(p.arg, name)) {
13315
13310
  return p;
13316
13311
  }
13317
13312
  }
13318
13313
  }
13319
- function isBindKey(arg, name) {
13314
+ function isStaticArgOf(arg, name) {
13320
13315
  return !!(arg && isStaticExp(arg) && arg.content === name);
13321
13316
  }
13322
13317
  function hasDynamicKeyVBind(node) {
@@ -13359,7 +13354,6 @@ function getUnnormalizedProps(props, callPath = []) {
13359
13354
  }
13360
13355
  function injectProp(node, prop, context) {
13361
13356
  let propsWithInjection;
13362
- const originalProps = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13363
13357
  /**
13364
13358
  * 1. mergeProps(...)
13365
13359
  * 2. toHandlers(...)
@@ -13368,7 +13362,7 @@ function injectProp(node, prop, context) {
13368
13362
  *
13369
13363
  * we need to get the real props before normalization
13370
13364
  */
13371
- let props = originalProps;
13365
+ let props = node.type === 13 /* VNODE_CALL */ ? node.props : node.arguments[2];
13372
13366
  let callPath = [];
13373
13367
  let parentCall;
13374
13368
  if (props &&
@@ -13507,11 +13501,6 @@ const deprecationData$1 = {
13507
13501
  `data source.`,
13508
13502
  link: `https://v3.vuejs.org/guide/migration/v-if-v-for.html`
13509
13503
  },
13510
- ["COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */]: {
13511
- message: `Ref usage on v-for no longer creates array ref values in Vue 3. ` +
13512
- `Consider using function refs or refactor to avoid ref usage altogether.`,
13513
- link: `https://v3.vuejs.org/guide/migration/array-refs.html`
13514
- },
13515
13504
  ["COMPILER_NATIVE_TEMPLATE" /* COMPILER_NATIVE_TEMPLATE */]: {
13516
13505
  message: `<template> with no special directives will render as a native template ` +
13517
13506
  `element instead of its inner content in Vue 3.`
@@ -14029,7 +14018,7 @@ function isComponent(tag, props, context) {
14029
14018
  else if (
14030
14019
  // :is on plain element - only treat as component in compat mode
14031
14020
  p.name === 'bind' &&
14032
- isBindKey(p.arg, 'is') &&
14021
+ isStaticArgOf(p.arg, 'is') &&
14033
14022
  true &&
14034
14023
  checkCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
14035
14024
  return true;
@@ -14389,15 +14378,6 @@ function isSingleElementRoot(root, child) {
14389
14378
  !isSlotOutlet(child));
14390
14379
  }
14391
14380
  function walk$1(node, context, doNotHoistNode = false) {
14392
- // Some transforms, e.g. transformAssetUrls from @vue/compiler-sfc, replaces
14393
- // static bindings with expressions. These expressions are guaranteed to be
14394
- // constant so they are still eligible for hoisting, but they are only
14395
- // available at runtime and therefore cannot be evaluated ahead of time.
14396
- // This is only a concern for pre-stringification (via transformHoist by
14397
- // @vue/compiler-dom), but doing it here allows us to perform only one full
14398
- // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
14399
- // stringification threshold is met.
14400
- let canStringify = true;
14401
14381
  const { children } = node;
14402
14382
  const originalCount = children.length;
14403
14383
  let hoistedCount = 0;
@@ -14410,9 +14390,6 @@ function walk$1(node, context, doNotHoistNode = false) {
14410
14390
  ? 0 /* NOT_CONSTANT */
14411
14391
  : getConstantType(child, context);
14412
14392
  if (constantType > 0 /* NOT_CONSTANT */) {
14413
- if (constantType < 3 /* CAN_STRINGIFY */) {
14414
- canStringify = false;
14415
- }
14416
14393
  if (constantType >= 2 /* CAN_HOIST */) {
14417
14394
  child.codegenNode.patchFlag =
14418
14395
  -1 /* HOISTED */ + (` /* HOISTED */` );
@@ -14443,17 +14420,10 @@ function walk$1(node, context, doNotHoistNode = false) {
14443
14420
  }
14444
14421
  }
14445
14422
  }
14446
- else if (child.type === 12 /* TEXT_CALL */) {
14447
- const contentType = getConstantType(child.content, context);
14448
- if (contentType > 0) {
14449
- if (contentType < 3 /* CAN_STRINGIFY */) {
14450
- canStringify = false;
14451
- }
14452
- if (contentType >= 2 /* CAN_HOIST */) {
14453
- child.codegenNode = context.hoist(child.codegenNode);
14454
- hoistedCount++;
14455
- }
14456
- }
14423
+ else if (child.type === 12 /* TEXT_CALL */ &&
14424
+ getConstantType(child.content, context) >= 2 /* CAN_HOIST */) {
14425
+ child.codegenNode = context.hoist(child.codegenNode);
14426
+ hoistedCount++;
14457
14427
  }
14458
14428
  // walk further
14459
14429
  if (child.type === 1 /* ELEMENT */) {
@@ -14477,7 +14447,7 @@ function walk$1(node, context, doNotHoistNode = false) {
14477
14447
  }
14478
14448
  }
14479
14449
  }
14480
- if (canStringify && hoistedCount && context.transformHoist) {
14450
+ if (hoistedCount && context.transformHoist) {
14481
14451
  context.transformHoist(children, context, node);
14482
14452
  }
14483
14453
  // all children were hoisted - the entire children array is hoistable.
@@ -14506,6 +14476,11 @@ function getConstantType(node, context) {
14506
14476
  if (codegenNode.type !== 13 /* VNODE_CALL */) {
14507
14477
  return 0 /* NOT_CONSTANT */;
14508
14478
  }
14479
+ if (codegenNode.isBlock &&
14480
+ node.tag !== 'svg' &&
14481
+ node.tag !== 'foreignObject') {
14482
+ return 0 /* NOT_CONSTANT */;
14483
+ }
14509
14484
  const flag = getPatchFlag(codegenNode);
14510
14485
  if (!flag) {
14511
14486
  let returnType = 3 /* CAN_STRINGIFY */;
@@ -14642,7 +14617,7 @@ function getGeneratedPropsConstantType(node, context) {
14642
14617
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
14643
14618
  // some helper calls can be hoisted,
14644
14619
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
14645
- // in this case we need to respect the ConstantType of the helper's argments
14620
+ // in this case we need to respect the ConstantType of the helper's arguments
14646
14621
  valueType = getConstantTypeOfHelperCall(value, context);
14647
14622
  }
14648
14623
  else {
@@ -16309,10 +16284,7 @@ const transformElement = (node, context) => {
16309
16284
  // updates inside get proper isSVG flag at runtime. (#639, #643)
16310
16285
  // This is technically web-specific, but splitting the logic out of core
16311
16286
  // leads to too much unnecessary complexity.
16312
- (tag === 'svg' ||
16313
- tag === 'foreignObject' ||
16314
- // #938: elements with dynamic keys should be forced into blocks
16315
- findProp(node, 'key', true)));
16287
+ (tag === 'svg' || tag === 'foreignObject'));
16316
16288
  // props
16317
16289
  if (props.length > 0) {
16318
16290
  const propsBuildResult = buildProps(node, context);
@@ -16324,6 +16296,9 @@ const transformElement = (node, context) => {
16324
16296
  directives && directives.length
16325
16297
  ? createArrayExpression(directives.map(dir => buildDirectiveArgs(dir, context)))
16326
16298
  : undefined;
16299
+ if (propsBuildResult.shouldUseBlock) {
16300
+ shouldUseBlock = true;
16301
+ }
16327
16302
  }
16328
16303
  // children
16329
16304
  if (node.children.length > 0) {
@@ -16452,11 +16427,13 @@ function resolveComponentType(node, context, ssr = false) {
16452
16427
  return toValidAssetId(tag, `component`);
16453
16428
  }
16454
16429
  function buildProps(node, context, props = node.props, ssr = false) {
16455
- const { tag, loc: elementLoc } = node;
16430
+ const { tag, loc: elementLoc, children } = node;
16456
16431
  const isComponent = node.tagType === 1 /* COMPONENT */;
16457
16432
  let properties = [];
16458
16433
  const mergeArgs = [];
16459
16434
  const runtimeDirectives = [];
16435
+ const hasChildren = children.length > 0;
16436
+ let shouldUseBlock = false;
16460
16437
  // patchFlag analysis
16461
16438
  let patchFlag = 0;
16462
16439
  let hasRef = false;
@@ -16519,9 +16496,12 @@ function buildProps(node, context, props = node.props, ssr = false) {
16519
16496
  const prop = props[i];
16520
16497
  if (prop.type === 6 /* ATTRIBUTE */) {
16521
16498
  const { loc, name, value } = prop;
16522
- let valueNode = createSimpleExpression(value ? value.content : '', true, value ? value.loc : loc);
16499
+ let isStatic = true;
16523
16500
  if (name === 'ref') {
16524
16501
  hasRef = true;
16502
+ if (context.scopes.vFor > 0) {
16503
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16504
+ }
16525
16505
  }
16526
16506
  // skip is on <component>, or is="vue:xxx"
16527
16507
  if (name === 'is' &&
@@ -16530,7 +16510,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
16530
16510
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
16531
16511
  continue;
16532
16512
  }
16533
- properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), valueNode));
16513
+ properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
16534
16514
  }
16535
16515
  else {
16536
16516
  // directives
@@ -16551,7 +16531,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
16551
16531
  // skip v-is and :is on <component>
16552
16532
  if (name === 'is' ||
16553
16533
  (isVBind &&
16554
- isBindKey(arg, 'is') &&
16534
+ isStaticArgOf(arg, 'is') &&
16555
16535
  (isComponentTag(tag) ||
16556
16536
  (isCompatEnabled$1("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
16557
16537
  continue;
@@ -16560,6 +16540,17 @@ function buildProps(node, context, props = node.props, ssr = false) {
16560
16540
  if (isVOn && ssr) {
16561
16541
  continue;
16562
16542
  }
16543
+ if (
16544
+ // #938: elements with dynamic keys should be forced into blocks
16545
+ (isVBind && isStaticArgOf(arg, 'key')) ||
16546
+ // inline before-update hooks need to force block so that it is invoked
16547
+ // before children
16548
+ (isVOn && hasChildren && isStaticArgOf(arg, 'vue:before-update'))) {
16549
+ shouldUseBlock = true;
16550
+ }
16551
+ if (isVBind && isStaticArgOf(arg, 'ref') && context.scopes.vFor > 0) {
16552
+ properties.push(createObjectProperty(createSimpleExpression('ref_for', true), createSimpleExpression('true')));
16553
+ }
16563
16554
  // special case for v-bind and v-on with no argument
16564
16555
  if (!arg && (isVBind || isVOn)) {
16565
16556
  hasDynamicKeys = true;
@@ -16633,14 +16624,13 @@ function buildProps(node, context, props = node.props, ssr = false) {
16633
16624
  else {
16634
16625
  // no built-in transform, this is a user custom directive.
16635
16626
  runtimeDirectives.push(prop);
16627
+ // custom dirs may use beforeUpdate so they need to force blocks
16628
+ // to ensure before-update gets called before children update
16629
+ if (hasChildren) {
16630
+ shouldUseBlock = true;
16631
+ }
16636
16632
  }
16637
16633
  }
16638
- if (prop.type === 6 /* ATTRIBUTE */ &&
16639
- prop.name === 'ref' &&
16640
- context.scopes.vFor > 0 &&
16641
- checkCompatEnabled$1("COMPILER_V_FOR_REF" /* COMPILER_V_FOR_REF */, context, prop.loc)) {
16642
- properties.push(createObjectProperty(createSimpleExpression('refInFor', true), createSimpleExpression('true', false)));
16643
- }
16644
16634
  }
16645
16635
  let propsExpression = undefined;
16646
16636
  // has v-bind="object" or v-on="object", wrap with mergeProps
@@ -16677,7 +16667,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
16677
16667
  patchFlag |= 32 /* HYDRATE_EVENTS */;
16678
16668
  }
16679
16669
  }
16680
- if ((patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16670
+ if (!shouldUseBlock &&
16671
+ (patchFlag === 0 || patchFlag === 32 /* HYDRATE_EVENTS */) &&
16681
16672
  (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) {
16682
16673
  patchFlag |= 512 /* NEED_PATCH */;
16683
16674
  }
@@ -16744,7 +16735,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
16744
16735
  props: propsExpression,
16745
16736
  directives: runtimeDirectives,
16746
16737
  patchFlag,
16747
- dynamicPropNames
16738
+ dynamicPropNames,
16739
+ shouldUseBlock
16748
16740
  };
16749
16741
  }
16750
16742
  // Dedupe props in an object literal.
@@ -16880,7 +16872,7 @@ function processSlotOutlet(node, context) {
16880
16872
  }
16881
16873
  }
16882
16874
  else {
16883
- if (p.name === 'bind' && isBindKey(p.arg, 'name')) {
16875
+ if (p.name === 'bind' && isStaticArgOf(p.arg, 'name')) {
16884
16876
  if (p.exp)
16885
16877
  slotName = p.exp;
16886
16878
  }
@@ -16914,7 +16906,11 @@ const transformOn = (dir, node, context, augmentor) => {
16914
16906
  let eventName;
16915
16907
  if (arg.type === 4 /* SIMPLE_EXPRESSION */) {
16916
16908
  if (arg.isStatic) {
16917
- const rawName = arg.content;
16909
+ let rawName = arg.content;
16910
+ // TODO deprecate @vnodeXXX usage
16911
+ if (rawName.startsWith('vue:')) {
16912
+ rawName = `vnode-${rawName.slice(4)}`;
16913
+ }
16918
16914
  // for all event listeners, auto convert it to camelCase. See issue #2249
16919
16915
  eventName = createSimpleExpression(toHandlerKey(camelize(rawName)), true, arg.loc);
16920
16916
  }