@vue/runtime-dom 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.
@@ -1827,7 +1827,9 @@ var VueRuntimeDOM = (function (exports) {
1827
1827
  }
1828
1828
  function flushPostFlushCbs(seen) {
1829
1829
  if (pendingPostFlushCbs.length) {
1830
- const deduped = [...new Set(pendingPostFlushCbs)];
1830
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1831
+ (a, b) => getId(a) - getId(b)
1832
+ );
1831
1833
  pendingPostFlushCbs.length = 0;
1832
1834
  if (activePostFlushCbs) {
1833
1835
  activePostFlushCbs.push(...deduped);
@@ -1837,7 +1839,6 @@ var VueRuntimeDOM = (function (exports) {
1837
1839
  {
1838
1840
  seen = seen || /* @__PURE__ */ new Map();
1839
1841
  }
1840
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1841
1842
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1842
1843
  if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1843
1844
  continue;
@@ -2930,6 +2931,7 @@ If this is a native custom element, make sure to exclude it from component resol
2930
2931
  {
2931
2932
  assertNumber(timeout, `Suspense timeout`);
2932
2933
  }
2934
+ const initialAnchor = anchor;
2933
2935
  const suspense = {
2934
2936
  vnode,
2935
2937
  parent: parentSuspense,
@@ -2937,7 +2939,6 @@ If this is a native custom element, make sure to exclude it from component resol
2937
2939
  namespace,
2938
2940
  container,
2939
2941
  hiddenContainer,
2940
- anchor,
2941
2942
  deps: 0,
2942
2943
  pendingId: suspenseId++,
2943
2944
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -2980,20 +2981,21 @@ If this is a native custom element, make sure to exclude it from component resol
2980
2981
  move(
2981
2982
  pendingBranch,
2982
2983
  container2,
2983
- next(activeBranch),
2984
+ anchor === initialAnchor ? next(activeBranch) : anchor,
2984
2985
  0
2985
2986
  );
2986
2987
  queuePostFlushCb(effects);
2987
2988
  }
2988
2989
  };
2989
2990
  }
2990
- let { anchor: anchor2 } = suspense;
2991
2991
  if (activeBranch) {
2992
- anchor2 = next(activeBranch);
2992
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
2993
+ anchor = next(activeBranch);
2994
+ }
2993
2995
  unmount(activeBranch, parentComponent2, suspense, true);
2994
2996
  }
2995
2997
  if (!delayEnter) {
2996
- move(pendingBranch, container2, anchor2, 0);
2998
+ move(pendingBranch, container2, anchor, 0);
2997
2999
  }
2998
3000
  }
2999
3001
  setActiveBranch(suspense, pendingBranch);
@@ -3403,10 +3405,11 @@ If this is a native custom element, make sure to exclude it from component resol
3403
3405
  scheduler = () => queueJob(job);
3404
3406
  }
3405
3407
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
3408
+ const scope = getCurrentScope();
3406
3409
  const unwatch = () => {
3407
3410
  effect.stop();
3408
- if (instance && instance.scope) {
3409
- remove(instance.scope.effects, effect);
3411
+ if (scope) {
3412
+ remove(scope.effects, effect);
3410
3413
  }
3411
3414
  };
3412
3415
  {
@@ -6370,7 +6373,7 @@ Server rendered element contains more child nodes than client vdom.`
6370
6373
  if (props) {
6371
6374
  {
6372
6375
  for (const key in props) {
6373
- if (propHasMismatch(el, key, props[key])) {
6376
+ if (propHasMismatch(el, key, props[key], vnode)) {
6374
6377
  hasMismatch = true;
6375
6378
  }
6376
6379
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6545,7 +6548,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6545
6548
  };
6546
6549
  return [hydrate, hydrateNode];
6547
6550
  }
6548
- function propHasMismatch(el, key, clientValue) {
6551
+ function propHasMismatch(el, key, clientValue, vnode) {
6549
6552
  let mismatchType;
6550
6553
  let mismatchKey;
6551
6554
  let actual;
@@ -6557,14 +6560,23 @@ Server rendered element contains fewer child nodes than client vdom.`
6557
6560
  mismatchType = mismatchKey = `class`;
6558
6561
  }
6559
6562
  } else if (key === "style") {
6560
- actual = el.getAttribute("style");
6561
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6562
- if (actual !== expected) {
6563
+ actual = toStyleMap(el.getAttribute("style") || "");
6564
+ expected = toStyleMap(
6565
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6566
+ );
6567
+ if (vnode.dirs) {
6568
+ for (const { dir, value } of vnode.dirs) {
6569
+ if (dir.name === "show" && !value) {
6570
+ expected.set("display", "none");
6571
+ }
6572
+ }
6573
+ }
6574
+ if (!isMapEqual(actual, expected)) {
6563
6575
  mismatchType = mismatchKey = "style";
6564
6576
  }
6565
6577
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6566
- actual = el.hasAttribute(key) && el.getAttribute(key);
6567
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
6578
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6579
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6568
6580
  if (actual !== expected) {
6569
6581
  mismatchType = `attribute`;
6570
6582
  mismatchKey = key;
@@ -6599,6 +6611,29 @@ Server rendered element contains fewer child nodes than client vdom.`
6599
6611
  }
6600
6612
  return true;
6601
6613
  }
6614
+ function toStyleMap(str) {
6615
+ const styleMap = /* @__PURE__ */ new Map();
6616
+ for (const item of str.split(";")) {
6617
+ let [key, value] = item.split(":");
6618
+ key = key == null ? void 0 : key.trim();
6619
+ value = value == null ? void 0 : value.trim();
6620
+ if (key && value) {
6621
+ styleMap.set(key, value);
6622
+ }
6623
+ }
6624
+ return styleMap;
6625
+ }
6626
+ function isMapEqual(a, b) {
6627
+ if (a.size !== b.size) {
6628
+ return false;
6629
+ }
6630
+ for (const [key, value] of a) {
6631
+ if (value !== b.get(key)) {
6632
+ return false;
6633
+ }
6634
+ }
6635
+ return true;
6636
+ }
6602
6637
 
6603
6638
  let supported;
6604
6639
  let perf;
@@ -7187,7 +7222,11 @@ Server rendered element contains fewer child nodes than client vdom.`
7187
7222
  hostInsert(fragmentStartAnchor, container, anchor);
7188
7223
  hostInsert(fragmentEndAnchor, container, anchor);
7189
7224
  mountChildren(
7190
- n2.children,
7225
+ // #10007
7226
+ // such fragment like `<></>` will be compiled into
7227
+ // a fragment which doesn't have a children.
7228
+ // In this case fallback to an empty array
7229
+ n2.children || [],
7191
7230
  container,
7192
7231
  fragmentEndAnchor,
7193
7232
  parentComponent,
@@ -8021,6 +8060,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8021
8060
  }
8022
8061
  return hostNextSibling(vnode.anchor || vnode.el);
8023
8062
  };
8063
+ let isFlushing = false;
8024
8064
  const render = (vnode, container, namespace) => {
8025
8065
  if (vnode == null) {
8026
8066
  if (container._vnode) {
@@ -8037,8 +8077,12 @@ Server rendered element contains fewer child nodes than client vdom.`
8037
8077
  namespace
8038
8078
  );
8039
8079
  }
8040
- flushPreFlushCbs();
8041
- flushPostFlushCbs();
8080
+ if (!isFlushing) {
8081
+ isFlushing = true;
8082
+ flushPreFlushCbs();
8083
+ flushPostFlushCbs();
8084
+ isFlushing = false;
8085
+ }
8042
8086
  container._vnode = vnode;
8043
8087
  };
8044
8088
  const internals = {
@@ -8881,7 +8925,14 @@ Component that was made reactive: `,
8881
8925
  return instance;
8882
8926
  }
8883
8927
  let currentInstance = null;
8884
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8928
+ const getCurrentInstance = () => {
8929
+ if (isInComputedGetter) {
8930
+ warn$1(
8931
+ `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.`
8932
+ );
8933
+ }
8934
+ return currentInstance || currentRenderingInstance;
8935
+ };
8885
8936
  let internalSetCurrentInstance;
8886
8937
  let setInSSRSetupState;
8887
8938
  {
@@ -9195,7 +9246,25 @@ Component that was made reactive: `,
9195
9246
  return isFunction(value) && "__vccOpts" in value;
9196
9247
  }
9197
9248
 
9249
+ let isInComputedGetter = false;
9250
+ function wrapComputedGetter(getter) {
9251
+ return () => {
9252
+ isInComputedGetter = true;
9253
+ try {
9254
+ return getter();
9255
+ } finally {
9256
+ isInComputedGetter = false;
9257
+ }
9258
+ };
9259
+ }
9198
9260
  const computed = (getterOrOptions, debugOptions) => {
9261
+ {
9262
+ if (isFunction(getterOrOptions)) {
9263
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
9264
+ } else {
9265
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9266
+ }
9267
+ }
9199
9268
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9200
9269
  };
9201
9270
 
@@ -9421,7 +9490,7 @@ Component that was made reactive: `,
9421
9490
  return true;
9422
9491
  }
9423
9492
 
9424
- const version = "3.4.4";
9493
+ const version = "3.4.6";
9425
9494
  const warn = warn$1 ;
9426
9495
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9427
9496
  const devtools = devtools$1 ;
@@ -9818,6 +9887,9 @@ Component that was made reactive: `,
9818
9887
  setDisplay(el, value);
9819
9888
  }
9820
9889
  };
9890
+ {
9891
+ vShow.name = "show";
9892
+ }
9821
9893
  function setDisplay(el, value) {
9822
9894
  el.style.display = value ? el[vShowOldKey] : "none";
9823
9895
  }