@vue/compat 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;
@@ -3513,6 +3514,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3513
3514
  {
3514
3515
  assertNumber(timeout, `Suspense timeout`);
3515
3516
  }
3517
+ const initialAnchor = anchor;
3516
3518
  const suspense = {
3517
3519
  vnode,
3518
3520
  parent: parentSuspense,
@@ -3520,7 +3522,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3520
3522
  namespace,
3521
3523
  container,
3522
3524
  hiddenContainer,
3523
- anchor,
3524
3525
  deps: 0,
3525
3526
  pendingId: suspenseId++,
3526
3527
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3563,20 +3564,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3563
3564
  move(
3564
3565
  pendingBranch,
3565
3566
  container2,
3566
- next(activeBranch),
3567
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3567
3568
  0
3568
3569
  );
3569
3570
  queuePostFlushCb(effects);
3570
3571
  }
3571
3572
  };
3572
3573
  }
3573
- let { anchor: anchor2 } = suspense;
3574
3574
  if (activeBranch) {
3575
- anchor2 = next(activeBranch);
3575
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3576
+ anchor = next(activeBranch);
3577
+ }
3576
3578
  unmount(activeBranch, parentComponent2, suspense, true);
3577
3579
  }
3578
3580
  if (!delayEnter) {
3579
- move(pendingBranch, container2, anchor2, 0);
3581
+ move(pendingBranch, container2, anchor, 0);
3580
3582
  }
3581
3583
  }
3582
3584
  setActiveBranch(suspense, pendingBranch);
@@ -4040,10 +4042,11 @@ function doWatch(source, cb, {
4040
4042
  scheduler = () => queueJob(job);
4041
4043
  }
4042
4044
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
4045
+ const scope = getCurrentScope();
4043
4046
  const unwatch = () => {
4044
4047
  effect.stop();
4045
- if (instance && instance.scope) {
4046
- remove(instance.scope.effects, effect);
4048
+ if (scope) {
4049
+ remove(scope.effects, effect);
4047
4050
  }
4048
4051
  };
4049
4052
  {
@@ -6523,7 +6526,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6523
6526
  return vm;
6524
6527
  }
6525
6528
  }
6526
- Vue.version = `2.6.14-compat:${"3.4.4"}`;
6529
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6527
6530
  Vue.config = singletonApp.config;
6528
6531
  Vue.use = (p, ...options) => {
6529
6532
  if (p && isFunction(p.install)) {
@@ -8068,7 +8071,7 @@ Server rendered element contains more child nodes than client vdom.`
8068
8071
  if (props) {
8069
8072
  {
8070
8073
  for (const key in props) {
8071
- if (propHasMismatch(el, key, props[key])) {
8074
+ if (propHasMismatch(el, key, props[key], vnode)) {
8072
8075
  hasMismatch = true;
8073
8076
  }
8074
8077
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8243,7 +8246,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8243
8246
  };
8244
8247
  return [hydrate, hydrateNode];
8245
8248
  }
8246
- function propHasMismatch(el, key, clientValue) {
8249
+ function propHasMismatch(el, key, clientValue, vnode) {
8247
8250
  let mismatchType;
8248
8251
  let mismatchKey;
8249
8252
  let actual;
@@ -8255,14 +8258,23 @@ function propHasMismatch(el, key, clientValue) {
8255
8258
  mismatchType = mismatchKey = `class`;
8256
8259
  }
8257
8260
  } else if (key === "style") {
8258
- actual = el.getAttribute("style");
8259
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8260
- if (actual !== expected) {
8261
+ actual = toStyleMap(el.getAttribute("style") || "");
8262
+ expected = toStyleMap(
8263
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8264
+ );
8265
+ if (vnode.dirs) {
8266
+ for (const { dir, value } of vnode.dirs) {
8267
+ if (dir.name === "show" && !value) {
8268
+ expected.set("display", "none");
8269
+ }
8270
+ }
8271
+ }
8272
+ if (!isMapEqual(actual, expected)) {
8261
8273
  mismatchType = mismatchKey = "style";
8262
8274
  }
8263
8275
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8264
- actual = el.hasAttribute(key) && el.getAttribute(key);
8265
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
8276
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8277
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8266
8278
  if (actual !== expected) {
8267
8279
  mismatchType = `attribute`;
8268
8280
  mismatchKey = key;
@@ -8297,6 +8309,29 @@ function isSetEqual(a, b) {
8297
8309
  }
8298
8310
  return true;
8299
8311
  }
8312
+ function toStyleMap(str) {
8313
+ const styleMap = /* @__PURE__ */ new Map();
8314
+ for (const item of str.split(";")) {
8315
+ let [key, value] = item.split(":");
8316
+ key = key == null ? void 0 : key.trim();
8317
+ value = value == null ? void 0 : value.trim();
8318
+ if (key && value) {
8319
+ styleMap.set(key, value);
8320
+ }
8321
+ }
8322
+ return styleMap;
8323
+ }
8324
+ function isMapEqual(a, b) {
8325
+ if (a.size !== b.size) {
8326
+ return false;
8327
+ }
8328
+ for (const [key, value] of a) {
8329
+ if (value !== b.get(key)) {
8330
+ return false;
8331
+ }
8332
+ }
8333
+ return true;
8334
+ }
8300
8335
 
8301
8336
  let supported;
8302
8337
  let perf;
@@ -8885,7 +8920,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8885
8920
  hostInsert(fragmentStartAnchor, container, anchor);
8886
8921
  hostInsert(fragmentEndAnchor, container, anchor);
8887
8922
  mountChildren(
8888
- n2.children,
8923
+ // #10007
8924
+ // such fragment like `<></>` will be compiled into
8925
+ // a fragment which doesn't have a children.
8926
+ // In this case fallback to an empty array
8927
+ n2.children || [],
8889
8928
  container,
8890
8929
  fragmentEndAnchor,
8891
8930
  parentComponent,
@@ -9753,6 +9792,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9753
9792
  }
9754
9793
  return hostNextSibling(vnode.anchor || vnode.el);
9755
9794
  };
9795
+ let isFlushing = false;
9756
9796
  const render = (vnode, container, namespace) => {
9757
9797
  if (vnode == null) {
9758
9798
  if (container._vnode) {
@@ -9769,8 +9809,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9769
9809
  namespace
9770
9810
  );
9771
9811
  }
9772
- flushPreFlushCbs();
9773
- flushPostFlushCbs();
9812
+ if (!isFlushing) {
9813
+ isFlushing = true;
9814
+ flushPreFlushCbs();
9815
+ flushPostFlushCbs();
9816
+ isFlushing = false;
9817
+ }
9774
9818
  container._vnode = vnode;
9775
9819
  };
9776
9820
  const internals = {
@@ -10674,7 +10718,14 @@ function createComponentInstance(vnode, parent, suspense) {
10674
10718
  return instance;
10675
10719
  }
10676
10720
  let currentInstance = null;
10677
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10721
+ const getCurrentInstance = () => {
10722
+ if (isInComputedGetter) {
10723
+ warn$1(
10724
+ `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.`
10725
+ );
10726
+ }
10727
+ return currentInstance || currentRenderingInstance;
10728
+ };
10678
10729
  let internalSetCurrentInstance;
10679
10730
  let setInSSRSetupState;
10680
10731
  {
@@ -11000,7 +11051,25 @@ function isClassComponent(value) {
11000
11051
  return isFunction(value) && "__vccOpts" in value;
11001
11052
  }
11002
11053
 
11054
+ let isInComputedGetter = false;
11055
+ function wrapComputedGetter(getter) {
11056
+ return () => {
11057
+ isInComputedGetter = true;
11058
+ try {
11059
+ return getter();
11060
+ } finally {
11061
+ isInComputedGetter = false;
11062
+ }
11063
+ };
11064
+ }
11003
11065
  const computed = (getterOrOptions, debugOptions) => {
11066
+ {
11067
+ if (isFunction(getterOrOptions)) {
11068
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11069
+ } else {
11070
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11071
+ }
11072
+ }
11004
11073
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11005
11074
  };
11006
11075
 
@@ -11226,7 +11295,7 @@ function isMemoSame(cached, memo) {
11226
11295
  return true;
11227
11296
  }
11228
11297
 
11229
- const version = "3.4.4";
11298
+ const version = "3.4.6";
11230
11299
  const warn = warn$1 ;
11231
11300
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11232
11301
  const devtools = devtools$1 ;
@@ -11667,6 +11736,9 @@ const vShow = {
11667
11736
  setDisplay(el, value);
11668
11737
  }
11669
11738
  };
11739
+ {
11740
+ vShow.name = "show";
11741
+ }
11670
11742
  function setDisplay(el, value) {
11671
11743
  el.style.display = value ? el[vShowOldKey] : "none";
11672
11744
  }