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.
@@ -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
  import * as runtimeDom from '@vue/runtime-dom';
2
7
  import { initCustomFormatter, registerRuntimeCompiler, warn } from '@vue/runtime-dom';
3
8
  export * from '@vue/runtime-dom';
@@ -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
  var Vue = (function (exports) {
2
7
  'use strict';
3
8
 
@@ -2645,8 +2650,6 @@ var Vue = (function (exports) {
2645
2650
  return false;
2646
2651
  }
2647
2652
  function updateHOCHostEl({ vnode, parent }, el) {
2648
- if (!el)
2649
- return;
2650
2653
  while (parent) {
2651
2654
  const root = parent.subTree;
2652
2655
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -2738,6 +2741,10 @@ If this is a native custom element, make sure to exclude it from component resol
2738
2741
  rendererInternals
2739
2742
  );
2740
2743
  } else {
2744
+ if (parentSuspense && parentSuspense.deps > 0) {
2745
+ n2.suspense = n1.suspense;
2746
+ return;
2747
+ }
2741
2748
  patchSuspense(
2742
2749
  n1,
2743
2750
  n2,
@@ -3287,7 +3294,12 @@ If this is a native custom element, make sure to exclude it from component resol
3287
3294
  function setActiveBranch(suspense, branch) {
3288
3295
  suspense.activeBranch = branch;
3289
3296
  const { vnode, parentComponent } = suspense;
3290
- const el = vnode.el = branch.el;
3297
+ let el = branch.el;
3298
+ while (!el && branch.component) {
3299
+ branch = branch.component.subTree;
3300
+ el = branch.el;
3301
+ }
3302
+ vnode.el = el;
3291
3303
  if (parentComponent && parentComponent.subTree === vnode) {
3292
3304
  parentComponent.vnode.el = el;
3293
3305
  updateHOCHostEl(parentComponent, el);
@@ -4800,58 +4812,6 @@ If this is a native custom element, make sure to exclude it from component resol
4800
4812
  function useAttrs() {
4801
4813
  return getContext().attrs;
4802
4814
  }
4803
- function useModel(props, name, options = EMPTY_OBJ) {
4804
- const i = getCurrentInstance();
4805
- if (!i) {
4806
- warn$1(`useModel() called without active instance.`);
4807
- return ref();
4808
- }
4809
- if (!i.propsOptions[0][name]) {
4810
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
4811
- return ref();
4812
- }
4813
- const camelizedName = camelize(name);
4814
- const hyphenatedName = hyphenate(name);
4815
- const res = customRef((track, trigger) => {
4816
- let localValue;
4817
- watchSyncEffect(() => {
4818
- const propValue = props[name];
4819
- if (hasChanged(localValue, propValue)) {
4820
- localValue = propValue;
4821
- trigger();
4822
- }
4823
- });
4824
- return {
4825
- get() {
4826
- track();
4827
- return options.get ? options.get(localValue) : localValue;
4828
- },
4829
- set(value) {
4830
- const rawProps = i.vnode.props;
4831
- if (!(rawProps && // check if parent has passed v-model
4832
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
4833
- localValue = value;
4834
- trigger();
4835
- }
4836
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
4837
- }
4838
- };
4839
- });
4840
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
4841
- res[Symbol.iterator] = () => {
4842
- let i2 = 0;
4843
- return {
4844
- next() {
4845
- if (i2 < 2) {
4846
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
4847
- } else {
4848
- return { done: true };
4849
- }
4850
- }
4851
- };
4852
- };
4853
- return res;
4854
- }
4855
4815
  function getContext() {
4856
4816
  const i = getCurrentInstance();
4857
4817
  if (!i) {
@@ -6613,29 +6573,43 @@ Server rendered element contains fewer child nodes than client vdom.`
6613
6573
  let actual;
6614
6574
  let expected;
6615
6575
  if (key === "class") {
6616
- actual = toClassSet(el.getAttribute("class") || "");
6617
- expected = toClassSet(normalizeClass(clientValue));
6618
- if (!isSetEqual(actual, expected)) {
6576
+ actual = el.getAttribute("class");
6577
+ expected = normalizeClass(clientValue);
6578
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6619
6579
  mismatchType = mismatchKey = `class`;
6620
6580
  }
6621
6581
  } else if (key === "style") {
6622
- actual = toStyleMap(el.getAttribute("style") || "");
6623
- expected = toStyleMap(
6624
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6625
- );
6582
+ actual = el.getAttribute("style");
6583
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6584
+ const actualMap = toStyleMap(actual);
6585
+ const expectedMap = toStyleMap(expected);
6626
6586
  if (vnode.dirs) {
6627
6587
  for (const { dir, value } of vnode.dirs) {
6628
6588
  if (dir.name === "show" && !value) {
6629
- expected.set("display", "none");
6589
+ expectedMap.set("display", "none");
6630
6590
  }
6631
6591
  }
6632
6592
  }
6633
- if (!isMapEqual(actual, expected)) {
6593
+ if (!isMapEqual(actualMap, expectedMap)) {
6634
6594
  mismatchType = mismatchKey = "style";
6635
6595
  }
6636
6596
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6637
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6638
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6597
+ if (isBooleanAttr(key)) {
6598
+ actual = el.hasAttribute(key);
6599
+ expected = includeBooleanAttr(clientValue);
6600
+ } else {
6601
+ if (el.hasAttribute(key)) {
6602
+ actual = el.getAttribute(key);
6603
+ } else if (key in el) {
6604
+ const serverValue = el[key];
6605
+ if (!isObject(serverValue)) {
6606
+ actual = serverValue == null ? "" : String(serverValue);
6607
+ }
6608
+ }
6609
+ if (!isObject(clientValue)) {
6610
+ expected = clientValue == null ? "" : String(clientValue);
6611
+ }
6612
+ }
6639
6613
  if (actual !== expected) {
6640
6614
  mismatchType = `attribute`;
6641
6615
  mismatchKey = key;
@@ -6643,15 +6617,15 @@ Server rendered element contains fewer child nodes than client vdom.`
6643
6617
  }
6644
6618
  if (mismatchType) {
6645
6619
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
6646
- warn$1(
6647
- `Hydration ${mismatchType} mismatch on`,
6648
- el,
6649
- `
6620
+ const preSegment = `Hydration ${mismatchType} mismatch on`;
6621
+ const postSegment = `
6650
6622
  - rendered on server: ${format(actual)}
6651
6623
  - expected on client: ${format(expected)}
6652
6624
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
6653
- You should fix the source of the mismatch.`
6654
- );
6625
+ You should fix the source of the mismatch.`;
6626
+ {
6627
+ warn$1(preSegment, el, postSegment);
6628
+ }
6655
6629
  return true;
6656
6630
  }
6657
6631
  return false;
@@ -9307,6 +9281,59 @@ Component that was made reactive: `,
9307
9281
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9308
9282
  };
9309
9283
 
9284
+ function useModel(props, name, options = EMPTY_OBJ) {
9285
+ const i = getCurrentInstance();
9286
+ if (!i) {
9287
+ warn$1(`useModel() called without active instance.`);
9288
+ return ref();
9289
+ }
9290
+ if (!i.propsOptions[0][name]) {
9291
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
9292
+ return ref();
9293
+ }
9294
+ const camelizedName = camelize(name);
9295
+ const hyphenatedName = hyphenate(name);
9296
+ const res = customRef((track, trigger) => {
9297
+ let localValue;
9298
+ watchSyncEffect(() => {
9299
+ const propValue = props[name];
9300
+ if (hasChanged(localValue, propValue)) {
9301
+ localValue = propValue;
9302
+ trigger();
9303
+ }
9304
+ });
9305
+ return {
9306
+ get() {
9307
+ track();
9308
+ return options.get ? options.get(localValue) : localValue;
9309
+ },
9310
+ set(value) {
9311
+ const rawProps = i.vnode.props;
9312
+ if (!(rawProps && // check if parent has passed v-model
9313
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9314
+ localValue = value;
9315
+ trigger();
9316
+ }
9317
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
9318
+ }
9319
+ };
9320
+ });
9321
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9322
+ res[Symbol.iterator] = () => {
9323
+ let i2 = 0;
9324
+ return {
9325
+ next() {
9326
+ if (i2 < 2) {
9327
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9328
+ } else {
9329
+ return { done: true };
9330
+ }
9331
+ }
9332
+ };
9333
+ };
9334
+ return res;
9335
+ }
9336
+
9310
9337
  function h(type, propsOrChildren, children) {
9311
9338
  const l = arguments.length;
9312
9339
  if (l === 2) {
@@ -9529,7 +9556,7 @@ Component that was made reactive: `,
9529
9556
  return true;
9530
9557
  }
9531
9558
 
9532
- const version = "3.4.7";
9559
+ const version = "3.4.9";
9533
9560
  const warn = warn$1 ;
9534
9561
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9535
9562
  const devtools = devtools$1 ;
@@ -9998,6 +10025,7 @@ Component that was made reactive: `,
9998
10025
 
9999
10026
  function patchStyle(el, prev, next) {
10000
10027
  const style = el.style;
10028
+ const currentDisplay = style.display;
10001
10029
  const isCssString = isString(next);
10002
10030
  if (next && !isCssString) {
10003
10031
  if (prev && !isString(prev)) {
@@ -10011,7 +10039,6 @@ Component that was made reactive: `,
10011
10039
  setStyle(style, key, next[key]);
10012
10040
  }
10013
10041
  } else {
10014
- const currentDisplay = style.display;
10015
10042
  if (isCssString) {
10016
10043
  if (prev !== next) {
10017
10044
  const cssVarText = style[CSS_VAR_TEXT];
@@ -10023,9 +10050,9 @@ Component that was made reactive: `,
10023
10050
  } else if (prev) {
10024
10051
  el.removeAttribute("style");
10025
10052
  }
10026
- if (vShowOldKey in el) {
10027
- style.display = currentDisplay;
10028
- }
10053
+ }
10054
+ if (vShowOldKey in el) {
10055
+ style.display = currentDisplay;
10029
10056
  }
10030
10057
  }
10031
10058
  const semicolonRE = /[^\\];\s*$/;