@vue/compat 3.4.5 → 3.4.7

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);
@@ -4012,14 +4014,9 @@ function instanceWatch(source, value, options) {
4012
4014
  cb = value.handler;
4013
4015
  options = value;
4014
4016
  }
4015
- const cur = currentInstance;
4016
- setCurrentInstance(this);
4017
+ const reset = setCurrentInstance(this);
4017
4018
  const res = doWatch(getter, cb.bind(publicThis), options);
4018
- if (cur) {
4019
- setCurrentInstance(cur);
4020
- } else {
4021
- unsetCurrentInstance();
4022
- }
4019
+ reset();
4023
4020
  return res;
4024
4021
  }
4025
4022
  function createPathGetter(ctx, path) {
@@ -4071,12 +4068,11 @@ function validateDirectiveName(name) {
4071
4068
  }
4072
4069
  }
4073
4070
  function withDirectives(vnode, directives) {
4074
- const internalInstance = currentRenderingInstance;
4075
- if (internalInstance === null) {
4071
+ if (currentRenderingInstance === null) {
4076
4072
  warn$1(`withDirectives can only be used inside render functions.`);
4077
4073
  return vnode;
4078
4074
  }
4079
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4075
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4080
4076
  const bindings = vnode.dirs || (vnode.dirs = []);
4081
4077
  for (let i = 0; i < directives.length; i++) {
4082
4078
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4865,9 +4861,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4865
4861
  return;
4866
4862
  }
4867
4863
  pauseTracking();
4868
- setCurrentInstance(target);
4864
+ const reset = setCurrentInstance(target);
4869
4865
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4870
- unsetCurrentInstance();
4866
+ reset();
4871
4867
  resetTracking();
4872
4868
  return res;
4873
4869
  });
@@ -6459,7 +6455,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6459
6455
  return vm;
6460
6456
  }
6461
6457
  }
6462
- Vue.version = `2.6.14-compat:${"3.4.5"}`;
6458
+ Vue.version = `2.6.14-compat:${"3.4.7"}`;
6463
6459
  Vue.config = singletonApp.config;
6464
6460
  Vue.use = (p, ...options) => {
6465
6461
  if (p && isFunction(p.install)) {
@@ -7299,12 +7295,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7299
7295
  if (key in propsDefaults) {
7300
7296
  value = propsDefaults[key];
7301
7297
  } else {
7302
- setCurrentInstance(instance);
7298
+ const reset = setCurrentInstance(instance);
7303
7299
  value = propsDefaults[key] = defaultValue.call(
7304
7300
  isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7305
7301
  props
7306
7302
  );
7307
- unsetCurrentInstance();
7303
+ reset();
7308
7304
  }
7309
7305
  } else {
7310
7306
  value = defaultValue;
@@ -8004,7 +8000,7 @@ Server rendered element contains more child nodes than client vdom.`
8004
8000
  if (props) {
8005
8001
  {
8006
8002
  for (const key in props) {
8007
- if (propHasMismatch(el, key, props[key])) {
8003
+ if (propHasMismatch(el, key, props[key], vnode)) {
8008
8004
  hasMismatch = true;
8009
8005
  }
8010
8006
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -8179,7 +8175,7 @@ Server rendered element contains fewer child nodes than client vdom.`
8179
8175
  };
8180
8176
  return [hydrate, hydrateNode];
8181
8177
  }
8182
- function propHasMismatch(el, key, clientValue) {
8178
+ function propHasMismatch(el, key, clientValue, vnode) {
8183
8179
  let mismatchType;
8184
8180
  let mismatchKey;
8185
8181
  let actual;
@@ -8191,14 +8187,23 @@ function propHasMismatch(el, key, clientValue) {
8191
8187
  mismatchType = mismatchKey = `class`;
8192
8188
  }
8193
8189
  } else if (key === "style") {
8194
- actual = el.getAttribute("style");
8195
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8196
- if (actual !== expected) {
8190
+ actual = toStyleMap(el.getAttribute("style") || "");
8191
+ expected = toStyleMap(
8192
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8193
+ );
8194
+ if (vnode.dirs) {
8195
+ for (const { dir, value } of vnode.dirs) {
8196
+ if (dir.name === "show" && !value) {
8197
+ expected.set("display", "none");
8198
+ }
8199
+ }
8200
+ }
8201
+ if (!isMapEqual(actual, expected)) {
8197
8202
  mismatchType = mismatchKey = "style";
8198
8203
  }
8199
8204
  } 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);
8205
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8206
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8202
8207
  if (actual !== expected) {
8203
8208
  mismatchType = `attribute`;
8204
8209
  mismatchKey = key;
@@ -8233,6 +8238,29 @@ function isSetEqual(a, b) {
8233
8238
  }
8234
8239
  return true;
8235
8240
  }
8241
+ function toStyleMap(str) {
8242
+ const styleMap = /* @__PURE__ */ new Map();
8243
+ for (const item of str.split(";")) {
8244
+ let [key, value] = item.split(":");
8245
+ key = key == null ? void 0 : key.trim();
8246
+ value = value == null ? void 0 : value.trim();
8247
+ if (key && value) {
8248
+ styleMap.set(key, value);
8249
+ }
8250
+ }
8251
+ return styleMap;
8252
+ }
8253
+ function isMapEqual(a, b) {
8254
+ if (a.size !== b.size) {
8255
+ return false;
8256
+ }
8257
+ for (const [key, value] of a) {
8258
+ if (value !== b.get(key)) {
8259
+ return false;
8260
+ }
8261
+ }
8262
+ return true;
8263
+ }
8236
8264
 
8237
8265
  let supported;
8238
8266
  let perf;
@@ -8821,7 +8849,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8821
8849
  hostInsert(fragmentStartAnchor, container, anchor);
8822
8850
  hostInsert(fragmentEndAnchor, container, anchor);
8823
8851
  mountChildren(
8824
- n2.children,
8852
+ // #10007
8853
+ // such fragment like `<></>` will be compiled into
8854
+ // a fragment which doesn't have a children.
8855
+ // In this case fallback to an empty array
8856
+ n2.children || [],
8825
8857
  container,
8826
8858
  fragmentEndAnchor,
8827
8859
  parentComponent,
@@ -9689,6 +9721,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9689
9721
  }
9690
9722
  return hostNextSibling(vnode.anchor || vnode.el);
9691
9723
  };
9724
+ let isFlushing = false;
9692
9725
  const render = (vnode, container, namespace) => {
9693
9726
  if (vnode == null) {
9694
9727
  if (container._vnode) {
@@ -9705,8 +9738,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9705
9738
  namespace
9706
9739
  );
9707
9740
  }
9708
- flushPreFlushCbs();
9709
- flushPostFlushCbs();
9741
+ if (!isFlushing) {
9742
+ isFlushing = true;
9743
+ flushPreFlushCbs();
9744
+ flushPostFlushCbs();
9745
+ isFlushing = false;
9746
+ }
9710
9747
  container._vnode = vnode;
9711
9748
  };
9712
9749
  const internals = {
@@ -10622,8 +10659,13 @@ let setInSSRSetupState;
10622
10659
  };
10623
10660
  }
10624
10661
  const setCurrentInstance = (instance) => {
10662
+ const prev = currentInstance;
10625
10663
  internalSetCurrentInstance(instance);
10626
10664
  instance.scope.on();
10665
+ return () => {
10666
+ instance.scope.off();
10667
+ internalSetCurrentInstance(prev);
10668
+ };
10627
10669
  };
10628
10670
  const unsetCurrentInstance = () => {
10629
10671
  currentInstance && currentInstance.scope.off();
@@ -10685,7 +10727,7 @@ function setupStatefulComponent(instance, isSSR) {
10685
10727
  const { setup } = Component;
10686
10728
  if (setup) {
10687
10729
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10688
- setCurrentInstance(instance);
10730
+ const reset = setCurrentInstance(instance);
10689
10731
  pauseTracking();
10690
10732
  const setupResult = callWithErrorHandling(
10691
10733
  setup,
@@ -10697,7 +10739,7 @@ function setupStatefulComponent(instance, isSSR) {
10697
10739
  ]
10698
10740
  );
10699
10741
  resetTracking();
10700
- unsetCurrentInstance();
10742
+ reset();
10701
10743
  if (isPromise(setupResult)) {
10702
10744
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10703
10745
  if (isSSR) {
@@ -10803,13 +10845,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10803
10845
  }
10804
10846
  }
10805
10847
  if (!skipOptions) {
10806
- setCurrentInstance(instance);
10848
+ const reset = setCurrentInstance(instance);
10807
10849
  pauseTracking();
10808
10850
  try {
10809
10851
  applyOptions(instance);
10810
10852
  } finally {
10811
10853
  resetTracking();
10812
- unsetCurrentInstance();
10854
+ reset();
10813
10855
  }
10814
10856
  }
10815
10857
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -11162,7 +11204,7 @@ function isMemoSame(cached, memo) {
11162
11204
  return true;
11163
11205
  }
11164
11206
 
11165
- const version = "3.4.5";
11207
+ const version = "3.4.7";
11166
11208
  const warn = warn$1 ;
11167
11209
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11168
11210
  const devtools = devtools$1 ;
@@ -11603,6 +11645,9 @@ const vShow = {
11603
11645
  setDisplay(el, value);
11604
11646
  }
11605
11647
  };
11648
+ {
11649
+ vShow.name = "show";
11650
+ }
11606
11651
  function setDisplay(el, value) {
11607
11652
  el.style.display = value ? el[vShowOldKey] : "none";
11608
11653
  }