@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.
@@ -1661,7 +1661,7 @@ const ErrorTypeStrings$1 = {
1661
1661
  [11]: "app warnHandler",
1662
1662
  [12]: "ref function",
1663
1663
  [13]: "async component loader",
1664
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
1664
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1665
1665
  };
1666
1666
  function callWithErrorHandling(fn, instance, type, args) {
1667
1667
  let res;
@@ -2659,7 +2659,9 @@ function emit(instance, event, ...rawArgs) {
2659
2659
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
2660
2660
  instance,
2661
2661
  instance.type
2662
- )} 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}".`
2662
+ )} 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(
2663
+ event
2664
+ )}" instead of "${event}".`
2663
2665
  );
2664
2666
  }
2665
2667
  }
@@ -3135,7 +3137,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
3135
3137
  const selfName = getComponentName(
3136
3138
  Component,
3137
3139
  false
3138
- /* do not include inferred name to avoid breaking existing code */
3139
3140
  );
3140
3141
  if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3141
3142
  return Component;
@@ -3665,6 +3666,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
3665
3666
  parentSuspense,
3666
3667
  parentComponent,
3667
3668
  node.parentNode,
3669
+ // eslint-disable-next-line no-restricted-globals
3668
3670
  document.createElement("div"),
3669
3671
  null,
3670
3672
  namespace,
@@ -3672,7 +3674,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
3672
3674
  optimized,
3673
3675
  rendererInternals,
3674
3676
  true
3675
- /* hydrating */
3676
3677
  );
3677
3678
  const result = hydrateNode(
3678
3679
  node,
@@ -3812,7 +3813,14 @@ function watch(source, cb, options) {
3812
3813
  }
3813
3814
  return doWatch(source, cb, options);
3814
3815
  }
3815
- function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3816
+ function doWatch(source, cb, {
3817
+ immediate,
3818
+ deep,
3819
+ flush,
3820
+ once,
3821
+ onTrack,
3822
+ onTrigger
3823
+ } = EMPTY_OBJ) {
3816
3824
  var _a;
3817
3825
  if (cb && once) {
3818
3826
  const _cb = cb;
@@ -4513,7 +4521,6 @@ function defineAsyncComponent(source) {
4513
4521
  instance,
4514
4522
  13,
4515
4523
  !errorComponent
4516
- /* do not throw in dev if user provided error component */
4517
4524
  );
4518
4525
  };
4519
4526
  if (suspensible && instance.suspense || false) {
@@ -4909,8 +4916,8 @@ function getCompatListeners(instance) {
4909
4916
  }
4910
4917
 
4911
4918
  function convertLegacyRenderFn(instance) {
4912
- const Component2 = instance.type;
4913
- const render = Component2.render;
4919
+ const Component = instance.type;
4920
+ const render = Component.render;
4914
4921
  if (!render || render._rc || render._compatChecked || render._compatWrapped) {
4915
4922
  return;
4916
4923
  }
@@ -4919,7 +4926,7 @@ function convertLegacyRenderFn(instance) {
4919
4926
  return;
4920
4927
  }
4921
4928
  if (checkCompatEnabled("RENDER_FUNCTION", instance)) {
4922
- const wrapped = Component2.render = function compatRender() {
4929
+ const wrapped = Component.render = function compatRender() {
4923
4930
  return render.call(this, compatH);
4924
4931
  };
4925
4932
  wrapped._compatWrapped = true;
@@ -5078,12 +5085,10 @@ function defineLegacyVNodeProperties(vnode) {
5078
5085
  "RENDER_FUNCTION",
5079
5086
  currentRenderingInstance,
5080
5087
  true
5081
- /* enable for built-ins */
5082
5088
  ) && isCompatEnabled(
5083
5089
  "PRIVATE_APIS",
5084
5090
  currentRenderingInstance,
5085
5091
  true
5086
- /* enable for built-ins */
5087
5092
  )) {
5088
5093
  const context = currentRenderingInstance;
5089
5094
  const getInstance = () => vnode.component && vnode.component.proxy;
@@ -5413,7 +5418,6 @@ function installCompatInstanceProperties(map) {
5413
5418
  assertCompatEnabled(
5414
5419
  "GLOBAL_MOUNT",
5415
5420
  null
5416
- /* this warning is global */
5417
5421
  );
5418
5422
  return i.ctx._compat_mount || NOOP;
5419
5423
  },
@@ -5807,7 +5811,7 @@ function useSlots() {
5807
5811
  function useAttrs() {
5808
5812
  return getContext().attrs;
5809
5813
  }
5810
- function useModel(props, name) {
5814
+ function useModel(props, name, options = EMPTY_OBJ) {
5811
5815
  const i = getCurrentInstance();
5812
5816
  if (!i) {
5813
5817
  warn$1(`useModel() called without active instance.`);
@@ -5817,7 +5821,7 @@ function useModel(props, name) {
5817
5821
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5818
5822
  return ref();
5819
5823
  }
5820
- return customRef((track, trigger) => {
5824
+ const res = customRef((track, trigger) => {
5821
5825
  let localValue;
5822
5826
  watchSyncEffect(() => {
5823
5827
  const propValue = props[name];
@@ -5829,7 +5833,7 @@ function useModel(props, name) {
5829
5833
  return {
5830
5834
  get() {
5831
5835
  track();
5832
- return localValue;
5836
+ return options.get ? options.get(localValue) : localValue;
5833
5837
  },
5834
5838
  set(value) {
5835
5839
  const rawProps = i.vnode.props;
@@ -5837,10 +5841,24 @@ function useModel(props, name) {
5837
5841
  localValue = value;
5838
5842
  trigger();
5839
5843
  }
5840
- i.emit(`update:${name}`, value);
5844
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
5841
5845
  }
5842
5846
  };
5843
5847
  });
5848
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
5849
+ res[Symbol.iterator] = () => {
5850
+ let i2 = 0;
5851
+ return {
5852
+ next() {
5853
+ if (i2 < 2) {
5854
+ return { value: i2++ ? props[modifierKey] : res, done: false };
5855
+ } else {
5856
+ return { done: true };
5857
+ }
5858
+ }
5859
+ };
5860
+ };
5861
+ return res;
5844
5862
  }
5845
5863
  function getContext() {
5846
5864
  const i = getCurrentInstance();
@@ -6141,7 +6159,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
6141
6159
  opt.from || key,
6142
6160
  opt.default,
6143
6161
  true
6144
- /* treat default function as factory */
6145
6162
  );
6146
6163
  } else {
6147
6164
  injected = inject(opt.from || key);
@@ -6414,7 +6431,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6414
6431
  return vm;
6415
6432
  }
6416
6433
  }
6417
- Vue.version = `2.6.14-compat:${"3.4.0-rc.2"}`;
6434
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.3"}`;
6418
6435
  Vue.config = singletonApp.config;
6419
6436
  Vue.use = (p, ...options) => {
6420
6437
  if (p && isFunction(p.install)) {
@@ -7121,7 +7138,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7121
7138
  value,
7122
7139
  instance,
7123
7140
  false
7124
- /* isAbsent */
7125
7141
  );
7126
7142
  }
7127
7143
  } else {
@@ -7160,7 +7176,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7160
7176
  void 0,
7161
7177
  instance,
7162
7178
  true
7163
- /* isAbsent */
7164
7179
  );
7165
7180
  }
7166
7181
  } else {
@@ -10135,7 +10150,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
10135
10150
  dynamicProps,
10136
10151
  shapeFlag,
10137
10152
  true
10138
- /* isBlock */
10139
10153
  )
10140
10154
  );
10141
10155
  }
@@ -10148,7 +10162,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
10148
10162
  patchFlag,
10149
10163
  dynamicProps,
10150
10164
  true
10151
- /* isBlock: prevent a block from tracking itself */
10152
10165
  )
10153
10166
  );
10154
10167
  }
@@ -10650,7 +10663,10 @@ function setupStatefulComponent(instance, isSSR) {
10650
10663
  setup,
10651
10664
  instance,
10652
10665
  0,
10653
- [shallowReadonly(instance.props) , setupContext]
10666
+ [
10667
+ shallowReadonly(instance.props) ,
10668
+ setupContext
10669
+ ]
10654
10670
  );
10655
10671
  resetTracking();
10656
10672
  unsetCurrentInstance();
@@ -10772,7 +10788,6 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10772
10788
  if (!compile && Component.template) {
10773
10789
  warn$1(
10774
10790
  `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
10775
- /* should not happen */
10776
10791
  );
10777
10792
  } else {
10778
10793
  warn$1(`Component is missing template or render function.`);
@@ -11132,7 +11147,7 @@ function isMemoSame(cached, memo) {
11132
11147
  return true;
11133
11148
  }
11134
11149
 
11135
- const version = "3.4.0-rc.2";
11150
+ const version = "3.4.0-rc.3";
11136
11151
  const warn = warn$1 ;
11137
11152
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11138
11153
  const devtools = devtools$1 ;
@@ -12994,7 +13009,6 @@ Vue.compile = () => {
12994
13009
  {
12995
13010
  warn(
12996
13011
  `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
12997
- /* should not happen */
12998
13012
  );
12999
13013
  }
13000
13014
  };