@vue/runtime-core 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.
@@ -343,7 +343,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
343
343
  }
344
344
  function flushPostFlushCbs(seen) {
345
345
  if (pendingPostFlushCbs.length) {
346
- const deduped = [...new Set(pendingPostFlushCbs)];
346
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
347
+ (a, b) => getId(a) - getId(b)
348
+ );
347
349
  pendingPostFlushCbs.length = 0;
348
350
  if (activePostFlushCbs) {
349
351
  activePostFlushCbs.push(...deduped);
@@ -353,7 +355,6 @@ function flushPostFlushCbs(seen) {
353
355
  {
354
356
  seen = seen || /* @__PURE__ */ new Map();
355
357
  }
356
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
357
358
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
358
359
  if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
359
360
  continue;
@@ -1446,6 +1447,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1446
1447
  {
1447
1448
  assertNumber(timeout, `Suspense timeout`);
1448
1449
  }
1450
+ const initialAnchor = anchor;
1449
1451
  const suspense = {
1450
1452
  vnode,
1451
1453
  parent: parentSuspense,
@@ -1453,7 +1455,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1453
1455
  namespace,
1454
1456
  container,
1455
1457
  hiddenContainer,
1456
- anchor,
1457
1458
  deps: 0,
1458
1459
  pendingId: suspenseId++,
1459
1460
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -1496,20 +1497,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1496
1497
  move(
1497
1498
  pendingBranch,
1498
1499
  container2,
1499
- next(activeBranch),
1500
+ anchor === initialAnchor ? next(activeBranch) : anchor,
1500
1501
  0
1501
1502
  );
1502
1503
  queuePostFlushCb(effects);
1503
1504
  }
1504
1505
  };
1505
1506
  }
1506
- let { anchor: anchor2 } = suspense;
1507
1507
  if (activeBranch) {
1508
- anchor2 = next(activeBranch);
1508
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
1509
+ anchor = next(activeBranch);
1510
+ }
1509
1511
  unmount(activeBranch, parentComponent2, suspense, true);
1510
1512
  }
1511
1513
  if (!delayEnter) {
1512
- move(pendingBranch, container2, anchor2, 0);
1514
+ move(pendingBranch, container2, anchor, 0);
1513
1515
  }
1514
1516
  }
1515
1517
  setActiveBranch(suspense, pendingBranch);
@@ -1983,14 +1985,9 @@ function instanceWatch(source, value, options) {
1983
1985
  cb = value.handler;
1984
1986
  options = value;
1985
1987
  }
1986
- const cur = currentInstance;
1987
- setCurrentInstance(this);
1988
+ const reset = setCurrentInstance(this);
1988
1989
  const res = doWatch(getter, cb.bind(publicThis), options);
1989
- if (cur) {
1990
- setCurrentInstance(cur);
1991
- } else {
1992
- unsetCurrentInstance();
1993
- }
1990
+ reset();
1994
1991
  return res;
1995
1992
  }
1996
1993
  function createPathGetter(ctx, path) {
@@ -2042,12 +2039,11 @@ function validateDirectiveName(name) {
2042
2039
  }
2043
2040
  }
2044
2041
  function withDirectives(vnode, directives) {
2045
- const internalInstance = currentRenderingInstance;
2046
- if (internalInstance === null) {
2042
+ if (currentRenderingInstance === null) {
2047
2043
  warn$1(`withDirectives can only be used inside render functions.`);
2048
2044
  return vnode;
2049
2045
  }
2050
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
2046
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
2051
2047
  const bindings = vnode.dirs || (vnode.dirs = []);
2052
2048
  for (let i = 0; i < directives.length; i++) {
2053
2049
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -2833,9 +2829,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2833
2829
  return;
2834
2830
  }
2835
2831
  reactivity.pauseTracking();
2836
- setCurrentInstance(target);
2832
+ const reset = setCurrentInstance(target);
2837
2833
  const res = callWithAsyncErrorHandling(hook, target, type, args);
2838
- unsetCurrentInstance();
2834
+ reset();
2839
2835
  reactivity.resetTracking();
2840
2836
  return res;
2841
2837
  });
@@ -4220,12 +4216,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
4220
4216
  if (key in propsDefaults) {
4221
4217
  value = propsDefaults[key];
4222
4218
  } else {
4223
- setCurrentInstance(instance);
4219
+ const reset = setCurrentInstance(instance);
4224
4220
  value = propsDefaults[key] = defaultValue.call(
4225
4221
  null,
4226
4222
  props
4227
4223
  );
4228
- unsetCurrentInstance();
4224
+ reset();
4229
4225
  }
4230
4226
  } else {
4231
4227
  value = defaultValue;
@@ -4920,7 +4916,7 @@ Server rendered element contains more child nodes than client vdom.`
4920
4916
  if (props) {
4921
4917
  {
4922
4918
  for (const key in props) {
4923
- if (propHasMismatch(el, key, props[key])) {
4919
+ if (propHasMismatch(el, key, props[key], vnode)) {
4924
4920
  hasMismatch = true;
4925
4921
  }
4926
4922
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -5095,7 +5091,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5095
5091
  };
5096
5092
  return [hydrate, hydrateNode];
5097
5093
  }
5098
- function propHasMismatch(el, key, clientValue) {
5094
+ function propHasMismatch(el, key, clientValue, vnode) {
5099
5095
  let mismatchType;
5100
5096
  let mismatchKey;
5101
5097
  let actual;
@@ -5107,14 +5103,23 @@ function propHasMismatch(el, key, clientValue) {
5107
5103
  mismatchType = mismatchKey = `class`;
5108
5104
  }
5109
5105
  } else if (key === "style") {
5110
- actual = el.getAttribute("style");
5111
- expected = shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue));
5112
- if (actual !== expected) {
5106
+ actual = toStyleMap(el.getAttribute("style") || "");
5107
+ expected = toStyleMap(
5108
+ shared.isString(clientValue) ? clientValue : shared.stringifyStyle(shared.normalizeStyle(clientValue))
5109
+ );
5110
+ if (vnode.dirs) {
5111
+ for (const { dir, value } of vnode.dirs) {
5112
+ if (dir.name === "show" && !value) {
5113
+ expected.set("display", "none");
5114
+ }
5115
+ }
5116
+ }
5117
+ if (!isMapEqual(actual, expected)) {
5113
5118
  mismatchType = mismatchKey = "style";
5114
5119
  }
5115
5120
  } else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
5116
- actual = el.hasAttribute(key) && el.getAttribute(key);
5117
- expected = shared.isBooleanAttr(key) ? shared.includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
5121
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
5122
+ expected = shared.isBooleanAttr(key) ? shared.includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
5118
5123
  if (actual !== expected) {
5119
5124
  mismatchType = `attribute`;
5120
5125
  mismatchKey = key;
@@ -5149,6 +5154,29 @@ function isSetEqual(a, b) {
5149
5154
  }
5150
5155
  return true;
5151
5156
  }
5157
+ function toStyleMap(str) {
5158
+ const styleMap = /* @__PURE__ */ new Map();
5159
+ for (const item of str.split(";")) {
5160
+ let [key, value] = item.split(":");
5161
+ key = key == null ? void 0 : key.trim();
5162
+ value = value == null ? void 0 : value.trim();
5163
+ if (key && value) {
5164
+ styleMap.set(key, value);
5165
+ }
5166
+ }
5167
+ return styleMap;
5168
+ }
5169
+ function isMapEqual(a, b) {
5170
+ if (a.size !== b.size) {
5171
+ return false;
5172
+ }
5173
+ for (const [key, value] of a) {
5174
+ if (value !== b.get(key)) {
5175
+ return false;
5176
+ }
5177
+ }
5178
+ return true;
5179
+ }
5152
5180
 
5153
5181
  let supported;
5154
5182
  let perf;
@@ -5737,7 +5765,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5737
5765
  hostInsert(fragmentStartAnchor, container, anchor);
5738
5766
  hostInsert(fragmentEndAnchor, container, anchor);
5739
5767
  mountChildren(
5740
- n2.children,
5768
+ // #10007
5769
+ // such fragment like `<></>` will be compiled into
5770
+ // a fragment which doesn't have a children.
5771
+ // In this case fallback to an empty array
5772
+ n2.children || [],
5741
5773
  container,
5742
5774
  fragmentEndAnchor,
5743
5775
  parentComponent,
@@ -6571,6 +6603,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6571
6603
  }
6572
6604
  return hostNextSibling(vnode.anchor || vnode.el);
6573
6605
  };
6606
+ let isFlushing = false;
6574
6607
  const render = (vnode, container, namespace) => {
6575
6608
  if (vnode == null) {
6576
6609
  if (container._vnode) {
@@ -6587,8 +6620,12 @@ function baseCreateRenderer(options, createHydrationFns) {
6587
6620
  namespace
6588
6621
  );
6589
6622
  }
6590
- flushPreFlushCbs();
6591
- flushPostFlushCbs();
6623
+ if (!isFlushing) {
6624
+ isFlushing = true;
6625
+ flushPreFlushCbs();
6626
+ flushPostFlushCbs();
6627
+ isFlushing = false;
6628
+ }
6592
6629
  container._vnode = vnode;
6593
6630
  };
6594
6631
  const internals = {
@@ -7458,8 +7495,13 @@ let setInSSRSetupState;
7458
7495
  );
7459
7496
  }
7460
7497
  const setCurrentInstance = (instance) => {
7498
+ const prev = currentInstance;
7461
7499
  internalSetCurrentInstance(instance);
7462
7500
  instance.scope.on();
7501
+ return () => {
7502
+ instance.scope.off();
7503
+ internalSetCurrentInstance(prev);
7504
+ };
7463
7505
  };
7464
7506
  const unsetCurrentInstance = () => {
7465
7507
  currentInstance && currentInstance.scope.off();
@@ -7521,7 +7563,7 @@ function setupStatefulComponent(instance, isSSR) {
7521
7563
  const { setup } = Component;
7522
7564
  if (setup) {
7523
7565
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
7524
- setCurrentInstance(instance);
7566
+ const reset = setCurrentInstance(instance);
7525
7567
  reactivity.pauseTracking();
7526
7568
  const setupResult = callWithErrorHandling(
7527
7569
  setup,
@@ -7533,7 +7575,7 @@ function setupStatefulComponent(instance, isSSR) {
7533
7575
  ]
7534
7576
  );
7535
7577
  reactivity.resetTracking();
7536
- unsetCurrentInstance();
7578
+ reset();
7537
7579
  if (shared.isPromise(setupResult)) {
7538
7580
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
7539
7581
  if (isSSR) {
@@ -7629,13 +7671,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7629
7671
  }
7630
7672
  }
7631
7673
  {
7632
- setCurrentInstance(instance);
7674
+ const reset = setCurrentInstance(instance);
7633
7675
  reactivity.pauseTracking();
7634
7676
  try {
7635
7677
  applyOptions(instance);
7636
7678
  } finally {
7637
7679
  reactivity.resetTracking();
7638
- unsetCurrentInstance();
7680
+ reset();
7639
7681
  }
7640
7682
  }
7641
7683
  if (!Component.render && instance.render === shared.NOOP && !isSSR) {
@@ -7992,7 +8034,7 @@ function isMemoSame(cached, memo) {
7992
8034
  return true;
7993
8035
  }
7994
8036
 
7995
- const version = "3.4.5";
8037
+ const version = "3.4.7";
7996
8038
  const warn = warn$1 ;
7997
8039
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
7998
8040
  const devtools = devtools$1 ;
@@ -214,14 +214,15 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
214
214
  }
215
215
  function flushPostFlushCbs(seen) {
216
216
  if (pendingPostFlushCbs.length) {
217
- const deduped = [...new Set(pendingPostFlushCbs)];
217
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
218
+ (a, b) => getId(a) - getId(b)
219
+ );
218
220
  pendingPostFlushCbs.length = 0;
219
221
  if (activePostFlushCbs) {
220
222
  activePostFlushCbs.push(...deduped);
221
223
  return;
222
224
  }
223
225
  activePostFlushCbs = deduped;
224
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
225
226
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
226
227
  activePostFlushCbs[postFlushIndex]();
227
228
  }
@@ -935,6 +936,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
935
936
  }
936
937
  }
937
938
  const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
939
+ const initialAnchor = anchor;
938
940
  const suspense = {
939
941
  vnode,
940
942
  parent: parentSuspense,
@@ -942,7 +944,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
942
944
  namespace,
943
945
  container,
944
946
  hiddenContainer,
945
- anchor,
946
947
  deps: 0,
947
948
  pendingId: suspenseId++,
948
949
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -973,20 +974,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
973
974
  move(
974
975
  pendingBranch,
975
976
  container2,
976
- next(activeBranch),
977
+ anchor === initialAnchor ? next(activeBranch) : anchor,
977
978
  0
978
979
  );
979
980
  queuePostFlushCb(effects);
980
981
  }
981
982
  };
982
983
  }
983
- let { anchor: anchor2 } = suspense;
984
984
  if (activeBranch) {
985
- anchor2 = next(activeBranch);
985
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
986
+ anchor = next(activeBranch);
987
+ }
986
988
  unmount(activeBranch, parentComponent2, suspense, true);
987
989
  }
988
990
  if (!delayEnter) {
989
- move(pendingBranch, container2, anchor2, 0);
991
+ move(pendingBranch, container2, anchor, 0);
990
992
  }
991
993
  }
992
994
  setActiveBranch(suspense, pendingBranch);
@@ -1405,14 +1407,9 @@ function instanceWatch(source, value, options) {
1405
1407
  cb = value.handler;
1406
1408
  options = value;
1407
1409
  }
1408
- const cur = currentInstance;
1409
- setCurrentInstance(this);
1410
+ const reset = setCurrentInstance(this);
1410
1411
  const res = doWatch(getter, cb.bind(publicThis), options);
1411
- if (cur) {
1412
- setCurrentInstance(cur);
1413
- } else {
1414
- unsetCurrentInstance();
1415
- }
1412
+ reset();
1416
1413
  return res;
1417
1414
  }
1418
1415
  function createPathGetter(ctx, path) {
@@ -1459,11 +1456,10 @@ function traverse(value, depth, currentDepth = 0, seen) {
1459
1456
  }
1460
1457
 
1461
1458
  function withDirectives(vnode, directives) {
1462
- const internalInstance = currentRenderingInstance;
1463
- if (internalInstance === null) {
1459
+ if (currentRenderingInstance === null) {
1464
1460
  return vnode;
1465
1461
  }
1466
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
1462
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
1467
1463
  const bindings = vnode.dirs || (vnode.dirs = []);
1468
1464
  for (let i = 0; i < directives.length; i++) {
1469
1465
  let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
@@ -2219,9 +2215,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2219
2215
  return;
2220
2216
  }
2221
2217
  reactivity.pauseTracking();
2222
- setCurrentInstance(target);
2218
+ const reset = setCurrentInstance(target);
2223
2219
  const res = callWithAsyncErrorHandling(hook, target, type, args);
2224
- unsetCurrentInstance();
2220
+ reset();
2225
2221
  reactivity.resetTracking();
2226
2222
  return res;
2227
2223
  });
@@ -3279,12 +3275,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3279
3275
  if (key in propsDefaults) {
3280
3276
  value = propsDefaults[key];
3281
3277
  } else {
3282
- setCurrentInstance(instance);
3278
+ const reset = setCurrentInstance(instance);
3283
3279
  value = propsDefaults[key] = defaultValue.call(
3284
3280
  null,
3285
3281
  props
3286
3282
  );
3287
- unsetCurrentInstance();
3283
+ reset();
3288
3284
  }
3289
3285
  } else {
3290
3286
  value = defaultValue;
@@ -4456,7 +4452,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4456
4452
  hostInsert(fragmentStartAnchor, container, anchor);
4457
4453
  hostInsert(fragmentEndAnchor, container, anchor);
4458
4454
  mountChildren(
4459
- n2.children,
4455
+ // #10007
4456
+ // such fragment like `<></>` will be compiled into
4457
+ // a fragment which doesn't have a children.
4458
+ // In this case fallback to an empty array
4459
+ n2.children || [],
4460
4460
  container,
4461
4461
  fragmentEndAnchor,
4462
4462
  parentComponent,
@@ -5204,6 +5204,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5204
5204
  }
5205
5205
  return hostNextSibling(vnode.anchor || vnode.el);
5206
5206
  };
5207
+ let isFlushing = false;
5207
5208
  const render = (vnode, container, namespace) => {
5208
5209
  if (vnode == null) {
5209
5210
  if (container._vnode) {
@@ -5220,8 +5221,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5220
5221
  namespace
5221
5222
  );
5222
5223
  }
5223
- flushPreFlushCbs();
5224
- flushPostFlushCbs();
5224
+ if (!isFlushing) {
5225
+ isFlushing = true;
5226
+ flushPreFlushCbs();
5227
+ flushPostFlushCbs();
5228
+ isFlushing = false;
5229
+ }
5225
5230
  container._vnode = vnode;
5226
5231
  };
5227
5232
  const internals = {
@@ -6031,8 +6036,13 @@ let setInSSRSetupState;
6031
6036
  );
6032
6037
  }
6033
6038
  const setCurrentInstance = (instance) => {
6039
+ const prev = currentInstance;
6034
6040
  internalSetCurrentInstance(instance);
6035
6041
  instance.scope.on();
6042
+ return () => {
6043
+ instance.scope.off();
6044
+ internalSetCurrentInstance(prev);
6045
+ };
6036
6046
  };
6037
6047
  const unsetCurrentInstance = () => {
6038
6048
  currentInstance && currentInstance.scope.off();
@@ -6059,7 +6069,7 @@ function setupStatefulComponent(instance, isSSR) {
6059
6069
  const { setup } = Component;
6060
6070
  if (setup) {
6061
6071
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
6062
- setCurrentInstance(instance);
6072
+ const reset = setCurrentInstance(instance);
6063
6073
  reactivity.pauseTracking();
6064
6074
  const setupResult = callWithErrorHandling(
6065
6075
  setup,
@@ -6071,7 +6081,7 @@ function setupStatefulComponent(instance, isSSR) {
6071
6081
  ]
6072
6082
  );
6073
6083
  reactivity.resetTracking();
6074
- unsetCurrentInstance();
6084
+ reset();
6075
6085
  if (shared.isPromise(setupResult)) {
6076
6086
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
6077
6087
  if (isSSR) {
@@ -6140,13 +6150,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
6140
6150
  }
6141
6151
  }
6142
6152
  {
6143
- setCurrentInstance(instance);
6153
+ const reset = setCurrentInstance(instance);
6144
6154
  reactivity.pauseTracking();
6145
6155
  try {
6146
6156
  applyOptions(instance);
6147
6157
  } finally {
6148
6158
  reactivity.resetTracking();
6149
- unsetCurrentInstance();
6159
+ reset();
6150
6160
  }
6151
6161
  }
6152
6162
  }
@@ -6255,7 +6265,7 @@ function isMemoSame(cached, memo) {
6255
6265
  return true;
6256
6266
  }
6257
6267
 
6258
- const version = "3.4.5";
6268
+ const version = "3.4.7";
6259
6269
  const warn$1 = shared.NOOP;
6260
6270
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6261
6271
  const devtools = void 0;
@@ -185,7 +185,6 @@ export interface SuspenseBoundary {
185
185
  namespace: ElementNamespace;
186
186
  container: RendererElement;
187
187
  hiddenContainer: RendererElement;
188
- anchor: RendererNode | null;
189
188
  activeBranch: VNode | null;
190
189
  pendingBranch: VNode | null;
191
190
  deps: number;
@@ -1396,7 +1395,7 @@ export declare function h(type: typeof Fragment, props?: RawProps | null, childr
1396
1395
  export declare function h(type: typeof Teleport, props: RawProps & TeleportProps, children: RawChildren | RawSlots): VNode;
1397
1396
  export declare function h(type: typeof Suspense, children?: RawChildren): VNode;
1398
1397
  export declare function h(type: typeof Suspense, props?: (RawProps & SuspenseProps) | null, children?: RawChildren | RawSlots): VNode;
1399
- export declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = {}>(type: FunctionalComponent<P, E, S>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | RawSlots): VNode;
1398
+ export declare function h<P, E extends EmitsOptions = {}, S extends Record<string, any> = any>(type: FunctionalComponent<P, any, S, any>, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren | IfAny<S, RawSlots, S>): VNode;
1400
1399
  export declare function h(type: Component, children?: RawChildren): VNode;
1401
1400
  export declare function h<P>(type: ConcreteComponent | string, children?: RawChildren): VNode;
1402
1401
  export declare function h<P>(type: ConcreteComponent<P> | string, props?: (RawProps & P) | ({} extends P ? null : never), children?: RawChildren): VNode;
@@ -345,7 +345,9 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
345
345
  }
346
346
  function flushPostFlushCbs(seen) {
347
347
  if (pendingPostFlushCbs.length) {
348
- const deduped = [...new Set(pendingPostFlushCbs)];
348
+ const deduped = [...new Set(pendingPostFlushCbs)].sort(
349
+ (a, b) => getId(a) - getId(b)
350
+ );
349
351
  pendingPostFlushCbs.length = 0;
350
352
  if (activePostFlushCbs) {
351
353
  activePostFlushCbs.push(...deduped);
@@ -355,7 +357,6 @@ function flushPostFlushCbs(seen) {
355
357
  if (!!(process.env.NODE_ENV !== "production")) {
356
358
  seen = seen || /* @__PURE__ */ new Map();
357
359
  }
358
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
359
360
  for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
360
361
  if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
361
362
  continue;
@@ -1448,6 +1449,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1448
1449
  if (!!(process.env.NODE_ENV !== "production")) {
1449
1450
  assertNumber(timeout, `Suspense timeout`);
1450
1451
  }
1452
+ const initialAnchor = anchor;
1451
1453
  const suspense = {
1452
1454
  vnode,
1453
1455
  parent: parentSuspense,
@@ -1455,7 +1457,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1455
1457
  namespace,
1456
1458
  container,
1457
1459
  hiddenContainer,
1458
- anchor,
1459
1460
  deps: 0,
1460
1461
  pendingId: suspenseId++,
1461
1462
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -1498,20 +1499,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
1498
1499
  move(
1499
1500
  pendingBranch,
1500
1501
  container2,
1501
- next(activeBranch),
1502
+ anchor === initialAnchor ? next(activeBranch) : anchor,
1502
1503
  0
1503
1504
  );
1504
1505
  queuePostFlushCb(effects);
1505
1506
  }
1506
1507
  };
1507
1508
  }
1508
- let { anchor: anchor2 } = suspense;
1509
1509
  if (activeBranch) {
1510
- anchor2 = next(activeBranch);
1510
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
1511
+ anchor = next(activeBranch);
1512
+ }
1511
1513
  unmount(activeBranch, parentComponent2, suspense, true);
1512
1514
  }
1513
1515
  if (!delayEnter) {
1514
- move(pendingBranch, container2, anchor2, 0);
1516
+ move(pendingBranch, container2, anchor, 0);
1515
1517
  }
1516
1518
  }
1517
1519
  setActiveBranch(suspense, pendingBranch);
@@ -1985,14 +1987,9 @@ function instanceWatch(source, value, options) {
1985
1987
  cb = value.handler;
1986
1988
  options = value;
1987
1989
  }
1988
- const cur = currentInstance;
1989
- setCurrentInstance(this);
1990
+ const reset = setCurrentInstance(this);
1990
1991
  const res = doWatch(getter, cb.bind(publicThis), options);
1991
- if (cur) {
1992
- setCurrentInstance(cur);
1993
- } else {
1994
- unsetCurrentInstance();
1995
- }
1992
+ reset();
1996
1993
  return res;
1997
1994
  }
1998
1995
  function createPathGetter(ctx, path) {
@@ -2044,12 +2041,11 @@ function validateDirectiveName(name) {
2044
2041
  }
2045
2042
  }
2046
2043
  function withDirectives(vnode, directives) {
2047
- const internalInstance = currentRenderingInstance;
2048
- if (internalInstance === null) {
2044
+ if (currentRenderingInstance === null) {
2049
2045
  !!(process.env.NODE_ENV !== "production") && warn$1(`withDirectives can only be used inside render functions.`);
2050
2046
  return vnode;
2051
2047
  }
2052
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
2048
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
2053
2049
  const bindings = vnode.dirs || (vnode.dirs = []);
2054
2050
  for (let i = 0; i < directives.length; i++) {
2055
2051
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -2837,9 +2833,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2837
2833
  return;
2838
2834
  }
2839
2835
  pauseTracking();
2840
- setCurrentInstance(target);
2836
+ const reset = setCurrentInstance(target);
2841
2837
  const res = callWithAsyncErrorHandling(hook, target, type, args);
2842
- unsetCurrentInstance();
2838
+ reset();
2843
2839
  resetTracking();
2844
2840
  return res;
2845
2841
  });
@@ -4228,12 +4224,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
4228
4224
  if (key in propsDefaults) {
4229
4225
  value = propsDefaults[key];
4230
4226
  } else {
4231
- setCurrentInstance(instance);
4227
+ const reset = setCurrentInstance(instance);
4232
4228
  value = propsDefaults[key] = defaultValue.call(
4233
4229
  null,
4234
4230
  props
4235
4231
  );
4236
- unsetCurrentInstance();
4232
+ reset();
4237
4233
  }
4238
4234
  } else {
4239
4235
  value = defaultValue;
@@ -4928,7 +4924,7 @@ Server rendered element contains more child nodes than client vdom.`
4928
4924
  if (props) {
4929
4925
  if (!!(process.env.NODE_ENV !== "production") || forcePatch || !optimized || patchFlag & (16 | 32)) {
4930
4926
  for (const key in props) {
4931
- if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key])) {
4927
+ if (!!(process.env.NODE_ENV !== "production") && propHasMismatch(el, key, props[key], vnode)) {
4932
4928
  hasMismatch = true;
4933
4929
  }
4934
4930
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -5113,7 +5109,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5113
5109
  };
5114
5110
  return [hydrate, hydrateNode];
5115
5111
  }
5116
- function propHasMismatch(el, key, clientValue) {
5112
+ function propHasMismatch(el, key, clientValue, vnode) {
5117
5113
  let mismatchType;
5118
5114
  let mismatchKey;
5119
5115
  let actual;
@@ -5125,14 +5121,23 @@ function propHasMismatch(el, key, clientValue) {
5125
5121
  mismatchType = mismatchKey = `class`;
5126
5122
  }
5127
5123
  } else if (key === "style") {
5128
- actual = el.getAttribute("style");
5129
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
5130
- if (actual !== expected) {
5124
+ actual = toStyleMap(el.getAttribute("style") || "");
5125
+ expected = toStyleMap(
5126
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
5127
+ );
5128
+ if (vnode.dirs) {
5129
+ for (const { dir, value } of vnode.dirs) {
5130
+ if (dir.name === "show" && !value) {
5131
+ expected.set("display", "none");
5132
+ }
5133
+ }
5134
+ }
5135
+ if (!isMapEqual(actual, expected)) {
5131
5136
  mismatchType = mismatchKey = "style";
5132
5137
  }
5133
5138
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5134
- actual = el.hasAttribute(key) && el.getAttribute(key);
5135
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
5139
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
5140
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
5136
5141
  if (actual !== expected) {
5137
5142
  mismatchType = `attribute`;
5138
5143
  mismatchKey = key;
@@ -5167,6 +5172,29 @@ function isSetEqual(a, b) {
5167
5172
  }
5168
5173
  return true;
5169
5174
  }
5175
+ function toStyleMap(str) {
5176
+ const styleMap = /* @__PURE__ */ new Map();
5177
+ for (const item of str.split(";")) {
5178
+ let [key, value] = item.split(":");
5179
+ key = key == null ? void 0 : key.trim();
5180
+ value = value == null ? void 0 : value.trim();
5181
+ if (key && value) {
5182
+ styleMap.set(key, value);
5183
+ }
5184
+ }
5185
+ return styleMap;
5186
+ }
5187
+ function isMapEqual(a, b) {
5188
+ if (a.size !== b.size) {
5189
+ return false;
5190
+ }
5191
+ for (const [key, value] of a) {
5192
+ if (value !== b.get(key)) {
5193
+ return false;
5194
+ }
5195
+ }
5196
+ return true;
5197
+ }
5170
5198
 
5171
5199
  let supported;
5172
5200
  let perf;
@@ -5780,7 +5808,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5780
5808
  hostInsert(fragmentStartAnchor, container, anchor);
5781
5809
  hostInsert(fragmentEndAnchor, container, anchor);
5782
5810
  mountChildren(
5783
- n2.children,
5811
+ // #10007
5812
+ // such fragment like `<></>` will be compiled into
5813
+ // a fragment which doesn't have a children.
5814
+ // In this case fallback to an empty array
5815
+ n2.children || [],
5784
5816
  container,
5785
5817
  fragmentEndAnchor,
5786
5818
  parentComponent,
@@ -6627,6 +6659,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6627
6659
  }
6628
6660
  return hostNextSibling(vnode.anchor || vnode.el);
6629
6661
  };
6662
+ let isFlushing = false;
6630
6663
  const render = (vnode, container, namespace) => {
6631
6664
  if (vnode == null) {
6632
6665
  if (container._vnode) {
@@ -6643,8 +6676,12 @@ function baseCreateRenderer(options, createHydrationFns) {
6643
6676
  namespace
6644
6677
  );
6645
6678
  }
6646
- flushPreFlushCbs();
6647
- flushPostFlushCbs();
6679
+ if (!isFlushing) {
6680
+ isFlushing = true;
6681
+ flushPreFlushCbs();
6682
+ flushPostFlushCbs();
6683
+ isFlushing = false;
6684
+ }
6648
6685
  container._vnode = vnode;
6649
6686
  };
6650
6687
  const internals = {
@@ -7516,8 +7553,13 @@ let setInSSRSetupState;
7516
7553
  );
7517
7554
  }
7518
7555
  const setCurrentInstance = (instance) => {
7556
+ const prev = currentInstance;
7519
7557
  internalSetCurrentInstance(instance);
7520
7558
  instance.scope.on();
7559
+ return () => {
7560
+ instance.scope.off();
7561
+ internalSetCurrentInstance(prev);
7562
+ };
7521
7563
  };
7522
7564
  const unsetCurrentInstance = () => {
7523
7565
  currentInstance && currentInstance.scope.off();
@@ -7579,7 +7621,7 @@ function setupStatefulComponent(instance, isSSR) {
7579
7621
  const { setup } = Component;
7580
7622
  if (setup) {
7581
7623
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
7582
- setCurrentInstance(instance);
7624
+ const reset = setCurrentInstance(instance);
7583
7625
  pauseTracking();
7584
7626
  const setupResult = callWithErrorHandling(
7585
7627
  setup,
@@ -7591,7 +7633,7 @@ function setupStatefulComponent(instance, isSSR) {
7591
7633
  ]
7592
7634
  );
7593
7635
  resetTracking();
7594
- unsetCurrentInstance();
7636
+ reset();
7595
7637
  if (isPromise(setupResult)) {
7596
7638
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
7597
7639
  if (isSSR) {
@@ -7687,13 +7729,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7687
7729
  }
7688
7730
  }
7689
7731
  if (__VUE_OPTIONS_API__ && true) {
7690
- setCurrentInstance(instance);
7732
+ const reset = setCurrentInstance(instance);
7691
7733
  pauseTracking();
7692
7734
  try {
7693
7735
  applyOptions(instance);
7694
7736
  } finally {
7695
7737
  resetTracking();
7696
- unsetCurrentInstance();
7738
+ reset();
7697
7739
  }
7698
7740
  }
7699
7741
  if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) {
@@ -8064,7 +8106,7 @@ function isMemoSame(cached, memo) {
8064
8106
  return true;
8065
8107
  }
8066
8108
 
8067
- const version = "3.4.5";
8109
+ const version = "3.4.7";
8068
8110
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8069
8111
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8070
8112
  const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -9,19 +9,6 @@
9
9
  "index.js",
10
10
  "dist"
11
11
  ],
12
- "exports": {
13
- ".": {
14
- "types": "./dist/runtime-core.d.ts",
15
- "node": {
16
- "production": "./dist/runtime-core.cjs.prod.js",
17
- "development": "./dist/runtime-core.cjs.js",
18
- "default": "./index.js"
19
- },
20
- "import": "./dist/runtime-core.esm-bundler.js",
21
- "require": "./index.js"
22
- },
23
- "./*": "./*"
24
- },
25
12
  "buildOptions": {
26
13
  "name": "VueRuntimeCore",
27
14
  "formats": [
@@ -45,7 +32,7 @@
45
32
  },
46
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
47
34
  "dependencies": {
48
- "@vue/shared": "3.4.5",
49
- "@vue/reactivity": "3.4.5"
35
+ "@vue/shared": "3.4.7",
36
+ "@vue/reactivity": "3.4.7"
50
37
  }
51
38
  }