@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.
@@ -1828,7 +1828,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1828
1828
  }
1829
1829
  function flushPostFlushCbs(seen) {
1830
1830
  if (pendingPostFlushCbs.length) {
1831
- const deduped = [...new Set(pendingPostFlushCbs)];
1831
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
1832
+ (a, b) => getId(a) - getId(b)
1833
+ );
1832
1834
  pendingPostFlushCbs.length = 0;
1833
1835
  if (activePostFlushCbs) {
1834
1836
  activePostFlushCbs.push(...deduped);
@@ -1838,7 +1840,6 @@ function flushPostFlushCbs(seen) {
1838
1840
  if (!!(process.env.NODE_ENV !== "production")) {
1839
1841
  seen = seen || /* @__PURE__ */ new Map();
1840
1842
  }
1841
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
1842
1843
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
1843
1844
  if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
1844
1845
  continue;
@@ -3455,6 +3456,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3455
3456
  if (!!(process.env.NODE_ENV !== "production")) {
3456
3457
  assertNumber(timeout, `Suspense timeout`);
3457
3458
  }
3459
+ const initialAnchor = anchor;
3458
3460
  const suspense = {
3459
3461
  vnode,
3460
3462
  parent: parentSuspense,
@@ -3462,7 +3464,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3462
3464
  namespace,
3463
3465
  container,
3464
3466
  hiddenContainer,
3465
- anchor,
3466
3467
  deps: 0,
3467
3468
  pendingId: suspenseId++,
3468
3469
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3505,20 +3506,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3505
3506
  move(
3506
3507
  pendingBranch,
3507
3508
  container2,
3508
- next(activeBranch),
3509
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3509
3510
  0
3510
3511
  );
3511
3512
  queuePostFlushCb(effects);
3512
3513
  }
3513
3514
  };
3514
3515
  }
3515
- let { anchor: anchor2 } = suspense;
3516
3516
  if (activeBranch) {
3517
- anchor2 = next(activeBranch);
3517
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3518
+ anchor = next(activeBranch);
3519
+ }
3518
3520
  unmount(activeBranch, parentComponent2, suspense, true);
3519
3521
  }
3520
3522
  if (!delayEnter) {
3521
- move(pendingBranch, container2, anchor2, 0);
3523
+ move(pendingBranch, container2, anchor, 0);
3522
3524
  }
3523
3525
  }
3524
3526
  setActiveBranch(suspense, pendingBranch);
@@ -6497,7 +6499,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6497
6499
  return vm;
6498
6500
  }
6499
6501
  }
6500
- Vue.version = `2.6.14-compat:${"3.4.5"}`;
6502
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6501
6503
  Vue.config = singletonApp.config;
6502
6504
  Vue.use = (p, ...options) => {
6503
6505
  if (p && isFunction(p.install)) {
@@ -8045,7 +8047,7 @@ Server rendered element contains more child nodes than client vdom.`
8045
8047
  if (props) {
8046
8048
  if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
8047
8049
  for (const key in props) {
8048
- if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key])) {
8050
+ if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode)) {
8049
8051
  hasMismatch = true;
8050
8052
  }
8051
8053
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8230,7 +8232,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8230
8232
  };
8231
8233
  return [hydrate, hydrateNode];
8232
8234
  }
8233
- function propHasMismatch(el, key, clientValue) {
8235
+ function propHasMismatch(el, key, clientValue, vnode) {
8234
8236
  let mismatchType;
8235
8237
  let mismatchKey;
8236
8238
  let actual;
@@ -8242,14 +8244,23 @@ function propHasMismatch(el, key, clientValue) {
8242
8244
  mismatchType = mismatchKey = `class`;
8243
8245
  }
8244
8246
  } else if (key === "style") {
8245
- actual = el.getAttribute("style");
8246
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8247
- if (actual !== expected) {
8247
+ actual = toStyleMap(el.getAttribute("style") || "");
8248
+ expected = toStyleMap(
8249
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8250
+ );
8251
+ if (vnode.dirs) {
8252
+ for (const { dir, value } of vnode.dirs) {
8253
+ if (dir.name === "show" && !value) {
8254
+ expected.set("display", "none");
8255
+ }
8256
+ }
8257
+ }
8258
+ if (!isMapEqual(actual, expected)) {
8248
8259
  mismatchType = mismatchKey = "style";
8249
8260
  }
8250
8261
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8251
- actual = el.hasAttribute(key) && el.getAttribute(key);
8252
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
8262
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8263
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8253
8264
  if (actual !== expected) {
8254
8265
  mismatchType = `attribute`;
8255
8266
  mismatchKey = key;
@@ -8284,6 +8295,29 @@ function isSetEqual(a, b) {
8284
8295
  }
8285
8296
  return true;
8286
8297
  }
8298
+ function toStyleMap(str) {
8299
+ const styleMap = /* @__PURE__ */ new Map();
8300
+ for (const item of str.split(";")) {
8301
+ let [key, value] = item.split(":");
8302
+ key = key == null ? void 0 : key.trim();
8303
+ value = value == null ? void 0 : value.trim();
8304
+ if (key && value) {
8305
+ styleMap.set(key, value);
8306
+ }
8307
+ }
8308
+ return styleMap;
8309
+ }
8310
+ function isMapEqual(a, b) {
8311
+ if (a.size !== b.size) {
8312
+ return false;
8313
+ }
8314
+ for (const [key, value] of a) {
8315
+ if (value !== b.get(key)) {
8316
+ return false;
8317
+ }
8318
+ }
8319
+ return true;
8320
+ }
8287
8321
 
8288
8322
  let supported;
8289
8323
  let perf;
@@ -8897,7 +8931,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8897
8931
  hostInsert(fragmentStartAnchor, container, anchor);
8898
8932
  hostInsert(fragmentEndAnchor, container, anchor);
8899
8933
  mountChildren(
8900
- n2.children,
8934
+ // #10007
8935
+ // such fragment like `<></>` will be compiled into
8936
+ // a fragment which doesn't have a children.
8937
+ // In this case fallback to an empty array
8938
+ n2.children || [],
8901
8939
  container,
8902
8940
  fragmentEndAnchor,
8903
8941
  parentComponent,
@@ -9778,6 +9816,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9778
9816
  }
9779
9817
  return hostNextSibling(vnode.anchor || vnode.el);
9780
9818
  };
9819
+ let isFlushing = false;
9781
9820
  const render = (vnode, container, namespace) => {
9782
9821
  if (vnode == null) {
9783
9822
  if (container._vnode) {
@@ -9794,8 +9833,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9794
9833
  namespace
9795
9834
  );
9796
9835
  }
9797
- flushPreFlushCbs();
9798
- flushPostFlushCbs();
9836
+ if (!isFlushing) {
9837
+ isFlushing = true;
9838
+ flushPreFlushCbs();
9839
+ flushPostFlushCbs();
9840
+ isFlushing = false;
9841
+ }
9799
9842
  container._vnode = vnode;
9800
9843
  };
9801
9844
  const internals = {
@@ -10701,7 +10744,14 @@ function createComponentInstance(vnode, parent, suspense) {
10701
10744
  return instance;
10702
10745
  }
10703
10746
  let currentInstance = null;
10704
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10747
+ const getCurrentInstance = () => {
10748
+ if (!!(process.env.NODE_ENV !== "production") && isInComputedGetter) {
10749
+ warn$1(
10750
+ `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.`
10751
+ );
10752
+ }
10753
+ return currentInstance || currentRenderingInstance;
10754
+ };
10705
10755
  let internalSetCurrentInstance;
10706
10756
  let setInSSRSetupState;
10707
10757
  {
@@ -11058,7 +11108,25 @@ function isClassComponent(value) {
11058
11108
  return isFunction(value) && "__vccOpts" in value;
11059
11109
  }
11060
11110
 
11111
+ let isInComputedGetter = false;
11112
+ function wrapComputedGetter(getter) {
11113
+ return () => {
11114
+ isInComputedGetter = true;
11115
+ try {
11116
+ return getter();
11117
+ } finally {
11118
+ isInComputedGetter = false;
11119
+ }
11120
+ };
11121
+ }
11061
11122
  const computed = (getterOrOptions, debugOptions) => {
11123
+ if (!!(process.env.NODE_ENV !== "production")) {
11124
+ if (isFunction(getterOrOptions)) {
11125
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11126
+ } else {
11127
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11128
+ }
11129
+ }
11062
11130
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11063
11131
  };
11064
11132
 
@@ -11284,7 +11352,7 @@ function isMemoSame(cached, memo) {
11284
11352
  return true;
11285
11353
  }
11286
11354
 
11287
- const version = "3.4.5";
11355
+ const version = "3.4.6";
11288
11356
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
11289
11357
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11290
11358
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
@@ -11733,6 +11801,9 @@ const vShow = {
11733
11801
  setDisplay(el, value);
11734
11802
  }
11735
11803
  };
11804
+ if (!!(process.env.NODE_ENV !== "production")) {
11805
+ vShow.name = "show";
11806
+ }
11736
11807
  function setDisplay(el, value) {
11737
11808
  el.style.display = value ? el[vShowOldKey] : "none";
11738
11809
  }
@@ -1827,7 +1827,9 @@ var Vue = (function () {
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 Vue = (function () {
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;
@@ -3451,6 +3452,7 @@ If this is a native custom element, make sure to exclude it from component resol
3451
3452
  {
3452
3453
  assertNumber(timeout, `Suspense timeout`);
3453
3454
  }
3455
+ const initialAnchor = anchor;
3454
3456
  const suspense = {
3455
3457
  vnode,
3456
3458
  parent: parentSuspense,
@@ -3458,7 +3460,6 @@ If this is a native custom element, make sure to exclude it from component resol
3458
3460
  namespace,
3459
3461
  container,
3460
3462
  hiddenContainer,
3461
- anchor,
3462
3463
  deps: 0,
3463
3464
  pendingId: suspenseId++,
3464
3465
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -3501,20 +3502,21 @@ If this is a native custom element, make sure to exclude it from component resol
3501
3502
  move(
3502
3503
  pendingBranch,
3503
3504
  container2,
3504
- next(activeBranch),
3505
+ anchor === initialAnchor ? next(activeBranch) : anchor,
3505
3506
  0
3506
3507
  );
3507
3508
  queuePostFlushCb(effects);
3508
3509
  }
3509
3510
  };
3510
3511
  }
3511
- let { anchor: anchor2 } = suspense;
3512
3512
  if (activeBranch) {
3513
- anchor2 = next(activeBranch);
3513
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
3514
+ anchor = next(activeBranch);
3515
+ }
3514
3516
  unmount(activeBranch, parentComponent2, suspense, true);
3515
3517
  }
3516
3518
  if (!delayEnter) {
3517
- move(pendingBranch, container2, anchor2, 0);
3519
+ move(pendingBranch, container2, anchor, 0);
3518
3520
  }
3519
3521
  }
3520
3522
  setActiveBranch(suspense, pendingBranch);
@@ -6456,7 +6458,7 @@ If this is a native custom element, make sure to exclude it from component resol
6456
6458
  return vm;
6457
6459
  }
6458
6460
  }
6459
- Vue.version = `2.6.14-compat:${"3.4.5"}`;
6461
+ Vue.version = `2.6.14-compat:${"3.4.6"}`;
6460
6462
  Vue.config = singletonApp.config;
6461
6463
  Vue.use = (p, ...options) => {
6462
6464
  if (p && isFunction(p.install)) {
@@ -8001,7 +8003,7 @@ Server rendered element contains more child nodes than client vdom.`
8001
8003
  if (props) {
8002
8004
  {
8003
8005
  for (const key in props) {
8004
- if (propHasMismatch(el, key, props[key])) {
8006
+ if (propHasMismatch(el, key, props[key], vnode)) {
8005
8007
  hasMismatch = true;
8006
8008
  }
8007
8009
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8176,7 +8178,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8176
8178
  };
8177
8179
  return [hydrate, hydrateNode];
8178
8180
  }
8179
- function propHasMismatch(el, key, clientValue) {
8181
+ function propHasMismatch(el, key, clientValue, vnode) {
8180
8182
  let mismatchType;
8181
8183
  let mismatchKey;
8182
8184
  let actual;
@@ -8188,14 +8190,23 @@ Server rendered element contains fewer child nodes than client vdom.`
8188
8190
  mismatchType = mismatchKey = `class`;
8189
8191
  }
8190
8192
  } else if (key === "style") {
8191
- actual = el.getAttribute("style");
8192
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8193
- if (actual !== expected) {
8193
+ actual = toStyleMap(el.getAttribute("style") || "");
8194
+ expected = toStyleMap(
8195
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8196
+ );
8197
+ if (vnode.dirs) {
8198
+ for (const { dir, value } of vnode.dirs) {
8199
+ if (dir.name === "show" && !value) {
8200
+ expected.set("display", "none");
8201
+ }
8202
+ }
8203
+ }
8204
+ if (!isMapEqual(actual, expected)) {
8194
8205
  mismatchType = mismatchKey = "style";
8195
8206
  }
8196
8207
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8197
- actual = el.hasAttribute(key) && el.getAttribute(key);
8198
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
8208
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8209
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8199
8210
  if (actual !== expected) {
8200
8211
  mismatchType = `attribute`;
8201
8212
  mismatchKey = key;
@@ -8230,6 +8241,29 @@ Server rendered element contains fewer child nodes than client vdom.`
8230
8241
  }
8231
8242
  return true;
8232
8243
  }
8244
+ function toStyleMap(str) {
8245
+ const styleMap = /* @__PURE__ */ new Map();
8246
+ for (const item of str.split(";")) {
8247
+ let [key, value] = item.split(":");
8248
+ key = key == null ? void 0 : key.trim();
8249
+ value = value == null ? void 0 : value.trim();
8250
+ if (key && value) {
8251
+ styleMap.set(key, value);
8252
+ }
8253
+ }
8254
+ return styleMap;
8255
+ }
8256
+ function isMapEqual(a, b) {
8257
+ if (a.size !== b.size) {
8258
+ return false;
8259
+ }
8260
+ for (const [key, value] of a) {
8261
+ if (value !== b.get(key)) {
8262
+ return false;
8263
+ }
8264
+ }
8265
+ return true;
8266
+ }
8233
8267
 
8234
8268
  let supported;
8235
8269
  let perf;
@@ -8818,7 +8852,11 @@ Server rendered element contains fewer child nodes than client vdom.`
8818
8852
  hostInsert(fragmentStartAnchor, container, anchor);
8819
8853
  hostInsert(fragmentEndAnchor, container, anchor);
8820
8854
  mountChildren(
8821
- n2.children,
8855
+ // #10007
8856
+ // such fragment like `<></>` will be compiled into
8857
+ // a fragment which doesn't have a children.
8858
+ // In this case fallback to an empty array
8859
+ n2.children || [],
8822
8860
  container,
8823
8861
  fragmentEndAnchor,
8824
8862
  parentComponent,
@@ -9686,6 +9724,7 @@ Server rendered element contains fewer child nodes than client vdom.`
9686
9724
  }
9687
9725
  return hostNextSibling(vnode.anchor || vnode.el);
9688
9726
  };
9727
+ let isFlushing = false;
9689
9728
  const render = (vnode, container, namespace) => {
9690
9729
  if (vnode == null) {
9691
9730
  if (container._vnode) {
@@ -9702,8 +9741,12 @@ Server rendered element contains fewer child nodes than client vdom.`
9702
9741
  namespace
9703
9742
  );
9704
9743
  }
9705
- flushPreFlushCbs();
9706
- flushPostFlushCbs();
9744
+ if (!isFlushing) {
9745
+ isFlushing = true;
9746
+ flushPreFlushCbs();
9747
+ flushPostFlushCbs();
9748
+ isFlushing = false;
9749
+ }
9707
9750
  container._vnode = vnode;
9708
9751
  };
9709
9752
  const internals = {
@@ -10607,7 +10650,14 @@ Component that was made reactive: `,
10607
10650
  return instance;
10608
10651
  }
10609
10652
  let currentInstance = null;
10610
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10653
+ const getCurrentInstance = () => {
10654
+ if (isInComputedGetter) {
10655
+ warn$1(
10656
+ `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.`
10657
+ );
10658
+ }
10659
+ return currentInstance || currentRenderingInstance;
10660
+ };
10611
10661
  let internalSetCurrentInstance;
10612
10662
  let setInSSRSetupState;
10613
10663
  {
@@ -10933,7 +10983,25 @@ Component that was made reactive: `,
10933
10983
  return isFunction(value) && "__vccOpts" in value;
10934
10984
  }
10935
10985
 
10986
+ let isInComputedGetter = false;
10987
+ function wrapComputedGetter(getter) {
10988
+ return () => {
10989
+ isInComputedGetter = true;
10990
+ try {
10991
+ return getter();
10992
+ } finally {
10993
+ isInComputedGetter = false;
10994
+ }
10995
+ };
10996
+ }
10936
10997
  const computed = (getterOrOptions, debugOptions) => {
10998
+ {
10999
+ if (isFunction(getterOrOptions)) {
11000
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
11001
+ } else {
11002
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11003
+ }
11004
+ }
10937
11005
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10938
11006
  };
10939
11007
 
@@ -11159,7 +11227,7 @@ Component that was made reactive: `,
11159
11227
  return true;
11160
11228
  }
11161
11229
 
11162
- const version = "3.4.5";
11230
+ const version = "3.4.6";
11163
11231
  const warn = warn$1 ;
11164
11232
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11165
11233
  const devtools = devtools$1 ;
@@ -11600,6 +11668,9 @@ Component that was made reactive: `,
11600
11668
  setDisplay(el, value);
11601
11669
  }
11602
11670
  };
11671
+ {
11672
+ vShow.name = "show";
11673
+ }
11603
11674
  function setDisplay(el, value) {
11604
11675
  el.style.display = value ? el[vShowOldKey] : "none";
11605
11676
  }