@vue/runtime-dom 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.
@@ -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);
@@ -6374,7 +6376,7 @@ Server rendered element contains more child nodes than client vdom.`
6374
6376
  if (props) {
6375
6377
  {
6376
6378
  for (const key in props) {
6377
- if (propHasMismatch(el, key, props[key])) {
6379
+ if (propHasMismatch(el, key, props[key], vnode)) {
6378
6380
  hasMismatch = true;
6379
6381
  }
6380
6382
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6549,7 +6551,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6549
6551
  };
6550
6552
  return [hydrate, hydrateNode];
6551
6553
  }
6552
- function propHasMismatch(el, key, clientValue) {
6554
+ function propHasMismatch(el, key, clientValue, vnode) {
6553
6555
  let mismatchType;
6554
6556
  let mismatchKey;
6555
6557
  let actual;
@@ -6561,14 +6563,23 @@ function propHasMismatch(el, key, clientValue) {
6561
6563
  mismatchType = mismatchKey = `class`;
6562
6564
  }
6563
6565
  } else if (key === "style") {
6564
- actual = el.getAttribute("style");
6565
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6566
- if (actual !== expected) {
6566
+ actual = toStyleMap(el.getAttribute("style") || "");
6567
+ expected = toStyleMap(
6568
+ isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
6569
+ );
6570
+ if (vnode.dirs) {
6571
+ for (const { dir, value } of vnode.dirs) {
6572
+ if (dir.name === "show" && !value) {
6573
+ expected.set("display", "none");
6574
+ }
6575
+ }
6576
+ }
6577
+ if (!isMapEqual(actual, expected)) {
6567
6578
  mismatchType = mismatchKey = "style";
6568
6579
  }
6569
6580
  } 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);
6581
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
6582
+ expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
6572
6583
  if (actual !== expected) {
6573
6584
  mismatchType = `attribute`;
6574
6585
  mismatchKey = key;
@@ -6603,6 +6614,29 @@ function isSetEqual(a, b) {
6603
6614
  }
6604
6615
  return true;
6605
6616
  }
6617
+ function toStyleMap(str) {
6618
+ const styleMap = /* @__PURE__ */ new Map();
6619
+ for (const item of str.split(";")) {
6620
+ let [key, value] = item.split(":");
6621
+ key = key == null ? void 0 : key.trim();
6622
+ value = value == null ? void 0 : value.trim();
6623
+ if (key && value) {
6624
+ styleMap.set(key, value);
6625
+ }
6626
+ }
6627
+ return styleMap;
6628
+ }
6629
+ function isMapEqual(a, b) {
6630
+ if (a.size !== b.size) {
6631
+ return false;
6632
+ }
6633
+ for (const [key, value] of a) {
6634
+ if (value !== b.get(key)) {
6635
+ return false;
6636
+ }
6637
+ }
6638
+ return true;
6639
+ }
6606
6640
 
6607
6641
  let supported;
6608
6642
  let perf;
@@ -7191,7 +7225,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7191
7225
  hostInsert(fragmentStartAnchor, container, anchor);
7192
7226
  hostInsert(fragmentEndAnchor, container, anchor);
7193
7227
  mountChildren(
7194
- n2.children,
7228
+ // #10007
7229
+ // such fragment like `<></>` will be compiled into
7230
+ // a fragment which doesn't have a children.
7231
+ // In this case fallback to an empty array
7232
+ n2.children || [],
7195
7233
  container,
7196
7234
  fragmentEndAnchor,
7197
7235
  parentComponent,
@@ -8025,6 +8063,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8025
8063
  }
8026
8064
  return hostNextSibling(vnode.anchor || vnode.el);
8027
8065
  };
8066
+ let isFlushing = false;
8028
8067
  const render = (vnode, container, namespace) => {
8029
8068
  if (vnode == null) {
8030
8069
  if (container._vnode) {
@@ -8041,8 +8080,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8041
8080
  namespace
8042
8081
  );
8043
8082
  }
8044
- flushPreFlushCbs();
8045
- flushPostFlushCbs();
8083
+ if (!isFlushing) {
8084
+ isFlushing = true;
8085
+ flushPreFlushCbs();
8086
+ flushPostFlushCbs();
8087
+ isFlushing = false;
8088
+ }
8046
8089
  container._vnode = vnode;
8047
8090
  };
8048
8091
  const internals = {
@@ -8885,7 +8928,14 @@ function createComponentInstance(vnode, parent, suspense) {
8885
8928
  return instance;
8886
8929
  }
8887
8930
  let currentInstance = null;
8888
- const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8931
+ const getCurrentInstance = () => {
8932
+ if (isInComputedGetter) {
8933
+ warn$1(
8934
+ `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.`
8935
+ );
8936
+ }
8937
+ return currentInstance || currentRenderingInstance;
8938
+ };
8889
8939
  let internalSetCurrentInstance;
8890
8940
  let setInSSRSetupState;
8891
8941
  {
@@ -9199,7 +9249,25 @@ function isClassComponent(value) {
9199
9249
  return isFunction(value) && "__vccOpts" in value;
9200
9250
  }
9201
9251
 
9252
+ let isInComputedGetter = false;
9253
+ function wrapComputedGetter(getter) {
9254
+ return () => {
9255
+ isInComputedGetter = true;
9256
+ try {
9257
+ return getter();
9258
+ } finally {
9259
+ isInComputedGetter = false;
9260
+ }
9261
+ };
9262
+ }
9202
9263
  const computed = (getterOrOptions, debugOptions) => {
9264
+ {
9265
+ if (isFunction(getterOrOptions)) {
9266
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
9267
+ } else {
9268
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9269
+ }
9270
+ }
9203
9271
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9204
9272
  };
9205
9273
 
@@ -9425,7 +9493,7 @@ function isMemoSame(cached, memo) {
9425
9493
  return true;
9426
9494
  }
9427
9495
 
9428
- const version = "3.4.5";
9496
+ const version = "3.4.6";
9429
9497
  const warn = warn$1 ;
9430
9498
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9431
9499
  const devtools = devtools$1 ;
@@ -9822,6 +9890,9 @@ const vShow = {
9822
9890
  setDisplay(el, value);
9823
9891
  }
9824
9892
  };
9893
+ {
9894
+ vShow.name = "show";
9895
+ }
9825
9896
  function setDisplay(el, value) {
9826
9897
  el.style.display = value ? el[vShowOldKey] : "none";
9827
9898
  }