@vue/compat 3.4.7 → 3.4.9

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
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @vue/compat v3.4.9
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  'use strict';
2
7
 
3
8
  var parser = require('@babel/parser');
@@ -3210,8 +3215,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3210
3215
  return false;
3211
3216
  }
3212
3217
  function updateHOCHostEl({ vnode, parent }, el) {
3213
- if (!el)
3214
- return;
3215
3218
  while (parent) {
3216
3219
  const root = parent.subTree;
3217
3220
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3307,6 +3310,10 @@ const SuspenseImpl = {
3307
3310
  rendererInternals
3308
3311
  );
3309
3312
  } else {
3313
+ if (parentSuspense && parentSuspense.deps > 0) {
3314
+ n2.suspense = n1.suspense;
3315
+ return;
3316
+ }
3310
3317
  patchSuspense(
3311
3318
  n1,
3312
3319
  n2,
@@ -3856,7 +3863,12 @@ function queueEffectWithSuspense(fn, suspense) {
3856
3863
  function setActiveBranch(suspense, branch) {
3857
3864
  suspense.activeBranch = branch;
3858
3865
  const { vnode, parentComponent } = suspense;
3859
- const el = vnode.el = branch.el;
3866
+ let el = branch.el;
3867
+ while (!el && branch.component) {
3868
+ branch = branch.component.subTree;
3869
+ el = branch.el;
3870
+ }
3871
+ vnode.el = el;
3860
3872
  if (parentComponent && parentComponent.subTree === vnode) {
3861
3873
  parentComponent.vnode.el = el;
3862
3874
  updateHOCHostEl(parentComponent, el);
@@ -5975,58 +5987,6 @@ function useSlots() {
5975
5987
  function useAttrs() {
5976
5988
  return getContext().attrs;
5977
5989
  }
5978
- function useModel(props, name, options = EMPTY_OBJ) {
5979
- const i = getCurrentInstance();
5980
- if (!i) {
5981
- warn$1(`useModel() called without active instance.`);
5982
- return ref();
5983
- }
5984
- if (!i.propsOptions[0][name]) {
5985
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
5986
- return ref();
5987
- }
5988
- const camelizedName = camelize(name);
5989
- const hyphenatedName = hyphenate(name);
5990
- const res = customRef((track, trigger) => {
5991
- let localValue;
5992
- watchSyncEffect(() => {
5993
- const propValue = props[name];
5994
- if (hasChanged(localValue, propValue)) {
5995
- localValue = propValue;
5996
- trigger();
5997
- }
5998
- });
5999
- return {
6000
- get() {
6001
- track();
6002
- return options.get ? options.get(localValue) : localValue;
6003
- },
6004
- set(value) {
6005
- const rawProps = i.vnode.props;
6006
- if (!(rawProps && // check if parent has passed v-model
6007
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
6008
- localValue = value;
6009
- trigger();
6010
- }
6011
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
6012
- }
6013
- };
6014
- });
6015
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
6016
- res[Symbol.iterator] = () => {
6017
- let i2 = 0;
6018
- return {
6019
- next() {
6020
- if (i2 < 2) {
6021
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
6022
- } else {
6023
- return { done: true };
6024
- }
6025
- }
6026
- };
6027
- };
6028
- return res;
6029
- }
6030
5990
  function getContext() {
6031
5991
  const i = getCurrentInstance();
6032
5992
  if (!i) {
@@ -6598,7 +6558,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6598
6558
  return vm;
6599
6559
  }
6600
6560
  }
6601
- Vue.version = `2.6.14-compat:${"3.4.7"}`;
6561
+ Vue.version = `2.6.14-compat:${"3.4.9"}`;
6602
6562
  Vue.config = singletonApp.config;
6603
6563
  Vue.use = (p, ...options) => {
6604
6564
  if (p && isFunction(p.install)) {
@@ -8324,29 +8284,43 @@ function propHasMismatch(el, key, clientValue, vnode) {
8324
8284
  let actual;
8325
8285
  let expected;
8326
8286
  if (key === "class") {
8327
- actual = toClassSet(el.getAttribute("class") || "");
8328
- expected = toClassSet(normalizeClass(clientValue));
8329
- if (!isSetEqual(actual, expected)) {
8287
+ actual = el.getAttribute("class");
8288
+ expected = normalizeClass(clientValue);
8289
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
8330
8290
  mismatchType = mismatchKey = `class`;
8331
8291
  }
8332
8292
  } else if (key === "style") {
8333
- actual = toStyleMap(el.getAttribute("style") || "");
8334
- expected = toStyleMap(
8335
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8336
- );
8293
+ actual = el.getAttribute("style");
8294
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8295
+ const actualMap = toStyleMap(actual);
8296
+ const expectedMap = toStyleMap(expected);
8337
8297
  if (vnode.dirs) {
8338
8298
  for (const { dir, value } of vnode.dirs) {
8339
8299
  if (dir.name === "show" && !value) {
8340
- expected.set("display", "none");
8300
+ expectedMap.set("display", "none");
8341
8301
  }
8342
8302
  }
8343
8303
  }
8344
- if (!isMapEqual(actual, expected)) {
8304
+ if (!isMapEqual(actualMap, expectedMap)) {
8345
8305
  mismatchType = mismatchKey = "style";
8346
8306
  }
8347
8307
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8348
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8349
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8308
+ if (isBooleanAttr(key)) {
8309
+ actual = el.hasAttribute(key);
8310
+ expected = includeBooleanAttr(clientValue);
8311
+ } else {
8312
+ if (el.hasAttribute(key)) {
8313
+ actual = el.getAttribute(key);
8314
+ } else if (key in el) {
8315
+ const serverValue = el[key];
8316
+ if (!isObject(serverValue)) {
8317
+ actual = serverValue == null ? "" : String(serverValue);
8318
+ }
8319
+ }
8320
+ if (!isObject(clientValue)) {
8321
+ expected = clientValue == null ? "" : String(clientValue);
8322
+ }
8323
+ }
8350
8324
  if (actual !== expected) {
8351
8325
  mismatchType = `attribute`;
8352
8326
  mismatchKey = key;
@@ -8354,15 +8328,15 @@ function propHasMismatch(el, key, clientValue, vnode) {
8354
8328
  }
8355
8329
  if (mismatchType) {
8356
8330
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
8357
- warn$1(
8358
- `Hydration ${mismatchType} mismatch on`,
8359
- el,
8360
- `
8331
+ const preSegment = `Hydration ${mismatchType} mismatch on`;
8332
+ const postSegment = `
8361
8333
  - rendered on server: ${format(actual)}
8362
8334
  - expected on client: ${format(expected)}
8363
8335
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
8364
- You should fix the source of the mismatch.`
8365
- );
8336
+ You should fix the source of the mismatch.`;
8337
+ {
8338
+ warn$1(preSegment, el, postSegment);
8339
+ }
8366
8340
  return true;
8367
8341
  }
8368
8342
  return false;
@@ -11142,6 +11116,59 @@ const computed = (getterOrOptions, debugOptions) => {
11142
11116
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11143
11117
  };
11144
11118
 
11119
+ function useModel(props, name, options = EMPTY_OBJ) {
11120
+ const i = getCurrentInstance();
11121
+ if (!i) {
11122
+ warn$1(`useModel() called without active instance.`);
11123
+ return ref();
11124
+ }
11125
+ if (!i.propsOptions[0][name]) {
11126
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
11127
+ return ref();
11128
+ }
11129
+ const camelizedName = camelize(name);
11130
+ const hyphenatedName = hyphenate(name);
11131
+ const res = customRef((track, trigger) => {
11132
+ let localValue;
11133
+ watchSyncEffect(() => {
11134
+ const propValue = props[name];
11135
+ if (hasChanged(localValue, propValue)) {
11136
+ localValue = propValue;
11137
+ trigger();
11138
+ }
11139
+ });
11140
+ return {
11141
+ get() {
11142
+ track();
11143
+ return options.get ? options.get(localValue) : localValue;
11144
+ },
11145
+ set(value) {
11146
+ const rawProps = i.vnode.props;
11147
+ if (!(rawProps && // check if parent has passed v-model
11148
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
11149
+ localValue = value;
11150
+ trigger();
11151
+ }
11152
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
11153
+ }
11154
+ };
11155
+ });
11156
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
11157
+ res[Symbol.iterator] = () => {
11158
+ let i2 = 0;
11159
+ return {
11160
+ next() {
11161
+ if (i2 < 2) {
11162
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
11163
+ } else {
11164
+ return { done: true };
11165
+ }
11166
+ }
11167
+ };
11168
+ };
11169
+ return res;
11170
+ }
11171
+
11145
11172
  function h(type, propsOrChildren, children) {
11146
11173
  const l = arguments.length;
11147
11174
  if (l === 2) {
@@ -11364,7 +11391,7 @@ function isMemoSame(cached, memo) {
11364
11391
  return true;
11365
11392
  }
11366
11393
 
11367
- const version = "3.4.7";
11394
+ const version = "3.4.9";
11368
11395
  const warn = warn$1 ;
11369
11396
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11370
11397
  const devtools = devtools$1 ;
@@ -11834,6 +11861,7 @@ function useCssVars(getter) {
11834
11861
 
11835
11862
  function patchStyle(el, prev, next) {
11836
11863
  const style = el.style;
11864
+ const currentDisplay = style.display;
11837
11865
  const isCssString = isString(next);
11838
11866
  if (next && !isCssString) {
11839
11867
  if (prev && !isString(prev)) {
@@ -11847,7 +11875,6 @@ function patchStyle(el, prev, next) {
11847
11875
  setStyle(style, key, next[key]);
11848
11876
  }
11849
11877
  } else {
11850
- const currentDisplay = style.display;
11851
11878
  if (isCssString) {
11852
11879
  if (prev !== next) {
11853
11880
  const cssVarText = style[CSS_VAR_TEXT];
@@ -11859,9 +11886,9 @@ function patchStyle(el, prev, next) {
11859
11886
  } else if (prev) {
11860
11887
  el.removeAttribute("style");
11861
11888
  }
11862
- if (vShowOldKey in el) {
11863
- style.display = currentDisplay;
11864
- }
11889
+ }
11890
+ if (vShowOldKey in el) {
11891
+ style.display = currentDisplay;
11865
11892
  }
11866
11893
  }
11867
11894
  const semicolonRE = /[^\\];\s*$/;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @vue/compat v3.4.9
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  'use strict';
2
7
 
3
8
  var parser = require('@babel/parser');
@@ -2282,8 +2287,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2282
2287
  return false;
2283
2288
  }
2284
2289
  function updateHOCHostEl({ vnode, parent }, el) {
2285
- if (!el)
2286
- return;
2287
2290
  while (parent) {
2288
2291
  const root = parent.subTree;
2289
2292
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -2370,6 +2373,10 @@ const SuspenseImpl = {
2370
2373
  rendererInternals
2371
2374
  );
2372
2375
  } else {
2376
+ if (parentSuspense && parentSuspense.deps > 0) {
2377
+ n2.suspense = n1.suspense;
2378
+ return;
2379
+ }
2373
2380
  patchSuspense(
2374
2381
  n1,
2375
2382
  n2,
@@ -2888,7 +2895,12 @@ function queueEffectWithSuspense(fn, suspense) {
2888
2895
  function setActiveBranch(suspense, branch) {
2889
2896
  suspense.activeBranch = branch;
2890
2897
  const { vnode, parentComponent } = suspense;
2891
- const el = vnode.el = branch.el;
2898
+ let el = branch.el;
2899
+ while (!el && branch.component) {
2900
+ branch = branch.component.subTree;
2901
+ el = branch.el;
2902
+ }
2903
+ vnode.el = el;
2892
2904
  if (parentComponent && parentComponent.subTree === vnode) {
2893
2905
  parentComponent.vnode.el = el;
2894
2906
  updateHOCHostEl(parentComponent, el);
@@ -4777,50 +4789,6 @@ function useSlots() {
4777
4789
  function useAttrs() {
4778
4790
  return getContext().attrs;
4779
4791
  }
4780
- function useModel(props, name, options = EMPTY_OBJ) {
4781
- const i = getCurrentInstance();
4782
- const camelizedName = camelize(name);
4783
- const hyphenatedName = hyphenate(name);
4784
- const res = customRef((track, trigger) => {
4785
- let localValue;
4786
- watchSyncEffect(() => {
4787
- const propValue = props[name];
4788
- if (hasChanged(localValue, propValue)) {
4789
- localValue = propValue;
4790
- trigger();
4791
- }
4792
- });
4793
- return {
4794
- get() {
4795
- track();
4796
- return options.get ? options.get(localValue) : localValue;
4797
- },
4798
- set(value) {
4799
- const rawProps = i.vnode.props;
4800
- if (!(rawProps && // check if parent has passed v-model
4801
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
4802
- localValue = value;
4803
- trigger();
4804
- }
4805
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
4806
- }
4807
- };
4808
- });
4809
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
4810
- res[Symbol.iterator] = () => {
4811
- let i2 = 0;
4812
- return {
4813
- next() {
4814
- if (i2 < 2) {
4815
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
4816
- } else {
4817
- return { done: true };
4818
- }
4819
- }
4820
- };
4821
- };
4822
- return res;
4823
- }
4824
4792
  function getContext() {
4825
4793
  const i = getCurrentInstance();
4826
4794
  return i.setupContext || (i.setupContext = createSetupContext(i));
@@ -5279,7 +5247,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5279
5247
  return vm;
5280
5248
  }
5281
5249
  }
5282
- Vue.version = `2.6.14-compat:${"3.4.7"}`;
5250
+ Vue.version = `2.6.14-compat:${"3.4.9"}`;
5283
5251
  Vue.config = singletonApp.config;
5284
5252
  Vue.use = (p, ...options) => {
5285
5253
  if (p && isFunction(p.install)) {
@@ -9041,6 +9009,51 @@ const computed = (getterOrOptions, debugOptions) => {
9041
9009
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9042
9010
  };
9043
9011
 
9012
+ function useModel(props, name, options = EMPTY_OBJ) {
9013
+ const i = getCurrentInstance();
9014
+ const camelizedName = camelize(name);
9015
+ const hyphenatedName = hyphenate(name);
9016
+ const res = customRef((track, trigger) => {
9017
+ let localValue;
9018
+ watchSyncEffect(() => {
9019
+ const propValue = props[name];
9020
+ if (hasChanged(localValue, propValue)) {
9021
+ localValue = propValue;
9022
+ trigger();
9023
+ }
9024
+ });
9025
+ return {
9026
+ get() {
9027
+ track();
9028
+ return options.get ? options.get(localValue) : localValue;
9029
+ },
9030
+ set(value) {
9031
+ const rawProps = i.vnode.props;
9032
+ if (!(rawProps && // check if parent has passed v-model
9033
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9034
+ localValue = value;
9035
+ trigger();
9036
+ }
9037
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
9038
+ }
9039
+ };
9040
+ });
9041
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9042
+ res[Symbol.iterator] = () => {
9043
+ let i2 = 0;
9044
+ return {
9045
+ next() {
9046
+ if (i2 < 2) {
9047
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9048
+ } else {
9049
+ return { done: true };
9050
+ }
9051
+ }
9052
+ };
9053
+ };
9054
+ return res;
9055
+ }
9056
+
9044
9057
  function h(type, propsOrChildren, children) {
9045
9058
  const l = arguments.length;
9046
9059
  if (l === 2) {
@@ -9093,7 +9106,7 @@ function isMemoSame(cached, memo) {
9093
9106
  return true;
9094
9107
  }
9095
9108
 
9096
- const version = "3.4.7";
9109
+ const version = "3.4.9";
9097
9110
  const warn$1 = NOOP;
9098
9111
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9099
9112
  const devtools = void 0;
@@ -9557,6 +9570,7 @@ function useCssVars(getter) {
9557
9570
 
9558
9571
  function patchStyle(el, prev, next) {
9559
9572
  const style = el.style;
9573
+ const currentDisplay = style.display;
9560
9574
  const isCssString = isString(next);
9561
9575
  if (next && !isCssString) {
9562
9576
  if (prev && !isString(prev)) {
@@ -9570,7 +9584,6 @@ function patchStyle(el, prev, next) {
9570
9584
  setStyle(style, key, next[key]);
9571
9585
  }
9572
9586
  } else {
9573
- const currentDisplay = style.display;
9574
9587
  if (isCssString) {
9575
9588
  if (prev !== next) {
9576
9589
  const cssVarText = style[CSS_VAR_TEXT];
@@ -9582,9 +9595,9 @@ function patchStyle(el, prev, next) {
9582
9595
  } else if (prev) {
9583
9596
  el.removeAttribute("style");
9584
9597
  }
9585
- if (vShowOldKey in el) {
9586
- style.display = currentDisplay;
9587
- }
9598
+ }
9599
+ if (vShowOldKey in el) {
9600
+ style.display = currentDisplay;
9588
9601
  }
9589
9602
  }
9590
9603
  const importantRE = /\s*!important$/;