@vue/compat 3.4.5 → 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.
@@ -1824,7 +1824,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1824
1824
  }
1825
1825
  function flushPostFlushCbs(seen) {
1826
1826
  if (pendingPostFlushCbs.length) {
1827
- const deduped = [...new Set(pendingPostFlushCbs)];
1827
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1828
+ (a, b) => getId(a) - getId(b)
1829
+ );
1828
1830
  pendingPostFlushCbs.length = 0;
1829
1831
  if (activePostFlushCbs) {
1830
1832
  activePostFlushCbs.push(...deduped);
@@ -1834,7 +1836,6 @@ function flushPostFlushCbs(seen) {
1834
1836
  {
1835
1837
  seen = seen || /* @__PURE__ */ new Map();
1836
1838
  }
1837
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1838
1839
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1839
1840
  if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1840
1841
  continue;
@@ -3448,6 +3449,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3448
3449
  {
3449
3450
  assertNumber(timeout, `Suspense timeout`);
3450
3451
  }
3452
+ const initialAnchor = anchor;
3451
3453
  const suspense = {
3452
3454
  vnode,
3453
3455
  parent: parentSuspense,
@@ -3455,7 +3457,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3455
3457
  namespace,
3456
3458
  container,
3457
3459
  hiddenContainer,
3458
- anchor,
3459
3460
  deps: 0,
3460
3461
  pendingId: suspenseId++,
3461
3462
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3498,20 +3499,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3498
3499
  move(
3499
3500
  pendingBranch,
3500
3501
  container2,
3501
- next(activeBranch),
3502
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3502
3503
  0
3503
3504
  );
3504
3505
  queuePostFlushCb(effects);
3505
3506
  }
3506
3507
  };
3507
3508
  }
3508
- let { anchor: anchor2 } = suspense;
3509
3509
  if (activeBranch) {
3510
- anchor2 = next(activeBranch);
3510
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3511
+ anchor = next(activeBranch);
3512
+ }
3511
3513
  unmount(activeBranch, parentComponent2, suspense, true);
3512
3514
  }
3513
3515
  if (!delayEnter) {
3514
- move(pendingBranch, container2, anchor2, 0);
3516
+ move(pendingBranch, container2, anchor, 0);
3515
3517
  }
3516
3518
  }
3517
3519
  setActiveBranch(suspense, pendingBranch);
@@ -6459,7 +6461,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6459
6461
  return vm;
6460
6462
  }
6461
6463
  }
6462
- Vue.version = `2.6.14-compat:${"3.4.5"}`;
6464
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6463
6465
  Vue.config = singletonApp.config;
6464
6466
  Vue.use = (p, ...options) => {
6465
6467
  if (p && isFunction(p.install)) {
@@ -8004,7 +8006,7 @@ Server rendered element contains more child nodes than client vdom.`
8004
8006
  if (props) {
8005
8007
  {
8006
8008
  for (const key in props) {
8007
- if (propHasMismatch(el, key, props[key])) {
8009
+ if (propHasMismatch(el, key, props[key], vnode)) {
8008
8010
  hasMismatch = true;
8009
8011
  }
8010
8012
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8179,7 +8181,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8179
8181
  };
8180
8182
  return [hydrate, hydrateNode];
8181
8183
  }
8182
- function propHasMismatch(el, key, clientValue) {
8184
+ function propHasMismatch(el, key, clientValue, vnode) {
8183
8185
  let mismatchType;
8184
8186
  let mismatchKey;
8185
8187
  let actual;
@@ -8191,14 +8193,23 @@ function propHasMismatch(el, key, clientValue) {
8191
8193
  mismatchType = mismatchKey = `class`;
8192
8194
  }
8193
8195
  } else if (key === "style") {
8194
- actual = el.getAttribute("style");
8195
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8196
- if (actual !== expected) {
8196
+ actual = toStyleMap(el.getAttribute("style") || "");
8197
+ expected = toStyleMap(
8198
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8199
+ );
8200
+ if (vnode.dirs) {
8201
+ for (const { dir, value } of vnode.dirs) {
8202
+ if (dir.name === "show" && !value) {
8203
+ expected.set("display", "none");
8204
+ }
8205
+ }
8206
+ }
8207
+ if (!isMapEqual(actual, expected)) {
8197
8208
  mismatchType = mismatchKey = "style";
8198
8209
  }
8199
8210
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8200
- actual = el.hasAttribute(key) && el.getAttribute(key);
8201
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
8211
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8212
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8202
8213
  if (actual !== expected) {
8203
8214
  mismatchType = `attribute`;
8204
8215
  mismatchKey = key;
@@ -8233,6 +8244,29 @@ function isSetEqual(a, b) {
8233
8244
  }
8234
8245
  return true;
8235
8246
  }
8247
+ function toStyleMap(str) {
8248
+ const styleMap = /* @__PURE__ */ new Map();
8249
+ for (const item of str.split(";")) {
8250
+ let [key, value] = item.split(":");
8251
+ key = key == null ? void 0 : key.trim();
8252
+ value = value == null ? void 0 : value.trim();
8253
+ if (key && value) {
8254
+ styleMap.set(key, value);
8255
+ }
8256
+ }
8257
+ return styleMap;
8258
+ }
8259
+ function isMapEqual(a, b) {
8260
+ if (a.size !== b.size) {
8261
+ return false;
8262
+ }
8263
+ for (const [key, value] of a) {
8264
+ if (value !== b.get(key)) {
8265
+ return false;
8266
+ }
8267
+ }
8268
+ return true;
8269
+ }
8236
8270
 
8237
8271
  let supported;
8238
8272
  let perf;
@@ -8821,7 +8855,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8821
8855
  hostInsert(fragmentStartAnchor, container, anchor);
8822
8856
  hostInsert(fragmentEndAnchor, container, anchor);
8823
8857
  mountChildren(
8824
- n2.children,
8858
+ // #10007
8859
+ // such fragment like `<></>` will be compiled into
8860
+ // a fragment which doesn't have a children.
8861
+ // In this case fallback to an empty array
8862
+ n2.children || [],
8825
8863
  container,
8826
8864
  fragmentEndAnchor,
8827
8865
  parentComponent,
@@ -9689,6 +9727,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9689
9727
  }
9690
9728
  return hostNextSibling(vnode.anchor || vnode.el);
9691
9729
  };
9730
+ let isFlushing = false;
9692
9731
  const render = (vnode, container, namespace) => {
9693
9732
  if (vnode == null) {
9694
9733
  if (container._vnode) {
@@ -9705,8 +9744,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9705
9744
  namespace
9706
9745
  );
9707
9746
  }
9708
- flushPreFlushCbs();
9709
- flushPostFlushCbs();
9747
+ if (!isFlushing) {
9748
+ isFlushing = true;
9749
+ flushPreFlushCbs();
9750
+ flushPostFlushCbs();
9751
+ isFlushing = false;
9752
+ }
9710
9753
  container._vnode = vnode;
9711
9754
  };
9712
9755
  const internals = {
@@ -10610,7 +10653,14 @@ function createComponentInstance(vnode, parent, suspense) {
10610
10653
  return instance;
10611
10654
  }
10612
10655
  let currentInstance = null;
10613
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10656
+ const getCurrentInstance = () => {
10657
+ if (isInComputedGetter) {
10658
+ warn$1(
10659
+ `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.`
10660
+ );
10661
+ }
10662
+ return currentInstance || currentRenderingInstance;
10663
+ };
10614
10664
  let internalSetCurrentInstance;
10615
10665
  let setInSSRSetupState;
10616
10666
  {
@@ -10936,7 +10986,25 @@ function isClassComponent(value) {
10936
10986
  return isFunction(value) && "__vccOpts" in value;
10937
10987
  }
10938
10988
 
10989
+ let isInComputedGetter = false;
10990
+ function wrapComputedGetter(getter) {
10991
+ return () => {
10992
+ isInComputedGetter = true;
10993
+ try {
10994
+ return getter();
10995
+ } finally {
10996
+ isInComputedGetter = false;
10997
+ }
10998
+ };
10999
+ }
10939
11000
  const computed = (getterOrOptions, debugOptions) => {
11001
+ {
11002
+ if (isFunction(getterOrOptions)) {
11003
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11004
+ } else {
11005
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11006
+ }
11007
+ }
10940
11008
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10941
11009
  };
10942
11010
 
@@ -11162,7 +11230,7 @@ function isMemoSame(cached, memo) {
11162
11230
  return true;
11163
11231
  }
11164
11232
 
11165
- const version = "3.4.5";
11233
+ const version = "3.4.6";
11166
11234
  const warn = warn$1 ;
11167
11235
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11168
11236
  const devtools = devtools$1 ;
@@ -11603,6 +11671,9 @@ const vShow = {
11603
11671
  setDisplay(el, value);
11604
11672
  }
11605
11673
  };
11674
+ {
11675
+ vShow.name = "show";
11676
+ }
11606
11677
  function setDisplay(el, value) {
11607
11678
  el.style.display = value ? el[vShowOldKey] : "none";
11608
11679
  }