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.
@@ -1889,7 +1889,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1889
1889
  }
1890
1890
  function flushPostFlushCbs(seen) {
1891
1891
  if (pendingPostFlushCbs.length) {
1892
- const deduped = [...new Set(pendingPostFlushCbs)];
1892
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1893
+ (a, b) => getId(a) - getId(b)
1894
+ );
1893
1895
  pendingPostFlushCbs.length = 0;
1894
1896
  if (activePostFlushCbs) {
1895
1897
  activePostFlushCbs.push(...deduped);
@@ -1899,7 +1901,6 @@ function flushPostFlushCbs(seen) {
1899
1901
  {
1900
1902
  seen = seen || /* @__PURE__ */ new Map();
1901
1903
  }
1902
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1903
1904
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1904
1905
  if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1905
1906
  continue;
@@ -2992,6 +2993,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2992
2993
  {
2993
2994
  assertNumber(timeout, `Suspense timeout`);
2994
2995
  }
2996
+ const initialAnchor = anchor;
2995
2997
  const suspense = {
2996
2998
  vnode,
2997
2999
  parent: parentSuspense,
@@ -2999,7 +3001,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2999
3001
  namespace,
3000
3002
  container,
3001
3003
  hiddenContainer,
3002
- anchor,
3003
3004
  deps: 0,
3004
3005
  pendingId: suspenseId++,
3005
3006
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3042,20 +3043,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3042
3043
  move(
3043
3044
  pendingBranch,
3044
3045
  container2,
3045
- next(activeBranch),
3046
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3046
3047
  0
3047
3048
  );
3048
3049
  queuePostFlushCb(effects);
3049
3050
  }
3050
3051
  };
3051
3052
  }
3052
- let { anchor: anchor2 } = suspense;
3053
3053
  if (activeBranch) {
3054
- anchor2 = next(activeBranch);
3054
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3055
+ anchor = next(activeBranch);
3056
+ }
3055
3057
  unmount(activeBranch, parentComponent2, suspense, true);
3056
3058
  }
3057
3059
  if (!delayEnter) {
3058
- move(pendingBranch, container2, anchor2, 0);
3060
+ move(pendingBranch, container2, anchor, 0);
3059
3061
  }
3060
3062
  }
3061
3063
  setActiveBranch(suspense, pendingBranch);
@@ -3471,10 +3473,11 @@ function doWatch(source, cb, {
3471
3473
  scheduler = () => queueJob(job);
3472
3474
  }
3473
3475
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
3476
+ const scope = getCurrentScope();
3474
3477
  const unwatch = () => {
3475
3478
  effect.stop();
3476
- if (instance && instance.scope) {
3477
- remove(instance.scope.effects, effect);
3479
+ if (scope) {
3480
+ remove(scope.effects, effect);
3478
3481
  }
3479
3482
  };
3480
3483
  {
@@ -6438,7 +6441,7 @@ Server rendered element contains more child nodes than client vdom.`
6438
6441
  if (props) {
6439
6442
  {
6440
6443
  for (const key in props) {
6441
- if (propHasMismatch(el, key, props[key])) {
6444
+ if (propHasMismatch(el, key, props[key], vnode)) {
6442
6445
  hasMismatch = true;
6443
6446
  }
6444
6447
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6613,7 +6616,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6613
6616
  };
6614
6617
  return [hydrate, hydrateNode];
6615
6618
  }
6616
- function propHasMismatch(el, key, clientValue) {
6619
+ function propHasMismatch(el, key, clientValue, vnode) {
6617
6620
  let mismatchType;
6618
6621
  let mismatchKey;
6619
6622
  let actual;
@@ -6625,14 +6628,23 @@ function propHasMismatch(el, key, clientValue) {
6625
6628
  mismatchType = mismatchKey = `class`;
6626
6629
  }
6627
6630
  } else if (key === "style") {
6628
- actual = el.getAttribute("style");
6629
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6630
- if (actual !== expected) {
6631
+ actual = toStyleMap(el.getAttribute("style") || "");
6632
+ expected = toStyleMap(
6633
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6634
+ );
6635
+ if (vnode.dirs) {
6636
+ for (const { dir, value } of vnode.dirs) {
6637
+ if (dir.name === "show" && !value) {
6638
+ expected.set("display", "none");
6639
+ }
6640
+ }
6641
+ }
6642
+ if (!isMapEqual(actual, expected)) {
6631
6643
  mismatchType = mismatchKey = "style";
6632
6644
  }
6633
6645
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6634
- actual = el.hasAttribute(key) && el.getAttribute(key);
6635
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
6646
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6647
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6636
6648
  if (actual !== expected) {
6637
6649
  mismatchType = `attribute`;
6638
6650
  mismatchKey = key;
@@ -6667,6 +6679,29 @@ function isSetEqual(a, b) {
6667
6679
  }
6668
6680
  return true;
6669
6681
  }
6682
+ function toStyleMap(str) {
6683
+ const styleMap = /* @__PURE__ */ new Map();
6684
+ for (const item of str.split(";")) {
6685
+ let [key, value] = item.split(":");
6686
+ key = key == null ? void 0 : key.trim();
6687
+ value = value == null ? void 0 : value.trim();
6688
+ if (key && value) {
6689
+ styleMap.set(key, value);
6690
+ }
6691
+ }
6692
+ return styleMap;
6693
+ }
6694
+ function isMapEqual(a, b) {
6695
+ if (a.size !== b.size) {
6696
+ return false;
6697
+ }
6698
+ for (const [key, value] of a) {
6699
+ if (value !== b.get(key)) {
6700
+ return false;
6701
+ }
6702
+ }
6703
+ return true;
6704
+ }
6670
6705
 
6671
6706
  let supported;
6672
6707
  let perf;
@@ -7255,7 +7290,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7255
7290
  hostInsert(fragmentStartAnchor, container, anchor);
7256
7291
  hostInsert(fragmentEndAnchor, container, anchor);
7257
7292
  mountChildren(
7258
- n2.children,
7293
+ // #10007
7294
+ // such fragment like `<></>` will be compiled into
7295
+ // a fragment which doesn't have a children.
7296
+ // In this case fallback to an empty array
7297
+ n2.children || [],
7259
7298
  container,
7260
7299
  fragmentEndAnchor,
7261
7300
  parentComponent,
@@ -8089,6 +8128,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8089
8128
  }
8090
8129
  return hostNextSibling(vnode.anchor || vnode.el);
8091
8130
  };
8131
+ let isFlushing = false;
8092
8132
  const render = (vnode, container, namespace) => {
8093
8133
  if (vnode == null) {
8094
8134
  if (container._vnode) {
@@ -8105,8 +8145,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8105
8145
  namespace
8106
8146
  );
8107
8147
  }
8108
- flushPreFlushCbs();
8109
- flushPostFlushCbs();
8148
+ if (!isFlushing) {
8149
+ isFlushing = true;
8150
+ flushPreFlushCbs();
8151
+ flushPostFlushCbs();
8152
+ isFlushing = false;
8153
+ }
8110
8154
  container._vnode = vnode;
8111
8155
  };
8112
8156
  const internals = {
@@ -8949,7 +8993,14 @@ function createComponentInstance(vnode, parent, suspense) {
8949
8993
  return instance;
8950
8994
  }
8951
8995
  let currentInstance = null;
8952
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8996
+ const getCurrentInstance = () => {
8997
+ if (isInComputedGetter) {
8998
+ warn$1(
8999
+ `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.`
9000
+ );
9001
+ }
9002
+ return currentInstance || currentRenderingInstance;
9003
+ };
8953
9004
  let internalSetCurrentInstance;
8954
9005
  let setInSSRSetupState;
8955
9006
  {
@@ -9263,7 +9314,25 @@ function isClassComponent(value) {
9263
9314
  return isFunction(value) && "__vccOpts" in value;
9264
9315
  }
9265
9316
 
9317
+ let isInComputedGetter = false;
9318
+ function wrapComputedGetter(getter) {
9319
+ return () => {
9320
+ isInComputedGetter = true;
9321
+ try {
9322
+ return getter();
9323
+ } finally {
9324
+ isInComputedGetter = false;
9325
+ }
9326
+ };
9327
+ }
9266
9328
  const computed = (getterOrOptions, debugOptions) => {
9329
+ {
9330
+ if (isFunction(getterOrOptions)) {
9331
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
9332
+ } else {
9333
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9334
+ }
9335
+ }
9267
9336
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9268
9337
  };
9269
9338
 
@@ -9489,7 +9558,7 @@ function isMemoSame(cached, memo) {
9489
9558
  return true;
9490
9559
  }
9491
9560
 
9492
- const version = "3.4.4";
9561
+ const version = "3.4.6";
9493
9562
  const warn = warn$1 ;
9494
9563
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9495
9564
  const devtools = devtools$1 ;
@@ -9886,6 +9955,9 @@ const vShow = {
9886
9955
  setDisplay(el, value);
9887
9956
  }
9888
9957
  };
9958
+ {
9959
+ vShow.name = "show";
9960
+ }
9889
9961
  function setDisplay(el, value) {
9890
9962
  el.style.display = value ? el[vShowOldKey] : "none";
9891
9963
  }