@vue/runtime-dom 3.4.4 → 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);
@@ -3406,10 +3408,11 @@ function doWatch(source, cb, {
3406
3408
  scheduler = () => queueJob(job);
3407
3409
  }
3408
3410
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
3411
+ const scope = getCurrentScope();
3409
3412
  const unwatch = () => {
3410
3413
  effect.stop();
3411
- if (instance && instance.scope) {
3412
- remove(instance.scope.effects, effect);
3414
+ if (scope) {
3415
+ remove(scope.effects, effect);
3413
3416
  }
3414
3417
  };
3415
3418
  {
@@ -6373,7 +6376,7 @@ Server rendered element contains more child nodes than client vdom.`
6373
6376
  if (props) {
6374
6377
  {
6375
6378
  for (const key in props) {
6376
- if (propHasMismatch(el, key, props[key])) {
6379
+ if (propHasMismatch(el, key, props[key], vnode)) {
6377
6380
  hasMismatch = true;
6378
6381
  }
6379
6382
  if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
@@ -6548,7 +6551,7 @@ Server rendered element contains fewer child nodes than client vdom.`
6548
6551
  };
6549
6552
  return [hydrate, hydrateNode];
6550
6553
  }
6551
- function propHasMismatch(el, key, clientValue) {
6554
+ function propHasMismatch(el, key, clientValue, vnode) {
6552
6555
  let mismatchType;
6553
6556
  let mismatchKey;
6554
6557
  let actual;
@@ -6560,14 +6563,23 @@ function propHasMismatch(el, key, clientValue) {
6560
6563
  mismatchType = mismatchKey = `class`;
6561
6564
  }
6562
6565
  } else if (key === "style") {
6563
- actual = el.getAttribute("style");
6564
- expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
6565
- 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)) {
6566
6578
  mismatchType = mismatchKey = "style";
6567
6579
  }
6568
6580
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
6569
- actual = el.hasAttribute(key) && el.getAttribute(key);
6570
- 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);
6571
6583
  if (actual !== expected) {
6572
6584
  mismatchType = `attribute`;
6573
6585
  mismatchKey = key;
@@ -6602,6 +6614,29 @@ function isSetEqual(a, b) {
6602
6614
  }
6603
6615
  return true;
6604
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
+ }
6605
6640
 
6606
6641
  let supported;
6607
6642
  let perf;
@@ -7190,7 +7225,11 @@ function baseCreateRenderer(options, createHydrationFns) {
7190
7225
  hostInsert(fragmentStartAnchor, container, anchor);
7191
7226
  hostInsert(fragmentEndAnchor, container, anchor);
7192
7227
  mountChildren(
7193
- 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 || [],
7194
7233
  container,
7195
7234
  fragmentEndAnchor,
7196
7235
  parentComponent,
@@ -8024,6 +8063,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8024
8063
  }
8025
8064
  return hostNextSibling(vnode.anchor || vnode.el);
8026
8065
  };
8066
+ let isFlushing = false;
8027
8067
  const render = (vnode, container, namespace) => {
8028
8068
  if (vnode == null) {
8029
8069
  if (container._vnode) {
@@ -8040,8 +8080,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8040
8080
  namespace
8041
8081
  );
8042
8082
  }
8043
- flushPreFlushCbs();
8044
- flushPostFlushCbs();
8083
+ if (!isFlushing) {
8084
+ isFlushing = true;
8085
+ flushPreFlushCbs();
8086
+ flushPostFlushCbs();
8087
+ isFlushing = false;
8088
+ }
8045
8089
  container._vnode = vnode;
8046
8090
  };
8047
8091
  const internals = {
@@ -8884,7 +8928,14 @@ function createComponentInstance(vnode, parent, suspense) {
8884
8928
  return instance;
8885
8929
  }
8886
8930
  let currentInstance = null;
8887
- 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
+ };
8888
8939
  let internalSetCurrentInstance;
8889
8940
  let setInSSRSetupState;
8890
8941
  {
@@ -9198,7 +9249,25 @@ function isClassComponent(value) {
9198
9249
  return isFunction(value) && "__vccOpts" in value;
9199
9250
  }
9200
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
+ }
9201
9263
  const computed = (getterOrOptions, debugOptions) => {
9264
+ {
9265
+ if (isFunction(getterOrOptions)) {
9266
+ getterOrOptions = wrapComputedGetter(getterOrOptions);
9267
+ } else {
9268
+ getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9269
+ }
9270
+ }
9202
9271
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9203
9272
  };
9204
9273
 
@@ -9424,7 +9493,7 @@ function isMemoSame(cached, memo) {
9424
9493
  return true;
9425
9494
  }
9426
9495
 
9427
- const version = "3.4.4";
9496
+ const version = "3.4.6";
9428
9497
  const warn = warn$1 ;
9429
9498
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9430
9499
  const devtools = devtools$1 ;
@@ -9821,6 +9890,9 @@ const vShow = {
9821
9890
  setDisplay(el, value);
9822
9891
  }
9823
9892
  };
9893
+ {
9894
+ vShow.name = "show";
9895
+ }
9824
9896
  function setDisplay(el, value) {
9825
9897
  el.style.display = value ? el[vShowOldKey] : "none";
9826
9898
  }