@vue/compat 3.2.44 → 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
@@ -4516,10 +4510,15 @@ function defineAsyncComponent(source) {
4516
4510
  }
4517
4511
  });
4518
4512
  }
4519
- function createInnerComp(comp, { vnode: { ref, props, children, shapeFlag }, parent }) {
4513
+ function createInnerComp(comp, parent) {
4514
+ const { ref, props, children, ce } = parent.vnode;
4520
4515
  const vnode = createVNode(comp, props, children);
4521
4516
  // ensure inner component inherits the async wrapper's ref owner
4522
4517
  vnode.ref = ref;
4518
+ // pass the custom element callback on to the inner comp
4519
+ // and remove it from the async wrapper
4520
+ vnode.ce = ce;
4521
+ delete parent.vnode.ce;
4523
4522
  return vnode;
4524
4523
  }
4525
4524
 
@@ -4677,8 +4676,7 @@ const KeepAliveImpl = {
4677
4676
  : comp);
4678
4677
  const { include, exclude, max } = props;
4679
4678
  if ((include && (!name || !matches(include, name))) ||
4680
- (exclude && name && matches(exclude, name)) ||
4681
- (hmrDirtyComponents.has(comp))) {
4679
+ (exclude && name && matches(exclude, name))) {
4682
4680
  current = vnode;
4683
4681
  return rawVNode;
4684
4682
  }
@@ -4791,14 +4789,9 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
4791
4789
  }, target);
4792
4790
  }
4793
4791
  function resetShapeFlag(vnode) {
4794
- let shapeFlag = vnode.shapeFlag;
4795
- if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
4796
- shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4797
- }
4798
- if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
4799
- shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4800
- }
4801
- vnode.shapeFlag = shapeFlag;
4792
+ // bitwise operations to remove keep alive flags
4793
+ vnode.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
4794
+ vnode.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
4802
4795
  }
4803
4796
  function getInnerChild(vnode) {
4804
4797
  return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
@@ -5426,7 +5419,9 @@ fallback, noSlotted) {
5426
5419
  (currentRenderingInstance.parent &&
5427
5420
  isAsyncWrapper(currentRenderingInstance.parent) &&
5428
5421
  currentRenderingInstance.parent.isCE)) {
5429
- return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
5422
+ if (name !== 'default')
5423
+ props.name = name;
5424
+ return createVNode('slot', props, fallback && fallback());
5430
5425
  }
5431
5426
  let slot = slots[name];
5432
5427
  if (slot && slot.length > 1) {
@@ -5746,6 +5741,7 @@ const publicPropertiesMap =
5746
5741
  installCompatInstanceProperties(publicPropertiesMap);
5747
5742
  }
5748
5743
  const isReservedPrefix = (key) => key === '_' || key === '$';
5744
+ const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
5749
5745
  const PublicInstanceProxyHandlers = {
5750
5746
  get({ _: instance }, key) {
5751
5747
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
@@ -5753,15 +5749,6 @@ const PublicInstanceProxyHandlers = {
5753
5749
  if (key === '__isVue') {
5754
5750
  return true;
5755
5751
  }
5756
- // prioritize <script setup> bindings during dev.
5757
- // this allows even properties that start with _ or $ to be used - so that
5758
- // it aligns with the production behavior where the render fn is inlined and
5759
- // indeed has access to all declared variables.
5760
- if (setupState !== EMPTY_OBJ &&
5761
- setupState.__isScriptSetup &&
5762
- hasOwn(setupState, key)) {
5763
- return setupState[key];
5764
- }
5765
5752
  // data / props / ctx
5766
5753
  // This getter gets called for every property access on the render context
5767
5754
  // during render and is a major hotspot. The most expensive part of this
@@ -5784,7 +5771,7 @@ const PublicInstanceProxyHandlers = {
5784
5771
  // default: just fallthrough
5785
5772
  }
5786
5773
  }
5787
- else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
5774
+ else if (hasSetupBinding(setupState, key)) {
5788
5775
  accessCache[key] = 1 /* AccessTypes.SETUP */;
5789
5776
  return setupState[key];
5790
5777
  }
@@ -5863,21 +5850,26 @@ const PublicInstanceProxyHandlers = {
5863
5850
  },
5864
5851
  set({ _: instance }, key, value) {
5865
5852
  const { data, setupState, ctx } = instance;
5866
- if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
5853
+ if (hasSetupBinding(setupState, key)) {
5867
5854
  setupState[key] = value;
5868
5855
  return true;
5869
5856
  }
5857
+ else if (setupState.__isScriptSetup &&
5858
+ hasOwn(setupState, key)) {
5859
+ warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
5860
+ return false;
5861
+ }
5870
5862
  else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
5871
5863
  data[key] = value;
5872
5864
  return true;
5873
5865
  }
5874
5866
  else if (hasOwn(instance.props, key)) {
5875
- warn$1(`Attempting to mutate prop "${key}". Props are readonly.`, instance);
5867
+ warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
5876
5868
  return false;
5877
5869
  }
5878
5870
  if (key[0] === '$' && key.slice(1) in instance) {
5879
5871
  warn$1(`Attempting to mutate public property "${key}". ` +
5880
- `Properties starting with $ are reserved and readonly.`, instance);
5872
+ `Properties starting with $ are reserved and readonly.`);
5881
5873
  return false;
5882
5874
  }
5883
5875
  else {
@@ -5898,7 +5890,7 @@ const PublicInstanceProxyHandlers = {
5898
5890
  let normalizedProps;
5899
5891
  return (!!accessCache[key] ||
5900
5892
  (data !== EMPTY_OBJ && hasOwn(data, key)) ||
5901
- (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) ||
5893
+ hasSetupBinding(setupState, key) ||
5902
5894
  ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
5903
5895
  hasOwn(ctx, key) ||
5904
5896
  hasOwn(publicPropertiesMap, key) ||
@@ -7173,7 +7165,7 @@ function createCompatVue(createApp, createSingletonApp) {
7173
7165
  return vm;
7174
7166
  }
7175
7167
  }
7176
- Vue.version = `2.6.14-compat:${"3.2.44"}`;
7168
+ Vue.version = `2.6.14-compat:${"3.2.45"}`;
7177
7169
  Vue.config = singletonApp.config;
7178
7170
  Vue.use = (p, ...options) => {
7179
7171
  if (p && isFunction(p.install)) {
@@ -9560,6 +9552,10 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9560
9552
  if (!shallow)
9561
9553
  traverseStaticChildren(c1, c2);
9562
9554
  }
9555
+ // #6852 also inherit for text nodes
9556
+ if (c2.type === Text) {
9557
+ c2.el = c1.el;
9558
+ }
9563
9559
  // also inherit for comment nodes, but not placeholders (e.g. v-if which
9564
9560
  // would have received .el during block patch)
9565
9561
  if (c2.type === Comment && !c2.el) {
@@ -9730,6 +9726,7 @@ const TeleportImpl = {
9730
9726
  }
9731
9727
  }
9732
9728
  }
9729
+ updateCssVars(n2);
9733
9730
  },
9734
9731
  remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount, o: { remove: hostRemove } }, doRemove) {
9735
9732
  const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
@@ -9808,11 +9805,26 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
9808
9805
  hydrateChildren(targetNode, vnode, target, parentComponent, parentSuspense, slotScopeIds, optimized);
9809
9806
  }
9810
9807
  }
9808
+ updateCssVars(vnode);
9811
9809
  }
9812
9810
  return vnode.anchor && nextSibling(vnode.anchor);
9813
9811
  }
9814
9812
  // Force-casted public typing for h and TSX props inference
9815
9813
  const Teleport = TeleportImpl;
9814
+ function updateCssVars(vnode) {
9815
+ // presence of .ut method indicates owner component uses css vars.
9816
+ // code path here can assume browser environment.
9817
+ const ctx = vnode.ctx;
9818
+ if (ctx && ctx.ut) {
9819
+ let node = vnode.children[0].el;
9820
+ while (node !== vnode.targetAnchor) {
9821
+ if (node.nodeType === 1)
9822
+ node.setAttribute('data-v-owner', ctx.uid);
9823
+ node = node.nextSibling;
9824
+ }
9825
+ ctx.ut();
9826
+ }
9827
+ }
9816
9828
 
9817
9829
  const normalizedAsyncComponentMap = new Map();
9818
9830
  function convertLegacyAsyncComponent(comp) {
@@ -9967,6 +9979,10 @@ function isVNode(value) {
9967
9979
  function isSameVNodeType(n1, n2) {
9968
9980
  if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
9969
9981
  hmrDirtyComponents.has(n2.type)) {
9982
+ // #7042, ensure the vnode being unmounted during HMR
9983
+ // bitwise operations to remove keep alive flags
9984
+ n1.shapeFlag &= ~256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
9985
+ n2.shapeFlag &= ~512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
9970
9986
  // HMR only: if the component has been hot-updated, force a reload.
9971
9987
  return false;
9972
9988
  }
@@ -10022,7 +10038,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
10022
10038
  patchFlag,
10023
10039
  dynamicProps,
10024
10040
  dynamicChildren: null,
10025
- appContext: null
10041
+ appContext: null,
10042
+ ctx: currentRenderingInstance
10026
10043
  };
10027
10044
  if (needFullChildrenNormalization) {
10028
10045
  normalizeChildren(vnode, children);
@@ -10197,7 +10214,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
10197
10214
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
10198
10215
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
10199
10216
  el: vnode.el,
10200
- anchor: vnode.anchor
10217
+ anchor: vnode.anchor,
10218
+ ctx: vnode.ctx
10201
10219
  };
10202
10220
  {
10203
10221
  defineLegacyVNodeProperties(cloned);
@@ -11185,7 +11203,7 @@ function isMemoSame(cached, memo) {
11185
11203
  }
11186
11204
 
11187
11205
  // Core API ------------------------------------------------------------------
11188
- const version = "3.2.44";
11206
+ const version = "3.2.45";
11189
11207
  /**
11190
11208
  * SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
11191
11209
  * @internal
@@ -11719,12 +11737,21 @@ class VueElement extends BaseClass {
11719
11737
  `defined as hydratable. Use \`defineSSRCustomElement\`.`);
11720
11738
  }
11721
11739
  this.attachShadow({ mode: 'open' });
11740
+ if (!this._def.__asyncLoader) {
11741
+ // for sync component defs we can immediately resolve props
11742
+ this._resolveProps(this._def);
11743
+ }
11722
11744
  }
11723
11745
  }
11724
11746
  connectedCallback() {
11725
11747
  this._connected = true;
11726
11748
  if (!this._instance) {
11727
- this._resolveDef();
11749
+ if (this._resolved) {
11750
+ this._update();
11751
+ }
11752
+ else {
11753
+ this._resolveDef();
11754
+ }
11728
11755
  }
11729
11756
  }
11730
11757
  disconnectedCallback() {
@@ -11740,9 +11767,6 @@ class VueElement extends BaseClass {
11740
11767
  * resolve inner component definition (handle possible async component)
11741
11768
  */
11742
11769
  _resolveDef() {
11743
- if (this._resolved) {
11744
- return;
11745
- }
11746
11770
  this._resolved = true;
11747
11771
  // set initial attrs
11748
11772
  for (let i = 0; i < this.attributes.length; i++) {
@@ -11754,38 +11778,26 @@ class VueElement extends BaseClass {
11754
11778
  this._setAttr(m.attributeName);
11755
11779
  }
11756
11780
  }).observe(this, { attributes: true });
11757
- const resolve = (def) => {
11758
- const { props = {}, styles } = def;
11759
- const hasOptions = !isArray(props);
11760
- const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
11781
+ const resolve = (def, isAsync = false) => {
11782
+ const { props, styles } = def;
11761
11783
  // cast Number-type props set before resolve
11762
11784
  let numberProps;
11763
- if (hasOptions) {
11764
- for (const key in this._props) {
11785
+ if (props && !isArray(props)) {
11786
+ for (const key in props) {
11765
11787
  const opt = props[key];
11766
11788
  if (opt === Number || (opt && opt.type === Number)) {
11767
- this._props[key] = toNumber(this._props[key]);
11768
- (numberProps || (numberProps = Object.create(null)))[key] = true;
11789
+ if (key in this._props) {
11790
+ this._props[key] = toNumber(this._props[key]);
11791
+ }
11792
+ (numberProps || (numberProps = Object.create(null)))[camelize(key)] = true;
11769
11793
  }
11770
11794
  }
11771
11795
  }
11772
11796
  this._numberProps = numberProps;
11773
- // check if there are props set pre-upgrade or connect
11774
- for (const key of Object.keys(this)) {
11775
- if (key[0] !== '_') {
11776
- this._setProp(key, this[key], true, false);
11777
- }
11778
- }
11779
- // defining getter/setters on prototype
11780
- for (const key of rawKeys.map(camelize)) {
11781
- Object.defineProperty(this, key, {
11782
- get() {
11783
- return this._getProp(key);
11784
- },
11785
- set(val) {
11786
- this._setProp(key, val);
11787
- }
11788
- });
11797
+ if (isAsync) {
11798
+ // defining getter/setters on prototype
11799
+ // for sync defs, this already happened in the constructor
11800
+ this._resolveProps(def);
11789
11801
  }
11790
11802
  // apply CSS
11791
11803
  this._applyStyles(styles);
@@ -11794,12 +11806,33 @@ class VueElement extends BaseClass {
11794
11806
  };
11795
11807
  const asyncDef = this._def.__asyncLoader;
11796
11808
  if (asyncDef) {
11797
- asyncDef().then(resolve);
11809
+ asyncDef().then(def => resolve(def, true));
11798
11810
  }
11799
11811
  else {
11800
11812
  resolve(this._def);
11801
11813
  }
11802
11814
  }
11815
+ _resolveProps(def) {
11816
+ const { props } = def;
11817
+ const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
11818
+ // check if there are props set pre-upgrade or connect
11819
+ for (const key of Object.keys(this)) {
11820
+ if (key[0] !== '_' && declaredPropKeys.includes(key)) {
11821
+ this._setProp(key, this[key], true, false);
11822
+ }
11823
+ }
11824
+ // defining getter/setters on prototype
11825
+ for (const key of declaredPropKeys.map(camelize)) {
11826
+ Object.defineProperty(this, key, {
11827
+ get() {
11828
+ return this._getProp(key);
11829
+ },
11830
+ set(val) {
11831
+ this._setProp(key, val);
11832
+ }
11833
+ });
11834
+ }
11835
+ }
11803
11836
  _setAttr(key) {
11804
11837
  let value = this.getAttribute(key);
11805
11838
  const camelKey = camelize(key);
@@ -11855,27 +11888,31 @@ class VueElement extends BaseClass {
11855
11888
  this._styles.length = 0;
11856
11889
  }
11857
11890
  this._applyStyles(newStyles);
11858
- // if this is an async component, ceReload is called from the inner
11859
- // component so no need to reload the async wrapper
11860
- if (!this._def.__asyncLoader) {
11861
- // reload
11862
- this._instance = null;
11863
- this._update();
11864
- }
11891
+ this._instance = null;
11892
+ this._update();
11865
11893
  };
11866
11894
  }
11867
- // intercept emit
11868
- instance.emit = (event, ...args) => {
11895
+ const dispatch = (event, args) => {
11869
11896
  this.dispatchEvent(new CustomEvent(event, {
11870
11897
  detail: args
11871
11898
  }));
11872
11899
  };
11900
+ // intercept emit
11901
+ instance.emit = (event, ...args) => {
11902
+ // dispatch both the raw and hyphenated versions of an event
11903
+ // to match Vue behavior
11904
+ dispatch(event, args);
11905
+ if (hyphenate(event) !== event) {
11906
+ dispatch(hyphenate(event), args);
11907
+ }
11908
+ };
11873
11909
  // locate nearest Vue custom element parent for provide/inject
11874
11910
  let parent = this;
11875
11911
  while ((parent =
11876
11912
  parent && (parent.parentNode || parent.host))) {
11877
11913
  if (parent instanceof VueElement) {
11878
11914
  instance.parent = parent._instance;
11915
+ instance.provides = parent._instance.provides;
11879
11916
  break;
11880
11917
  }
11881
11918
  }
@@ -11931,7 +11968,14 @@ function useCssVars(getter) {
11931
11968
  warn$1(`useCssVars is called without current active component instance.`);
11932
11969
  return;
11933
11970
  }
11934
- const setVars = () => setVarsOnVNode(instance.subTree, getter(instance.proxy));
11971
+ const updateTeleports = (instance.ut = (vars = getter(instance.proxy)) => {
11972
+ Array.from(document.querySelectorAll(`[data-v-owner="${instance.uid}"]`)).forEach(node => setVarsOnNode(node, vars));
11973
+ });
11974
+ const setVars = () => {
11975
+ const vars = getter(instance.proxy);
11976
+ setVarsOnVNode(instance.subTree, vars);
11977
+ updateTeleports(vars);
11978
+ };
11935
11979
  watchPostEffect(setVars);
11936
11980
  onMounted(() => {
11937
11981
  const ob = new MutationObserver(setVars);
@@ -13192,15 +13236,16 @@ const errorMessages = {
13192
13236
  [41 /* ErrorCodes.X_V_MODEL_NO_EXPRESSION */]: `v-model is missing expression.`,
13193
13237
  [42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */]: `v-model value must be a valid JavaScript member expression.`,
13194
13238
  [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.`,
13195
- [44 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
13196
- [45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
13239
+ [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.`,
13240
+ [45 /* ErrorCodes.X_INVALID_EXPRESSION */]: `Error parsing JavaScript expression: `,
13241
+ [46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */]: `<KeepAlive> expects exactly one child component.`,
13197
13242
  // generic errors
13198
- [46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13199
- [47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
13200
- [48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13201
- [49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
13243
+ [47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
13244
+ [48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
13245
+ [49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
13246
+ [50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
13202
13247
  // just to fulfill types
13203
- [50 /* ErrorCodes.__EXTEND_POINT__ */]: ``
13248
+ [51 /* ErrorCodes.__EXTEND_POINT__ */]: ``
13204
13249
  };
13205
13250
 
13206
13251
  const FRAGMENT = Symbol(`Fragment` );
@@ -15825,7 +15870,7 @@ function validateBrowserExpression(node, context, asParams = false, asRawStateme
15825
15870
  if (keywordMatch) {
15826
15871
  message = `avoid using JavaScript keyword as property name: "${keywordMatch[0]}"`;
15827
15872
  }
15828
- context.onError(createCompilerError(44 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
15873
+ context.onError(createCompilerError(45 /* ErrorCodes.X_INVALID_EXPRESSION */, node.loc, undefined, message));
15829
15874
  }
15830
15875
  }
15831
15876
 
@@ -16619,7 +16664,7 @@ const transformElement = (node, context) => {
16619
16664
  // 2. Force keep-alive to always be updated, since it uses raw children.
16620
16665
  patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
16621
16666
  if (node.children.length > 1) {
16622
- context.onError(createCompilerError(45 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
16667
+ context.onError(createCompilerError(46 /* ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN */, {
16623
16668
  start: node.children[0].loc.start,
16624
16669
  end: node.children[node.children.length - 1].loc.end,
16625
16670
  source: ''
@@ -17474,8 +17519,14 @@ const transformModel = (dir, node, context) => {
17474
17519
  const expString = exp.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ ? exp.content : rawExp;
17475
17520
  // im SFC <script setup> inline mode, the exp may have been transformed into
17476
17521
  // _unref(exp)
17477
- context.bindingMetadata[rawExp];
17478
- const maybeRef = !true /* BindingTypes.SETUP_CONST */;
17522
+ const bindingType = context.bindingMetadata[rawExp];
17523
+ // check props
17524
+ if (bindingType === "props" /* BindingTypes.PROPS */ ||
17525
+ bindingType === "props-aliased" /* BindingTypes.PROPS_ALIASED */) {
17526
+ context.onError(createCompilerError(44 /* ErrorCodes.X_V_MODEL_ON_PROPS */, exp.loc));
17527
+ return createTransformProps();
17528
+ }
17529
+ const maybeRef = !true ;
17479
17530
  if (!expString.trim() ||
17480
17531
  (!isMemberExpression(expString) && !maybeRef)) {
17481
17532
  context.onError(createCompilerError(42 /* ErrorCodes.X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
@@ -17742,18 +17793,18 @@ function baseCompile(template, options = {}) {
17742
17793
  /* istanbul ignore if */
17743
17794
  {
17744
17795
  if (options.prefixIdentifiers === true) {
17745
- onError(createCompilerError(46 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
17796
+ onError(createCompilerError(47 /* ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED */));
17746
17797
  }
17747
17798
  else if (isModuleMode) {
17748
- onError(createCompilerError(47 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
17799
+ onError(createCompilerError(48 /* ErrorCodes.X_MODULE_MODE_NOT_SUPPORTED */));
17749
17800
  }
17750
17801
  }
17751
17802
  const prefixIdentifiers = !true ;
17752
17803
  if (options.cacheHandlers) {
17753
- onError(createCompilerError(48 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
17804
+ onError(createCompilerError(49 /* ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
17754
17805
  }
17755
17806
  if (options.scopeId && !isModuleMode) {
17756
- onError(createCompilerError(49 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
17807
+ onError(createCompilerError(50 /* ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
17757
17808
  }
17758
17809
  const ast = isString(template) ? baseParse(template, options) : template;
17759
17810
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
@@ -17911,26 +17962,26 @@ function createDOMCompilerError(code, loc) {
17911
17962
  return createCompilerError(code, loc, DOMErrorMessages );
17912
17963
  }
17913
17964
  const DOMErrorMessages = {
17914
- [50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
17915
- [51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
17916
- [52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
17917
- [53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
17918
- [54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17919
- [55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
17920
- [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.`,
17921
- [57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17922
- [58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
17923
- [59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
17924
- [60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17965
+ [51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
17966
+ [52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
17967
+ [53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
17968
+ [54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
17969
+ [55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17970
+ [56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
17971
+ [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.`,
17972
+ [58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17973
+ [59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
17974
+ [60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
17975
+ [61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17925
17976
  };
17926
17977
 
17927
17978
  const transformVHtml = (dir, node, context) => {
17928
17979
  const { exp, loc } = dir;
17929
17980
  if (!exp) {
17930
- context.onError(createDOMCompilerError(50 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
17981
+ context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
17931
17982
  }
17932
17983
  if (node.children.length) {
17933
- context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
17984
+ context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
17934
17985
  node.children.length = 0;
17935
17986
  }
17936
17987
  return {
@@ -17943,10 +17994,10 @@ const transformVHtml = (dir, node, context) => {
17943
17994
  const transformVText = (dir, node, context) => {
17944
17995
  const { exp, loc } = dir;
17945
17996
  if (!exp) {
17946
- context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
17997
+ context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
17947
17998
  }
17948
17999
  if (node.children.length) {
17949
- context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
18000
+ context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
17950
18001
  node.children.length = 0;
17951
18002
  }
17952
18003
  return {
@@ -17967,12 +18018,12 @@ const transformModel$1 = (dir, node, context) => {
17967
18018
  return baseResult;
17968
18019
  }
17969
18020
  if (dir.arg) {
17970
- context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
18021
+ context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
17971
18022
  }
17972
18023
  function checkDuplicatedValue() {
17973
18024
  const value = findProp(node, 'value');
17974
18025
  if (value) {
17975
- context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
18026
+ context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
17976
18027
  }
17977
18028
  }
17978
18029
  const { tag } = node;
@@ -18000,7 +18051,7 @@ const transformModel$1 = (dir, node, context) => {
18000
18051
  break;
18001
18052
  case 'file':
18002
18053
  isInvalidType = true;
18003
- context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
18054
+ context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
18004
18055
  break;
18005
18056
  default:
18006
18057
  // text type
@@ -18034,7 +18085,7 @@ const transformModel$1 = (dir, node, context) => {
18034
18085
  }
18035
18086
  }
18036
18087
  else {
18037
- context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
18088
+ context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
18038
18089
  }
18039
18090
  // native vmodel doesn't need the `modelValue` props since they are also
18040
18091
  // passed to the runtime as `binding.value`. removing it reduces code size.
@@ -18158,7 +18209,7 @@ const transformOn$1 = (dir, node, context) => {
18158
18209
  const transformShow = (dir, node, context) => {
18159
18210
  const { exp, loc } = dir;
18160
18211
  if (!exp) {
18161
- context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
18212
+ context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
18162
18213
  }
18163
18214
  return {
18164
18215
  props: [],
@@ -18177,7 +18228,7 @@ const transformTransition = (node, context) => {
18177
18228
  }
18178
18229
  // warn multiple transition children
18179
18230
  if (hasMultipleChildren(node)) {
18180
- context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
18231
+ context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
18181
18232
  start: node.children[0].loc.start,
18182
18233
  end: node.children[node.children.length - 1].loc.end,
18183
18234
  source: ''
@@ -18216,7 +18267,7 @@ const ignoreSideEffectTags = (node, context) => {
18216
18267
  if (node.type === 1 /* NodeTypes.ELEMENT */ &&
18217
18268
  node.tagType === 0 /* ElementTypes.ELEMENT */ &&
18218
18269
  (node.tag === 'script' || node.tag === 'style')) {
18219
- context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
18270
+ context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
18220
18271
  context.removeNode();
18221
18272
  }
18222
18273
  };