@vue/runtime-dom 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/runtime-dom v3.4.9
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  var VueRuntimeDOM = (function (exports) {
2
7
  'use strict';
3
8
 
@@ -2580,8 +2585,6 @@ var VueRuntimeDOM = (function (exports) {
2580
2585
  return false;
2581
2586
  }
2582
2587
  function updateHOCHostEl({ vnode, parent }, el) {
2583
- if (!el)
2584
- return;
2585
2588
  while (parent) {
2586
2589
  const root = parent.subTree;
2587
2590
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -2673,6 +2676,10 @@ If this is a native custom element, make sure to exclude it from component resol
2673
2676
  rendererInternals
2674
2677
  );
2675
2678
  } else {
2679
+ if (parentSuspense && parentSuspense.deps > 0) {
2680
+ n2.suspense = n1.suspense;
2681
+ return;
2682
+ }
2676
2683
  patchSuspense(
2677
2684
  n1,
2678
2685
  n2,
@@ -3222,7 +3229,12 @@ If this is a native custom element, make sure to exclude it from component resol
3222
3229
  function setActiveBranch(suspense, branch) {
3223
3230
  suspense.activeBranch = branch;
3224
3231
  const { vnode, parentComponent } = suspense;
3225
- const el = vnode.el = branch.el;
3232
+ let el = branch.el;
3233
+ while (!el && branch.component) {
3234
+ branch = branch.component.subTree;
3235
+ el = branch.el;
3236
+ }
3237
+ vnode.el = el;
3226
3238
  if (parentComponent && parentComponent.subTree === vnode) {
3227
3239
  parentComponent.vnode.el = el;
3228
3240
  updateHOCHostEl(parentComponent, el);
@@ -4735,58 +4747,6 @@ If this is a native custom element, make sure to exclude it from component resol
4735
4747
  function useAttrs() {
4736
4748
  return getContext().attrs;
4737
4749
  }
4738
- function useModel(props, name, options = EMPTY_OBJ) {
4739
- const i = getCurrentInstance();
4740
- if (!i) {
4741
- warn$1(`useModel() called without active instance.`);
4742
- return ref();
4743
- }
4744
- if (!i.propsOptions[0][name]) {
4745
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
4746
- return ref();
4747
- }
4748
- const camelizedName = camelize(name);
4749
- const hyphenatedName = hyphenate(name);
4750
- const res = customRef((track, trigger) => {
4751
- let localValue;
4752
- watchSyncEffect(() => {
4753
- const propValue = props[name];
4754
- if (hasChanged(localValue, propValue)) {
4755
- localValue = propValue;
4756
- trigger();
4757
- }
4758
- });
4759
- return {
4760
- get() {
4761
- track();
4762
- return options.get ? options.get(localValue) : localValue;
4763
- },
4764
- set(value) {
4765
- const rawProps = i.vnode.props;
4766
- if (!(rawProps && // check if parent has passed v-model
4767
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
4768
- localValue = value;
4769
- trigger();
4770
- }
4771
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
4772
- }
4773
- };
4774
- });
4775
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
4776
- res[Symbol.iterator] = () => {
4777
- let i2 = 0;
4778
- return {
4779
- next() {
4780
- if (i2 < 2) {
4781
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
4782
- } else {
4783
- return { done: true };
4784
- }
4785
- }
4786
- };
4787
- };
4788
- return res;
4789
- }
4790
4750
  function getContext() {
4791
4751
  const i = getCurrentInstance();
4792
4752
  if (!i) {
@@ -6548,29 +6508,43 @@ Server rendered element contains fewer child nodes than client vdom.`
6548
6508
  let actual;
6549
6509
  let expected;
6550
6510
  if (key === "class") {
6551
- actual = toClassSet(el.getAttribute("class") || "");
6552
- expected = toClassSet(normalizeClass(clientValue));
6553
- if (!isSetEqual(actual, expected)) {
6511
+ actual = el.getAttribute("class");
6512
+ expected = normalizeClass(clientValue);
6513
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6554
6514
  mismatchType = mismatchKey = `class`;
6555
6515
  }
6556
6516
  } else if (key === "style") {
6557
- actual = toStyleMap(el.getAttribute("style") || "");
6558
- expected = toStyleMap(
6559
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6560
- );
6517
+ actual = el.getAttribute("style");
6518
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6519
+ const actualMap = toStyleMap(actual);
6520
+ const expectedMap = toStyleMap(expected);
6561
6521
  if (vnode.dirs) {
6562
6522
  for (const { dir, value } of vnode.dirs) {
6563
6523
  if (dir.name === "show" && !value) {
6564
- expected.set("display", "none");
6524
+ expectedMap.set("display", "none");
6565
6525
  }
6566
6526
  }
6567
6527
  }
6568
- if (!isMapEqual(actual, expected)) {
6528
+ if (!isMapEqual(actualMap, expectedMap)) {
6569
6529
  mismatchType = mismatchKey = "style";
6570
6530
  }
6571
6531
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6572
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6573
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6532
+ if (isBooleanAttr(key)) {
6533
+ actual = el.hasAttribute(key);
6534
+ expected = includeBooleanAttr(clientValue);
6535
+ } else {
6536
+ if (el.hasAttribute(key)) {
6537
+ actual = el.getAttribute(key);
6538
+ } else if (key in el) {
6539
+ const serverValue = el[key];
6540
+ if (!isObject(serverValue)) {
6541
+ actual = serverValue == null ? "" : String(serverValue);
6542
+ }
6543
+ }
6544
+ if (!isObject(clientValue)) {
6545
+ expected = clientValue == null ? "" : String(clientValue);
6546
+ }
6547
+ }
6574
6548
  if (actual !== expected) {
6575
6549
  mismatchType = `attribute`;
6576
6550
  mismatchKey = key;
@@ -6578,15 +6552,15 @@ Server rendered element contains fewer child nodes than client vdom.`
6578
6552
  }
6579
6553
  if (mismatchType) {
6580
6554
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
6581
- warn$1(
6582
- `Hydration ${mismatchType} mismatch on`,
6583
- el,
6584
- `
6555
+ const preSegment = `Hydration ${mismatchType} mismatch on`;
6556
+ const postSegment = `
6585
6557
  - rendered on server: ${format(actual)}
6586
6558
  - expected on client: ${format(expected)}
6587
6559
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
6588
- You should fix the source of the mismatch.`
6589
- );
6560
+ You should fix the source of the mismatch.`;
6561
+ {
6562
+ warn$1(preSegment, el, postSegment);
6563
+ }
6590
6564
  return true;
6591
6565
  }
6592
6566
  return false;
@@ -9242,6 +9216,59 @@ Component that was made reactive: `,
9242
9216
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9243
9217
  };
9244
9218
 
9219
+ function useModel(props, name, options = EMPTY_OBJ) {
9220
+ const i = getCurrentInstance();
9221
+ if (!i) {
9222
+ warn$1(`useModel() called without active instance.`);
9223
+ return ref();
9224
+ }
9225
+ if (!i.propsOptions[0][name]) {
9226
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
9227
+ return ref();
9228
+ }
9229
+ const camelizedName = camelize(name);
9230
+ const hyphenatedName = hyphenate(name);
9231
+ const res = customRef((track, trigger) => {
9232
+ let localValue;
9233
+ watchSyncEffect(() => {
9234
+ const propValue = props[name];
9235
+ if (hasChanged(localValue, propValue)) {
9236
+ localValue = propValue;
9237
+ trigger();
9238
+ }
9239
+ });
9240
+ return {
9241
+ get() {
9242
+ track();
9243
+ return options.get ? options.get(localValue) : localValue;
9244
+ },
9245
+ set(value) {
9246
+ const rawProps = i.vnode.props;
9247
+ if (!(rawProps && // check if parent has passed v-model
9248
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9249
+ localValue = value;
9250
+ trigger();
9251
+ }
9252
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
9253
+ }
9254
+ };
9255
+ });
9256
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9257
+ res[Symbol.iterator] = () => {
9258
+ let i2 = 0;
9259
+ return {
9260
+ next() {
9261
+ if (i2 < 2) {
9262
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9263
+ } else {
9264
+ return { done: true };
9265
+ }
9266
+ }
9267
+ };
9268
+ };
9269
+ return res;
9270
+ }
9271
+
9245
9272
  function h(type, propsOrChildren, children) {
9246
9273
  const l = arguments.length;
9247
9274
  if (l === 2) {
@@ -9464,7 +9491,7 @@ Component that was made reactive: `,
9464
9491
  return true;
9465
9492
  }
9466
9493
 
9467
- const version = "3.4.7";
9494
+ const version = "3.4.9";
9468
9495
  const warn = warn$1 ;
9469
9496
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9470
9497
  const devtools = devtools$1 ;
@@ -9933,6 +9960,7 @@ Component that was made reactive: `,
9933
9960
 
9934
9961
  function patchStyle(el, prev, next) {
9935
9962
  const style = el.style;
9963
+ const currentDisplay = style.display;
9936
9964
  const isCssString = isString(next);
9937
9965
  if (next && !isCssString) {
9938
9966
  if (prev && !isString(prev)) {
@@ -9946,7 +9974,6 @@ Component that was made reactive: `,
9946
9974
  setStyle(style, key, next[key]);
9947
9975
  }
9948
9976
  } else {
9949
- const currentDisplay = style.display;
9950
9977
  if (isCssString) {
9951
9978
  if (prev !== next) {
9952
9979
  const cssVarText = style[CSS_VAR_TEXT];
@@ -9958,9 +9985,9 @@ Component that was made reactive: `,
9958
9985
  } else if (prev) {
9959
9986
  el.removeAttribute("style");
9960
9987
  }
9961
- if (vShowOldKey in el) {
9962
- style.display = currentDisplay;
9963
- }
9988
+ }
9989
+ if (vShowOldKey in el) {
9990
+ style.display = currentDisplay;
9964
9991
  }
9965
9992
  }
9966
9993
  const semicolonRE = /[^\\];\s*$/;