vue 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 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
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,8 @@
1
+ /**
2
+ * vue 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
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,8 @@
1
+ /**
2
+ * vue v3.4.9
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  function makeMap(str, expectsLowerCase) {
2
7
  const set = new Set(str.split(","));
3
8
  return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
@@ -2642,8 +2647,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2642
2647
  return false;
2643
2648
  }
2644
2649
  function updateHOCHostEl({ vnode, parent }, el) {
2645
- if (!el)
2646
- return;
2647
2650
  while (parent) {
2648
2651
  const root = parent.subTree;
2649
2652
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -2735,6 +2738,10 @@ const SuspenseImpl = {
2735
2738
  rendererInternals
2736
2739
  );
2737
2740
  } else {
2741
+ if (parentSuspense && parentSuspense.deps > 0) {
2742
+ n2.suspense = n1.suspense;
2743
+ return;
2744
+ }
2738
2745
  patchSuspense(
2739
2746
  n1,
2740
2747
  n2,
@@ -3284,7 +3291,12 @@ function queueEffectWithSuspense(fn, suspense) {
3284
3291
  function setActiveBranch(suspense, branch) {
3285
3292
  suspense.activeBranch = branch;
3286
3293
  const { vnode, parentComponent } = suspense;
3287
- const el = vnode.el = branch.el;
3294
+ let el = branch.el;
3295
+ while (!el && branch.component) {
3296
+ branch = branch.component.subTree;
3297
+ el = branch.el;
3298
+ }
3299
+ vnode.el = el;
3288
3300
  if (parentComponent && parentComponent.subTree === vnode) {
3289
3301
  parentComponent.vnode.el = el;
3290
3302
  updateHOCHostEl(parentComponent, el);
@@ -4803,58 +4815,6 @@ function useSlots() {
4803
4815
  function useAttrs() {
4804
4816
  return getContext().attrs;
4805
4817
  }
4806
- function useModel(props, name, options = EMPTY_OBJ) {
4807
- const i = getCurrentInstance();
4808
- if (!i) {
4809
- warn$1(`useModel() called without active instance.`);
4810
- return ref();
4811
- }
4812
- if (!i.propsOptions[0][name]) {
4813
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
4814
- return ref();
4815
- }
4816
- const camelizedName = camelize(name);
4817
- const hyphenatedName = hyphenate(name);
4818
- const res = customRef((track, trigger) => {
4819
- let localValue;
4820
- watchSyncEffect(() => {
4821
- const propValue = props[name];
4822
- if (hasChanged(localValue, propValue)) {
4823
- localValue = propValue;
4824
- trigger();
4825
- }
4826
- });
4827
- return {
4828
- get() {
4829
- track();
4830
- return options.get ? options.get(localValue) : localValue;
4831
- },
4832
- set(value) {
4833
- const rawProps = i.vnode.props;
4834
- if (!(rawProps && // check if parent has passed v-model
4835
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
4836
- localValue = value;
4837
- trigger();
4838
- }
4839
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
4840
- }
4841
- };
4842
- });
4843
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
4844
- res[Symbol.iterator] = () => {
4845
- let i2 = 0;
4846
- return {
4847
- next() {
4848
- if (i2 < 2) {
4849
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
4850
- } else {
4851
- return { done: true };
4852
- }
4853
- }
4854
- };
4855
- };
4856
- return res;
4857
- }
4858
4818
  function getContext() {
4859
4819
  const i = getCurrentInstance();
4860
4820
  if (!i) {
@@ -6616,29 +6576,43 @@ function propHasMismatch(el, key, clientValue, vnode) {
6616
6576
  let actual;
6617
6577
  let expected;
6618
6578
  if (key === "class") {
6619
- actual = toClassSet(el.getAttribute("class") || "");
6620
- expected = toClassSet(normalizeClass(clientValue));
6621
- if (!isSetEqual(actual, expected)) {
6579
+ actual = el.getAttribute("class");
6580
+ expected = normalizeClass(clientValue);
6581
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6622
6582
  mismatchType = mismatchKey = `class`;
6623
6583
  }
6624
6584
  } else if (key === "style") {
6625
- actual = toStyleMap(el.getAttribute("style") || "");
6626
- expected = toStyleMap(
6627
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6628
- );
6585
+ actual = el.getAttribute("style");
6586
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6587
+ const actualMap = toStyleMap(actual);
6588
+ const expectedMap = toStyleMap(expected);
6629
6589
  if (vnode.dirs) {
6630
6590
  for (const { dir, value } of vnode.dirs) {
6631
6591
  if (dir.name === "show" && !value) {
6632
- expected.set("display", "none");
6592
+ expectedMap.set("display", "none");
6633
6593
  }
6634
6594
  }
6635
6595
  }
6636
- if (!isMapEqual(actual, expected)) {
6596
+ if (!isMapEqual(actualMap, expectedMap)) {
6637
6597
  mismatchType = mismatchKey = "style";
6638
6598
  }
6639
6599
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6640
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6641
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6600
+ if (isBooleanAttr(key)) {
6601
+ actual = el.hasAttribute(key);
6602
+ expected = includeBooleanAttr(clientValue);
6603
+ } else {
6604
+ if (el.hasAttribute(key)) {
6605
+ actual = el.getAttribute(key);
6606
+ } else if (key in el) {
6607
+ const serverValue = el[key];
6608
+ if (!isObject(serverValue)) {
6609
+ actual = serverValue == null ? "" : String(serverValue);
6610
+ }
6611
+ }
6612
+ if (!isObject(clientValue)) {
6613
+ expected = clientValue == null ? "" : String(clientValue);
6614
+ }
6615
+ }
6642
6616
  if (actual !== expected) {
6643
6617
  mismatchType = `attribute`;
6644
6618
  mismatchKey = key;
@@ -6646,15 +6620,15 @@ function propHasMismatch(el, key, clientValue, vnode) {
6646
6620
  }
6647
6621
  if (mismatchType) {
6648
6622
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
6649
- warn$1(
6650
- `Hydration ${mismatchType} mismatch on`,
6651
- el,
6652
- `
6623
+ const preSegment = `Hydration ${mismatchType} mismatch on`;
6624
+ const postSegment = `
6653
6625
  - rendered on server: ${format(actual)}
6654
6626
  - expected on client: ${format(expected)}
6655
6627
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
6656
- You should fix the source of the mismatch.`
6657
- );
6628
+ You should fix the source of the mismatch.`;
6629
+ {
6630
+ warn$1(preSegment, el, postSegment);
6631
+ }
6658
6632
  return true;
6659
6633
  }
6660
6634
  return false;
@@ -9310,6 +9284,59 @@ const computed = (getterOrOptions, debugOptions) => {
9310
9284
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9311
9285
  };
9312
9286
 
9287
+ function useModel(props, name, options = EMPTY_OBJ) {
9288
+ const i = getCurrentInstance();
9289
+ if (!i) {
9290
+ warn$1(`useModel() called without active instance.`);
9291
+ return ref();
9292
+ }
9293
+ if (!i.propsOptions[0][name]) {
9294
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
9295
+ return ref();
9296
+ }
9297
+ const camelizedName = camelize(name);
9298
+ const hyphenatedName = hyphenate(name);
9299
+ const res = customRef((track, trigger) => {
9300
+ let localValue;
9301
+ watchSyncEffect(() => {
9302
+ const propValue = props[name];
9303
+ if (hasChanged(localValue, propValue)) {
9304
+ localValue = propValue;
9305
+ trigger();
9306
+ }
9307
+ });
9308
+ return {
9309
+ get() {
9310
+ track();
9311
+ return options.get ? options.get(localValue) : localValue;
9312
+ },
9313
+ set(value) {
9314
+ const rawProps = i.vnode.props;
9315
+ if (!(rawProps && // check if parent has passed v-model
9316
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9317
+ localValue = value;
9318
+ trigger();
9319
+ }
9320
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
9321
+ }
9322
+ };
9323
+ });
9324
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9325
+ res[Symbol.iterator] = () => {
9326
+ let i2 = 0;
9327
+ return {
9328
+ next() {
9329
+ if (i2 < 2) {
9330
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9331
+ } else {
9332
+ return { done: true };
9333
+ }
9334
+ }
9335
+ };
9336
+ };
9337
+ return res;
9338
+ }
9339
+
9313
9340
  function h(type, propsOrChildren, children) {
9314
9341
  const l = arguments.length;
9315
9342
  if (l === 2) {
@@ -9532,7 +9559,7 @@ function isMemoSame(cached, memo) {
9532
9559
  return true;
9533
9560
  }
9534
9561
 
9535
- const version = "3.4.7";
9562
+ const version = "3.4.9";
9536
9563
  const warn = warn$1 ;
9537
9564
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9538
9565
  const devtools = devtools$1 ;
@@ -10001,6 +10028,7 @@ function setVarsOnNode(el, vars) {
10001
10028
 
10002
10029
  function patchStyle(el, prev, next) {
10003
10030
  const style = el.style;
10031
+ const currentDisplay = style.display;
10004
10032
  const isCssString = isString(next);
10005
10033
  if (next && !isCssString) {
10006
10034
  if (prev && !isString(prev)) {
@@ -10014,7 +10042,6 @@ function patchStyle(el, prev, next) {
10014
10042
  setStyle(style, key, next[key]);
10015
10043
  }
10016
10044
  } else {
10017
- const currentDisplay = style.display;
10018
10045
  if (isCssString) {
10019
10046
  if (prev !== next) {
10020
10047
  const cssVarText = style[CSS_VAR_TEXT];
@@ -10026,9 +10053,9 @@ function patchStyle(el, prev, next) {
10026
10053
  } else if (prev) {
10027
10054
  el.removeAttribute("style");
10028
10055
  }
10029
- if (vShowOldKey in el) {
10030
- style.display = currentDisplay;
10031
- }
10056
+ }
10057
+ if (vShowOldKey in el) {
10058
+ style.display = currentDisplay;
10032
10059
  }
10033
10060
  }
10034
10061
  const semicolonRE = /[^\\];\s*$/;