@vue/runtime-dom 3.4.5 → 3.4.7

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);
@@ -3440,14 +3442,9 @@ If this is a native custom element, make sure to exclude it from component resol
3440
3442
  cb = value.handler;
3441
3443
  options = value;
3442
3444
  }
3443
- const cur = currentInstance;
3444
- setCurrentInstance(this);
3445
+ const reset = setCurrentInstance(this);
3445
3446
  const res = doWatch(getter, cb.bind(publicThis), options);
3446
- if (cur) {
3447
- setCurrentInstance(cur);
3448
- } else {
3449
- unsetCurrentInstance();
3450
- }
3447
+ reset();
3451
3448
  return res;
3452
3449
  }
3453
3450
  function createPathGetter(ctx, path) {
@@ -3499,12 +3496,11 @@ If this is a native custom element, make sure to exclude it from component resol
3499
3496
  }
3500
3497
  }
3501
3498
  function withDirectives(vnode, directives) {
3502
- const internalInstance = currentRenderingInstance;
3503
- if (internalInstance === null) {
3499
+ if (currentRenderingInstance === null) {
3504
3500
  warn$1(`withDirectives can only be used inside render functions.`);
3505
3501
  return vnode;
3506
3502
  }
3507
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3503
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3508
3504
  const bindings = vnode.dirs || (vnode.dirs = []);
3509
3505
  for (let i = 0; i < directives.length; i++) {
3510
3506
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4284,9 +4280,9 @@ If this is a native custom element, make sure to exclude it from component resol
4284
4280
  return;
4285
4281
  }
4286
4282
  pauseTracking();
4287
- setCurrentInstance(target);
4283
+ const reset = setCurrentInstance(target);
4288
4284
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4289
- unsetCurrentInstance();
4285
+ reset();
4290
4286
  resetTracking();
4291
4287
  return res;
4292
4288
  });
@@ -5671,12 +5667,12 @@ If you want to remount the same app, move your app creation logic into a factory
5671
5667
  if (key in propsDefaults) {
5672
5668
  value = propsDefaults[key];
5673
5669
  } else {
5674
- setCurrentInstance(instance);
5670
+ const reset = setCurrentInstance(instance);
5675
5671
  value = propsDefaults[key] = defaultValue.call(
5676
5672
  null,
5677
5673
  props
5678
5674
  );
5679
- unsetCurrentInstance();
5675
+ reset();
5680
5676
  }
5681
5677
  } else {
5682
5678
  value = defaultValue;
@@ -6371,7 +6367,7 @@ Server rendered element contains more child nodes than client vdom.`
6371
6367
  if (props) {
6372
6368
  {
6373
6369
  for (const key in props) {
6374
- if (propHasMismatch(el, key, props[key])) {
6370
+ if (propHasMismatch(el, key, props[key], vnode)) {
6375
6371
  hasMismatch = true;
6376
6372
  }
6377
6373
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6546,7 +6542,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6546
6542
  };
6547
6543
  return [hydrate, hydrateNode];
6548
6544
  }
6549
- function propHasMismatch(el, key, clientValue) {
6545
+ function propHasMismatch(el, key, clientValue, vnode) {
6550
6546
  let mismatchType;
6551
6547
  let mismatchKey;
6552
6548
  let actual;
@@ -6558,14 +6554,23 @@ Server rendered element contains fewer child nodes than client vdom.`
6558
6554
  mismatchType = mismatchKey = `class`;
6559
6555
  }
6560
6556
  } else if (key === "style") {
6561
- actual = el.getAttribute("style");
6562
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6563
- if (actual !== expected) {
6557
+ actual = toStyleMap(el.getAttribute("style") || "");
6558
+ expected = toStyleMap(
6559
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6560
+ );
6561
+ if (vnode.dirs) {
6562
+ for (const { dir, value } of vnode.dirs) {
6563
+ if (dir.name === "show" && !value) {
6564
+ expected.set("display", "none");
6565
+ }
6566
+ }
6567
+ }
6568
+ if (!isMapEqual(actual, expected)) {
6564
6569
  mismatchType = mismatchKey = "style";
6565
6570
  }
6566
6571
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6567
- actual = el.hasAttribute(key) && el.getAttribute(key);
6568
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
6572
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6573
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6569
6574
  if (actual !== expected) {
6570
6575
  mismatchType = `attribute`;
6571
6576
  mismatchKey = key;
@@ -6600,6 +6605,29 @@ Server rendered element contains fewer child nodes than client vdom.`
6600
6605
  }
6601
6606
  return true;
6602
6607
  }
6608
+ function toStyleMap(str) {
6609
+ const styleMap = /* @__PURE__ */ new Map();
6610
+ for (const item of str.split(";")) {
6611
+ let [key, value] = item.split(":");
6612
+ key = key == null ? void 0 : key.trim();
6613
+ value = value == null ? void 0 : value.trim();
6614
+ if (key && value) {
6615
+ styleMap.set(key, value);
6616
+ }
6617
+ }
6618
+ return styleMap;
6619
+ }
6620
+ function isMapEqual(a, b) {
6621
+ if (a.size !== b.size) {
6622
+ return false;
6623
+ }
6624
+ for (const [key, value] of a) {
6625
+ if (value !== b.get(key)) {
6626
+ return false;
6627
+ }
6628
+ }
6629
+ return true;
6630
+ }
6603
6631
 
6604
6632
  let supported;
6605
6633
  let perf;
@@ -7188,7 +7216,11 @@ Server rendered element contains fewer child nodes than client vdom.`
7188
7216
  hostInsert(fragmentStartAnchor, container, anchor);
7189
7217
  hostInsert(fragmentEndAnchor, container, anchor);
7190
7218
  mountChildren(
7191
- n2.children,
7219
+ // #10007
7220
+ // such fragment like `<></>` will be compiled into
7221
+ // a fragment which doesn't have a children.
7222
+ // In this case fallback to an empty array
7223
+ n2.children || [],
7192
7224
  container,
7193
7225
  fragmentEndAnchor,
7194
7226
  parentComponent,
@@ -8022,6 +8054,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8022
8054
  }
8023
8055
  return hostNextSibling(vnode.anchor || vnode.el);
8024
8056
  };
8057
+ let isFlushing = false;
8025
8058
  const render = (vnode, container, namespace) => {
8026
8059
  if (vnode == null) {
8027
8060
  if (container._vnode) {
@@ -8038,8 +8071,12 @@ Server rendered element contains fewer child nodes than client vdom.`
8038
8071
  namespace
8039
8072
  );
8040
8073
  }
8041
- flushPreFlushCbs();
8042
- flushPostFlushCbs();
8074
+ if (!isFlushing) {
8075
+ isFlushing = true;
8076
+ flushPreFlushCbs();
8077
+ flushPostFlushCbs();
8078
+ isFlushing = false;
8079
+ }
8043
8080
  container._vnode = vnode;
8044
8081
  };
8045
8082
  const internals = {
@@ -8894,8 +8931,13 @@ Component that was made reactive: `,
8894
8931
  };
8895
8932
  }
8896
8933
  const setCurrentInstance = (instance) => {
8934
+ const prev = currentInstance;
8897
8935
  internalSetCurrentInstance(instance);
8898
8936
  instance.scope.on();
8937
+ return () => {
8938
+ instance.scope.off();
8939
+ internalSetCurrentInstance(prev);
8940
+ };
8899
8941
  };
8900
8942
  const unsetCurrentInstance = () => {
8901
8943
  currentInstance && currentInstance.scope.off();
@@ -8957,7 +8999,7 @@ Component that was made reactive: `,
8957
8999
  const { setup } = Component;
8958
9000
  if (setup) {
8959
9001
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
8960
- setCurrentInstance(instance);
9002
+ const reset = setCurrentInstance(instance);
8961
9003
  pauseTracking();
8962
9004
  const setupResult = callWithErrorHandling(
8963
9005
  setup,
@@ -8969,7 +9011,7 @@ Component that was made reactive: `,
8969
9011
  ]
8970
9012
  );
8971
9013
  resetTracking();
8972
- unsetCurrentInstance();
9014
+ reset();
8973
9015
  if (isPromise(setupResult)) {
8974
9016
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
8975
9017
  if (isSSR) {
@@ -9063,13 +9105,13 @@ Component that was made reactive: `,
9063
9105
  }
9064
9106
  }
9065
9107
  {
9066
- setCurrentInstance(instance);
9108
+ const reset = setCurrentInstance(instance);
9067
9109
  pauseTracking();
9068
9110
  try {
9069
9111
  applyOptions(instance);
9070
9112
  } finally {
9071
9113
  resetTracking();
9072
- unsetCurrentInstance();
9114
+ reset();
9073
9115
  }
9074
9116
  }
9075
9117
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9422,7 +9464,7 @@ Component that was made reactive: `,
9422
9464
  return true;
9423
9465
  }
9424
9466
 
9425
- const version = "3.4.5";
9467
+ const version = "3.4.7";
9426
9468
  const warn = warn$1 ;
9427
9469
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9428
9470
  const devtools = devtools$1 ;
@@ -9819,6 +9861,9 @@ Component that was made reactive: `,
9819
9861
  setDisplay(el, value);
9820
9862
  }
9821
9863
  };
9864
+ {
9865
+ vShow.name = "show";
9866
+ }
9822
9867
  function setDisplay(el, value) {
9823
9868
  el.style.display = value ? el[vShowOldKey] : "none";
9824
9869
  }