@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.
@@ -1893,7 +1893,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1893
1893
  }
1894
1894
  function flushPostFlushCbs(seen) {
1895
1895
  if (pendingPostFlushCbs.length) {
1896
- const deduped = [...new Set(pendingPostFlushCbs)];
1896
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1897
+ (a, b) => getId(a) - getId(b)
1898
+ );
1897
1899
  pendingPostFlushCbs.length = 0;
1898
1900
  if (activePostFlushCbs) {
1899
1901
  activePostFlushCbs.push(...deduped);
@@ -1903,7 +1905,6 @@ function flushPostFlushCbs(seen) {
1903
1905
  if (!!(process.env.NODE_ENV !== "production")) {
1904
1906
  seen = seen || /* @__PURE__ */ new Map();
1905
1907
  }
1906
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1907
1908
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1908
1909
  if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1909
1910
  continue;
@@ -3520,6 +3521,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3520
3521
  if (!!(process.env.NODE_ENV !== "production")) {
3521
3522
  assertNumber(timeout, `Suspense timeout`);
3522
3523
  }
3524
+ const initialAnchor = anchor;
3523
3525
  const suspense = {
3524
3526
  vnode,
3525
3527
  parent: parentSuspense,
@@ -3527,7 +3529,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3527
3529
  namespace,
3528
3530
  container,
3529
3531
  hiddenContainer,
3530
- anchor,
3531
3532
  deps: 0,
3532
3533
  pendingId: suspenseId++,
3533
3534
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3570,20 +3571,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3570
3571
  move(
3571
3572
  pendingBranch,
3572
3573
  container2,
3573
- next(activeBranch),
3574
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3574
3575
  0
3575
3576
  );
3576
3577
  queuePostFlushCb(effects);
3577
3578
  }
3578
3579
  };
3579
3580
  }
3580
- let { anchor: anchor2 } = suspense;
3581
3581
  if (activeBranch) {
3582
- anchor2 = next(activeBranch);
3582
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3583
+ anchor = next(activeBranch);
3584
+ }
3583
3585
  unmount(activeBranch, parentComponent2, suspense, true);
3584
3586
  }
3585
3587
  if (!delayEnter) {
3586
- move(pendingBranch, container2, anchor2, 0);
3588
+ move(pendingBranch, container2, anchor, 0);
3587
3589
  }
3588
3590
  }
3589
3591
  setActiveBranch(suspense, pendingBranch);
@@ -6562,7 +6564,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6562
6564
  return vm;
6563
6565
  }
6564
6566
  }
6565
- Vue.version = `2.6.14-compat:${"3.4.5"}`;
6567
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6566
6568
  Vue.config = singletonApp.config;
6567
6569
  Vue.use = (p, ...options) => {
6568
6570
  if (p && isFunction(p.install)) {
@@ -8110,7 +8112,7 @@ Server rendered element contains more child nodes than client vdom.`
8110
8112
  if (props) {
8111
8113
  if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
8112
8114
  for (const key in props) {
8113
- if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key])) {
8115
+ if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode)) {
8114
8116
  hasMismatch = true;
8115
8117
  }
8116
8118
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8295,7 +8297,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8295
8297
  };
8296
8298
  return [hydrate, hydrateNode];
8297
8299
  }
8298
- function propHasMismatch(el, key, clientValue) {
8300
+ function propHasMismatch(el, key, clientValue, vnode) {
8299
8301
  let mismatchType;
8300
8302
  let mismatchKey;
8301
8303
  let actual;
@@ -8307,14 +8309,23 @@ function propHasMismatch(el, key, clientValue) {
8307
8309
  mismatchType = mismatchKey = `class`;
8308
8310
  }
8309
8311
  } else if (key === "style") {
8310
- actual = el.getAttribute("style");
8311
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8312
- if (actual !== expected) {
8312
+ actual = toStyleMap(el.getAttribute("style") || "");
8313
+ expected = toStyleMap(
8314
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8315
+ );
8316
+ if (vnode.dirs) {
8317
+ for (const { dir, value } of vnode.dirs) {
8318
+ if (dir.name === "show" && !value) {
8319
+ expected.set("display", "none");
8320
+ }
8321
+ }
8322
+ }
8323
+ if (!isMapEqual(actual, expected)) {
8313
8324
  mismatchType = mismatchKey = "style";
8314
8325
  }
8315
8326
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8316
- actual = el.hasAttribute(key) && el.getAttribute(key);
8317
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
8327
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8328
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8318
8329
  if (actual !== expected) {
8319
8330
  mismatchType = `attribute`;
8320
8331
  mismatchKey = key;
@@ -8349,6 +8360,29 @@ function isSetEqual(a, b) {
8349
8360
  }
8350
8361
  return true;
8351
8362
  }
8363
+ function toStyleMap(str) {
8364
+ const styleMap = /* @__PURE__ */ new Map();
8365
+ for (const item of str.split(";")) {
8366
+ let [key, value] = item.split(":");
8367
+ key = key == null ? void 0 : key.trim();
8368
+ value = value == null ? void 0 : value.trim();
8369
+ if (key && value) {
8370
+ styleMap.set(key, value);
8371
+ }
8372
+ }
8373
+ return styleMap;
8374
+ }
8375
+ function isMapEqual(a, b) {
8376
+ if (a.size !== b.size) {
8377
+ return false;
8378
+ }
8379
+ for (const [key, value] of a) {
8380
+ if (value !== b.get(key)) {
8381
+ return false;
8382
+ }
8383
+ }
8384
+ return true;
8385
+ }
8352
8386
 
8353
8387
  let supported;
8354
8388
  let perf;
@@ -8962,7 +8996,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8962
8996
  hostInsert(fragmentStartAnchor, container, anchor);
8963
8997
  hostInsert(fragmentEndAnchor, container, anchor);
8964
8998
  mountChildren(
8965
- n2.children,
8999
+ // #10007
9000
+ // such fragment like `<></>` will be compiled into
9001
+ // a fragment which doesn't have a children.
9002
+ // In this case fallback to an empty array
9003
+ n2.children || [],
8966
9004
  container,
8967
9005
  fragmentEndAnchor,
8968
9006
  parentComponent,
@@ -9843,6 +9881,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9843
9881
  }
9844
9882
  return hostNextSibling(vnode.anchor || vnode.el);
9845
9883
  };
9884
+ let isFlushing = false;
9846
9885
  const render = (vnode, container, namespace) => {
9847
9886
  if (vnode == null) {
9848
9887
  if (container._vnode) {
@@ -9859,8 +9898,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9859
9898
  namespace
9860
9899
  );
9861
9900
  }
9862
- flushPreFlushCbs();
9863
- flushPostFlushCbs();
9901
+ if (!isFlushing) {
9902
+ isFlushing = true;
9903
+ flushPreFlushCbs();
9904
+ flushPostFlushCbs();
9905
+ isFlushing = false;
9906
+ }
9864
9907
  container._vnode = vnode;
9865
9908
  };
9866
9909
  const internals = {
@@ -10766,7 +10809,14 @@ function createComponentInstance(vnode, parent, suspense) {
10766
10809
  return instance;
10767
10810
  }
10768
10811
  let currentInstance = null;
10769
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10812
+ const getCurrentInstance = () => {
10813
+ if (!!(process.env.NODE_ENV !== "production") && isInComputedGetter) {
10814
+ warn$1(
10815
+ `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.`
10816
+ );
10817
+ }
10818
+ return currentInstance || currentRenderingInstance;
10819
+ };
10770
10820
  let internalSetCurrentInstance;
10771
10821
  let setInSSRSetupState;
10772
10822
  {
@@ -11123,7 +11173,25 @@ function isClassComponent(value) {
11123
11173
  return isFunction(value) && "__vccOpts" in value;
11124
11174
  }
11125
11175
 
11176
+ let isInComputedGetter = false;
11177
+ function wrapComputedGetter(getter) {
11178
+ return () => {
11179
+ isInComputedGetter = true;
11180
+ try {
11181
+ return getter();
11182
+ } finally {
11183
+ isInComputedGetter = false;
11184
+ }
11185
+ };
11186
+ }
11126
11187
  const computed = (getterOrOptions, debugOptions) => {
11188
+ if (!!(process.env.NODE_ENV !== "production")) {
11189
+ if (isFunction(getterOrOptions)) {
11190
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11191
+ } else {
11192
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11193
+ }
11194
+ }
11127
11195
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11128
11196
  };
11129
11197
 
@@ -11349,7 +11417,7 @@ function isMemoSame(cached, memo) {
11349
11417
  return true;
11350
11418
  }
11351
11419
 
11352
- const version = "3.4.5";
11420
+ const version = "3.4.6";
11353
11421
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11354
11422
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11355
11423
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -11798,6 +11866,9 @@ const vShow = {
11798
11866
  setDisplay(el, value);
11799
11867
  }
11800
11868
  };
11869
+ if (!!(process.env.NODE_ENV !== "production")) {
11870
+ vShow.name = "show";
11871
+ }
11801
11872
  function setDisplay(el, value) {
11802
11873
  el.style.display = value ? el[vShowOldKey] : "none";
11803
11874
  }
@@ -1892,7 +1892,9 @@ var Vue = (function () {
1892
1892
  }
1893
1893
  function flushPostFlushCbs(seen) {
1894
1894
  if (pendingPostFlushCbs.length) {
1895
- const deduped = [...new Set(pendingPostFlushCbs)];
1895
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1896
+ (a, b) => getId(a) - getId(b)
1897
+ );
1896
1898
  pendingPostFlushCbs.length = 0;
1897
1899
  if (activePostFlushCbs) {
1898
1900
  activePostFlushCbs.push(...deduped);
@@ -1902,7 +1904,6 @@ var Vue = (function () {
1902
1904
  {
1903
1905
  seen = seen || /* @__PURE__ */ new Map();
1904
1906
  }
1905
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1906
1907
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1907
1908
  if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1908
1909
  continue;
@@ -3516,6 +3517,7 @@ If this is a native custom element, make sure to exclude it from component resol
3516
3517
  {
3517
3518
  assertNumber(timeout, `Suspense timeout`);
3518
3519
  }
3520
+ const initialAnchor = anchor;
3519
3521
  const suspense = {
3520
3522
  vnode,
3521
3523
  parent: parentSuspense,
@@ -3523,7 +3525,6 @@ If this is a native custom element, make sure to exclude it from component resol
3523
3525
  namespace,
3524
3526
  container,
3525
3527
  hiddenContainer,
3526
- anchor,
3527
3528
  deps: 0,
3528
3529
  pendingId: suspenseId++,
3529
3530
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3566,20 +3567,21 @@ If this is a native custom element, make sure to exclude it from component resol
3566
3567
  move(
3567
3568
  pendingBranch,
3568
3569
  container2,
3569
- next(activeBranch),
3570
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3570
3571
  0
3571
3572
  );
3572
3573
  queuePostFlushCb(effects);
3573
3574
  }
3574
3575
  };
3575
3576
  }
3576
- let { anchor: anchor2 } = suspense;
3577
3577
  if (activeBranch) {
3578
- anchor2 = next(activeBranch);
3578
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3579
+ anchor = next(activeBranch);
3580
+ }
3579
3581
  unmount(activeBranch, parentComponent2, suspense, true);
3580
3582
  }
3581
3583
  if (!delayEnter) {
3582
- move(pendingBranch, container2, anchor2, 0);
3584
+ move(pendingBranch, container2, anchor, 0);
3583
3585
  }
3584
3586
  }
3585
3587
  setActiveBranch(suspense, pendingBranch);
@@ -6521,7 +6523,7 @@ If this is a native custom element, make sure to exclude it from component resol
6521
6523
  return vm;
6522
6524
  }
6523
6525
  }
6524
- Vue.version = `2.6.14-compat:${"3.4.5"}`;
6526
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6525
6527
  Vue.config = singletonApp.config;
6526
6528
  Vue.use = (p, ...options) => {
6527
6529
  if (p && isFunction(p.install)) {
@@ -8066,7 +8068,7 @@ Server rendered element contains more child nodes than client vdom.`
8066
8068
  if (props) {
8067
8069
  {
8068
8070
  for (const key in props) {
8069
- if (propHasMismatch(el, key, props[key])) {
8071
+ if (propHasMismatch(el, key, props[key], vnode)) {
8070
8072
  hasMismatch = true;
8071
8073
  }
8072
8074
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8241,7 +8243,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8241
8243
  };
8242
8244
  return [hydrate, hydrateNode];
8243
8245
  }
8244
- function propHasMismatch(el, key, clientValue) {
8246
+ function propHasMismatch(el, key, clientValue, vnode) {
8245
8247
  let mismatchType;
8246
8248
  let mismatchKey;
8247
8249
  let actual;
@@ -8253,14 +8255,23 @@ Server rendered element contains fewer child nodes than client vdom.`
8253
8255
  mismatchType = mismatchKey = `class`;
8254
8256
  }
8255
8257
  } else if (key === "style") {
8256
- actual = el.getAttribute("style");
8257
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8258
- if (actual !== expected) {
8258
+ actual = toStyleMap(el.getAttribute("style") || "");
8259
+ expected = toStyleMap(
8260
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8261
+ );
8262
+ if (vnode.dirs) {
8263
+ for (const { dir, value } of vnode.dirs) {
8264
+ if (dir.name === "show" && !value) {
8265
+ expected.set("display", "none");
8266
+ }
8267
+ }
8268
+ }
8269
+ if (!isMapEqual(actual, expected)) {
8259
8270
  mismatchType = mismatchKey = "style";
8260
8271
  }
8261
8272
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8262
- actual = el.hasAttribute(key) && el.getAttribute(key);
8263
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
8273
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8274
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8264
8275
  if (actual !== expected) {
8265
8276
  mismatchType = `attribute`;
8266
8277
  mismatchKey = key;
@@ -8295,6 +8306,29 @@ Server rendered element contains fewer child nodes than client vdom.`
8295
8306
  }
8296
8307
  return true;
8297
8308
  }
8309
+ function toStyleMap(str) {
8310
+ const styleMap = /* @__PURE__ */ new Map();
8311
+ for (const item of str.split(";")) {
8312
+ let [key, value] = item.split(":");
8313
+ key = key == null ? void 0 : key.trim();
8314
+ value = value == null ? void 0 : value.trim();
8315
+ if (key && value) {
8316
+ styleMap.set(key, value);
8317
+ }
8318
+ }
8319
+ return styleMap;
8320
+ }
8321
+ function isMapEqual(a, b) {
8322
+ if (a.size !== b.size) {
8323
+ return false;
8324
+ }
8325
+ for (const [key, value] of a) {
8326
+ if (value !== b.get(key)) {
8327
+ return false;
8328
+ }
8329
+ }
8330
+ return true;
8331
+ }
8298
8332
 
8299
8333
  let supported;
8300
8334
  let perf;
@@ -8883,7 +8917,11 @@ Server rendered element contains fewer child nodes than client vdom.`
8883
8917
  hostInsert(fragmentStartAnchor, container, anchor);
8884
8918
  hostInsert(fragmentEndAnchor, container, anchor);
8885
8919
  mountChildren(
8886
- n2.children,
8920
+ // #10007
8921
+ // such fragment like `<></>` will be compiled into
8922
+ // a fragment which doesn't have a children.
8923
+ // In this case fallback to an empty array
8924
+ n2.children || [],
8887
8925
  container,
8888
8926
  fragmentEndAnchor,
8889
8927
  parentComponent,
@@ -9751,6 +9789,7 @@ Server rendered element contains fewer child nodes than client vdom.`
9751
9789
  }
9752
9790
  return hostNextSibling(vnode.anchor || vnode.el);
9753
9791
  };
9792
+ let isFlushing = false;
9754
9793
  const render = (vnode, container, namespace) => {
9755
9794
  if (vnode == null) {
9756
9795
  if (container._vnode) {
@@ -9767,8 +9806,12 @@ Server rendered element contains fewer child nodes than client vdom.`
9767
9806
  namespace
9768
9807
  );
9769
9808
  }
9770
- flushPreFlushCbs();
9771
- flushPostFlushCbs();
9809
+ if (!isFlushing) {
9810
+ isFlushing = true;
9811
+ flushPreFlushCbs();
9812
+ flushPostFlushCbs();
9813
+ isFlushing = false;
9814
+ }
9772
9815
  container._vnode = vnode;
9773
9816
  };
9774
9817
  const internals = {
@@ -10672,7 +10715,14 @@ Component that was made reactive: `,
10672
10715
  return instance;
10673
10716
  }
10674
10717
  let currentInstance = null;
10675
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10718
+ const getCurrentInstance = () => {
10719
+ if (isInComputedGetter) {
10720
+ warn$1(
10721
+ `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.`
10722
+ );
10723
+ }
10724
+ return currentInstance || currentRenderingInstance;
10725
+ };
10676
10726
  let internalSetCurrentInstance;
10677
10727
  let setInSSRSetupState;
10678
10728
  {
@@ -10998,7 +11048,25 @@ Component that was made reactive: `,
10998
11048
  return isFunction(value) && "__vccOpts" in value;
10999
11049
  }
11000
11050
 
11051
+ let isInComputedGetter = false;
11052
+ function wrapComputedGetter(getter) {
11053
+ return () => {
11054
+ isInComputedGetter = true;
11055
+ try {
11056
+ return getter();
11057
+ } finally {
11058
+ isInComputedGetter = false;
11059
+ }
11060
+ };
11061
+ }
11001
11062
  const computed = (getterOrOptions, debugOptions) => {
11063
+ {
11064
+ if (isFunction(getterOrOptions)) {
11065
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11066
+ } else {
11067
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11068
+ }
11069
+ }
11002
11070
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11003
11071
  };
11004
11072
 
@@ -11224,7 +11292,7 @@ Component that was made reactive: `,
11224
11292
  return true;
11225
11293
  }
11226
11294
 
11227
- const version = "3.4.5";
11295
+ const version = "3.4.6";
11228
11296
  const warn = warn$1 ;
11229
11297
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11230
11298
  const devtools = devtools$1 ;
@@ -11665,6 +11733,9 @@ Component that was made reactive: `,
11665
11733
  setDisplay(el, value);
11666
11734
  }
11667
11735
  };
11736
+ {
11737
+ vShow.name = "show";
11738
+ }
11668
11739
  function setDisplay(el, value) {
11669
11740
  el.style.display = value ? el[vShowOldKey] : "none";
11670
11741
  }