@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.
package/dist/vue.cjs.js CHANGED
@@ -3903,6 +3903,19 @@ function mapCompatDirectiveHook(name, dir, instance) {
3903
3903
  }
3904
3904
  }
3905
3905
 
3906
+ const ssrContextKey = Symbol.for("v-scx");
3907
+ const useSSRContext = () => {
3908
+ {
3909
+ const ctx = inject(ssrContextKey);
3910
+ if (!ctx) {
3911
+ warn$1(
3912
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
3913
+ );
3914
+ }
3915
+ return ctx;
3916
+ }
3917
+ };
3918
+
3906
3919
  function watchEffect(effect, options) {
3907
3920
  return doWatch(effect, null, options);
3908
3921
  }
@@ -3977,8 +3990,8 @@ function doWatch(source, cb, {
3977
3990
  getter = () => source.value;
3978
3991
  forceTrigger = isShallow(source);
3979
3992
  } else if (isReactive(source)) {
3980
- getter = () => source;
3981
- deep = true;
3993
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3994
+ forceTrigger = true;
3982
3995
  } else if (isArray(source)) {
3983
3996
  isMultiSource = true;
3984
3997
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3986,7 +3999,7 @@ function doWatch(source, cb, {
3986
3999
  if (isRef(s)) {
3987
4000
  return s.value;
3988
4001
  } else if (isReactive(s)) {
3989
- return traverse(s);
4002
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3990
4003
  } else if (isFunction(s)) {
3991
4004
  return callWithErrorHandling(s, instance, 2);
3992
4005
  } else {
@@ -4150,28 +4163,34 @@ function createPathGetter(ctx, path) {
4150
4163
  return cur;
4151
4164
  };
4152
4165
  }
4153
- function traverse(value, seen) {
4166
+ function traverse(value, depth, currentDepth = 0, seen) {
4154
4167
  if (!isObject(value) || value["__v_skip"]) {
4155
4168
  return value;
4156
4169
  }
4170
+ if (depth && depth > 0) {
4171
+ if (currentDepth >= depth) {
4172
+ return value;
4173
+ }
4174
+ currentDepth++;
4175
+ }
4157
4176
  seen = seen || /* @__PURE__ */ new Set();
4158
4177
  if (seen.has(value)) {
4159
4178
  return value;
4160
4179
  }
4161
4180
  seen.add(value);
4162
4181
  if (isRef(value)) {
4163
- traverse(value.value, seen);
4182
+ traverse(value.value, depth, currentDepth, seen);
4164
4183
  } else if (isArray(value)) {
4165
4184
  for (let i = 0; i < value.length; i++) {
4166
- traverse(value[i], seen);
4185
+ traverse(value[i], depth, currentDepth, seen);
4167
4186
  }
4168
4187
  } else if (isSet(value) || isMap(value)) {
4169
4188
  value.forEach((v) => {
4170
- traverse(v, seen);
4189
+ traverse(v, depth, currentDepth, seen);
4171
4190
  });
4172
4191
  } else if (isPlainObject(value)) {
4173
4192
  for (const key in value) {
4174
- traverse(value[key], seen);
4193
+ traverse(value[key], depth, currentDepth, seen);
4175
4194
  }
4176
4195
  }
4177
4196
  return value;
@@ -5964,6 +5983,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5964
5983
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5965
5984
  return ref();
5966
5985
  }
5986
+ const camelizedName = camelize(name);
5967
5987
  const res = customRef((track, trigger) => {
5968
5988
  let localValue;
5969
5989
  watchSyncEffect(() => {
@@ -5980,7 +6000,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
5980
6000
  },
5981
6001
  set(value) {
5982
6002
  const rawProps = i.vnode.props;
5983
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
6003
+ if (!(rawProps && // check if parent has passed v-model
6004
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5984
6005
  localValue = value;
5985
6006
  trigger();
5986
6007
  }
@@ -5994,7 +6015,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5994
6015
  return {
5995
6016
  next() {
5996
6017
  if (i2 < 2) {
5997
- return { value: i2++ ? props[modifierKey] : res, done: false };
6018
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5998
6019
  } else {
5999
6020
  return { done: true };
6000
6021
  }
@@ -6574,7 +6595,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6574
6595
  return vm;
6575
6596
  }
6576
6597
  }
6577
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6598
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6578
6599
  Vue.config = singletonApp.config;
6579
6600
  Vue.use = (p, ...options) => {
6580
6601
  if (p && isFunction(p.install)) {
@@ -11093,19 +11114,6 @@ function h(type, propsOrChildren, children) {
11093
11114
  }
11094
11115
  }
11095
11116
 
11096
- const ssrContextKey = Symbol.for("v-scx");
11097
- const useSSRContext = () => {
11098
- {
11099
- const ctx = inject(ssrContextKey);
11100
- if (!ctx) {
11101
- warn$1(
11102
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
11103
- );
11104
- }
11105
- return ctx;
11106
- }
11107
- };
11108
-
11109
11117
  function initCustomFormatter() {
11110
11118
  if (typeof window === "undefined") {
11111
11119
  return;
@@ -11307,7 +11315,7 @@ function isMemoSame(cached, memo) {
11307
11315
  return true;
11308
11316
  }
11309
11317
 
11310
- const version = "3.4.0";
11318
+ const version = "3.4.2";
11311
11319
  const warn = warn$1 ;
11312
11320
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11313
11321
  const devtools = devtools$1 ;
@@ -14276,7 +14284,7 @@ const deprecationData = {
14276
14284
  message: `"inline-template" has been removed in Vue 3.`,
14277
14285
  link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
14278
14286
  },
14279
- ["COMPILER_FILTER"]: {
14287
+ ["COMPILER_FILTERS"]: {
14280
14288
  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.`,
14281
14289
  link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
14282
14290
  }
@@ -19020,7 +19028,7 @@ function createTransformProps(props = []) {
19020
19028
 
19021
19029
  const validDivisionCharRE = /[\w).+\-_$\]]/;
19022
19030
  const transformFilter = (node, context) => {
19023
- if (!isCompatEnabled("COMPILER_FILTER", context)) {
19031
+ if (!isCompatEnabled("COMPILER_FILTERS", context)) {
19024
19032
  return;
19025
19033
  }
19026
19034
  if (node.type === 5) {
@@ -19141,7 +19149,7 @@ function parseFilter(node, context) {
19141
19149
  }
19142
19150
  if (filters.length) {
19143
19151
  warnDeprecation(
19144
- "COMPILER_FILTER",
19152
+ "COMPILER_FILTERS",
19145
19153
  context,
19146
19154
  node.loc
19147
19155
  );
@@ -2935,6 +2935,14 @@ function mapCompatDirectiveHook(name, dir, instance) {
2935
2935
  }
2936
2936
  }
2937
2937
 
2938
+ const ssrContextKey = Symbol.for("v-scx");
2939
+ const useSSRContext = () => {
2940
+ {
2941
+ const ctx = inject(ssrContextKey);
2942
+ return ctx;
2943
+ }
2944
+ };
2945
+
2938
2946
  function watchEffect(effect, options) {
2939
2947
  return doWatch(effect, null, options);
2940
2948
  }
@@ -2980,8 +2988,8 @@ function doWatch(source, cb, {
2980
2988
  getter = () => source.value;
2981
2989
  forceTrigger = isShallow(source);
2982
2990
  } else if (isReactive(source)) {
2983
- getter = () => source;
2984
- deep = true;
2991
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
2992
+ forceTrigger = true;
2985
2993
  } else if (isArray(source)) {
2986
2994
  isMultiSource = true;
2987
2995
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -2989,7 +2997,7 @@ function doWatch(source, cb, {
2989
2997
  if (isRef(s)) {
2990
2998
  return s.value;
2991
2999
  } else if (isReactive(s)) {
2992
- return traverse(s);
3000
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
2993
3001
  } else if (isFunction(s)) {
2994
3002
  return callWithErrorHandling(s, instance, 2);
2995
3003
  } else ;
@@ -3146,28 +3154,34 @@ function createPathGetter(ctx, path) {
3146
3154
  return cur;
3147
3155
  };
3148
3156
  }
3149
- function traverse(value, seen) {
3157
+ function traverse(value, depth, currentDepth = 0, seen) {
3150
3158
  if (!isObject(value) || value["__v_skip"]) {
3151
3159
  return value;
3152
3160
  }
3161
+ if (depth && depth > 0) {
3162
+ if (currentDepth >= depth) {
3163
+ return value;
3164
+ }
3165
+ currentDepth++;
3166
+ }
3153
3167
  seen = seen || /* @__PURE__ */ new Set();
3154
3168
  if (seen.has(value)) {
3155
3169
  return value;
3156
3170
  }
3157
3171
  seen.add(value);
3158
3172
  if (isRef(value)) {
3159
- traverse(value.value, seen);
3173
+ traverse(value.value, depth, currentDepth, seen);
3160
3174
  } else if (isArray(value)) {
3161
3175
  for (let i = 0; i < value.length; i++) {
3162
- traverse(value[i], seen);
3176
+ traverse(value[i], depth, currentDepth, seen);
3163
3177
  }
3164
3178
  } else if (isSet(value) || isMap(value)) {
3165
3179
  value.forEach((v) => {
3166
- traverse(v, seen);
3180
+ traverse(v, depth, currentDepth, seen);
3167
3181
  });
3168
3182
  } else if (isPlainObject(value)) {
3169
3183
  for (const key in value) {
3170
- traverse(value[key], seen);
3184
+ traverse(value[key], depth, currentDepth, seen);
3171
3185
  }
3172
3186
  }
3173
3187
  return value;
@@ -4768,6 +4782,7 @@ function useAttrs() {
4768
4782
  }
4769
4783
  function useModel(props, name, options = EMPTY_OBJ) {
4770
4784
  const i = getCurrentInstance();
4785
+ const camelizedName = camelize(name);
4771
4786
  const res = customRef((track, trigger) => {
4772
4787
  let localValue;
4773
4788
  watchSyncEffect(() => {
@@ -4784,7 +4799,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
4784
4799
  },
4785
4800
  set(value) {
4786
4801
  const rawProps = i.vnode.props;
4787
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
4802
+ if (!(rawProps && // check if parent has passed v-model
4803
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
4788
4804
  localValue = value;
4789
4805
  trigger();
4790
4806
  }
@@ -4798,7 +4814,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
4798
4814
  return {
4799
4815
  next() {
4800
4816
  if (i2 < 2) {
4801
- return { value: i2++ ? props[modifierKey] : res, done: false };
4817
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
4802
4818
  } else {
4803
4819
  return { done: true };
4804
4820
  }
@@ -5265,7 +5281,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5265
5281
  return vm;
5266
5282
  }
5267
5283
  }
5268
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
5284
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
5269
5285
  Vue.config = singletonApp.config;
5270
5286
  Vue.use = (p, ...options) => {
5271
5287
  if (p && isFunction(p.install)) {
@@ -9034,14 +9050,6 @@ function h(type, propsOrChildren, children) {
9034
9050
  }
9035
9051
  }
9036
9052
 
9037
- const ssrContextKey = Symbol.for("v-scx");
9038
- const useSSRContext = () => {
9039
- {
9040
- const ctx = inject(ssrContextKey);
9041
- return ctx;
9042
- }
9043
- };
9044
-
9045
9053
  function initCustomFormatter() {
9046
9054
  {
9047
9055
  return;
@@ -9073,7 +9081,7 @@ function isMemoSame(cached, memo) {
9073
9081
  return true;
9074
9082
  }
9075
9083
 
9076
- const version = "3.4.0";
9084
+ const version = "3.4.2";
9077
9085
  const warn$1 = NOOP;
9078
9086
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9079
9087
  const devtools = void 0;
@@ -16493,7 +16501,7 @@ function createTransformProps(props = []) {
16493
16501
 
16494
16502
  const validDivisionCharRE = /[\w).+\-_$\]]/;
16495
16503
  const transformFilter = (node, context) => {
16496
- if (!isCompatEnabled("COMPILER_FILTER", context)) {
16504
+ if (!isCompatEnabled("COMPILER_FILTERS", context)) {
16497
16505
  return;
16498
16506
  }
16499
16507
  if (node.type === 5) {
@@ -3852,6 +3852,19 @@ function mapCompatDirectiveHook(name, dir, instance) {
3852
3852
  }
3853
3853
  }
3854
3854
 
3855
+ const ssrContextKey = Symbol.for("v-scx");
3856
+ const useSSRContext = () => {
3857
+ {
3858
+ const ctx = inject(ssrContextKey);
3859
+ if (!ctx) {
3860
+ warn$1(
3861
+ `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
3862
+ );
3863
+ }
3864
+ return ctx;
3865
+ }
3866
+ };
3867
+
3855
3868
  function watchEffect(effect, options) {
3856
3869
  return doWatch(effect, null, options);
3857
3870
  }
@@ -3926,8 +3939,8 @@ function doWatch(source, cb, {
3926
3939
  getter = () => source.value;
3927
3940
  forceTrigger = isShallow(source);
3928
3941
  } else if (isReactive(source)) {
3929
- getter = () => source;
3930
- deep = true;
3942
+ getter = isShallow(source) || deep === false ? () => traverse(source, 1) : () => traverse(source);
3943
+ forceTrigger = true;
3931
3944
  } else if (isArray(source)) {
3932
3945
  isMultiSource = true;
3933
3946
  forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
@@ -3935,7 +3948,7 @@ function doWatch(source, cb, {
3935
3948
  if (isRef(s)) {
3936
3949
  return s.value;
3937
3950
  } else if (isReactive(s)) {
3938
- return traverse(s);
3951
+ return traverse(s, isShallow(s) || deep === false ? 1 : void 0);
3939
3952
  } else if (isFunction(s)) {
3940
3953
  return callWithErrorHandling(s, instance, 2);
3941
3954
  } else {
@@ -4078,28 +4091,34 @@ function createPathGetter(ctx, path) {
4078
4091
  return cur;
4079
4092
  };
4080
4093
  }
4081
- function traverse(value, seen) {
4094
+ function traverse(value, depth, currentDepth = 0, seen) {
4082
4095
  if (!isObject(value) || value["__v_skip"]) {
4083
4096
  return value;
4084
4097
  }
4098
+ if (depth && depth > 0) {
4099
+ if (currentDepth >= depth) {
4100
+ return value;
4101
+ }
4102
+ currentDepth++;
4103
+ }
4085
4104
  seen = seen || /* @__PURE__ */ new Set();
4086
4105
  if (seen.has(value)) {
4087
4106
  return value;
4088
4107
  }
4089
4108
  seen.add(value);
4090
4109
  if (isRef(value)) {
4091
- traverse(value.value, seen);
4110
+ traverse(value.value, depth, currentDepth, seen);
4092
4111
  } else if (isArray(value)) {
4093
4112
  for (let i = 0; i < value.length; i++) {
4094
- traverse(value[i], seen);
4113
+ traverse(value[i], depth, currentDepth, seen);
4095
4114
  }
4096
4115
  } else if (isSet(value) || isMap(value)) {
4097
4116
  value.forEach((v) => {
4098
- traverse(v, seen);
4117
+ traverse(v, depth, currentDepth, seen);
4099
4118
  });
4100
4119
  } else if (isPlainObject(value)) {
4101
4120
  for (const key in value) {
4102
- traverse(value[key], seen);
4121
+ traverse(value[key], depth, currentDepth, seen);
4103
4122
  }
4104
4123
  }
4105
4124
  return value;
@@ -5886,6 +5905,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5886
5905
  warn$1(`useModel() called with prop "${name}" which is not declared.`);
5887
5906
  return ref();
5888
5907
  }
5908
+ const camelizedName = camelize(name);
5889
5909
  const res = customRef((track, trigger) => {
5890
5910
  let localValue;
5891
5911
  watchSyncEffect(() => {
@@ -5902,7 +5922,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
5902
5922
  },
5903
5923
  set(value) {
5904
5924
  const rawProps = i.vnode.props;
5905
- if (!(rawProps && name in rawProps) && hasChanged(value, localValue)) {
5925
+ if (!(rawProps && // check if parent has passed v-model
5926
+ (name in rawProps || camelizedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps)) && hasChanged(value, localValue)) {
5906
5927
  localValue = value;
5907
5928
  trigger();
5908
5929
  }
@@ -5916,7 +5937,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
5916
5937
  return {
5917
5938
  next() {
5918
5939
  if (i2 < 2) {
5919
- return { value: i2++ ? props[modifierKey] : res, done: false };
5940
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
5920
5941
  } else {
5921
5942
  return { done: true };
5922
5943
  }
@@ -6496,7 +6517,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6496
6517
  return vm;
6497
6518
  }
6498
6519
  }
6499
- Vue.version = `2.6.14-compat:${"3.4.0"}`;
6520
+ Vue.version = `2.6.14-compat:${"3.4.2"}`;
6500
6521
  Vue.config = singletonApp.config;
6501
6522
  Vue.use = (p, ...options) => {
6502
6523
  if (p && isFunction(p.install)) {
@@ -10998,19 +11019,6 @@ function h(type, propsOrChildren, children) {
10998
11019
  }
10999
11020
  }
11000
11021
 
11001
- const ssrContextKey = Symbol.for("v-scx");
11002
- const useSSRContext = () => {
11003
- {
11004
- const ctx = inject(ssrContextKey);
11005
- if (!ctx) {
11006
- warn$1(
11007
- `Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`
11008
- );
11009
- }
11010
- return ctx;
11011
- }
11012
- };
11013
-
11014
11022
  function initCustomFormatter() {
11015
11023
  if (typeof window === "undefined") {
11016
11024
  return;
@@ -11212,7 +11220,7 @@ function isMemoSame(cached, memo) {
11212
11220
  return true;
11213
11221
  }
11214
11222
 
11215
- const version = "3.4.0";
11223
+ const version = "3.4.2";
11216
11224
  const warn = warn$1 ;
11217
11225
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11218
11226
  const devtools = devtools$1 ;
@@ -14136,7 +14144,7 @@ const deprecationData = {
14136
14144
  message: `"inline-template" has been removed in Vue 3.`,
14137
14145
  link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
14138
14146
  },
14139
- ["COMPILER_FILTER"]: {
14147
+ ["COMPILER_FILTERS"]: {
14140
14148
  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.`,
14141
14149
  link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
14142
14150
  }
@@ -18001,7 +18009,7 @@ function createTransformProps(props = []) {
18001
18009
 
18002
18010
  const validDivisionCharRE = /[\w).+\-_$\]]/;
18003
18011
  const transformFilter = (node, context) => {
18004
- if (!isCompatEnabled("COMPILER_FILTER", context)) {
18012
+ if (!isCompatEnabled("COMPILER_FILTERS", context)) {
18005
18013
  return;
18006
18014
  }
18007
18015
  if (node.type === 5) {
@@ -18122,7 +18130,7 @@ function parseFilter(node, context) {
18122
18130
  }
18123
18131
  if (filters.length) {
18124
18132
  warnDeprecation(
18125
- "COMPILER_FILTER",
18133
+ "COMPILER_FILTERS",
18126
18134
  context,
18127
18135
  node.loc
18128
18136
  );