vue 3.4.4 → 3.4.6

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.
@@ -1892,7 +1892,9 @@ var Vue = (function (exports) {
1892
1892
  }
1893
1893
  function flushPostFlushCbs(seen) {
1894
1894
  if (pendingPostFlushCbs.length) {
1895
- const deduped = [...new Set(pendingPostFlushCbs)];
1895
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1896
+ (a, b) => getId(a) - getId(b)
1897
+ );
1896
1898
  pendingPostFlushCbs.length = 0;
1897
1899
  if (activePostFlushCbs) {
1898
1900
  activePostFlushCbs.push(...deduped);
@@ -1902,7 +1904,6 @@ var Vue = (function (exports) {
1902
1904
  {
1903
1905
  seen = seen || /* @__PURE__ */ new Map();
1904
1906
  }
1905
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1906
1907
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1907
1908
  if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1908
1909
  continue;
@@ -2995,6 +2996,7 @@ If this is a native custom element, make sure to exclude it from component resol
2995
2996
  {
2996
2997
  assertNumber(timeout, `Suspense timeout`);
2997
2998
  }
2999
+ const initialAnchor = anchor;
2998
3000
  const suspense = {
2999
3001
  vnode,
3000
3002
  parent: parentSuspense,
@@ -3002,7 +3004,6 @@ If this is a native custom element, make sure to exclude it from component resol
3002
3004
  namespace,
3003
3005
  container,
3004
3006
  hiddenContainer,
3005
- anchor,
3006
3007
  deps: 0,
3007
3008
  pendingId: suspenseId++,
3008
3009
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3045,20 +3046,21 @@ If this is a native custom element, make sure to exclude it from component resol
3045
3046
  move(
3046
3047
  pendingBranch,
3047
3048
  container2,
3048
- next(activeBranch),
3049
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3049
3050
  0
3050
3051
  );
3051
3052
  queuePostFlushCb(effects);
3052
3053
  }
3053
3054
  };
3054
3055
  }
3055
- let { anchor: anchor2 } = suspense;
3056
3056
  if (activeBranch) {
3057
- anchor2 = next(activeBranch);
3057
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3058
+ anchor = next(activeBranch);
3059
+ }
3058
3060
  unmount(activeBranch, parentComponent2, suspense, true);
3059
3061
  }
3060
3062
  if (!delayEnter) {
3061
- move(pendingBranch, container2, anchor2, 0);
3063
+ move(pendingBranch, container2, anchor, 0);
3062
3064
  }
3063
3065
  }
3064
3066
  setActiveBranch(suspense, pendingBranch);
@@ -3468,10 +3470,11 @@ If this is a native custom element, make sure to exclude it from component resol
3468
3470
  scheduler = () => queueJob(job);
3469
3471
  }
3470
3472
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
3473
+ const scope = getCurrentScope();
3471
3474
  const unwatch = () => {
3472
3475
  effect.stop();
3473
- if (instance && instance.scope) {
3474
- remove(instance.scope.effects, effect);
3476
+ if (scope) {
3477
+ remove(scope.effects, effect);
3475
3478
  }
3476
3479
  };
3477
3480
  {
@@ -6435,7 +6438,7 @@ Server rendered element contains more child nodes than client vdom.`
6435
6438
  if (props) {
6436
6439
  {
6437
6440
  for (const key in props) {
6438
- if (propHasMismatch(el, key, props[key])) {
6441
+ if (propHasMismatch(el, key, props[key], vnode)) {
6439
6442
  hasMismatch = true;
6440
6443
  }
6441
6444
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6610,7 +6613,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6610
6613
  };
6611
6614
  return [hydrate, hydrateNode];
6612
6615
  }
6613
- function propHasMismatch(el, key, clientValue) {
6616
+ function propHasMismatch(el, key, clientValue, vnode) {
6614
6617
  let mismatchType;
6615
6618
  let mismatchKey;
6616
6619
  let actual;
@@ -6622,14 +6625,23 @@ Server rendered element contains fewer child nodes than client vdom.`
6622
6625
  mismatchType = mismatchKey = `class`;
6623
6626
  }
6624
6627
  } else if (key === "style") {
6625
- actual = el.getAttribute("style");
6626
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6627
- if (actual !== expected) {
6628
+ actual = toStyleMap(el.getAttribute("style") || "");
6629
+ expected = toStyleMap(
6630
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6631
+ );
6632
+ if (vnode.dirs) {
6633
+ for (const { dir, value } of vnode.dirs) {
6634
+ if (dir.name === "show" && !value) {
6635
+ expected.set("display", "none");
6636
+ }
6637
+ }
6638
+ }
6639
+ if (!isMapEqual(actual, expected)) {
6628
6640
  mismatchType = mismatchKey = "style";
6629
6641
  }
6630
6642
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6631
- actual = el.hasAttribute(key) && el.getAttribute(key);
6632
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
6643
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6644
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6633
6645
  if (actual !== expected) {
6634
6646
  mismatchType = `attribute`;
6635
6647
  mismatchKey = key;
@@ -6664,6 +6676,29 @@ Server rendered element contains fewer child nodes than client vdom.`
6664
6676
  }
6665
6677
  return true;
6666
6678
  }
6679
+ function toStyleMap(str) {
6680
+ const styleMap = /* @__PURE__ */ new Map();
6681
+ for (const item of str.split(";")) {
6682
+ let [key, value] = item.split(":");
6683
+ key = key == null ? void 0 : key.trim();
6684
+ value = value == null ? void 0 : value.trim();
6685
+ if (key && value) {
6686
+ styleMap.set(key, value);
6687
+ }
6688
+ }
6689
+ return styleMap;
6690
+ }
6691
+ function isMapEqual(a, b) {
6692
+ if (a.size !== b.size) {
6693
+ return false;
6694
+ }
6695
+ for (const [key, value] of a) {
6696
+ if (value !== b.get(key)) {
6697
+ return false;
6698
+ }
6699
+ }
6700
+ return true;
6701
+ }
6667
6702
 
6668
6703
  let supported;
6669
6704
  let perf;
@@ -7252,7 +7287,11 @@ Server rendered element contains fewer child nodes than client vdom.`
7252
7287
  hostInsert(fragmentStartAnchor, container, anchor);
7253
7288
  hostInsert(fragmentEndAnchor, container, anchor);
7254
7289
  mountChildren(
7255
- n2.children,
7290
+ // #10007
7291
+ // such fragment like `<></>` will be compiled into
7292
+ // a fragment which doesn't have a children.
7293
+ // In this case fallback to an empty array
7294
+ n2.children || [],
7256
7295
  container,
7257
7296
  fragmentEndAnchor,
7258
7297
  parentComponent,
@@ -8086,6 +8125,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8086
8125
  }
8087
8126
  return hostNextSibling(vnode.anchor || vnode.el);
8088
8127
  };
8128
+ let isFlushing = false;
8089
8129
  const render = (vnode, container, namespace) => {
8090
8130
  if (vnode == null) {
8091
8131
  if (container._vnode) {
@@ -8102,8 +8142,12 @@ Server rendered element contains fewer child nodes than client vdom.`
8102
8142
  namespace
8103
8143
  );
8104
8144
  }
8105
- flushPreFlushCbs();
8106
- flushPostFlushCbs();
8145
+ if (!isFlushing) {
8146
+ isFlushing = true;
8147
+ flushPreFlushCbs();
8148
+ flushPostFlushCbs();
8149
+ isFlushing = false;
8150
+ }
8107
8151
  container._vnode = vnode;
8108
8152
  };
8109
8153
  const internals = {
@@ -8946,7 +8990,14 @@ Component that was made reactive: `,
8946
8990
  return instance;
8947
8991
  }
8948
8992
  let currentInstance = null;
8949
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8993
+ const getCurrentInstance = () => {
8994
+ if (isInComputedGetter) {
8995
+ warn$1(
8996
+ `getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.`
8997
+ );
8998
+ }
8999
+ return currentInstance || currentRenderingInstance;
9000
+ };
8950
9001
  let internalSetCurrentInstance;
8951
9002
  let setInSSRSetupState;
8952
9003
  {
@@ -9260,7 +9311,25 @@ Component that was made reactive: `,
9260
9311
  return isFunction(value) && "__vccOpts" in value;
9261
9312
  }
9262
9313
 
9314
+ let isInComputedGetter = false;
9315
+ function wrapComputedGetter(getter) {
9316
+ return () => {
9317
+ isInComputedGetter = true;
9318
+ try {
9319
+ return getter();
9320
+ } finally {
9321
+ isInComputedGetter = false;
9322
+ }
9323
+ };
9324
+ }
9263
9325
  const computed = (getterOrOptions, debugOptions) => {
9326
+ {
9327
+ if (isFunction(getterOrOptions)) {
9328
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
9329
+ } else {
9330
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9331
+ }
9332
+ }
9264
9333
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9265
9334
  };
9266
9335
 
@@ -9486,7 +9555,7 @@ Component that was made reactive: `,
9486
9555
  return true;
9487
9556
  }
9488
9557
 
9489
- const version = "3.4.4";
9558
+ const version = "3.4.6";
9490
9559
  const warn = warn$1 ;
9491
9560
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9492
9561
  const devtools = devtools$1 ;
@@ -9883,6 +9952,9 @@ Component that was made reactive: `,
9883
9952
  setDisplay(el, value);
9884
9953
  }
9885
9954
  };
9955
+ {
9956
+ vShow.name = "show";
9957
+ }
9886
9958
  function setDisplay(el, value) {
9887
9959
  el.style.display = value ? el[vShowOldKey] : "none";
9888
9960
  }