@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
  'use strict';
2
7
 
3
8
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -413,6 +418,7 @@ function useCssVars(getter) {
413
418
 
414
419
  function patchStyle(el, prev, next) {
415
420
  const style = el.style;
421
+ const currentDisplay = style.display;
416
422
  const isCssString = shared.isString(next);
417
423
  if (next && !isCssString) {
418
424
  if (prev && !shared.isString(prev)) {
@@ -426,7 +432,6 @@ function patchStyle(el, prev, next) {
426
432
  setStyle(style, key, next[key]);
427
433
  }
428
434
  } else {
429
- const currentDisplay = style.display;
430
435
  if (isCssString) {
431
436
  if (prev !== next) {
432
437
  const cssVarText = style[CSS_VAR_TEXT];
@@ -438,9 +443,9 @@ function patchStyle(el, prev, next) {
438
443
  } else if (prev) {
439
444
  el.removeAttribute("style");
440
445
  }
441
- if (vShowOldKey in el) {
442
- style.display = currentDisplay;
443
- }
446
+ }
447
+ if (vShowOldKey in el) {
448
+ style.display = currentDisplay;
444
449
  }
445
450
  }
446
451
  const semicolonRE = /[^\\];\s*$/;
@@ -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
  'use strict';
2
7
 
3
8
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -407,6 +412,7 @@ function useCssVars(getter) {
407
412
 
408
413
  function patchStyle(el, prev, next) {
409
414
  const style = el.style;
415
+ const currentDisplay = style.display;
410
416
  const isCssString = shared.isString(next);
411
417
  if (next && !isCssString) {
412
418
  if (prev && !shared.isString(prev)) {
@@ -420,7 +426,6 @@ function patchStyle(el, prev, next) {
420
426
  setStyle(style, key, next[key]);
421
427
  }
422
428
  } else {
423
- const currentDisplay = style.display;
424
429
  if (isCssString) {
425
430
  if (prev !== next) {
426
431
  const cssVarText = style[CSS_VAR_TEXT];
@@ -432,9 +437,9 @@ function patchStyle(el, prev, next) {
432
437
  } else if (prev) {
433
438
  el.removeAttribute("style");
434
439
  }
435
- if (vShowOldKey in el) {
436
- style.display = currentDisplay;
437
- }
440
+ }
441
+ if (vShowOldKey in el) {
442
+ style.display = currentDisplay;
438
443
  }
439
444
  }
440
445
  const importantRE = /\s*!important$/;
@@ -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
  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);
@@ -2577,8 +2582,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2577
2582
  return false;
2578
2583
  }
2579
2584
  function updateHOCHostEl({ vnode, parent }, el) {
2580
- if (!el)
2581
- return;
2582
2585
  while (parent) {
2583
2586
  const root = parent.subTree;
2584
2587
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -2670,6 +2673,10 @@ const SuspenseImpl = {
2670
2673
  rendererInternals
2671
2674
  );
2672
2675
  } else {
2676
+ if (parentSuspense && parentSuspense.deps > 0) {
2677
+ n2.suspense = n1.suspense;
2678
+ return;
2679
+ }
2673
2680
  patchSuspense(
2674
2681
  n1,
2675
2682
  n2,
@@ -3219,7 +3226,12 @@ function queueEffectWithSuspense(fn, suspense) {
3219
3226
  function setActiveBranch(suspense, branch) {
3220
3227
  suspense.activeBranch = branch;
3221
3228
  const { vnode, parentComponent } = suspense;
3222
- const el = vnode.el = branch.el;
3229
+ let el = branch.el;
3230
+ while (!el && branch.component) {
3231
+ branch = branch.component.subTree;
3232
+ el = branch.el;
3233
+ }
3234
+ vnode.el = el;
3223
3235
  if (parentComponent && parentComponent.subTree === vnode) {
3224
3236
  parentComponent.vnode.el = el;
3225
3237
  updateHOCHostEl(parentComponent, el);
@@ -4738,58 +4750,6 @@ function useSlots() {
4738
4750
  function useAttrs() {
4739
4751
  return getContext().attrs;
4740
4752
  }
4741
- function useModel(props, name, options = EMPTY_OBJ) {
4742
- const i = getCurrentInstance();
4743
- if (!i) {
4744
- warn$1(`useModel() called without active instance.`);
4745
- return ref();
4746
- }
4747
- if (!i.propsOptions[0][name]) {
4748
- warn$1(`useModel() called with prop "${name}" which is not declared.`);
4749
- return ref();
4750
- }
4751
- const camelizedName = camelize(name);
4752
- const hyphenatedName = hyphenate(name);
4753
- const res = customRef((track, trigger) => {
4754
- let localValue;
4755
- watchSyncEffect(() => {
4756
- const propValue = props[name];
4757
- if (hasChanged(localValue, propValue)) {
4758
- localValue = propValue;
4759
- trigger();
4760
- }
4761
- });
4762
- return {
4763
- get() {
4764
- track();
4765
- return options.get ? options.get(localValue) : localValue;
4766
- },
4767
- set(value) {
4768
- const rawProps = i.vnode.props;
4769
- if (!(rawProps && // check if parent has passed v-model
4770
- (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
4771
- localValue = value;
4772
- trigger();
4773
- }
4774
- i.emit(`update:${name}`, options.set ? options.set(value) : value);
4775
- }
4776
- };
4777
- });
4778
- const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
4779
- res[Symbol.iterator] = () => {
4780
- let i2 = 0;
4781
- return {
4782
- next() {
4783
- if (i2 < 2) {
4784
- return { value: i2++ ? props[modifierKey] || {} : res, done: false };
4785
- } else {
4786
- return { done: true };
4787
- }
4788
- }
4789
- };
4790
- };
4791
- return res;
4792
- }
4793
4753
  function getContext() {
4794
4754
  const i = getCurrentInstance();
4795
4755
  if (!i) {
@@ -6551,29 +6511,43 @@ function propHasMismatch(el, key, clientValue, vnode) {
6551
6511
  let actual;
6552
6512
  let expected;
6553
6513
  if (key === "class") {
6554
- actual = toClassSet(el.getAttribute("class") || "");
6555
- expected = toClassSet(normalizeClass(clientValue));
6556
- if (!isSetEqual(actual, expected)) {
6514
+ actual = el.getAttribute("class");
6515
+ expected = normalizeClass(clientValue);
6516
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
6557
6517
  mismatchType = mismatchKey = `class`;
6558
6518
  }
6559
6519
  } else if (key === "style") {
6560
- actual = toStyleMap(el.getAttribute("style") || "");
6561
- expected = toStyleMap(
6562
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6563
- );
6520
+ actual = el.getAttribute("style");
6521
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6522
+ const actualMap = toStyleMap(actual);
6523
+ const expectedMap = toStyleMap(expected);
6564
6524
  if (vnode.dirs) {
6565
6525
  for (const { dir, value } of vnode.dirs) {
6566
6526
  if (dir.name === "show" && !value) {
6567
- expected.set("display", "none");
6527
+ expectedMap.set("display", "none");
6568
6528
  }
6569
6529
  }
6570
6530
  }
6571
- if (!isMapEqual(actual, expected)) {
6531
+ if (!isMapEqual(actualMap, expectedMap)) {
6572
6532
  mismatchType = mismatchKey = "style";
6573
6533
  }
6574
6534
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6575
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6576
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6535
+ if (isBooleanAttr(key)) {
6536
+ actual = el.hasAttribute(key);
6537
+ expected = includeBooleanAttr(clientValue);
6538
+ } else {
6539
+ if (el.hasAttribute(key)) {
6540
+ actual = el.getAttribute(key);
6541
+ } else if (key in el) {
6542
+ const serverValue = el[key];
6543
+ if (!isObject(serverValue)) {
6544
+ actual = serverValue == null ? "" : String(serverValue);
6545
+ }
6546
+ }
6547
+ if (!isObject(clientValue)) {
6548
+ expected = clientValue == null ? "" : String(clientValue);
6549
+ }
6550
+ }
6577
6551
  if (actual !== expected) {
6578
6552
  mismatchType = `attribute`;
6579
6553
  mismatchKey = key;
@@ -6581,15 +6555,15 @@ function propHasMismatch(el, key, clientValue, vnode) {
6581
6555
  }
6582
6556
  if (mismatchType) {
6583
6557
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
6584
- warn$1(
6585
- `Hydration ${mismatchType} mismatch on`,
6586
- el,
6587
- `
6558
+ const preSegment = `Hydration ${mismatchType} mismatch on`;
6559
+ const postSegment = `
6588
6560
  - rendered on server: ${format(actual)}
6589
6561
  - expected on client: ${format(expected)}
6590
6562
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
6591
- You should fix the source of the mismatch.`
6592
- );
6563
+ You should fix the source of the mismatch.`;
6564
+ {
6565
+ warn$1(preSegment, el, postSegment);
6566
+ }
6593
6567
  return true;
6594
6568
  }
6595
6569
  return false;
@@ -9245,6 +9219,59 @@ const computed = (getterOrOptions, debugOptions) => {
9245
9219
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9246
9220
  };
9247
9221
 
9222
+ function useModel(props, name, options = EMPTY_OBJ) {
9223
+ const i = getCurrentInstance();
9224
+ if (!i) {
9225
+ warn$1(`useModel() called without active instance.`);
9226
+ return ref();
9227
+ }
9228
+ if (!i.propsOptions[0][name]) {
9229
+ warn$1(`useModel() called with prop "${name}" which is not declared.`);
9230
+ return ref();
9231
+ }
9232
+ const camelizedName = camelize(name);
9233
+ const hyphenatedName = hyphenate(name);
9234
+ const res = customRef((track, trigger) => {
9235
+ let localValue;
9236
+ watchSyncEffect(() => {
9237
+ const propValue = props[name];
9238
+ if (hasChanged(localValue, propValue)) {
9239
+ localValue = propValue;
9240
+ trigger();
9241
+ }
9242
+ });
9243
+ return {
9244
+ get() {
9245
+ track();
9246
+ return options.get ? options.get(localValue) : localValue;
9247
+ },
9248
+ set(value) {
9249
+ const rawProps = i.vnode.props;
9250
+ if (!(rawProps && // check if parent has passed v-model
9251
+ (name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && hasChanged(value, localValue)) {
9252
+ localValue = value;
9253
+ trigger();
9254
+ }
9255
+ i.emit(`update:${name}`, options.set ? options.set(value) : value);
9256
+ }
9257
+ };
9258
+ });
9259
+ const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
9260
+ res[Symbol.iterator] = () => {
9261
+ let i2 = 0;
9262
+ return {
9263
+ next() {
9264
+ if (i2 < 2) {
9265
+ return { value: i2++ ? props[modifierKey] || {} : res, done: false };
9266
+ } else {
9267
+ return { done: true };
9268
+ }
9269
+ }
9270
+ };
9271
+ };
9272
+ return res;
9273
+ }
9274
+
9248
9275
  function h(type, propsOrChildren, children) {
9249
9276
  const l = arguments.length;
9250
9277
  if (l === 2) {
@@ -9467,7 +9494,7 @@ function isMemoSame(cached, memo) {
9467
9494
  return true;
9468
9495
  }
9469
9496
 
9470
- const version = "3.4.7";
9497
+ const version = "3.4.9";
9471
9498
  const warn = warn$1 ;
9472
9499
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9473
9500
  const devtools = devtools$1 ;
@@ -9936,6 +9963,7 @@ function setVarsOnNode(el, vars) {
9936
9963
 
9937
9964
  function patchStyle(el, prev, next) {
9938
9965
  const style = el.style;
9966
+ const currentDisplay = style.display;
9939
9967
  const isCssString = isString(next);
9940
9968
  if (next && !isCssString) {
9941
9969
  if (prev && !isString(prev)) {
@@ -9949,7 +9977,6 @@ function patchStyle(el, prev, next) {
9949
9977
  setStyle(style, key, next[key]);
9950
9978
  }
9951
9979
  } else {
9952
- const currentDisplay = style.display;
9953
9980
  if (isCssString) {
9954
9981
  if (prev !== next) {
9955
9982
  const cssVarText = style[CSS_VAR_TEXT];
@@ -9961,9 +9988,9 @@ function patchStyle(el, prev, next) {
9961
9988
  } else if (prev) {
9962
9989
  el.removeAttribute("style");
9963
9990
  }
9964
- if (vShowOldKey in el) {
9965
- style.display = currentDisplay;
9966
- }
9991
+ }
9992
+ if (vShowOldKey in el) {
9993
+ style.display = currentDisplay;
9967
9994
  }
9968
9995
  }
9969
9996
  const semicolonRE = /[^\\];\s*$/;