@vue/compat 3.5.22 → 3.5.23

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.22
2
+ * @vue/compat v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -4725,14 +4725,16 @@ Server rendered element contains more child nodes than client vdom.`
4725
4725
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4726
4726
  clientText = clientText.slice(1);
4727
4727
  }
4728
- if (el.textContent !== clientText) {
4728
+ const { textContent } = el;
4729
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4730
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4729
4731
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4730
4732
  warn$1(
4731
4733
  `Hydration text content mismatch on`,
4732
4734
  el,
4733
4735
  `
4734
- - rendered on server: ${el.textContent}
4735
- - expected on client: ${vnode.children}`
4736
+ - rendered on server: ${textContent}
4737
+ - expected on client: ${clientText}`
4736
4738
  );
4737
4739
  logMismatchError();
4738
4740
  }
@@ -5327,7 +5329,10 @@ function defineAsyncComponent(source) {
5327
5329
  error: error.value
5328
5330
  });
5329
5331
  } else if (loadingComponent && !delayed.value) {
5330
- return createVNode(loadingComponent);
5332
+ return createInnerComp(
5333
+ loadingComponent,
5334
+ instance
5335
+ );
5331
5336
  }
5332
5337
  };
5333
5338
  }
@@ -7272,7 +7277,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7272
7277
  return vm;
7273
7278
  }
7274
7279
  }
7275
- Vue.version = `2.6.14-compat:${"3.5.22"}`;
7280
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7276
7281
  Vue.config = singletonApp.config;
7277
7282
  Vue.use = (plugin, ...options) => {
7278
7283
  if (plugin && isFunction(plugin.install)) {
@@ -8718,15 +8723,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8718
8723
  optimized
8719
8724
  );
8720
8725
  } else {
8721
- patchElement(
8722
- n1,
8723
- n2,
8724
- parentComponent,
8725
- parentSuspense,
8726
- namespace,
8727
- slotScopeIds,
8728
- optimized
8729
- );
8726
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8727
+ try {
8728
+ if (customElement) {
8729
+ customElement._beginPatch();
8730
+ }
8731
+ patchElement(
8732
+ n1,
8733
+ n2,
8734
+ parentComponent,
8735
+ parentSuspense,
8736
+ namespace,
8737
+ slotScopeIds,
8738
+ optimized
8739
+ );
8740
+ } finally {
8741
+ if (customElement) {
8742
+ customElement._endPatch();
8743
+ }
8744
+ }
8730
8745
  }
8731
8746
  };
8732
8747
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -11031,7 +11046,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11031
11046
  pendingId,
11032
11047
  effects,
11033
11048
  parentComponent: parentComponent2,
11034
- container: container2
11049
+ container: container2,
11050
+ isInFallback
11035
11051
  } = suspense;
11036
11052
  let delayEnter = false;
11037
11053
  if (suspense.isHydrating) {
@@ -11048,6 +11064,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11048
11064
  0
11049
11065
  );
11050
11066
  queuePostFlushCb(effects);
11067
+ if (isInFallback && vnode2.ssFallback) {
11068
+ vnode2.ssFallback.el = null;
11069
+ }
11051
11070
  }
11052
11071
  };
11053
11072
  }
@@ -11056,6 +11075,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11056
11075
  anchor = next(activeBranch);
11057
11076
  }
11058
11077
  unmount(activeBranch, parentComponent2, suspense, true);
11078
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11079
+ vnode2.ssFallback.el = null;
11080
+ }
11059
11081
  }
11060
11082
  if (!delayEnter) {
11061
11083
  move(pendingBranch, container2, anchor, 0);
@@ -11174,6 +11196,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11174
11196
  optimized2
11175
11197
  );
11176
11198
  if (placeholder) {
11199
+ vnode2.placeholder = null;
11177
11200
  remove(placeholder);
11178
11201
  }
11179
11202
  updateHOCHostEl(instance, vnode2.el);
@@ -12428,7 +12451,7 @@ function isMemoSame(cached, memo) {
12428
12451
  return true;
12429
12452
  }
12430
12453
 
12431
- const version = "3.5.22";
12454
+ const version = "3.5.23";
12432
12455
  const warn = warn$1 ;
12433
12456
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12434
12457
  const devtools = devtools$1 ;
@@ -13338,6 +13361,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
13338
13361
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13339
13362
  return false;
13340
13363
  }
13364
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13365
+ return false;
13366
+ }
13341
13367
  if (key === "form") {
13342
13368
  return false;
13343
13369
  }
@@ -13398,6 +13424,8 @@ class VueElement extends BaseClass {
13398
13424
  this._nonce = this._def.nonce;
13399
13425
  this._connected = false;
13400
13426
  this._resolved = false;
13427
+ this._patching = false;
13428
+ this._dirty = false;
13401
13429
  this._numberProps = null;
13402
13430
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13403
13431
  this._ob = null;
@@ -13573,7 +13601,7 @@ class VueElement extends BaseClass {
13573
13601
  return this._getProp(key);
13574
13602
  },
13575
13603
  set(val) {
13576
- this._setProp(key, val, true, true);
13604
+ this._setProp(key, val, true, !this._patching);
13577
13605
  }
13578
13606
  });
13579
13607
  }
@@ -13599,6 +13627,7 @@ class VueElement extends BaseClass {
13599
13627
  */
13600
13628
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13601
13629
  if (val !== this._props[key]) {
13630
+ this._dirty = true;
13602
13631
  if (val === REMOVAL) {
13603
13632
  delete this._props[key];
13604
13633
  } else {
@@ -13753,10 +13782,14 @@ class VueElement extends BaseClass {
13753
13782
  if (this._teleportTargets) {
13754
13783
  roots.push(...this._teleportTargets);
13755
13784
  }
13756
- return roots.reduce((res, i) => {
13757
- res.push(...Array.from(i.querySelectorAll("slot")));
13758
- return res;
13759
- }, []);
13785
+ const slots = /* @__PURE__ */ new Set();
13786
+ for (const root of roots) {
13787
+ const found = root.querySelectorAll("slot");
13788
+ for (let i = 0; i < found.length; i++) {
13789
+ slots.add(found[i]);
13790
+ }
13791
+ }
13792
+ return Array.from(slots);
13760
13793
  }
13761
13794
  /**
13762
13795
  * @internal
@@ -13764,6 +13797,22 @@ class VueElement extends BaseClass {
13764
13797
  _injectChildStyle(comp) {
13765
13798
  this._applyStyles(comp.styles, comp);
13766
13799
  }
13800
+ /**
13801
+ * @internal
13802
+ */
13803
+ _beginPatch() {
13804
+ this._patching = true;
13805
+ this._dirty = false;
13806
+ }
13807
+ /**
13808
+ * @internal
13809
+ */
13810
+ _endPatch() {
13811
+ this._patching = false;
13812
+ if (this._dirty && this._instance) {
13813
+ this._update();
13814
+ }
13815
+ }
13767
13816
  /**
13768
13817
  * @internal
13769
13818
  */
@@ -13907,10 +13956,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13907
13956
  instance
13908
13957
  )
13909
13958
  );
13910
- positionMap.set(
13911
- child,
13912
- child.el.getBoundingClientRect()
13913
- );
13959
+ positionMap.set(child, {
13960
+ left: child.el.offsetLeft,
13961
+ top: child.el.offsetTop
13962
+ });
13914
13963
  }
13915
13964
  }
13916
13965
  }
@@ -13941,7 +13990,10 @@ function callPendingCbs(c) {
13941
13990
  }
13942
13991
  }
13943
13992
  function recordPosition(c) {
13944
- newPositionMap.set(c, c.el.getBoundingClientRect());
13993
+ newPositionMap.set(c, {
13994
+ left: c.el.offsetLeft,
13995
+ top: c.el.offsetTop
13996
+ });
13945
13997
  }
13946
13998
  function applyTranslation(c) {
13947
13999
  const oldPos = positionMap.get(c);
@@ -13987,24 +14039,22 @@ function onCompositionEnd(e) {
13987
14039
  }
13988
14040
  }
13989
14041
  const assignKey = Symbol("_assign");
14042
+ function castValue(value, trim, number) {
14043
+ if (trim) value = value.trim();
14044
+ if (number) value = looseToNumber(value);
14045
+ return value;
14046
+ }
13990
14047
  const vModelText = {
13991
14048
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13992
14049
  el[assignKey] = getModelAssigner(vnode);
13993
14050
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13994
14051
  addEventListener(el, lazy ? "change" : "input", (e) => {
13995
14052
  if (e.target.composing) return;
13996
- let domValue = el.value;
13997
- if (trim) {
13998
- domValue = domValue.trim();
13999
- }
14000
- if (castToNumber) {
14001
- domValue = looseToNumber(domValue);
14002
- }
14003
- el[assignKey](domValue);
14053
+ el[assignKey](castValue(el.value, trim, castToNumber));
14004
14054
  });
14005
- if (trim) {
14055
+ if (trim || castToNumber) {
14006
14056
  addEventListener(el, "change", () => {
14007
- el.value = el.value.trim();
14057
+ el.value = castValue(el.value, trim, castToNumber);
14008
14058
  });
14009
14059
  }
14010
14060
  if (!lazy) {
@@ -19888,7 +19938,8 @@ const transformMemo = (node, context) => {
19888
19938
  const transformVBindShorthand = (node, context) => {
19889
19939
  if (node.type === 1) {
19890
19940
  for (const prop of node.props) {
19891
- if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
19941
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
19942
+ prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
19892
19943
  const arg = prop.arg;
19893
19944
  if (arg.type !== 4 || !arg.isStatic) {
19894
19945
  context.onError(