@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.
@@ -3859,6 +3859,19 @@ function mapCompatDirectiveHook(name, dir, instance) {
3859
3859
  }
3860
3860
  }
3861
3861
 
3862
+ const ssrContextKey = Symbol.for("v-scx");
3863
+ const useSSRContext = () => {
3864
+ {
3865
+ const ctx = inject(ssrContextKey);
3866
+ if (!ctx) {
3867
+ !!(process.env.NODE_ENV !== "production") && warn$1(
3868
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
3869
+ );
3870
+ }
3871
+ return ctx;
3872
+ }
3873
+ };
3874
+
3862
3875
  function watchEffect(effect, options) {
3863
3876
  return doWatch(effect, null, options);
3864
3877
  }
@@ -3933,8 +3946,8 @@ function doWatch(source, cb, {
3933
3946
  getter = () => source.value;
3934
3947
  forceTrigger = isShallow(source);
3935
3948
  } else if (isReactive(source)) {
3936
- getter = () => source;
3937
- deep = true;
3949
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3950
+ forceTrigger = true;
3938
3951
  } else if (isArray(source)) {
3939
3952
  isMultiSource = true;
3940
3953
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3942,7 +3955,7 @@ function doWatch(source, cb, {
3942
3955
  if (isRef(s)) {
3943
3956
  return s.value;
3944
3957
  } else if (isReactive(s)) {
3945
- return traverse(s);
3958
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3946
3959
  } else if (isFunction(s)) {
3947
3960
  return callWithErrorHandling(s, instance, 2);
3948
3961
  } else {
@@ -4106,28 +4119,34 @@ function createPathGetter(ctx, path) {
4106
4119
  return cur;
4107
4120
  };
4108
4121
  }
4109
- function traverse(value, seen) {
4122
+ function traverse(value, depth, currentDepth = 0, seen) {
4110
4123
  if (!isObject(value) || value["__v_skip"]) {
4111
4124
  return value;
4112
4125
  }
4126
+ if (depth && depth > 0) {
4127
+ if (currentDepth >= depth) {
4128
+ return value;
4129
+ }
4130
+ currentDepth++;
4131
+ }
4113
4132
  seen = seen || /* @__PURE__ */ new Set();
4114
4133
  if (seen.has(value)) {
4115
4134
  return value;
4116
4135
  }
4117
4136
  seen.add(value);
4118
4137
  if (isRef(value)) {
4119
- traverse(value.value, seen);
4138
+ traverse(value.value, depth, currentDepth, seen);
4120
4139
  } else if (isArray(value)) {
4121
4140
  for (let i = 0; i < value.length; i++) {
4122
- traverse(value[i], seen);
4141
+ traverse(value[i], depth, currentDepth, seen);
4123
4142
  }
4124
4143
  } else if (isSet(value) || isMap(value)) {
4125
4144
  value.forEach((v) => {
4126
- traverse(v, seen);
4145
+ traverse(v, depth, currentDepth, seen);
4127
4146
  });
4128
4147
  } else if (isPlainObject(value)) {
4129
4148
  for (const key in value) {
4130
- traverse(value[key], seen);
4149
+ traverse(value[key], depth, currentDepth, seen);
4131
4150
  }
4132
4151
  }
4133
4152
  return value;
@@ -5922,6 +5941,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5922
5941
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5923
5942
  return ref();
5924
5943
  }
5944
+ const camelizedName = camelize(name);
5925
5945
  const res = customRef((track, trigger) => {
5926
5946
  let localValue;
5927
5947
  watchSyncEffect(() => {
@@ -5938,7 +5958,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
5938
5958
  },
5939
5959
  set(value) {
5940
5960
  const rawProps = i.vnode.props;
5941
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5961
+ if (!(rawProps && // check if parent has passed v-model
5962
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5942
5963
  localValue = value;
5943
5964
  trigger();
5944
5965
  }
@@ -5952,7 +5973,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5952
5973
  return {
5953
5974
  next() {
5954
5975
  if (i2 < 2) {
5955
- return { value: i2++ ? props[modifierKey] : res, done: false };
5976
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5956
5977
  } else {
5957
5978
  return { done: true };
5958
5979
  }
@@ -6534,7 +6555,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6534
6555
  return vm;
6535
6556
  }
6536
6557
  }
6537
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6558
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6538
6559
  Vue.config = singletonApp.config;
6539
6560
  Vue.use = (p, ...options) => {
6540
6561
  if (p && isFunction(p.install)) {
@@ -11120,19 +11141,6 @@ function h(type, propsOrChildren, children) {
11120
11141
  }
11121
11142
  }
11122
11143
 
11123
- const ssrContextKey = Symbol.for("v-scx");
11124
- const useSSRContext = () => {
11125
- {
11126
- const ctx = inject(ssrContextKey);
11127
- if (!ctx) {
11128
- !!(process.env.NODE_ENV !== "production") && warn$1(
11129
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
11130
- );
11131
- }
11132
- return ctx;
11133
- }
11134
- };
11135
-
11136
11144
  function initCustomFormatter() {
11137
11145
  if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
11138
11146
  return;
@@ -11334,7 +11342,7 @@ function isMemoSame(cached, memo) {
11334
11342
  return true;
11335
11343
  }
11336
11344
 
11337
- const version = "3.4.0";
11345
+ const version = "3.4.2";
11338
11346
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11339
11347
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11340
11348
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -14308,7 +14316,7 @@ const deprecationData = {
14308
14316
  message: `"inline-template" has been removed in Vue 3.`,
14309
14317
  link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
14310
14318
  },
14311
- ["COMPILER_FILTER"]: {
14319
+ ["COMPILER_FILTERS"]: {
14312
14320
  message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
14313
14321
  link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
14314
14322
  }
@@ -18176,7 +18184,7 @@ function createTransformProps(props = []) {
18176
18184
 
18177
18185
  const validDivisionCharRE = /[\w).+\-_$\]]/;
18178
18186
  const transformFilter = (node, context) => {
18179
- if (!isCompatEnabled("COMPILER_FILTER", context)) {
18187
+ if (!isCompatEnabled("COMPILER_FILTERS", context)) {
18180
18188
  return;
18181
18189
  }
18182
18190
  if (node.type === 5) {
@@ -18297,7 +18305,7 @@ function parseFilter(node, context) {
18297
18305
  }
18298
18306
  if (filters.length) {
18299
18307
  !!(process.env.NODE_ENV !== "production") && warnDeprecation(
18300
- "COMPILER_FILTER",
18308
+ "COMPILER_FILTERS",
18301
18309
  context,
18302
18310
  node.loc
18303
18311
  );
@@ -3855,6 +3855,13 @@ If this is a native custom element, make sure to exclude it from component resol
3855
3855
  }
3856
3856
  }
3857
3857
 
3858
+ const ssrContextKey = Symbol.for("v-scx");
3859
+ const useSSRContext = () => {
3860
+ {
3861
+ warn$1(`useSSRContext() is not supported in the global build.`);
3862
+ }
3863
+ };
3864
+
3858
3865
  function watchEffect(effect, options) {
3859
3866
  return doWatch(effect, null, options);
3860
3867
  }
@@ -3929,8 +3936,8 @@ If this is a native custom element, make sure to exclude it from component resol
3929
3936
  getter = () => source.value;
3930
3937
  forceTrigger = isShallow(source);
3931
3938
  } else if (isReactive(source)) {
3932
- getter = () => source;
3933
- deep = true;
3939
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3940
+ forceTrigger = true;
3934
3941
  } else if (isArray(source)) {
3935
3942
  isMultiSource = true;
3936
3943
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3938,7 +3945,7 @@ If this is a native custom element, make sure to exclude it from component resol
3938
3945
  if (isRef(s)) {
3939
3946
  return s.value;
3940
3947
  } else if (isReactive(s)) {
3941
- return traverse(s);
3948
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3942
3949
  } else if (isFunction(s)) {
3943
3950
  return callWithErrorHandling(s, instance, 2);
3944
3951
  } else {
@@ -4081,28 +4088,34 @@ If this is a native custom element, make sure to exclude it from component resol
4081
4088
  return cur;
4082
4089
  };
4083
4090
  }
4084
- function traverse(value, seen) {
4091
+ function traverse(value, depth, currentDepth = 0, seen) {
4085
4092
  if (!isObject(value) || value["__v_skip"]) {
4086
4093
  return value;
4087
4094
  }
4095
+ if (depth && depth > 0) {
4096
+ if (currentDepth >= depth) {
4097
+ return value;
4098
+ }
4099
+ currentDepth++;
4100
+ }
4088
4101
  seen = seen || /* @__PURE__ */ new Set();
4089
4102
  if (seen.has(value)) {
4090
4103
  return value;
4091
4104
  }
4092
4105
  seen.add(value);
4093
4106
  if (isRef(value)) {
4094
- traverse(value.value, seen);
4107
+ traverse(value.value, depth, currentDepth, seen);
4095
4108
  } else if (isArray(value)) {
4096
4109
  for (let i = 0; i < value.length; i++) {
4097
- traverse(value[i], seen);
4110
+ traverse(value[i], depth, currentDepth, seen);
4098
4111
  }
4099
4112
  } else if (isSet(value) || isMap(value)) {
4100
4113
  value.forEach((v) => {
4101
- traverse(v, seen);
4114
+ traverse(v, depth, currentDepth, seen);
4102
4115
  });
4103
4116
  } else if (isPlainObject(value)) {
4104
4117
  for (const key in value) {
4105
- traverse(value[key], seen);
4118
+ traverse(value[key], depth, currentDepth, seen);
4106
4119
  }
4107
4120
  }
4108
4121
  return value;
@@ -5889,6 +5902,7 @@ If this is a native custom element, make sure to exclude it from component resol
5889
5902
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5890
5903
  return ref();
5891
5904
  }
5905
+ const camelizedName = camelize(name);
5892
5906
  const res = customRef((track, trigger) => {
5893
5907
  let localValue;
5894
5908
  watchSyncEffect(() => {
@@ -5905,7 +5919,8 @@ If this is a native custom element, make sure to exclude it from component resol
5905
5919
  },
5906
5920
  set(value) {
5907
5921
  const rawProps = i.vnode.props;
5908
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5922
+ if (!(rawProps && // check if parent has passed v-model
5923
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5909
5924
  localValue = value;
5910
5925
  trigger();
5911
5926
  }
@@ -5919,7 +5934,7 @@ If this is a native custom element, make sure to exclude it from component resol
5919
5934
  return {
5920
5935
  next() {
5921
5936
  if (i2 < 2) {
5922
- return { value: i2++ ? props[modifierKey] : res, done: false };
5937
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5923
5938
  } else {
5924
5939
  return { done: true };
5925
5940
  }
@@ -6499,7 +6514,7 @@ If this is a native custom element, make sure to exclude it from component resol
6499
6514
  return vm;
6500
6515
  }
6501
6516
  }
6502
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6517
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6503
6518
  Vue.config = singletonApp.config;
6504
6519
  Vue.use = (p, ...options) => {
6505
6520
  if (p && isFunction(p.install)) {
@@ -11001,13 +11016,6 @@ Component that was made reactive: `,
11001
11016
  }
11002
11017
  }
11003
11018
 
11004
- const ssrContextKey = Symbol.for("v-scx");
11005
- const useSSRContext = () => {
11006
- {
11007
- warn$1(`useSSRContext() is not supported in the global build.`);
11008
- }
11009
- };
11010
-
11011
11019
  function initCustomFormatter() {
11012
11020
  if (typeof window === "undefined") {
11013
11021
  return;
@@ -11209,7 +11217,7 @@ Component that was made reactive: `,
11209
11217
  return true;
11210
11218
  }
11211
11219
 
11212
- const version = "3.4.0";
11220
+ const version = "3.4.2";
11213
11221
  const warn = warn$1 ;
11214
11222
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11215
11223
  const devtools = devtools$1 ;
@@ -14121,7 +14129,7 @@ Make sure to use the production build (*.prod.js) when deploying for production.
14121
14129
  message: `"inline-template" has been removed in Vue 3.`,
14122
14130
  link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
14123
14131
  },
14124
- ["COMPILER_FILTER"]: {
14132
+ ["COMPILER_FILTERS"]: {
14125
14133
  message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
14126
14134
  link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
14127
14135
  }
@@ -17986,7 +17994,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17986
17994
 
17987
17995
  const validDivisionCharRE = /[\w).+\-_$\]]/;
17988
17996
  const transformFilter = (node, context) => {
17989
- if (!isCompatEnabled("COMPILER_FILTER", context)) {
17997
+ if (!isCompatEnabled("COMPILER_FILTERS", context)) {
17990
17998
  return;
17991
17999
  }
17992
18000
  if (node.type === 5) {
@@ -18107,7 +18115,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18107
18115
  }
18108
18116
  if (filters.length) {
18109
18117
  warnDeprecation(
18110
- "COMPILER_FILTER",
18118
+ "COMPILER_FILTERS",
18111
18119
  context,
18112
18120
  node.loc
18113
18121
  );