@vue/runtime-dom 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.
@@ -392,6 +392,9 @@ const vShow = {
392
392
  setDisplay(el, value);
393
393
  }
394
394
  };
395
+ {
396
+ vShow.name = "show";
397
+ }
395
398
  function setDisplay(el, value) {
396
399
  el.style.display = value ? el[vShowOldKey] : "none";
397
400
  }
@@ -120,7 +120,9 @@ declare const vShowOldKey: unique symbol;
120
120
  interface VShowElement extends HTMLElement {
121
121
  [vShowOldKey]: string;
122
122
  }
123
- export declare const vShow: ObjectDirective<VShowElement>;
123
+ export declare const vShow: ObjectDirective<VShowElement> & {
124
+ name?: 'show';
125
+ };
124
126
 
125
127
  export interface CSSProperties extends CSS.Properties<string | number>, CSS.PropertiesHyphen<string | number> {
126
128
  /**
@@ -704,7 +706,7 @@ export interface TextareaHTMLAttributes extends HTMLAttributes {
704
706
  readonly?: Booleanish;
705
707
  required?: Booleanish;
706
708
  rows?: Numberish;
707
- value?: string | ReadonlyArray<string> | number;
709
+ value?: string | ReadonlyArray<string> | number | null;
708
710
  wrap?: string;
709
711
  }
710
712
  export interface TdHTMLAttributes extends HTMLAttributes {
@@ -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;
@@ -2927,6 +2928,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2927
2928
  {
2928
2929
  assertNumber(timeout, `Suspense timeout`);
2929
2930
  }
2931
+ const initialAnchor = anchor;
2930
2932
  const suspense = {
2931
2933
  vnode,
2932
2934
  parent: parentSuspense,
@@ -2934,7 +2936,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2934
2936
  namespace,
2935
2937
  container,
2936
2938
  hiddenContainer,
2937
- anchor,
2938
2939
  deps: 0,
2939
2940
  pendingId: suspenseId++,
2940
2941
  timeout: typeof timeout === "number" ? timeout : -1,
@@ -2977,20 +2978,21 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2977
2978
  move(
2978
2979
  pendingBranch,
2979
2980
  container2,
2980
- next(activeBranch),
2981
+ anchor === initialAnchor ? next(activeBranch) : anchor,
2981
2982
  0
2982
2983
  );
2983
2984
  queuePostFlushCb(effects);
2984
2985
  }
2985
2986
  };
2986
2987
  }
2987
- let { anchor: anchor2 } = suspense;
2988
2988
  if (activeBranch) {
2989
- anchor2 = next(activeBranch);
2989
+ if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
2990
+ anchor = next(activeBranch);
2991
+ }
2990
2992
  unmount(activeBranch, parentComponent2, suspense, true);
2991
2993
  }
2992
2994
  if (!delayEnter) {
2993
- move(pendingBranch, container2, anchor2, 0);
2995
+ move(pendingBranch, container2, anchor, 0);
2994
2996
  }
2995
2997
  }
2996
2998
  setActiveBranch(suspense, pendingBranch);
@@ -3443,14 +3445,9 @@ function instanceWatch(source, value, options) {
3443
3445
  cb = value.handler;
3444
3446
  options = value;
3445
3447
  }
3446
- const cur = currentInstance;
3447
- setCurrentInstance(this);
3448
+ const reset = setCurrentInstance(this);
3448
3449
  const res = doWatch(getter, cb.bind(publicThis), options);
3449
- if (cur) {
3450
- setCurrentInstance(cur);
3451
- } else {
3452
- unsetCurrentInstance();
3453
- }
3450
+ reset();
3454
3451
  return res;
3455
3452
  }
3456
3453
  function createPathGetter(ctx, path) {
@@ -3502,12 +3499,11 @@ function validateDirectiveName(name) {
3502
3499
  }
3503
3500
  }
3504
3501
  function withDirectives(vnode, directives) {
3505
- const internalInstance = currentRenderingInstance;
3506
- if (internalInstance === null) {
3502
+ if (currentRenderingInstance === null) {
3507
3503
  warn$1(`withDirectives can only be used inside render functions.`);
3508
3504
  return vnode;
3509
3505
  }
3510
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3506
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3511
3507
  const bindings = vnode.dirs || (vnode.dirs = []);
3512
3508
  for (let i = 0; i < directives.length; i++) {
3513
3509
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4287,9 +4283,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
4287
4283
  return;
4288
4284
  }
4289
4285
  pauseTracking();
4290
- setCurrentInstance(target);
4286
+ const reset = setCurrentInstance(target);
4291
4287
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4292
- unsetCurrentInstance();
4288
+ reset();
4293
4289
  resetTracking();
4294
4290
  return res;
4295
4291
  });
@@ -5674,12 +5670,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5674
5670
  if (key in propsDefaults) {
5675
5671
  value = propsDefaults[key];
5676
5672
  } else {
5677
- setCurrentInstance(instance);
5673
+ const reset = setCurrentInstance(instance);
5678
5674
  value = propsDefaults[key] = defaultValue.call(
5679
5675
  null,
5680
5676
  props
5681
5677
  );
5682
- unsetCurrentInstance();
5678
+ reset();
5683
5679
  }
5684
5680
  } else {
5685
5681
  value = defaultValue;
@@ -6374,7 +6370,7 @@ Server rendered element contains more child nodes than client vdom.`
6374
6370
  if (props) {
6375
6371
  {
6376
6372
  for (const key in props) {
6377
- if (propHasMismatch(el, key, props[key])) {
6373
+ if (propHasMismatch(el, key, props[key], vnode)) {
6378
6374
  hasMismatch = true;
6379
6375
  }
6380
6376
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6549,7 +6545,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6549
6545
  };
6550
6546
  return [hydrate, hydrateNode];
6551
6547
  }
6552
- function propHasMismatch(el, key, clientValue) {
6548
+ function propHasMismatch(el, key, clientValue, vnode) {
6553
6549
  let mismatchType;
6554
6550
  let mismatchKey;
6555
6551
  let actual;
@@ -6561,14 +6557,23 @@ function propHasMismatch(el, key, clientValue) {
6561
6557
  mismatchType = mismatchKey = `class`;
6562
6558
  }
6563
6559
  } else if (key === "style") {
6564
- actual = el.getAttribute("style");
6565
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6566
- if (actual !== expected) {
6560
+ actual = toStyleMap(el.getAttribute("style") || "");
6561
+ expected = toStyleMap(
6562
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6563
+ );
6564
+ if (vnode.dirs) {
6565
+ for (const { dir, value } of vnode.dirs) {
6566
+ if (dir.name === "show" && !value) {
6567
+ expected.set("display", "none");
6568
+ }
6569
+ }
6570
+ }
6571
+ if (!isMapEqual(actual, expected)) {
6567
6572
  mismatchType = mismatchKey = "style";
6568
6573
  }
6569
6574
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6570
- actual = el.hasAttribute(key) && el.getAttribute(key);
6571
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? false : String(clientValue);
6575
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6576
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6572
6577
  if (actual !== expected) {
6573
6578
  mismatchType = `attribute`;
6574
6579
  mismatchKey = key;
@@ -6603,6 +6608,29 @@ function isSetEqual(a, b) {
6603
6608
  }
6604
6609
  return true;
6605
6610
  }
6611
+ function toStyleMap(str) {
6612
+ const styleMap = /* @__PURE__ */ new Map();
6613
+ for (const item of str.split(";")) {
6614
+ let [key, value] = item.split(":");
6615
+ key = key == null ? void 0 : key.trim();
6616
+ value = value == null ? void 0 : value.trim();
6617
+ if (key && value) {
6618
+ styleMap.set(key, value);
6619
+ }
6620
+ }
6621
+ return styleMap;
6622
+ }
6623
+ function isMapEqual(a, b) {
6624
+ if (a.size !== b.size) {
6625
+ return false;
6626
+ }
6627
+ for (const [key, value] of a) {
6628
+ if (value !== b.get(key)) {
6629
+ return false;
6630
+ }
6631
+ }
6632
+ return true;
6633
+ }
6606
6634
 
6607
6635
  let supported;
6608
6636
  let perf;
@@ -7191,7 +7219,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7191
7219
  hostInsert(fragmentStartAnchor, container, anchor);
7192
7220
  hostInsert(fragmentEndAnchor, container, anchor);
7193
7221
  mountChildren(
7194
- n2.children,
7222
+ // #10007
7223
+ // such fragment like `<></>` will be compiled into
7224
+ // a fragment which doesn't have a children.
7225
+ // In this case fallback to an empty array
7226
+ n2.children || [],
7195
7227
  container,
7196
7228
  fragmentEndAnchor,
7197
7229
  parentComponent,
@@ -8025,6 +8057,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8025
8057
  }
8026
8058
  return hostNextSibling(vnode.anchor || vnode.el);
8027
8059
  };
8060
+ let isFlushing = false;
8028
8061
  const render = (vnode, container, namespace) => {
8029
8062
  if (vnode == null) {
8030
8063
  if (container._vnode) {
@@ -8041,8 +8074,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8041
8074
  namespace
8042
8075
  );
8043
8076
  }
8044
- flushPreFlushCbs();
8045
- flushPostFlushCbs();
8077
+ if (!isFlushing) {
8078
+ isFlushing = true;
8079
+ flushPreFlushCbs();
8080
+ flushPostFlushCbs();
8081
+ isFlushing = false;
8082
+ }
8046
8083
  container._vnode = vnode;
8047
8084
  };
8048
8085
  const internals = {
@@ -8897,8 +8934,13 @@ let setInSSRSetupState;
8897
8934
  };
8898
8935
  }
8899
8936
  const setCurrentInstance = (instance) => {
8937
+ const prev = currentInstance;
8900
8938
  internalSetCurrentInstance(instance);
8901
8939
  instance.scope.on();
8940
+ return () => {
8941
+ instance.scope.off();
8942
+ internalSetCurrentInstance(prev);
8943
+ };
8902
8944
  };
8903
8945
  const unsetCurrentInstance = () => {
8904
8946
  currentInstance && currentInstance.scope.off();
@@ -8960,7 +9002,7 @@ function setupStatefulComponent(instance, isSSR) {
8960
9002
  const { setup } = Component;
8961
9003
  if (setup) {
8962
9004
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
8963
- setCurrentInstance(instance);
9005
+ const reset = setCurrentInstance(instance);
8964
9006
  pauseTracking();
8965
9007
  const setupResult = callWithErrorHandling(
8966
9008
  setup,
@@ -8972,7 +9014,7 @@ function setupStatefulComponent(instance, isSSR) {
8972
9014
  ]
8973
9015
  );
8974
9016
  resetTracking();
8975
- unsetCurrentInstance();
9017
+ reset();
8976
9018
  if (isPromise(setupResult)) {
8977
9019
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
8978
9020
  if (isSSR) {
@@ -9066,13 +9108,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9066
9108
  }
9067
9109
  }
9068
9110
  {
9069
- setCurrentInstance(instance);
9111
+ const reset = setCurrentInstance(instance);
9070
9112
  pauseTracking();
9071
9113
  try {
9072
9114
  applyOptions(instance);
9073
9115
  } finally {
9074
9116
  resetTracking();
9075
- unsetCurrentInstance();
9117
+ reset();
9076
9118
  }
9077
9119
  }
9078
9120
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9425,7 +9467,7 @@ function isMemoSame(cached, memo) {
9425
9467
  return true;
9426
9468
  }
9427
9469
 
9428
- const version = "3.4.5";
9470
+ const version = "3.4.7";
9429
9471
  const warn = warn$1 ;
9430
9472
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9431
9473
  const devtools = devtools$1 ;
@@ -9822,6 +9864,9 @@ const vShow = {
9822
9864
  setDisplay(el, value);
9823
9865
  }
9824
9866
  };
9867
+ {
9868
+ vShow.name = "show";
9869
+ }
9825
9870
  function setDisplay(el, value) {
9826
9871
  el.style.display = value ? el[vShowOldKey] : "none";
9827
9872
  }