@vue/compat 3.4.0 → 3.4.2

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.
@@ -3787,6 +3787,19 @@ function mapCompatDirectiveHook(name, dir, instance) {
3787
3787
  }
3788
3788
  }
3789
3789
 
3790
+ const ssrContextKey = Symbol.for("v-scx");
3791
+ const useSSRContext = () => {
3792
+ {
3793
+ const ctx = inject(ssrContextKey);
3794
+ if (!ctx) {
3795
+ warn$1(
3796
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
3797
+ );
3798
+ }
3799
+ return ctx;
3800
+ }
3801
+ };
3802
+
3790
3803
  function watchEffect(effect, options) {
3791
3804
  return doWatch(effect, null, options);
3792
3805
  }
@@ -3861,8 +3874,8 @@ function doWatch(source, cb, {
3861
3874
  getter = () => source.value;
3862
3875
  forceTrigger = isShallow(source);
3863
3876
  } else if (isReactive(source)) {
3864
- getter = () => source;
3865
- deep = true;
3877
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3878
+ forceTrigger = true;
3866
3879
  } else if (isArray(source)) {
3867
3880
  isMultiSource = true;
3868
3881
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3870,7 +3883,7 @@ function doWatch(source, cb, {
3870
3883
  if (isRef(s)) {
3871
3884
  return s.value;
3872
3885
  } else if (isReactive(s)) {
3873
- return traverse(s);
3886
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3874
3887
  } else if (isFunction(s)) {
3875
3888
  return callWithErrorHandling(s, instance, 2);
3876
3889
  } else {
@@ -4013,28 +4026,34 @@ function createPathGetter(ctx, path) {
4013
4026
  return cur;
4014
4027
  };
4015
4028
  }
4016
- function traverse(value, seen) {
4029
+ function traverse(value, depth, currentDepth = 0, seen) {
4017
4030
  if (!isObject(value) || value["__v_skip"]) {
4018
4031
  return value;
4019
4032
  }
4033
+ if (depth && depth > 0) {
4034
+ if (currentDepth >= depth) {
4035
+ return value;
4036
+ }
4037
+ currentDepth++;
4038
+ }
4020
4039
  seen = seen || /* @__PURE__ */ new Set();
4021
4040
  if (seen.has(value)) {
4022
4041
  return value;
4023
4042
  }
4024
4043
  seen.add(value);
4025
4044
  if (isRef(value)) {
4026
- traverse(value.value, seen);
4045
+ traverse(value.value, depth, currentDepth, seen);
4027
4046
  } else if (isArray(value)) {
4028
4047
  for (let i = 0; i < value.length; i++) {
4029
- traverse(value[i], seen);
4048
+ traverse(value[i], depth, currentDepth, seen);
4030
4049
  }
4031
4050
  } else if (isSet(value) || isMap(value)) {
4032
4051
  value.forEach((v) => {
4033
- traverse(v, seen);
4052
+ traverse(v, depth, currentDepth, seen);
4034
4053
  });
4035
4054
  } else if (isPlainObject(value)) {
4036
4055
  for (const key in value) {
4037
- traverse(value[key], seen);
4056
+ traverse(value[key], depth, currentDepth, seen);
4038
4057
  }
4039
4058
  }
4040
4059
  return value;
@@ -5821,6 +5840,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5821
5840
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5822
5841
  return ref();
5823
5842
  }
5843
+ const camelizedName = camelize(name);
5824
5844
  const res = customRef((track, trigger) => {
5825
5845
  let localValue;
5826
5846
  watchSyncEffect(() => {
@@ -5837,7 +5857,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
5837
5857
  },
5838
5858
  set(value) {
5839
5859
  const rawProps = i.vnode.props;
5840
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5860
+ if (!(rawProps && // check if parent has passed v-model
5861
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5841
5862
  localValue = value;
5842
5863
  trigger();
5843
5864
  }
@@ -5851,7 +5872,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5851
5872
  return {
5852
5873
  next() {
5853
5874
  if (i2 < 2) {
5854
- return { value: i2++ ? props[modifierKey] : res, done: false };
5875
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5855
5876
  } else {
5856
5877
  return { done: true };
5857
5878
  }
@@ -6431,7 +6452,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6431
6452
  return vm;
6432
6453
  }
6433
6454
  }
6434
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6455
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6435
6456
  Vue.config = singletonApp.config;
6436
6457
  Vue.use = (p, ...options) => {
6437
6458
  if (p && isFunction(p.install)) {
@@ -10933,19 +10954,6 @@ function h(type, propsOrChildren, children) {
10933
10954
  }
10934
10955
  }
10935
10956
 
10936
- const ssrContextKey = Symbol.for("v-scx");
10937
- const useSSRContext = () => {
10938
- {
10939
- const ctx = inject(ssrContextKey);
10940
- if (!ctx) {
10941
- warn$1(
10942
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
10943
- );
10944
- }
10945
- return ctx;
10946
- }
10947
- };
10948
-
10949
10957
  function initCustomFormatter() {
10950
10958
  if (typeof window === "undefined") {
10951
10959
  return;
@@ -11147,7 +11155,7 @@ function isMemoSame(cached, memo) {
11147
11155
  return true;
11148
11156
  }
11149
11157
 
11150
- const version = "3.4.0";
11158
+ const version = "3.4.2";
11151
11159
  const warn = warn$1 ;
11152
11160
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11153
11161
  const devtools = devtools$1 ;