@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.
@@ -3794,6 +3794,19 @@ function mapCompatDirectiveHook(name, dir, instance) {
3794
3794
  }
3795
3795
  }
3796
3796
 
3797
+ const ssrContextKey = Symbol.for("v-scx");
3798
+ const useSSRContext = () => {
3799
+ {
3800
+ const ctx = inject(ssrContextKey);
3801
+ if (!ctx) {
3802
+ !!(process.env.NODE_ENV !== "production") && warn$1(
3803
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
3804
+ );
3805
+ }
3806
+ return ctx;
3807
+ }
3808
+ };
3809
+
3797
3810
  function watchEffect(effect, options) {
3798
3811
  return doWatch(effect, null, options);
3799
3812
  }
@@ -3868,8 +3881,8 @@ function doWatch(source, cb, {
3868
3881
  getter = () => source.value;
3869
3882
  forceTrigger = isShallow(source);
3870
3883
  } else if (isReactive(source)) {
3871
- getter = () => source;
3872
- deep = true;
3884
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3885
+ forceTrigger = true;
3873
3886
  } else if (isArray(source)) {
3874
3887
  isMultiSource = true;
3875
3888
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3877,7 +3890,7 @@ function doWatch(source, cb, {
3877
3890
  if (isRef(s)) {
3878
3891
  return s.value;
3879
3892
  } else if (isReactive(s)) {
3880
- return traverse(s);
3893
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3881
3894
  } else if (isFunction(s)) {
3882
3895
  return callWithErrorHandling(s, instance, 2);
3883
3896
  } else {
@@ -4041,28 +4054,34 @@ function createPathGetter(ctx, path) {
4041
4054
  return cur;
4042
4055
  };
4043
4056
  }
4044
- function traverse(value, seen) {
4057
+ function traverse(value, depth, currentDepth = 0, seen) {
4045
4058
  if (!isObject(value) || value["__v_skip"]) {
4046
4059
  return value;
4047
4060
  }
4061
+ if (depth && depth > 0) {
4062
+ if (currentDepth >= depth) {
4063
+ return value;
4064
+ }
4065
+ currentDepth++;
4066
+ }
4048
4067
  seen = seen || /* @__PURE__ */ new Set();
4049
4068
  if (seen.has(value)) {
4050
4069
  return value;
4051
4070
  }
4052
4071
  seen.add(value);
4053
4072
  if (isRef(value)) {
4054
- traverse(value.value, seen);
4073
+ traverse(value.value, depth, currentDepth, seen);
4055
4074
  } else if (isArray(value)) {
4056
4075
  for (let i = 0; i < value.length; i++) {
4057
- traverse(value[i], seen);
4076
+ traverse(value[i], depth, currentDepth, seen);
4058
4077
  }
4059
4078
  } else if (isSet(value) || isMap(value)) {
4060
4079
  value.forEach((v) => {
4061
- traverse(v, seen);
4080
+ traverse(v, depth, currentDepth, seen);
4062
4081
  });
4063
4082
  } else if (isPlainObject(value)) {
4064
4083
  for (const key in value) {
4065
- traverse(value[key], seen);
4084
+ traverse(value[key], depth, currentDepth, seen);
4066
4085
  }
4067
4086
  }
4068
4087
  return value;
@@ -5857,6 +5876,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5857
5876
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5858
5877
  return ref();
5859
5878
  }
5879
+ const camelizedName = camelize(name);
5860
5880
  const res = customRef((track, trigger) => {
5861
5881
  let localValue;
5862
5882
  watchSyncEffect(() => {
@@ -5873,7 +5893,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
5873
5893
  },
5874
5894
  set(value) {
5875
5895
  const rawProps = i.vnode.props;
5876
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5896
+ if (!(rawProps && // check if parent has passed v-model
5897
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5877
5898
  localValue = value;
5878
5899
  trigger();
5879
5900
  }
@@ -5887,7 +5908,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5887
5908
  return {
5888
5909
  next() {
5889
5910
  if (i2 < 2) {
5890
- return { value: i2++ ? props[modifierKey] : res, done: false };
5911
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5891
5912
  } else {
5892
5913
  return { done: true };
5893
5914
  }
@@ -6469,7 +6490,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6469
6490
  return vm;
6470
6491
  }
6471
6492
  }
6472
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6493
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6473
6494
  Vue.config = singletonApp.config;
6474
6495
  Vue.use = (p, ...options) => {
6475
6496
  if (p && isFunction(p.install)) {
@@ -11055,19 +11076,6 @@ function h(type, propsOrChildren, children) {
11055
11076
  }
11056
11077
  }
11057
11078
 
11058
- const ssrContextKey = Symbol.for("v-scx");
11059
- const useSSRContext = () => {
11060
- {
11061
- const ctx = inject(ssrContextKey);
11062
- if (!ctx) {
11063
- !!(process.env.NODE_ENV !== "production") && warn$1(
11064
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
11065
- );
11066
- }
11067
- return ctx;
11068
- }
11069
- };
11070
-
11071
11079
  function initCustomFormatter() {
11072
11080
  if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
11073
11081
  return;
@@ -11269,7 +11277,7 @@ function isMemoSame(cached, memo) {
11269
11277
  return true;
11270
11278
  }
11271
11279
 
11272
- const version = "3.4.0";
11280
+ const version = "3.4.2";
11273
11281
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11274
11282
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11275
11283
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -3790,6 +3790,13 @@ If this is a native custom element, make sure to exclude it from component resol
3790
3790
  }
3791
3791
  }
3792
3792
 
3793
+ const ssrContextKey = Symbol.for("v-scx");
3794
+ const useSSRContext = () => {
3795
+ {
3796
+ warn$1(`useSSRContext() is not supported in the global build.`);
3797
+ }
3798
+ };
3799
+
3793
3800
  function watchEffect(effect, options) {
3794
3801
  return doWatch(effect, null, options);
3795
3802
  }
@@ -3864,8 +3871,8 @@ If this is a native custom element, make sure to exclude it from component resol
3864
3871
  getter = () => source.value;
3865
3872
  forceTrigger = isShallow(source);
3866
3873
  } else if (isReactive(source)) {
3867
- getter = () => source;
3868
- deep = true;
3874
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3875
+ forceTrigger = true;
3869
3876
  } else if (isArray(source)) {
3870
3877
  isMultiSource = true;
3871
3878
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3873,7 +3880,7 @@ If this is a native custom element, make sure to exclude it from component resol
3873
3880
  if (isRef(s)) {
3874
3881
  return s.value;
3875
3882
  } else if (isReactive(s)) {
3876
- return traverse(s);
3883
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3877
3884
  } else if (isFunction(s)) {
3878
3885
  return callWithErrorHandling(s, instance, 2);
3879
3886
  } else {
@@ -4016,28 +4023,34 @@ If this is a native custom element, make sure to exclude it from component resol
4016
4023
  return cur;
4017
4024
  };
4018
4025
  }
4019
- function traverse(value, seen) {
4026
+ function traverse(value, depth, currentDepth = 0, seen) {
4020
4027
  if (!isObject(value) || value["__v_skip"]) {
4021
4028
  return value;
4022
4029
  }
4030
+ if (depth && depth > 0) {
4031
+ if (currentDepth >= depth) {
4032
+ return value;
4033
+ }
4034
+ currentDepth++;
4035
+ }
4023
4036
  seen = seen || /* @__PURE__ */ new Set();
4024
4037
  if (seen.has(value)) {
4025
4038
  return value;
4026
4039
  }
4027
4040
  seen.add(value);
4028
4041
  if (isRef(value)) {
4029
- traverse(value.value, seen);
4042
+ traverse(value.value, depth, currentDepth, seen);
4030
4043
  } else if (isArray(value)) {
4031
4044
  for (let i = 0; i < value.length; i++) {
4032
- traverse(value[i], seen);
4045
+ traverse(value[i], depth, currentDepth, seen);
4033
4046
  }
4034
4047
  } else if (isSet(value) || isMap(value)) {
4035
4048
  value.forEach((v) => {
4036
- traverse(v, seen);
4049
+ traverse(v, depth, currentDepth, seen);
4037
4050
  });
4038
4051
  } else if (isPlainObject(value)) {
4039
4052
  for (const key in value) {
4040
- traverse(value[key], seen);
4053
+ traverse(value[key], depth, currentDepth, seen);
4041
4054
  }
4042
4055
  }
4043
4056
  return value;
@@ -5824,6 +5837,7 @@ If this is a native custom element, make sure to exclude it from component resol
5824
5837
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5825
5838
  return ref();
5826
5839
  }
5840
+ const camelizedName = camelize(name);
5827
5841
  const res = customRef((track, trigger) => {
5828
5842
  let localValue;
5829
5843
  watchSyncEffect(() => {
@@ -5840,7 +5854,8 @@ If this is a native custom element, make sure to exclude it from component resol
5840
5854
  },
5841
5855
  set(value) {
5842
5856
  const rawProps = i.vnode.props;
5843
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5857
+ if (!(rawProps && // check if parent has passed v-model
5858
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5844
5859
  localValue = value;
5845
5860
  trigger();
5846
5861
  }
@@ -5854,7 +5869,7 @@ If this is a native custom element, make sure to exclude it from component resol
5854
5869
  return {
5855
5870
  next() {
5856
5871
  if (i2 < 2) {
5857
- return { value: i2++ ? props[modifierKey] : res, done: false };
5872
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5858
5873
  } else {
5859
5874
  return { done: true };
5860
5875
  }
@@ -6434,7 +6449,7 @@ If this is a native custom element, make sure to exclude it from component resol
6434
6449
  return vm;
6435
6450
  }
6436
6451
  }
6437
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6452
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6438
6453
  Vue.config = singletonApp.config;
6439
6454
  Vue.use = (p, ...options) => {
6440
6455
  if (p && isFunction(p.install)) {
@@ -10936,13 +10951,6 @@ Component that was made reactive: `,
10936
10951
  }
10937
10952
  }
10938
10953
 
10939
- const ssrContextKey = Symbol.for("v-scx");
10940
- const useSSRContext = () => {
10941
- {
10942
- warn$1(`useSSRContext() is not supported in the global build.`);
10943
- }
10944
- };
10945
-
10946
10954
  function initCustomFormatter() {
10947
10955
  if (typeof window === "undefined") {
10948
10956
  return;
@@ -11144,7 +11152,7 @@ Component that was made reactive: `,
11144
11152
  return true;
11145
11153
  }
11146
11154
 
11147
- const version = "3.4.0";
11155
+ const version = "3.4.2";
11148
11156
  const warn = warn$1 ;
11149
11157
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11150
11158
  const devtools = devtools$1 ;