@vue/compat 3.4.0-rc.2 → 3.4.0

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.
@@ -1726,7 +1726,7 @@ const ErrorTypeStrings$1 = {
1726
1726
  [11]: "app warnHandler",
1727
1727
  [12]: "ref function",
1728
1728
  [13]: "async component loader",
1729
- [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
1729
+ [14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
1730
1730
  };
1731
1731
  function callWithErrorHandling(fn, instance, type, args) {
1732
1732
  let res;
@@ -2724,7 +2724,9 @@ function emit(instance, event, ...rawArgs) {
2724
2724
  `Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
2725
2725
  instance,
2726
2726
  instance.type
2727
- )} 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}".`
2727
+ )} 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(
2728
+ event
2729
+ )}" instead of "${event}".`
2728
2730
  );
2729
2731
  }
2730
2732
  }
@@ -3200,7 +3202,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
3200
3202
  const selfName = getComponentName(
3201
3203
  Component,
3202
3204
  false
3203
- /* do not include inferred name to avoid breaking existing code */
3204
3205
  );
3205
3206
  if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3206
3207
  return Component;
@@ -3730,6 +3731,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
3730
3731
  parentSuspense,
3731
3732
  parentComponent,
3732
3733
  node.parentNode,
3734
+ // eslint-disable-next-line no-restricted-globals
3733
3735
  document.createElement("div"),
3734
3736
  null,
3735
3737
  namespace,
@@ -3737,7 +3739,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
3737
3739
  optimized,
3738
3740
  rendererInternals,
3739
3741
  true
3740
- /* hydrating */
3741
3742
  );
3742
3743
  const result = hydrateNode(
3743
3744
  node,
@@ -3877,7 +3878,14 @@ function watch(source, cb, options) {
3877
3878
  }
3878
3879
  return doWatch(source, cb, options);
3879
3880
  }
3880
- function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
3881
+ function doWatch(source, cb, {
3882
+ immediate,
3883
+ deep,
3884
+ flush,
3885
+ once,
3886
+ onTrack,
3887
+ onTrigger
3888
+ } = EMPTY_OBJ) {
3881
3889
  var _a;
3882
3890
  if (cb && once) {
3883
3891
  const _cb = cb;
@@ -4578,7 +4586,6 @@ function defineAsyncComponent(source) {
4578
4586
  instance,
4579
4587
  13,
4580
4588
  !errorComponent
4581
- /* do not throw in dev if user provided error component */
4582
4589
  );
4583
4590
  };
4584
4591
  if (suspensible && instance.suspense || false) {
@@ -4974,8 +4981,8 @@ function getCompatListeners(instance) {
4974
4981
  }
4975
4982
 
4976
4983
  function convertLegacyRenderFn(instance) {
4977
- const Component2 = instance.type;
4978
- const render = Component2.render;
4984
+ const Component = instance.type;
4985
+ const render = Component.render;
4979
4986
  if (!render || render._rc || render._compatChecked || render._compatWrapped) {
4980
4987
  return;
4981
4988
  }
@@ -4984,7 +4991,7 @@ function convertLegacyRenderFn(instance) {
4984
4991
  return;
4985
4992
  }
4986
4993
  if (checkCompatEnabled$1("RENDER_FUNCTION", instance)) {
4987
- const wrapped = Component2.render = function compatRender() {
4994
+ const wrapped = Component.render = function compatRender() {
4988
4995
  return render.call(this, compatH);
4989
4996
  };
4990
4997
  wrapped._compatWrapped = true;
@@ -5143,12 +5150,10 @@ function defineLegacyVNodeProperties(vnode) {
5143
5150
  "RENDER_FUNCTION",
5144
5151
  currentRenderingInstance,
5145
5152
  true
5146
- /* enable for built-ins */
5147
5153
  ) && isCompatEnabled$1(
5148
5154
  "PRIVATE_APIS",
5149
5155
  currentRenderingInstance,
5150
5156
  true
5151
- /* enable for built-ins */
5152
5157
  )) {
5153
5158
  const context = currentRenderingInstance;
5154
5159
  const getInstance = () => vnode.component && vnode.component.proxy;
@@ -5478,7 +5483,6 @@ function installCompatInstanceProperties(map) {
5478
5483
  assertCompatEnabled(
5479
5484
  "GLOBAL_MOUNT",
5480
5485
  null
5481
- /* this warning is global */
5482
5486
  );
5483
5487
  return i.ctx._compat_mount || NOOP;
5484
5488
  },
@@ -5872,7 +5876,7 @@ function useSlots() {
5872
5876
  function useAttrs() {
5873
5877
  return getContext().attrs;
5874
5878
  }
5875
- function useModel(props, name) {
5879
+ function useModel(props, name, options = EMPTY_OBJ) {
5876
5880
  const i = getCurrentInstance();
5877
5881
  if (!i) {
5878
5882
  warn$1(`useModel() called without active instance.`);
@@ -5882,7 +5886,7 @@ function useModel(props, name) {
5882
5886
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5883
5887
  return ref();
5884
5888
  }
5885
- return customRef((track, trigger) => {
5889
+ const res = customRef((track, trigger) => {
5886
5890
  let localValue;
5887
5891
  watchSyncEffect(() => {
5888
5892
  const propValue = props[name];
@@ -5894,7 +5898,7 @@ function useModel(props, name) {
5894
5898
  return {
5895
5899
  get() {
5896
5900
  track();
5897
- return localValue;
5901
+ return options.get ? options.get(localValue) : localValue;
5898
5902
  },
5899
5903
  set(value) {
5900
5904
  const rawProps = i.vnode.props;
@@ -5902,10 +5906,24 @@ function useModel(props, name) {
5902
5906
  localValue = value;
5903
5907
  trigger();
5904
5908
  }
5905
- i.emit(`update:${name}`, value);
5909
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
5906
5910
  }
5907
5911
  };
5908
5912
  });
5913
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
5914
+ res[Symbol.iterator] = () => {
5915
+ let i2 = 0;
5916
+ return {
5917
+ next() {
5918
+ if (i2 < 2) {
5919
+ return { value: i2++ ? props[modifierKey] : res, done: false };
5920
+ } else {
5921
+ return { done: true };
5922
+ }
5923
+ }
5924
+ };
5925
+ };
5926
+ return res;
5909
5927
  }
5910
5928
  function getContext() {
5911
5929
  const i = getCurrentInstance();
@@ -6206,7 +6224,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
6206
6224
  opt.from || key,
6207
6225
  opt.default,
6208
6226
  true
6209
- /* treat default function as factory */
6210
6227
  );
6211
6228
  } else {
6212
6229
  injected = inject(opt.from || key);
@@ -6479,7 +6496,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6479
6496
  return vm;
6480
6497
  }
6481
6498
  }
6482
- Vue.version = `2.6.14-compat:${"3.4.0-rc.2"}`;
6499
+ Vue.version = `2.6.14-compat:${"3.4.0"}`;
6483
6500
  Vue.config = singletonApp.config;
6484
6501
  Vue.use = (p, ...options) => {
6485
6502
  if (p && isFunction(p.install)) {
@@ -7186,7 +7203,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7186
7203
  value,
7187
7204
  instance,
7188
7205
  false
7189
- /* isAbsent */
7190
7206
  );
7191
7207
  }
7192
7208
  } else {
@@ -7225,7 +7241,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
7225
7241
  void 0,
7226
7242
  instance,
7227
7243
  true
7228
- /* isAbsent */
7229
7244
  );
7230
7245
  }
7231
7246
  } else {
@@ -10200,7 +10215,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
10200
10215
  dynamicProps,
10201
10216
  shapeFlag,
10202
10217
  true
10203
- /* isBlock */
10204
10218
  )
10205
10219
  );
10206
10220
  }
@@ -10213,7 +10227,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
10213
10227
  patchFlag,
10214
10228
  dynamicProps,
10215
10229
  true
10216
- /* isBlock: prevent a block from tracking itself */
10217
10230
  )
10218
10231
  );
10219
10232
  }
@@ -10715,7 +10728,10 @@ function setupStatefulComponent(instance, isSSR) {
10715
10728
  setup,
10716
10729
  instance,
10717
10730
  0,
10718
- [shallowReadonly(instance.props) , setupContext]
10731
+ [
10732
+ shallowReadonly(instance.props) ,
10733
+ setupContext
10734
+ ]
10719
10735
  );
10720
10736
  resetTracking();
10721
10737
  unsetCurrentInstance();
@@ -10837,7 +10853,6 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10837
10853
  if (!compile$1 && Component.template) {
10838
10854
  warn$1(
10839
10855
  `Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
10840
- /* should not happen */
10841
10856
  );
10842
10857
  } else {
10843
10858
  warn$1(`Component is missing template or render function.`);
@@ -11197,7 +11212,7 @@ function isMemoSame(cached, memo) {
11197
11212
  return true;
11198
11213
  }
11199
11214
 
11200
- const version = "3.4.0-rc.2";
11215
+ const version = "3.4.0";
11201
11216
  const warn = warn$1 ;
11202
11217
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11203
11218
  const devtools = devtools$1 ;
@@ -15660,7 +15675,6 @@ function createRootCodegen(root, context) {
15660
15675
  true,
15661
15676
  void 0,
15662
15677
  false
15663
- /* isComponent */
15664
15678
  );
15665
15679
  } else ;
15666
15680
  }
@@ -16671,7 +16685,6 @@ const transformFor = createStructuralDirectiveTransform(
16671
16685
  true,
16672
16686
  void 0,
16673
16687
  false
16674
- /* isComponent */
16675
16688
  );
16676
16689
  } else {
16677
16690
  childBlock = children[0].codegenNode;
@@ -16728,7 +16741,6 @@ const transformFor = createStructuralDirectiveTransform(
16728
16741
  createForLoopParams(forNode.parseResult),
16729
16742
  childBlock,
16730
16743
  true
16731
- /* force newline */
16732
16744
  )
16733
16745
  );
16734
16746
  }
@@ -16945,13 +16957,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16945
16957
  createForLoopParams(parseResult),
16946
16958
  buildDynamicSlot(slotName, slotFunction),
16947
16959
  true
16948
- /* force newline */
16949
16960
  )
16950
16961
  ])
16951
16962
  );
16952
16963
  } else {
16953
16964
  context.onError(
16954
- createCompilerError(32, vFor.loc)
16965
+ createCompilerError(
16966
+ 32,
16967
+ vFor.loc
16968
+ )
16955
16969
  );
16956
16970
  }
16957
16971
  } else {