@vue/compat 3.4.0-rc.2 → 3.4.0-rc.3

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.
@@ -1663,7 +1663,7 @@ const ErrorTypeStrings$1 = {
1663
1663
  [11]: "app warnHandler",
1664
1664
  [12]: "ref function",
1665
1665
  [13]: "async component loader",
1666
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
1666
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1667
1667
  };
1668
1668
  function callWithErrorHandling(fn, instance, type, args) {
1669
1669
  let res;
@@ -2666,7 +2666,9 @@ function emit(instance, event, ...rawArgs) {
2666
2666
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
2667
2667
  instance,
2668
2668
  instance.type
2669
- )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(event)}" instead of "${event}".`
2669
+ )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
2670
+ event
2671
+ )}" instead of "${event}".`
2670
2672
  );
2671
2673
  }
2672
2674
  }
@@ -3142,7 +3144,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
3142
3144
  const selfName = getComponentName(
3143
3145
  Component,
3144
3146
  false
3145
- /* do not include inferred name to avoid breaking existing code */
3146
3147
  );
3147
3148
  if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3148
3149
  return Component;
@@ -3672,6 +3673,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
3672
3673
  parentSuspense,
3673
3674
  parentComponent,
3674
3675
  node.parentNode,
3676
+ // eslint-disable-next-line no-restricted-globals
3675
3677
  document.createElement("div"),
3676
3678
  null,
3677
3679
  namespace,
@@ -3679,7 +3681,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
3679
3681
  optimized,
3680
3682
  rendererInternals,
3681
3683
  true
3682
- /* hydrating */
3683
3684
  );
3684
3685
  const result = hydrateNode(
3685
3686
  node,
@@ -3819,7 +3820,14 @@ function watch(source, cb, options) {
3819
3820
  }
3820
3821
  return doWatch(source, cb, options);
3821
3822
  }
3822
- function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3823
+ function doWatch(source, cb, {
3824
+ immediate,
3825
+ deep,
3826
+ flush,
3827
+ once,
3828
+ onTrack,
3829
+ onTrigger
3830
+ } = EMPTY_OBJ) {
3823
3831
  var _a;
3824
3832
  if (cb && once) {
3825
3833
  const _cb = cb;
@@ -4543,7 +4551,6 @@ function defineAsyncComponent(source) {
4543
4551
  instance,
4544
4552
  13,
4545
4553
  !errorComponent
4546
- /* do not throw in dev if user provided error component */
4547
4554
  );
4548
4555
  };
4549
4556
  if (suspensible && instance.suspense || isInSSRComponentSetup) {
@@ -4945,8 +4952,8 @@ function getCompatListeners(instance) {
4945
4952
  }
4946
4953
 
4947
4954
  function convertLegacyRenderFn(instance) {
4948
- const Component2 = instance.type;
4949
- const render = Component2.render;
4955
+ const Component = instance.type;
4956
+ const render = Component.render;
4950
4957
  if (!render || render._rc || render._compatChecked || render._compatWrapped) {
4951
4958
  return;
4952
4959
  }
@@ -4955,7 +4962,7 @@ function convertLegacyRenderFn(instance) {
4955
4962
  return;
4956
4963
  }
4957
4964
  if (checkCompatEnabled("RENDER_FUNCTION", instance)) {
4958
- const wrapped = Component2.render = function compatRender() {
4965
+ const wrapped = Component.render = function compatRender() {
4959
4966
  return render.call(this, compatH);
4960
4967
  };
4961
4968
  wrapped._compatWrapped = true;
@@ -5114,12 +5121,10 @@ function defineLegacyVNodeProperties(vnode) {
5114
5121
  "RENDER_FUNCTION",
5115
5122
  currentRenderingInstance,
5116
5123
  true
5117
- /* enable for built-ins */
5118
5124
  ) && isCompatEnabled(
5119
5125
  "PRIVATE_APIS",
5120
5126
  currentRenderingInstance,
5121
5127
  true
5122
- /* enable for built-ins */
5123
5128
  )) {
5124
5129
  const context = currentRenderingInstance;
5125
5130
  const getInstance = () => vnode.component && vnode.component.proxy;
@@ -5449,7 +5454,6 @@ function installCompatInstanceProperties(map) {
5449
5454
  assertCompatEnabled(
5450
5455
  "GLOBAL_MOUNT",
5451
5456
  null
5452
- /* this warning is global */
5453
5457
  );
5454
5458
  return i.ctx._compat_mount || NOOP;
5455
5459
  },
@@ -5843,7 +5847,7 @@ function useSlots() {
5843
5847
  function useAttrs() {
5844
5848
  return getContext().attrs;
5845
5849
  }
5846
- function useModel(props, name) {
5850
+ function useModel(props, name, options = EMPTY_OBJ) {
5847
5851
  const i = getCurrentInstance();
5848
5852
  if (!!(process.env.NODE_ENV !== "production") && !i) {
5849
5853
  warn$1(`useModel() called without active instance.`);
@@ -5853,7 +5857,7 @@ function useModel(props, name) {
5853
5857
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5854
5858
  return ref();
5855
5859
  }
5856
- return customRef((track, trigger) => {
5860
+ const res = customRef((track, trigger) => {
5857
5861
  let localValue;
5858
5862
  watchSyncEffect(() => {
5859
5863
  const propValue = props[name];
@@ -5865,7 +5869,7 @@ function useModel(props, name) {
5865
5869
  return {
5866
5870
  get() {
5867
5871
  track();
5868
- return localValue;
5872
+ return options.get ? options.get(localValue) : localValue;
5869
5873
  },
5870
5874
  set(value) {
5871
5875
  const rawProps = i.vnode.props;
@@ -5873,10 +5877,24 @@ function useModel(props, name) {
5873
5877
  localValue = value;
5874
5878
  trigger();
5875
5879
  }
5876
- i.emit(`update:${name}`, value);
5880
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
5877
5881
  }
5878
5882
  };
5879
5883
  });
5884
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
5885
+ res[Symbol.iterator] = () => {
5886
+ let i2 = 0;
5887
+ return {
5888
+ next() {
5889
+ if (i2 < 2) {
5890
+ return { value: i2++ ? props[modifierKey] : res, done: false };
5891
+ } else {
5892
+ return { done: true };
5893
+ }
5894
+ }
5895
+ };
5896
+ };
5897
+ return res;
5880
5898
  }
5881
5899
  function getContext() {
5882
5900
  const i = getCurrentInstance();
@@ -6179,7 +6197,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
6179
6197
  opt.from || key,
6180
6198
  opt.default,
6181
6199
  true
6182
- /* treat default function as factory */
6183
6200
  );
6184
6201
  } else {
6185
6202
  injected = inject(opt.from || key);
@@ -6452,7 +6469,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6452
6469
  return vm;
6453
6470
  }
6454
6471
  }
6455
- Vue.version = `2.6.14-compat:${"3.4.0-rc.2"}`;
6472
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.3"}`;
6456
6473
  Vue.config = singletonApp.config;
6457
6474
  Vue.use = (p, ...options) => {
6458
6475
  if (p && isFunction(p.install)) {
@@ -7162,7 +7179,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7162
7179
  value,
7163
7180
  instance,
7164
7181
  false
7165
- /* isAbsent */
7166
7182
  );
7167
7183
  }
7168
7184
  } else {
@@ -7201,7 +7217,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7201
7217
  void 0,
7202
7218
  instance,
7203
7219
  true
7204
- /* isAbsent */
7205
7220
  );
7206
7221
  }
7207
7222
  } else {
@@ -10224,7 +10239,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
10224
10239
  dynamicProps,
10225
10240
  shapeFlag,
10226
10241
  true
10227
- /* isBlock */
10228
10242
  )
10229
10243
  );
10230
10244
  }
@@ -10237,7 +10251,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
10237
10251
  patchFlag,
10238
10252
  dynamicProps,
10239
10253
  true
10240
- /* isBlock: prevent a block from tracking itself */
10241
10254
  )
10242
10255
  );
10243
10256
  }
@@ -10756,7 +10769,10 @@ function setupStatefulComponent(instance, isSSR) {
10756
10769
  setup,
10757
10770
  instance,
10758
10771
  0,
10759
- [!!(process.env.NODE_ENV !== "production") ? shallowReadonly(instance.props) : instance.props, setupContext]
10772
+ [
10773
+ !!(process.env.NODE_ENV !== "production") ? shallowReadonly(instance.props) : instance.props,
10774
+ setupContext
10775
+ ]
10760
10776
  );
10761
10777
  resetTracking();
10762
10778
  unsetCurrentInstance();
@@ -10880,7 +10896,6 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10880
10896
  if (!compile && Component.template) {
10881
10897
  warn$1(
10882
10898
  `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".` )
10883
- /* should not happen */
10884
10899
  );
10885
10900
  } else {
10886
10901
  warn$1(`Component is missing template or render function.`);
@@ -11254,7 +11269,7 @@ function isMemoSame(cached, memo) {
11254
11269
  return true;
11255
11270
  }
11256
11271
 
11257
- const version = "3.4.0-rc.2";
11272
+ const version = "3.4.0-rc.3";
11258
11273
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11259
11274
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11260
11275
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -13166,7 +13181,6 @@ Vue.compile = () => {
13166
13181
  if (!!(process.env.NODE_ENV !== "production")) {
13167
13182
  warn(
13168
13183
  `Runtime compilation is not supported in this build of Vue.` + (` Configure your bundler to alias "vue" to "@vue/compat/dist/vue.esm-bundler.js".` )
13169
- /* should not happen */
13170
13184
  );
13171
13185
  }
13172
13186
  };
@@ -1664,7 +1664,7 @@ var Vue = (function () {
1664
1664
  [11]: "app warnHandler",
1665
1665
  [12]: "ref function",
1666
1666
  [13]: "async component loader",
1667
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
1667
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1668
1668
  };
1669
1669
  function callWithErrorHandling(fn, instance, type, args) {
1670
1670
  let res;
@@ -2662,7 +2662,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2662
2662
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
2663
2663
  instance,
2664
2664
  instance.type
2665
- )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(event)}" instead of "${event}".`
2665
+ )} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
2666
+ event
2667
+ )}" instead of "${event}".`
2666
2668
  );
2667
2669
  }
2668
2670
  }
@@ -3138,7 +3140,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3138
3140
  const selfName = getComponentName(
3139
3141
  Component,
3140
3142
  false
3141
- /* do not include inferred name to avoid breaking existing code */
3142
3143
  );
3143
3144
  if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3144
3145
  return Component;
@@ -3668,6 +3669,7 @@ If this is a native custom element, make sure to exclude it from component resol
3668
3669
  parentSuspense,
3669
3670
  parentComponent,
3670
3671
  node.parentNode,
3672
+ // eslint-disable-next-line no-restricted-globals
3671
3673
  document.createElement("div"),
3672
3674
  null,
3673
3675
  namespace,
@@ -3675,7 +3677,6 @@ If this is a native custom element, make sure to exclude it from component resol
3675
3677
  optimized,
3676
3678
  rendererInternals,
3677
3679
  true
3678
- /* hydrating */
3679
3680
  );
3680
3681
  const result = hydrateNode(
3681
3682
  node,
@@ -3815,7 +3816,14 @@ If this is a native custom element, make sure to exclude it from component resol
3815
3816
  }
3816
3817
  return doWatch(source, cb, options);
3817
3818
  }
3818
- function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3819
+ function doWatch(source, cb, {
3820
+ immediate,
3821
+ deep,
3822
+ flush,
3823
+ once,
3824
+ onTrack,
3825
+ onTrigger
3826
+ } = EMPTY_OBJ) {
3819
3827
  var _a;
3820
3828
  if (cb && once) {
3821
3829
  const _cb = cb;
@@ -4516,7 +4524,6 @@ If this is a native custom element, make sure to exclude it from component resol
4516
4524
  instance,
4517
4525
  13,
4518
4526
  !errorComponent
4519
- /* do not throw in dev if user provided error component */
4520
4527
  );
4521
4528
  };
4522
4529
  if (suspensible && instance.suspense || false) {
@@ -4912,8 +4919,8 @@ If this is a native custom element, make sure to exclude it from component resol
4912
4919
  }
4913
4920
 
4914
4921
  function convertLegacyRenderFn(instance) {
4915
- const Component2 = instance.type;
4916
- const render = Component2.render;
4922
+ const Component = instance.type;
4923
+ const render = Component.render;
4917
4924
  if (!render || render._rc || render._compatChecked || render._compatWrapped) {
4918
4925
  return;
4919
4926
  }
@@ -4922,7 +4929,7 @@ If this is a native custom element, make sure to exclude it from component resol
4922
4929
  return;
4923
4930
  }
4924
4931
  if (checkCompatEnabled("RENDER_FUNCTION", instance)) {
4925
- const wrapped = Component2.render = function compatRender() {
4932
+ const wrapped = Component.render = function compatRender() {
4926
4933
  return render.call(this, compatH);
4927
4934
  };
4928
4935
  wrapped._compatWrapped = true;
@@ -5081,12 +5088,10 @@ If this is a native custom element, make sure to exclude it from component resol
5081
5088
  "RENDER_FUNCTION",
5082
5089
  currentRenderingInstance,
5083
5090
  true
5084
- /* enable for built-ins */
5085
5091
  ) && isCompatEnabled(
5086
5092
  "PRIVATE_APIS",
5087
5093
  currentRenderingInstance,
5088
5094
  true
5089
- /* enable for built-ins */
5090
5095
  )) {
5091
5096
  const context = currentRenderingInstance;
5092
5097
  const getInstance = () => vnode.component && vnode.component.proxy;
@@ -5416,7 +5421,6 @@ If this is a native custom element, make sure to exclude it from component resol
5416
5421
  assertCompatEnabled(
5417
5422
  "GLOBAL_MOUNT",
5418
5423
  null
5419
- /* this warning is global */
5420
5424
  );
5421
5425
  return i.ctx._compat_mount || NOOP;
5422
5426
  },
@@ -5810,7 +5814,7 @@ If this is a native custom element, make sure to exclude it from component resol
5810
5814
  function useAttrs() {
5811
5815
  return getContext().attrs;
5812
5816
  }
5813
- function useModel(props, name) {
5817
+ function useModel(props, name, options = EMPTY_OBJ) {
5814
5818
  const i = getCurrentInstance();
5815
5819
  if (!i) {
5816
5820
  warn$1(`useModel() called without active instance.`);
@@ -5820,7 +5824,7 @@ If this is a native custom element, make sure to exclude it from component resol
5820
5824
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5821
5825
  return ref();
5822
5826
  }
5823
- return customRef((track, trigger) => {
5827
+ const res = customRef((track, trigger) => {
5824
5828
  let localValue;
5825
5829
  watchSyncEffect(() => {
5826
5830
  const propValue = props[name];
@@ -5832,7 +5836,7 @@ If this is a native custom element, make sure to exclude it from component resol
5832
5836
  return {
5833
5837
  get() {
5834
5838
  track();
5835
- return localValue;
5839
+ return options.get ? options.get(localValue) : localValue;
5836
5840
  },
5837
5841
  set(value) {
5838
5842
  const rawProps = i.vnode.props;
@@ -5840,10 +5844,24 @@ If this is a native custom element, make sure to exclude it from component resol
5840
5844
  localValue = value;
5841
5845
  trigger();
5842
5846
  }
5843
- i.emit(`update:${name}`, value);
5847
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
5844
5848
  }
5845
5849
  };
5846
5850
  });
5851
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
5852
+ res[Symbol.iterator] = () => {
5853
+ let i2 = 0;
5854
+ return {
5855
+ next() {
5856
+ if (i2 < 2) {
5857
+ return { value: i2++ ? props[modifierKey] : res, done: false };
5858
+ } else {
5859
+ return { done: true };
5860
+ }
5861
+ }
5862
+ };
5863
+ };
5864
+ return res;
5847
5865
  }
5848
5866
  function getContext() {
5849
5867
  const i = getCurrentInstance();
@@ -6144,7 +6162,6 @@ If this is a native custom element, make sure to exclude it from component resol
6144
6162
  opt.from || key,
6145
6163
  opt.default,
6146
6164
  true
6147
- /* treat default function as factory */
6148
6165
  );
6149
6166
  } else {
6150
6167
  injected = inject(opt.from || key);
@@ -6417,7 +6434,7 @@ If this is a native custom element, make sure to exclude it from component resol
6417
6434
  return vm;
6418
6435
  }
6419
6436
  }
6420
- Vue.version = `2.6.14-compat:${"3.4.0-rc.2"}`;
6437
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.3"}`;
6421
6438
  Vue.config = singletonApp.config;
6422
6439
  Vue.use = (p, ...options) => {
6423
6440
  if (p && isFunction(p.install)) {
@@ -7124,7 +7141,6 @@ If you want to remount the same app, move your app creation logic into a factory
7124
7141
  value,
7125
7142
  instance,
7126
7143
  false
7127
- /* isAbsent */
7128
7144
  );
7129
7145
  }
7130
7146
  } else {
@@ -7163,7 +7179,6 @@ If you want to remount the same app, move your app creation logic into a factory
7163
7179
  void 0,
7164
7180
  instance,
7165
7181
  true
7166
- /* isAbsent */
7167
7182
  );
7168
7183
  }
7169
7184
  } else {
@@ -10138,7 +10153,6 @@ Server rendered element contains fewer child nodes than client vdom.`
10138
10153
  dynamicProps,
10139
10154
  shapeFlag,
10140
10155
  true
10141
- /* isBlock */
10142
10156
  )
10143
10157
  );
10144
10158
  }
@@ -10151,7 +10165,6 @@ Server rendered element contains fewer child nodes than client vdom.`
10151
10165
  patchFlag,
10152
10166
  dynamicProps,
10153
10167
  true
10154
- /* isBlock: prevent a block from tracking itself */
10155
10168
  )
10156
10169
  );
10157
10170
  }
@@ -10653,7 +10666,10 @@ Component that was made reactive: `,
10653
10666
  setup,
10654
10667
  instance,
10655
10668
  0,
10656
- [shallowReadonly(instance.props) , setupContext]
10669
+ [
10670
+ shallowReadonly(instance.props) ,
10671
+ setupContext
10672
+ ]
10657
10673
  );
10658
10674
  resetTracking();
10659
10675
  unsetCurrentInstance();
@@ -10775,7 +10791,6 @@ Component that was made reactive: `,
10775
10791
  if (!compile && Component.template) {
10776
10792
  warn$1(
10777
10793
  `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
10778
- /* should not happen */
10779
10794
  );
10780
10795
  } else {
10781
10796
  warn$1(`Component is missing template or render function.`);
@@ -11129,7 +11144,7 @@ Component that was made reactive: `,
11129
11144
  return true;
11130
11145
  }
11131
11146
 
11132
- const version = "3.4.0-rc.2";
11147
+ const version = "3.4.0-rc.3";
11133
11148
  const warn = warn$1 ;
11134
11149
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11135
11150
  const devtools = devtools$1 ;
@@ -12979,7 +12994,6 @@ Make sure to use the production build (*.prod.js) when deploying for production.
12979
12994
  {
12980
12995
  warn(
12981
12996
  `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.global.js" instead.` )
12982
- /* should not happen */
12983
12997
  );
12984
12998
  }
12985
12999
  };