@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.
@@ -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);
@@ -3975,10 +3977,11 @@ function doWatch(source, cb, {
3975
3977
  scheduler = () => queueJob(job);
3976
3978
  }
3977
3979
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
3980
+ const scope = getCurrentScope();
3978
3981
  const unwatch = () => {
3979
3982
  effect.stop();
3980
- if (instance && instance.scope) {
3981
- remove(instance.scope.effects, effect);
3983
+ if (scope) {
3984
+ remove(scope.effects, effect);
3982
3985
  }
3983
3986
  };
3984
3987
  {
@@ -6458,7 +6461,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6458
6461
  return vm;
6459
6462
  }
6460
6463
  }
6461
- Vue.version = `2.6.14-compat:${"3.4.4"}`;
6464
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6462
6465
  Vue.config = singletonApp.config;
6463
6466
  Vue.use = (p, ...options) => {
6464
6467
  if (p && isFunction(p.install)) {
@@ -8003,7 +8006,7 @@ Server rendered element contains more child nodes than client vdom.`
8003
8006
  if (props) {
8004
8007
  {
8005
8008
  for (const key in props) {
8006
- if (propHasMismatch(el, key, props[key])) {
8009
+ if (propHasMismatch(el, key, props[key], vnode)) {
8007
8010
  hasMismatch = true;
8008
8011
  }
8009
8012
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8178,7 +8181,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8178
8181
  };
8179
8182
  return [hydrate, hydrateNode];
8180
8183
  }
8181
- function propHasMismatch(el, key, clientValue) {
8184
+ function propHasMismatch(el, key, clientValue, vnode) {
8182
8185
  let mismatchType;
8183
8186
  let mismatchKey;
8184
8187
  let actual;
@@ -8190,14 +8193,23 @@ function propHasMismatch(el, key, clientValue) {
8190
8193
  mismatchType = mismatchKey = `class`;
8191
8194
  }
8192
8195
  } else if (key === "style") {
8193
- actual = el.getAttribute("style");
8194
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8195
- 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)) {
8196
8208
  mismatchType = mismatchKey = "style";
8197
8209
  }
8198
8210
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8199
- actual = el.hasAttribute(key) && el.getAttribute(key);
8200
- 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);
8201
8213
  if (actual !== expected) {
8202
8214
  mismatchType = `attribute`;
8203
8215
  mismatchKey = key;
@@ -8232,6 +8244,29 @@ function isSetEqual(a, b) {
8232
8244
  }
8233
8245
  return true;
8234
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
+ }
8235
8270
 
8236
8271
  let supported;
8237
8272
  let perf;
@@ -8820,7 +8855,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8820
8855
  hostInsert(fragmentStartAnchor, container, anchor);
8821
8856
  hostInsert(fragmentEndAnchor, container, anchor);
8822
8857
  mountChildren(
8823
- 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 || [],
8824
8863
  container,
8825
8864
  fragmentEndAnchor,
8826
8865
  parentComponent,
@@ -9688,6 +9727,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9688
9727
  }
9689
9728
  return hostNextSibling(vnode.anchor || vnode.el);
9690
9729
  };
9730
+ let isFlushing = false;
9691
9731
  const render = (vnode, container, namespace) => {
9692
9732
  if (vnode == null) {
9693
9733
  if (container._vnode) {
@@ -9704,8 +9744,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9704
9744
  namespace
9705
9745
  );
9706
9746
  }
9707
- flushPreFlushCbs();
9708
- flushPostFlushCbs();
9747
+ if (!isFlushing) {
9748
+ isFlushing = true;
9749
+ flushPreFlushCbs();
9750
+ flushPostFlushCbs();
9751
+ isFlushing = false;
9752
+ }
9709
9753
  container._vnode = vnode;
9710
9754
  };
9711
9755
  const internals = {
@@ -10609,7 +10653,14 @@ function createComponentInstance(vnode, parent, suspense) {
10609
10653
  return instance;
10610
10654
  }
10611
10655
  let currentInstance = null;
10612
- 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
+ };
10613
10664
  let internalSetCurrentInstance;
10614
10665
  let setInSSRSetupState;
10615
10666
  {
@@ -10935,7 +10986,25 @@ function isClassComponent(value) {
10935
10986
  return isFunction(value) && "__vccOpts" in value;
10936
10987
  }
10937
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
+ }
10938
11000
  const computed = (getterOrOptions, debugOptions) => {
11001
+ {
11002
+ if (isFunction(getterOrOptions)) {
11003
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11004
+ } else {
11005
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11006
+ }
11007
+ }
10939
11008
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10940
11009
  };
10941
11010
 
@@ -11161,7 +11230,7 @@ function isMemoSame(cached, memo) {
11161
11230
  return true;
11162
11231
  }
11163
11232
 
11164
- const version = "3.4.4";
11233
+ const version = "3.4.6";
11165
11234
  const warn = warn$1 ;
11166
11235
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11167
11236
  const devtools = devtools$1 ;
@@ -11602,6 +11671,9 @@ const vShow = {
11602
11671
  setDisplay(el, value);
11603
11672
  }
11604
11673
  };
11674
+ {
11675
+ vShow.name = "show";
11676
+ }
11605
11677
  function setDisplay(el, value) {
11606
11678
  el.style.display = value ? el[vShowOldKey] : "none";
11607
11679
  }