@vue/compat 3.5.21 → 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.21
2
+ * @vue/compat v3.5.23
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1145,7 +1145,7 @@ var Vue = (function () {
1145
1145
  iter._next = iter.next;
1146
1146
  iter.next = () => {
1147
1147
  const result = iter._next();
1148
- if (result.value) {
1148
+ if (!result.done) {
1149
1149
  result.value = wrapValue(result.value);
1150
1150
  }
1151
1151
  return result;
@@ -1272,7 +1272,8 @@ var Vue = (function () {
1272
1272
  return res;
1273
1273
  }
1274
1274
  if (isRef(res)) {
1275
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1275
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1276
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1276
1277
  }
1277
1278
  if (isObject(res)) {
1278
1279
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2622,14 +2623,11 @@ var Vue = (function () {
2622
2623
  let isHmrUpdating = false;
2623
2624
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2624
2625
  {
2625
- const g = getGlobalThis();
2626
- if (!g.__VUE_HMR_RUNTIME__) {
2627
- g.__VUE_HMR_RUNTIME__ = {
2628
- createRecord: tryWrap(createRecord),
2629
- rerender: tryWrap(rerender),
2630
- reload: tryWrap(reload)
2631
- };
2632
- }
2626
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2627
+ createRecord: tryWrap(createRecord),
2628
+ rerender: tryWrap(rerender),
2629
+ reload: tryWrap(reload)
2630
+ };
2633
2631
  }
2634
2632
  const map = /* @__PURE__ */ new Map();
2635
2633
  function registerHMR(instance) {
@@ -3524,9 +3522,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3524
3522
  insert(mainAnchor, container, anchor);
3525
3523
  const mount = (container2, anchor2) => {
3526
3524
  if (shapeFlag & 16) {
3527
- if (parentComponent && parentComponent.isCE) {
3528
- parentComponent.ce._teleportTarget = container2;
3529
- }
3530
3525
  mountChildren(
3531
3526
  children,
3532
3527
  container2,
@@ -3548,6 +3543,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3548
3543
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3549
3544
  namespace = "mathml";
3550
3545
  }
3546
+ if (parentComponent && parentComponent.isCE) {
3547
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3548
+ }
3551
3549
  if (!disabled) {
3552
3550
  mount(target, targetAnchor);
3553
3551
  updateCssVars(n2, false);
@@ -4657,14 +4655,16 @@ Server rendered element contains more child nodes than client vdom.`
4657
4655
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4658
4656
  clientText = clientText.slice(1);
4659
4657
  }
4660
- if (el.textContent !== clientText) {
4658
+ const { textContent } = el;
4659
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4660
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4661
4661
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4662
4662
  warn$1(
4663
4663
  `Hydration text content mismatch on`,
4664
4664
  el,
4665
4665
  `
4666
- - rendered on server: ${el.textContent}
4667
- - expected on client: ${vnode.children}`
4666
+ - rendered on server: ${textContent}
4667
+ - expected on client: ${clientText}`
4668
4668
  );
4669
4669
  logMismatchError();
4670
4670
  }
@@ -5259,7 +5259,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5259
5259
  error: error.value
5260
5260
  });
5261
5261
  } else if (loadingComponent && !delayed.value) {
5262
- return createVNode(loadingComponent);
5262
+ return createInnerComp(
5263
+ loadingComponent,
5264
+ instance
5265
+ );
5263
5266
  }
5264
5267
  };
5265
5268
  }
@@ -6001,12 +6004,13 @@ If this is a native custom element, make sure to exclude it from component resol
6001
6004
 
6002
6005
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6003
6006
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6007
+ const hasProps = Object.keys(props).length > 0;
6004
6008
  if (name !== "default") props.name = name;
6005
6009
  return openBlock(), createBlock(
6006
6010
  Fragment,
6007
6011
  null,
6008
6012
  [createVNode("slot", props, fallback && fallback())],
6009
- 64
6013
+ hasProps ? -2 : 64
6010
6014
  );
6011
6015
  }
6012
6016
  let slot = slots[name];
@@ -7194,7 +7198,7 @@ If this is a native custom element, make sure to exclude it from component resol
7194
7198
  return vm;
7195
7199
  }
7196
7200
  }
7197
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7201
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7198
7202
  Vue.config = singletonApp.config;
7199
7203
  Vue.use = (plugin, ...options) => {
7200
7204
  if (plugin && isFunction(plugin.install)) {
@@ -8640,15 +8644,25 @@ If you want to remount the same app, move your app creation logic into a factory
8640
8644
  optimized
8641
8645
  );
8642
8646
  } else {
8643
- patchElement(
8644
- n1,
8645
- n2,
8646
- parentComponent,
8647
- parentSuspense,
8648
- namespace,
8649
- slotScopeIds,
8650
- optimized
8651
- );
8647
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8648
+ try {
8649
+ if (customElement) {
8650
+ customElement._beginPatch();
8651
+ }
8652
+ patchElement(
8653
+ n1,
8654
+ n2,
8655
+ parentComponent,
8656
+ parentSuspense,
8657
+ namespace,
8658
+ slotScopeIds,
8659
+ optimized
8660
+ );
8661
+ } finally {
8662
+ if (customElement) {
8663
+ customElement._endPatch();
8664
+ }
8665
+ }
8652
8666
  }
8653
8667
  };
8654
8668
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -10925,7 +10939,8 @@ If you want to remount the same app, move your app creation logic into a factory
10925
10939
  pendingId,
10926
10940
  effects,
10927
10941
  parentComponent: parentComponent2,
10928
- container: container2
10942
+ container: container2,
10943
+ isInFallback
10929
10944
  } = suspense;
10930
10945
  let delayEnter = false;
10931
10946
  if (suspense.isHydrating) {
@@ -10942,6 +10957,9 @@ If you want to remount the same app, move your app creation logic into a factory
10942
10957
  0
10943
10958
  );
10944
10959
  queuePostFlushCb(effects);
10960
+ if (isInFallback && vnode2.ssFallback) {
10961
+ vnode2.ssFallback.el = null;
10962
+ }
10945
10963
  }
10946
10964
  };
10947
10965
  }
@@ -10950,6 +10968,9 @@ If you want to remount the same app, move your app creation logic into a factory
10950
10968
  anchor = next(activeBranch);
10951
10969
  }
10952
10970
  unmount(activeBranch, parentComponent2, suspense, true);
10971
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
10972
+ vnode2.ssFallback.el = null;
10973
+ }
10953
10974
  }
10954
10975
  if (!delayEnter) {
10955
10976
  move(pendingBranch, container2, anchor, 0);
@@ -11068,6 +11089,7 @@ If you want to remount the same app, move your app creation logic into a factory
11068
11089
  optimized2
11069
11090
  );
11070
11091
  if (placeholder) {
11092
+ vnode2.placeholder = null;
11071
11093
  remove(placeholder);
11072
11094
  }
11073
11095
  updateHOCHostEl(instance, vnode2.el);
@@ -12077,31 +12099,28 @@ Component that was made reactive: `,
12077
12099
  };
12078
12100
 
12079
12101
  function h(type, propsOrChildren, children) {
12080
- const doCreateVNode = (type2, props, children2) => {
12102
+ try {
12081
12103
  setBlockTracking(-1);
12082
- try {
12083
- return createVNode(type2, props, children2);
12084
- } finally {
12085
- setBlockTracking(1);
12086
- }
12087
- };
12088
- const l = arguments.length;
12089
- if (l === 2) {
12090
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12091
- if (isVNode(propsOrChildren)) {
12092
- return doCreateVNode(type, null, [propsOrChildren]);
12104
+ const l = arguments.length;
12105
+ if (l === 2) {
12106
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12107
+ if (isVNode(propsOrChildren)) {
12108
+ return createVNode(type, null, [propsOrChildren]);
12109
+ }
12110
+ return createVNode(type, propsOrChildren);
12111
+ } else {
12112
+ return createVNode(type, null, propsOrChildren);
12093
12113
  }
12094
- return doCreateVNode(type, propsOrChildren);
12095
12114
  } else {
12096
- return doCreateVNode(type, null, propsOrChildren);
12097
- }
12098
- } else {
12099
- if (l > 3) {
12100
- children = Array.prototype.slice.call(arguments, 2);
12101
- } else if (l === 3 && isVNode(children)) {
12102
- children = [children];
12115
+ if (l > 3) {
12116
+ children = Array.prototype.slice.call(arguments, 2);
12117
+ } else if (l === 3 && isVNode(children)) {
12118
+ children = [children];
12119
+ }
12120
+ return createVNode(type, propsOrChildren, children);
12103
12121
  }
12104
- return doCreateVNode(type, propsOrChildren, children);
12122
+ } finally {
12123
+ setBlockTracking(1);
12105
12124
  }
12106
12125
  }
12107
12126
 
@@ -12311,7 +12330,7 @@ Component that was made reactive: `,
12311
12330
  return true;
12312
12331
  }
12313
12332
 
12314
- const version = "3.5.21";
12333
+ const version = "3.5.23";
12315
12334
  const warn = warn$1 ;
12316
12335
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12317
12336
  const devtools = devtools$1 ;
@@ -12569,11 +12588,11 @@ Component that was made reactive: `,
12569
12588
  addTransitionClass(el, legacyLeaveFromClass);
12570
12589
  }
12571
12590
  if (!el._enterCancelled) {
12572
- forceReflow();
12591
+ forceReflow(el);
12573
12592
  addTransitionClass(el, leaveActiveClass);
12574
12593
  } else {
12575
12594
  addTransitionClass(el, leaveActiveClass);
12576
- forceReflow();
12595
+ forceReflow(el);
12577
12596
  }
12578
12597
  nextFrame(() => {
12579
12598
  if (!el._isLeaving) {
@@ -12722,8 +12741,9 @@ Component that was made reactive: `,
12722
12741
  if (s === "auto") return 0;
12723
12742
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12724
12743
  }
12725
- function forceReflow() {
12726
- return document.body.offsetHeight;
12744
+ function forceReflow(el) {
12745
+ const targetDocument = el ? el.ownerDocument : document;
12746
+ return targetDocument.body.offsetHeight;
12727
12747
  }
12728
12748
 
12729
12749
  function patchClass(el, value, isSVG) {
@@ -13201,6 +13221,9 @@ Expected function or array of functions, received type ${typeof value}.`
13201
13221
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13202
13222
  return false;
13203
13223
  }
13224
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13225
+ return false;
13226
+ }
13204
13227
  if (key === "form") {
13205
13228
  return false;
13206
13229
  }
@@ -13261,6 +13284,8 @@ Expected function or array of functions, received type ${typeof value}.`
13261
13284
  this._nonce = this._def.nonce;
13262
13285
  this._connected = false;
13263
13286
  this._resolved = false;
13287
+ this._patching = false;
13288
+ this._dirty = false;
13264
13289
  this._numberProps = null;
13265
13290
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13266
13291
  this._ob = null;
@@ -13273,7 +13298,11 @@ Expected function or array of functions, received type ${typeof value}.`
13273
13298
  );
13274
13299
  }
13275
13300
  if (_def.shadowRoot !== false) {
13276
- this.attachShadow({ mode: "open" });
13301
+ this.attachShadow(
13302
+ extend({}, _def.shadowRootOptions, {
13303
+ mode: "open"
13304
+ })
13305
+ );
13277
13306
  this._root = this.shadowRoot;
13278
13307
  } else {
13279
13308
  this._root = this;
@@ -13333,9 +13362,18 @@ Expected function or array of functions, received type ${typeof value}.`
13333
13362
  this._app && this._app.unmount();
13334
13363
  if (this._instance) this._instance.ce = void 0;
13335
13364
  this._app = this._instance = null;
13365
+ if (this._teleportTargets) {
13366
+ this._teleportTargets.clear();
13367
+ this._teleportTargets = void 0;
13368
+ }
13336
13369
  }
13337
13370
  });
13338
13371
  }
13372
+ _processMutations(mutations) {
13373
+ for (const m of mutations) {
13374
+ this._setAttr(m.attributeName);
13375
+ }
13376
+ }
13339
13377
  /**
13340
13378
  * resolve inner component definition (handle possible async component)
13341
13379
  */
@@ -13346,11 +13384,7 @@ Expected function or array of functions, received type ${typeof value}.`
13346
13384
  for (let i = 0; i < this.attributes.length; i++) {
13347
13385
  this._setAttr(this.attributes[i].name);
13348
13386
  }
13349
- this._ob = new MutationObserver((mutations) => {
13350
- for (const m of mutations) {
13351
- this._setAttr(m.attributeName);
13352
- }
13353
- });
13387
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13354
13388
  this._ob.observe(this, { attributes: true });
13355
13389
  const resolve = (def, isAsync = false) => {
13356
13390
  this._resolved = true;
@@ -13427,7 +13461,7 @@ Expected function or array of functions, received type ${typeof value}.`
13427
13461
  return this._getProp(key);
13428
13462
  },
13429
13463
  set(val) {
13430
- this._setProp(key, val, true, true);
13464
+ this._setProp(key, val, true, !this._patching);
13431
13465
  }
13432
13466
  });
13433
13467
  }
@@ -13453,6 +13487,7 @@ Expected function or array of functions, received type ${typeof value}.`
13453
13487
  */
13454
13488
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13455
13489
  if (val !== this._props[key]) {
13490
+ this._dirty = true;
13456
13491
  if (val === REMOVAL) {
13457
13492
  delete this._props[key];
13458
13493
  } else {
@@ -13466,7 +13501,10 @@ Expected function or array of functions, received type ${typeof value}.`
13466
13501
  }
13467
13502
  if (shouldReflect) {
13468
13503
  const ob = this._ob;
13469
- ob && ob.disconnect();
13504
+ if (ob) {
13505
+ this._processMutations(ob.takeRecords());
13506
+ ob.disconnect();
13507
+ }
13470
13508
  if (val === true) {
13471
13509
  this.setAttribute(hyphenate(key), "");
13472
13510
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13570,7 +13608,7 @@ Expected function or array of functions, received type ${typeof value}.`
13570
13608
  * Only called when shadowRoot is false
13571
13609
  */
13572
13610
  _renderSlots() {
13573
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13611
+ const outlets = this._getSlots();
13574
13612
  const scopeId = this._instance.type.__scopeId;
13575
13613
  for (let i = 0; i < outlets.length; i++) {
13576
13614
  const o = outlets[i];
@@ -13596,12 +13634,45 @@ Expected function or array of functions, received type ${typeof value}.`
13596
13634
  parent.removeChild(o);
13597
13635
  }
13598
13636
  }
13637
+ /**
13638
+ * @internal
13639
+ */
13640
+ _getSlots() {
13641
+ const roots = [this];
13642
+ if (this._teleportTargets) {
13643
+ roots.push(...this._teleportTargets);
13644
+ }
13645
+ const slots = /* @__PURE__ */ new Set();
13646
+ for (const root of roots) {
13647
+ const found = root.querySelectorAll("slot");
13648
+ for (let i = 0; i < found.length; i++) {
13649
+ slots.add(found[i]);
13650
+ }
13651
+ }
13652
+ return Array.from(slots);
13653
+ }
13599
13654
  /**
13600
13655
  * @internal
13601
13656
  */
13602
13657
  _injectChildStyle(comp) {
13603
13658
  this._applyStyles(comp.styles, comp);
13604
13659
  }
13660
+ /**
13661
+ * @internal
13662
+ */
13663
+ _beginPatch() {
13664
+ this._patching = true;
13665
+ this._dirty = false;
13666
+ }
13667
+ /**
13668
+ * @internal
13669
+ */
13670
+ _endPatch() {
13671
+ this._patching = false;
13672
+ if (this._dirty && this._instance) {
13673
+ this._update();
13674
+ }
13675
+ }
13605
13676
  /**
13606
13677
  * @internal
13607
13678
  */
@@ -13688,7 +13759,7 @@ Expected function or array of functions, received type ${typeof value}.`
13688
13759
  prevChildren.forEach(callPendingCbs);
13689
13760
  prevChildren.forEach(recordPosition);
13690
13761
  const movedChildren = prevChildren.filter(applyTranslation);
13691
- forceReflow();
13762
+ forceReflow(instance.vnode.el);
13692
13763
  movedChildren.forEach((c) => {
13693
13764
  const el = c.el;
13694
13765
  const style = el.style;
@@ -13733,10 +13804,10 @@ Expected function or array of functions, received type ${typeof value}.`
13733
13804
  instance
13734
13805
  )
13735
13806
  );
13736
- positionMap.set(
13737
- child,
13738
- child.el.getBoundingClientRect()
13739
- );
13807
+ positionMap.set(child, {
13808
+ left: child.el.offsetLeft,
13809
+ top: child.el.offsetTop
13810
+ });
13740
13811
  }
13741
13812
  }
13742
13813
  }
@@ -13767,7 +13838,10 @@ Expected function or array of functions, received type ${typeof value}.`
13767
13838
  }
13768
13839
  }
13769
13840
  function recordPosition(c) {
13770
- newPositionMap.set(c, c.el.getBoundingClientRect());
13841
+ newPositionMap.set(c, {
13842
+ left: c.el.offsetLeft,
13843
+ top: c.el.offsetTop
13844
+ });
13771
13845
  }
13772
13846
  function applyTranslation(c) {
13773
13847
  const oldPos = positionMap.get(c);
@@ -13813,24 +13887,22 @@ Expected function or array of functions, received type ${typeof value}.`
13813
13887
  }
13814
13888
  }
13815
13889
  const assignKey = Symbol("_assign");
13890
+ function castValue(value, trim, number) {
13891
+ if (trim) value = value.trim();
13892
+ if (number) value = looseToNumber(value);
13893
+ return value;
13894
+ }
13816
13895
  const vModelText = {
13817
13896
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13818
13897
  el[assignKey] = getModelAssigner(vnode);
13819
13898
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13820
13899
  addEventListener(el, lazy ? "change" : "input", (e) => {
13821
13900
  if (e.target.composing) return;
13822
- let domValue = el.value;
13823
- if (trim) {
13824
- domValue = domValue.trim();
13825
- }
13826
- if (castToNumber) {
13827
- domValue = looseToNumber(domValue);
13828
- }
13829
- el[assignKey](domValue);
13901
+ el[assignKey](castValue(el.value, trim, castToNumber));
13830
13902
  });
13831
- if (trim) {
13903
+ if (trim || castToNumber) {
13832
13904
  addEventListener(el, "change", () => {
13833
- el.value = el.value.trim();
13905
+ el.value = castValue(el.value, trim, castToNumber);
13834
13906
  });
13835
13907
  }
13836
13908
  if (!lazy) {