vue 3.2.43 → 3.2.45

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.
@@ -2098,12 +2098,6 @@ function reload(id, newComp) {
2098
2098
  // components to be unmounted and re-mounted. Queue the update so that we
2099
2099
  // don't end up forcing the same parent to re-render multiple times.
2100
2100
  queueJob(instance.parent.update);
2101
- // instance is the inner component of an async custom element
2102
- // invoke to reset styles
2103
- if (instance.parent.type.__asyncLoader &&
2104
- instance.parent.ceReload) {
2105
- instance.parent.ceReload(newComp.styles);
2106
- }
2107
2101
  }
2108
2102
  else if (instance.appContext.reload) {
2109
2103
  // root instance mounted via createApp() has a reload method
@@ -3351,10 +3345,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3351
3345
  callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
3352
3346
  newValue,
3353
3347
  // pass undefined as the old value when it's changed for the first time
3354
- oldValue === INITIAL_WATCHER_VALUE ||
3355
- (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3356
- ? []
3357
- : oldValue,
3348
+ oldValue === INITIAL_WATCHER_VALUE
3349
+ ? undefined
3350
+ : (isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE)
3351
+ ? []
3352
+ : oldValue,
3358
3353
  onCleanup
3359
3354
  ]);
3360
3355
  oldValue = newValue;
@@ -3951,10 +3946,15 @@ function defineAsyncComponent(source) {
3951
3946
  }
3952
3947
  });
3953
3948
  }
3954
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
3949
+ function createInnerComp(comp, parent) {
3950
+ const { ref, props, children, ce } = parent.vnode;
3955
3951
  const vnode = createVNode(comp, props, children);
3956
3952
  // ensure inner component inherits the async wrapper's ref owner
3957
3953
  vnode.ref = ref;
3954
+ // pass the custom element callback on to the inner comp
3955
+ // and remove it from the async wrapper
3956
+ vnode.ce = ce;
3957
+ delete parent.vnode.ce;
3958
3958
  return vnode;
3959
3959
  }
3960
3960
 
@@ -4112,8 +4112,7 @@ const KeepAliveImpl = {
4112
4112
  : comp);
4113
4113
  const { include, exclude, max } = props;
4114
4114
  if ((include && (!name || !matches(include, name))) ||
4115
- (exclude && name && matches(exclude, name)) ||
4116
- (hmrDirtyComponents.has(comp))) {
4115
+ (exclude && name && matches(exclude, name))) {
4117
4116
  current = vnode;
4118
4117
  return rawVNode;
4119
4118
  }
@@ -4223,14 +4222,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4223
4222
  }, target);
4224
4223
  }
4225
4224
  function resetShapeFlag(vnode) {
4226
- let shapeFlag = vnode.shapeFlag;
4227
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
4228
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4229
- }
4230
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
4231
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4232
- }
4233
- vnode.shapeFlag = shapeFlag;
4225
+ // bitwise operations to remove keep alive flags
4226
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4227
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4234
4228
  }
4235
4229
  function getInnerChild(vnode) {
4236
4230
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -4529,7 +4523,9 @@ fallback, noSlotted) {
4529
4523
  (currentRenderingInstance.parent &&
4530
4524
  isAsyncWrapper(currentRenderingInstance.parent) &&
4531
4525
  currentRenderingInstance.parent.isCE)) {
4532
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
4526
+ if (name !== 'default')
4527
+ props.name = name;
4528
+ return createVNode('slot', props, fallback && fallback());
4533
4529
  }
4534
4530
  let slot = slots[name];
4535
4531
  if (slot && slot.length > 1) {
@@ -4629,6 +4625,7 @@ const publicPropertiesMap =
4629
4625
  $watch: i => (instanceWatch.bind(i) )
4630
4626
  });
4631
4627
  const isReservedPrefix = (key) => key === '_' || key === '$';
4628
+ const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
4632
4629
  const PublicInstanceProxyHandlers = {
4633
4630
  get({ _: instance }, key) {
4634
4631
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -4636,15 +4633,6 @@ const PublicInstanceProxyHandlers = {
4636
4633
  if (key === '__isVue') {
4637
4634
  return true;
4638
4635
  }
4639
- // prioritize <script setup> bindings during dev.
4640
- // this allows even properties that start with _ or $ to be used - so that
4641
- // it aligns with the production behavior where the render fn is inlined and
4642
- // indeed has access to all declared variables.
4643
- if (setupState !== EMPTY_OBJ &&
4644
- setupState.__isScriptSetup &&
4645
- hasOwn(setupState, key)) {
4646
- return setupState[key];
4647
- }
4648
4636
  // data / props / ctx
4649
4637
  // This getter gets called for every property access on the render context
4650
4638
  // during render and is a major hotspot. The most expensive part of this
@@ -4667,7 +4655,7 @@ const PublicInstanceProxyHandlers = {
4667
4655
  // default: just fallthrough
4668
4656
  }
4669
4657
  }
4670
- else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
4658
+ else if (hasSetupBinding(setupState, key)) {
4671
4659
  accessCache[key] = 1 /* AccessTypes.SETUP */;
4672
4660
  return setupState[key];
4673
4661
  }
@@ -4737,21 +4725,26 @@ const PublicInstanceProxyHandlers = {
4737
4725
  },
4738
4726
  set({ _: instance }, key, value) {
4739
4727
  const { data, setupState, ctx } = instance;
4740
- if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
4728
+ if (hasSetupBinding(setupState, key)) {
4741
4729
  setupState[key] = value;
4742
4730
  return true;
4743
4731
  }
4732
+ else if (setupState.__isScriptSetup &&
4733
+ hasOwn(setupState, key)) {
4734
+ warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
4735
+ return false;
4736
+ }
4744
4737
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
4745
4738
  data[key] = value;
4746
4739
  return true;
4747
4740
  }
4748
4741
  else if (hasOwn(instance.props, key)) {
4749
- warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
4742
+ warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
4750
4743
  return false;
4751
4744
  }
4752
4745
  if (key[0] === '$' && key.slice(1) in instance) {
4753
4746
  warn$1(`Attempting to mutate public property "${key}". ` +
4754
- `Properties starting with $ are reserved and readonly.`, instance);
4747
+ `Properties starting with $ are reserved and readonly.`);
4755
4748
  return false;
4756
4749
  }
4757
4750
  else {
@@ -4772,7 +4765,7 @@ const PublicInstanceProxyHandlers = {
4772
4765
  let normalizedProps;
4773
4766
  return (!!accessCache[key] ||
4774
4767
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
4775
- (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
4768
+ hasSetupBinding(setupState, key) ||
4776
4769
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
4777
4770
  hasOwn(ctx, key) ||
4778
4771
  hasOwn(publicPropertiesMap, key) ||
@@ -7811,6 +7804,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
7811
7804
  if (!shallow)
7812
7805
  traverseStaticChildren(c1, c2);
7813
7806
  }
7807
+ // #6852 also inherit for text nodes
7808
+ if (c2.type === Text) {
7809
+ c2.el = c1.el;
7810
+ }
7814
7811
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
7815
7812
  // would have received .el during block patch)
7816
7813
  if (c2.type === Comment && !c2.el) {
@@ -7981,6 +7978,7 @@ const TeleportImpl = {
7981
7978
  }
7982
7979
  }
7983
7980
  }
7981
+ updateCssVars(n2);
7984
7982
  },
7985
7983
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
7986
7984
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -8059,11 +8057,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
8059
8057
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
8060
8058
  }
8061
8059
  }
8060
+ updateCssVars(vnode);
8062
8061
  }
8063
8062
  return vnode.anchor && nextSibling(vnode.anchor);
8064
8063
  }
8065
8064
  // Force-casted public typing for h and TSX props inference
8066
8065
  const Teleport = TeleportImpl;
8066
+ function updateCssVars(vnode) {
8067
+ // presence of .ut method indicates owner component uses css vars.
8068
+ // code path here can assume browser environment.
8069
+ const ctx = vnode.ctx;
8070
+ if (ctx && ctx.ut) {
8071
+ let node = vnode.children[0].el;
8072
+ while (node !== vnode.targetAnchor) {
8073
+ if (node.nodeType === 1)
8074
+ node.setAttribute('data-v-owner', ctx.uid);
8075
+ node = node.nextSibling;
8076
+ }
8077
+ ctx.ut();
8078
+ }
8079
+ }
8067
8080
 
8068
8081
  const Fragment = Symbol('Fragment' );
8069
8082
  const Text = Symbol('Text' );
@@ -8158,6 +8171,10 @@ function isVNode(value) {
8158
8171
  function isSameVNodeType(n1, n2) {
8159
8172
  if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
8160
8173
  hmrDirtyComponents.has(n2.type)) {
8174
+ // #7042, ensure the vnode being unmounted during HMR
8175
+ // bitwise operations to remove keep alive flags
8176
+ n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
8177
+ n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
8161
8178
  // HMR only: if the component has been hot-updated, force a reload.
8162
8179
  return false;
8163
8180
  }
@@ -8213,7 +8230,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
8213
8230
  patchFlag,
8214
8231
  dynamicProps,
8215
8232
  dynamicChildren: null,
8216
- appContext: null
8233
+ appContext: null,
8234
+ ctx: currentRenderingInstance
8217
8235
  };
8218
8236
  if (needFullChildrenNormalization) {
8219
8237
  normalizeChildren(vnode, children);
@@ -8380,7 +8398,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
8380
8398
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
8381
8399
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
8382
8400
  el: vnode.el,
8383
- anchor: vnode.anchor
8401
+ anchor: vnode.anchor,
8402
+ ctx: vnode.ctx
8384
8403
  };
8385
8404
  return cloned;
8386
8405
  }
@@ -9349,7 +9368,7 @@ function isMemoSame(cached, memo) {
9349
9368
  }
9350
9369
 
9351
9370
  // Core API ------------------------------------------------------------------
9352
- const version = "3.2.43";
9371
+ const version = "3.2.45";
9353
9372
  /**
9354
9373
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
9355
9374
  * @internal
@@ -9495,6 +9514,7 @@ function patchStyle(el, prev, next) {
9495
9514
  }
9496
9515
  }
9497
9516
  }
9517
+ const semicolonRE = /[^\\];\s*$/;
9498
9518
  const importantRE = /\s*!important$/;
9499
9519
  function setStyle(style, name, val) {
9500
9520
  if (isArray(val)) {
@@ -9503,6 +9523,11 @@ function setStyle(style, name, val) {
9503
9523
  else {
9504
9524
  if (val == null)
9505
9525
  val = '';
9526
+ {
9527
+ if (semicolonRE.test(val)) {
9528
+ warn$1(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
9529
+ }
9530
+ }
9506
9531
  if (name.startsWith('--')) {
9507
9532
  // custom property definition
9508
9533
  style.setProperty(name, val);
@@ -9832,12 +9857,21 @@ class VueElement extends BaseClass {
9832
9857
  `defined as hydratable. Use \`defineSSRCustomElement\`.`);
9833
9858
  }
9834
9859
  this.attachShadow({ mode: 'open' });
9860
+ if (!this._def.__asyncLoader) {
9861
+ // for sync component defs we can immediately resolve props
9862
+ this._resolveProps(this._def);
9863
+ }
9835
9864
  }
9836
9865
  }
9837
9866
  connectedCallback() {
9838
9867
  this._connected = true;
9839
9868
  if (!this._instance) {
9840
- this._resolveDef();
9869
+ if (this._resolved) {
9870
+ this._update();
9871
+ }
9872
+ else {
9873
+ this._resolveDef();
9874
+ }
9841
9875
  }
9842
9876
  }
9843
9877
  disconnectedCallback() {
@@ -9853,9 +9887,6 @@ class VueElement extends BaseClass {
9853
9887
  * resolve inner component definition (handle possible async component)
9854
9888
  */
9855
9889
  _resolveDef() {
9856
- if (this._resolved) {
9857
- return;
9858
- }
9859
9890
  this._resolved = true;
9860
9891
  // set initial attrs
9861
9892
  for (let i = 0; i < this.attributes.length; i++) {
@@ -9867,38 +9898,26 @@ class VueElement extends BaseClass {
9867
9898
  this._setAttr(m.attributeName);
9868
9899
  }
9869
9900
  }).observe(this, { attributes: true });
9870
- const resolve = (def) => {
9871
- const { props = {}, styles } = def;
9872
- const hasOptions = !isArray(props);
9873
- const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
9901
+ const resolve = (def, isAsync = false) => {
9902
+ const { props, styles } = def;
9874
9903
  // cast Number-type props set before resolve
9875
9904
  let numberProps;
9876
- if (hasOptions) {
9877
- for (const key in this._props) {
9905
+ if (props && !isArray(props)) {
9906
+ for (const key in props) {
9878
9907
  const opt = props[key];
9879
9908
  if (opt === Number || (opt && opt.type === Number)) {
9880
- this._props[key] = toNumber(this._props[key]);
9881
- (numberProps || (numberProps = Object.create(null)))[key] = true;
9909
+ if (key in this._props) {
9910
+ this._props[key] = toNumber(this._props[key]);
9911
+ }
9912
+ (numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
9882
9913
  }
9883
9914
  }
9884
9915
  }
9885
9916
  this._numberProps = numberProps;
9886
- // check if there are props set pre-upgrade or connect
9887
- for (const key of Object.keys(this)) {
9888
- if (key[0] !== '_') {
9889
- this._setProp(key, this[key], true, false);
9890
- }
9891
- }
9892
- // defining getter/setters on prototype
9893
- for (const key of rawKeys.map(camelize)) {
9894
- Object.defineProperty(this, key, {
9895
- get() {
9896
- return this._getProp(key);
9897
- },
9898
- set(val) {
9899
- this._setProp(key, val);
9900
- }
9901
- });
9917
+ if (isAsync) {
9918
+ // defining getter/setters on prototype
9919
+ // for sync defs, this already happened in the constructor
9920
+ this._resolveProps(def);
9902
9921
  }
9903
9922
  // apply CSS
9904
9923
  this._applyStyles(styles);
@@ -9907,12 +9926,33 @@ class VueElement extends BaseClass {
9907
9926
  };
9908
9927
  const asyncDef = this._def.__asyncLoader;
9909
9928
  if (asyncDef) {
9910
- asyncDef().then(resolve);
9929
+ asyncDef().then(def => resolve(def, true));
9911
9930
  }
9912
9931
  else {
9913
9932
  resolve(this._def);
9914
9933
  }
9915
9934
  }
9935
+ _resolveProps(def) {
9936
+ const { props } = def;
9937
+ const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
9938
+ // check if there are props set pre-upgrade or connect
9939
+ for (const key of Object.keys(this)) {
9940
+ if (key[0] !== '_' && declaredPropKeys.includes(key)) {
9941
+ this._setProp(key, this[key], true, false);
9942
+ }
9943
+ }
9944
+ // defining getter/setters on prototype
9945
+ for (const key of declaredPropKeys.map(camelize)) {
9946
+ Object.defineProperty(this, key, {
9947
+ get() {
9948
+ return this._getProp(key);
9949
+ },
9950
+ set(val) {
9951
+ this._setProp(key, val);
9952
+ }
9953
+ });
9954
+ }
9955
+ }
9916
9956
  _setAttr(key) {
9917
9957
  let value = this.getAttribute(key);
9918
9958
  const camelKey = camelize(key);
@@ -9968,27 +10008,31 @@ class VueElement extends BaseClass {
9968
10008
  this._styles.length = 0;
9969
10009
  }
9970
10010
  this._applyStyles(newStyles);
9971
- // if this is an async component, ceReload is called from the inner
9972
- // component so no need to reload the async wrapper
9973
- if (!this._def.__asyncLoader) {
9974
- // reload
9975
- this._instance = null;
9976
- this._update();
9977
- }
10011
+ this._instance = null;
10012
+ this._update();
9978
10013
  };
9979
10014
  }
9980
- // intercept emit
9981
- instance.emit = (event, ...args) => {
10015
+ const dispatch = (event, args) => {
9982
10016
  this.dispatchEvent(new CustomEvent(event, {
9983
10017
  detail: args
9984
10018
  }));
9985
10019
  };
10020
+ // intercept emit
10021
+ instance.emit = (event, ...args) => {
10022
+ // dispatch both the raw and hyphenated versions of an event
10023
+ // to match Vue behavior
10024
+ dispatch(event, args);
10025
+ if (hyphenate(event) !== event) {
10026
+ dispatch(hyphenate(event), args);
10027
+ }
10028
+ };
9986
10029
  // locate nearest Vue custom element parent for provide/inject
9987
10030
  let parent = this;
9988
10031
  while ((parent =
9989
10032
  parent && (parent.parentNode || parent.host))) {
9990
10033
  if (parent instanceof VueElement) {
9991
10034
  instance.parent = parent._instance;
10035
+ instance.provides = parent._instance.provides;
9992
10036
  break;
9993
10037
  }
9994
10038
  }
@@ -10044,7 +10088,14 @@ function useCssVars(getter) {
10044
10088
  warn$1(`useCssVars is called without current active component instance.`);
10045
10089
  return;
10046
10090
  }
10047
- const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
10091
+ const updateTeleports = (instance.ut = (vars = getter(instance.proxy)) => {
10092
+ Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach(node => setVarsOnNode(node, vars));
10093
+ });
10094
+ const setVars = () => {
10095
+ const vars = getter(instance.proxy);
10096
+ setVarsOnVNode(instance.subTree, vars);
10097
+ updateTeleports(vars);
10098
+ };
10048
10099
  watchPostEffect(setVars);
10049
10100
  onMounted(() => {
10050
10101
  const ob = new MutationObserver(setVars);
@@ -11193,15 +11244,16 @@ const errorMessages = {
11193
11244
  [41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
11194
11245
  [42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
11195
11246
  [43 /* ErrorCodes.X_V_MODEL_ON_SCOPE_VARIABLE */]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
11196
- [44 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
11197
- [45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
11247
+ [44 /* ErrorCodes.X_V_MODEL_ON_PROPS */]: `v-model cannot be used on a prop, because local prop bindings are not writable.\nUse a v-bind binding combined with a v-on listener that emits update:x event instead.`,
11248
+ [45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
11249
+ [46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
11198
11250
  // generic errors
11199
- [46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
11200
- [47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
11201
- [48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
11202
- [49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
11251
+ [47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
11252
+ [48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
11253
+ [49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
11254
+ [50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
11203
11255
  // just to fulfill types
11204
- [50 /* ErrorCodes.__EXTEND_POINT__ */]: ``
11256
+ [51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
11205
11257
  };
11206
11258
 
11207
11259
  const FRAGMENT = Symbol(`Fragment` );
@@ -13754,7 +13806,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
13754
13806
  if (keywordMatch) {
13755
13807
  message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
13756
13808
  }
13757
- context.onError(createCompilerError(44 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
13809
+ context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
13758
13810
  }
13759
13811
  }
13760
13812
 
@@ -14545,7 +14597,7 @@ const transformElement = (node, context) => {
14545
14597
  // 2. Force keep-alive to always be updated, since it uses raw children.
14546
14598
  patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
14547
14599
  if (node.children.length > 1) {
14548
- context.onError(createCompilerError(45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
14600
+ context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
14549
14601
  start: node.children[0].loc.start,
14550
14602
  end: node.children[node.children.length - 1].loc.end,
14551
14603
  source: ''
@@ -15371,8 +15423,14 @@ const transformModel = (dir, node, context) => {
15371
15423
  const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
15372
15424
  // im SFC <script setup> inline mode, the exp may have been transformed into
15373
15425
  // _unref(exp)
15374
- context.bindingMetadata[rawExp];
15375
- const maybeRef = !true /* BindingTypes.SETUP_CONST */;
15426
+ const bindingType = context.bindingMetadata[rawExp];
15427
+ // check props
15428
+ if (bindingType === "props" /* BindingTypes.PROPS */ ||
15429
+ bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
15430
+ context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
15431
+ return createTransformProps();
15432
+ }
15433
+ const maybeRef = !true ;
15376
15434
  if (!expString.trim() ||
15377
15435
  (!isMemberExpression(expString) && !maybeRef)) {
15378
15436
  context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
@@ -15474,18 +15532,18 @@ function baseCompile(template, options = {}) {
15474
15532
  /* istanbul ignore if */
15475
15533
  {
15476
15534
  if (options.prefixIdentifiers === true) {
15477
- onError(createCompilerError(46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
15535
+ onError(createCompilerError(47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
15478
15536
  }
15479
15537
  else if (isModuleMode) {
15480
- onError(createCompilerError(47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
15538
+ onError(createCompilerError(48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
15481
15539
  }
15482
15540
  }
15483
15541
  const prefixIdentifiers = !true ;
15484
15542
  if (options.cacheHandlers) {
15485
- onError(createCompilerError(48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
15543
+ onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
15486
15544
  }
15487
15545
  if (options.scopeId && !isModuleMode) {
15488
- onError(createCompilerError(49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
15546
+ onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
15489
15547
  }
15490
15548
  const ast = isString(template) ? baseParse(template, options) : template;
15491
15549
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -15643,26 +15701,26 @@ function createDOMCompilerError(code, loc) {
15643
15701
  return createCompilerError(code, loc, DOMErrorMessages );
15644
15702
  }
15645
15703
  const DOMErrorMessages = {
15646
- [50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
15647
- [51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
15648
- [52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
15649
- [53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
15650
- [54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
15651
- [55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
15652
- [56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
15653
- [57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
15654
- [58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
15655
- [59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
15656
- [60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
15704
+ [51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
15705
+ [52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
15706
+ [53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
15707
+ [54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
15708
+ [55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
15709
+ [56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
15710
+ [57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
15711
+ [58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
15712
+ [59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
15713
+ [60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
15714
+ [61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
15657
15715
  };
15658
15716
 
15659
15717
  const transformVHtml = (dir, node, context) => {
15660
15718
  const { exp, loc } = dir;
15661
15719
  if (!exp) {
15662
- context.onError(createDOMCompilerError(50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
15720
+ context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
15663
15721
  }
15664
15722
  if (node.children.length) {
15665
- context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
15723
+ context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
15666
15724
  node.children.length = 0;
15667
15725
  }
15668
15726
  return {
@@ -15675,10 +15733,10 @@ const transformVHtml = (dir, node, context) => {
15675
15733
  const transformVText = (dir, node, context) => {
15676
15734
  const { exp, loc } = dir;
15677
15735
  if (!exp) {
15678
- context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
15736
+ context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
15679
15737
  }
15680
15738
  if (node.children.length) {
15681
- context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
15739
+ context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
15682
15740
  node.children.length = 0;
15683
15741
  }
15684
15742
  return {
@@ -15699,12 +15757,12 @@ const transformModel$1 = (dir, node, context) => {
15699
15757
  return baseResult;
15700
15758
  }
15701
15759
  if (dir.arg) {
15702
- context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
15760
+ context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
15703
15761
  }
15704
15762
  function checkDuplicatedValue() {
15705
15763
  const value = findProp(node, 'value');
15706
15764
  if (value) {
15707
- context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
15765
+ context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
15708
15766
  }
15709
15767
  }
15710
15768
  const { tag } = node;
@@ -15732,7 +15790,7 @@ const transformModel$1 = (dir, node, context) => {
15732
15790
  break;
15733
15791
  case 'file':
15734
15792
  isInvalidType = true;
15735
- context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
15793
+ context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
15736
15794
  break;
15737
15795
  default:
15738
15796
  // text type
@@ -15766,7 +15824,7 @@ const transformModel$1 = (dir, node, context) => {
15766
15824
  }
15767
15825
  }
15768
15826
  else {
15769
- context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
15827
+ context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
15770
15828
  }
15771
15829
  // native vmodel doesn't need the `modelValue` props since they are also
15772
15830
  // passed to the runtime as `binding.value`. removing it reduces code size.
@@ -15886,7 +15944,7 @@ const transformOn$1 = (dir, node, context) => {
15886
15944
  const transformShow = (dir, node, context) => {
15887
15945
  const { exp, loc } = dir;
15888
15946
  if (!exp) {
15889
- context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
15947
+ context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
15890
15948
  }
15891
15949
  return {
15892
15950
  props: [],
@@ -15905,7 +15963,7 @@ const transformTransition = (node, context) => {
15905
15963
  }
15906
15964
  // warn multiple transition children
15907
15965
  if (hasMultipleChildren(node)) {
15908
- context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
15966
+ context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
15909
15967
  start: node.children[0].loc.start,
15910
15968
  end: node.children[node.children.length - 1].loc.end,
15911
15969
  source: ''
@@ -15944,7 +16002,7 @@ const ignoreSideEffectTags = (node, context) => {
15944
16002
  if (node.type === 1 /* NodeTypes.ELEMENT */ &&
15945
16003
  node.tagType === 0 /* ElementTypes.ELEMENT */ &&
15946
16004
  (node.tag === 'script' || node.tag === 'style')) {
15947
- context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
16005
+ context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
15948
16006
  context.removeNode();
15949
16007
  }
15950
16008
  };