@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
  **/
@@ -1142,7 +1142,7 @@ function iterator(self, method, wrapValue) {
1142
1142
  iter._next = iter.next;
1143
1143
  iter.next = () => {
1144
1144
  const result = iter._next();
1145
- if (result.value) {
1145
+ if (!result.done) {
1146
1146
  result.value = wrapValue(result.value);
1147
1147
  }
1148
1148
  return result;
@@ -1269,7 +1269,8 @@ class BaseReactiveHandler {
1269
1269
  return res;
1270
1270
  }
1271
1271
  if (isRef(res)) {
1272
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1272
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1273
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1273
1274
  }
1274
1275
  if (isObject(res)) {
1275
1276
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2619,14 +2620,11 @@ function checkRecursiveUpdates(seen, fn) {
2619
2620
  let isHmrUpdating = false;
2620
2621
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2621
2622
  {
2622
- const g = getGlobalThis();
2623
- if (!g.__VUE_HMR_RUNTIME__) {
2624
- g.__VUE_HMR_RUNTIME__ = {
2625
- createRecord: tryWrap(createRecord),
2626
- rerender: tryWrap(rerender),
2627
- reload: tryWrap(reload)
2628
- };
2629
- }
2623
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2624
+ createRecord: tryWrap(createRecord),
2625
+ rerender: tryWrap(rerender),
2626
+ reload: tryWrap(reload)
2627
+ };
2630
2628
  }
2631
2629
  const map = /* @__PURE__ */ new Map();
2632
2630
  function registerHMR(instance) {
@@ -3521,9 +3519,6 @@ const TeleportImpl = {
3521
3519
  insert(mainAnchor, container, anchor);
3522
3520
  const mount = (container2, anchor2) => {
3523
3521
  if (shapeFlag & 16) {
3524
- if (parentComponent && parentComponent.isCE) {
3525
- parentComponent.ce._teleportTarget = container2;
3526
- }
3527
3522
  mountChildren(
3528
3523
  children,
3529
3524
  container2,
@@ -3545,6 +3540,9 @@ const TeleportImpl = {
3545
3540
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3546
3541
  namespace = "mathml";
3547
3542
  }
3543
+ if (parentComponent && parentComponent.isCE) {
3544
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3545
+ }
3548
3546
  if (!disabled) {
3549
3547
  mount(target, targetAnchor);
3550
3548
  updateCssVars(n2, false);
@@ -4654,14 +4652,16 @@ Server rendered element contains more child nodes than client vdom.`
4654
4652
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4655
4653
  clientText = clientText.slice(1);
4656
4654
  }
4657
- if (el.textContent !== clientText) {
4655
+ const { textContent } = el;
4656
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4657
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4658
4658
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4659
4659
  warn$1(
4660
4660
  `Hydration text content mismatch on`,
4661
4661
  el,
4662
4662
  `
4663
- - rendered on server: ${el.textContent}
4664
- - expected on client: ${vnode.children}`
4663
+ - rendered on server: ${textContent}
4664
+ - expected on client: ${clientText}`
4665
4665
  );
4666
4666
  logMismatchError();
4667
4667
  }
@@ -5256,7 +5256,10 @@ function defineAsyncComponent(source) {
5256
5256
  error: error.value
5257
5257
  });
5258
5258
  } else if (loadingComponent && !delayed.value) {
5259
- return createVNode(loadingComponent);
5259
+ return createInnerComp(
5260
+ loadingComponent,
5261
+ instance
5262
+ );
5260
5263
  }
5261
5264
  };
5262
5265
  }
@@ -6004,12 +6007,13 @@ function createSlots(slots, dynamicSlots) {
6004
6007
 
6005
6008
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6006
6009
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6010
+ const hasProps = Object.keys(props).length > 0;
6007
6011
  if (name !== "default") props.name = name;
6008
6012
  return openBlock(), createBlock(
6009
6013
  Fragment,
6010
6014
  null,
6011
6015
  [createVNode("slot", props, fallback && fallback())],
6012
- 64
6016
+ hasProps ? -2 : 64
6013
6017
  );
6014
6018
  }
6015
6019
  let slot = slots[name];
@@ -7200,7 +7204,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7200
7204
  return vm;
7201
7205
  }
7202
7206
  }
7203
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7207
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7204
7208
  Vue.config = singletonApp.config;
7205
7209
  Vue.use = (plugin, ...options) => {
7206
7210
  if (plugin && isFunction(plugin.install)) {
@@ -8646,15 +8650,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8646
8650
  optimized
8647
8651
  );
8648
8652
  } else {
8649
- patchElement(
8650
- n1,
8651
- n2,
8652
- parentComponent,
8653
- parentSuspense,
8654
- namespace,
8655
- slotScopeIds,
8656
- optimized
8657
- );
8653
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8654
+ try {
8655
+ if (customElement) {
8656
+ customElement._beginPatch();
8657
+ }
8658
+ patchElement(
8659
+ n1,
8660
+ n2,
8661
+ parentComponent,
8662
+ parentSuspense,
8663
+ namespace,
8664
+ slotScopeIds,
8665
+ optimized
8666
+ );
8667
+ } finally {
8668
+ if (customElement) {
8669
+ customElement._endPatch();
8670
+ }
8671
+ }
8658
8672
  }
8659
8673
  };
8660
8674
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -10959,7 +10973,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10959
10973
  pendingId,
10960
10974
  effects,
10961
10975
  parentComponent: parentComponent2,
10962
- container: container2
10976
+ container: container2,
10977
+ isInFallback
10963
10978
  } = suspense;
10964
10979
  let delayEnter = false;
10965
10980
  if (suspense.isHydrating) {
@@ -10976,6 +10991,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10976
10991
  0
10977
10992
  );
10978
10993
  queuePostFlushCb(effects);
10994
+ if (isInFallback && vnode2.ssFallback) {
10995
+ vnode2.ssFallback.el = null;
10996
+ }
10979
10997
  }
10980
10998
  };
10981
10999
  }
@@ -10984,6 +11002,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
10984
11002
  anchor = next(activeBranch);
10985
11003
  }
10986
11004
  unmount(activeBranch, parentComponent2, suspense, true);
11005
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11006
+ vnode2.ssFallback.el = null;
11007
+ }
10987
11008
  }
10988
11009
  if (!delayEnter) {
10989
11010
  move(pendingBranch, container2, anchor, 0);
@@ -11102,6 +11123,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11102
11123
  optimized2
11103
11124
  );
11104
11125
  if (placeholder) {
11126
+ vnode2.placeholder = null;
11105
11127
  remove(placeholder);
11106
11128
  }
11107
11129
  updateHOCHostEl(instance, vnode2.el);
@@ -12125,31 +12147,28 @@ const computed = (getterOrOptions, debugOptions) => {
12125
12147
  };
12126
12148
 
12127
12149
  function h(type, propsOrChildren, children) {
12128
- const doCreateVNode = (type2, props, children2) => {
12150
+ try {
12129
12151
  setBlockTracking(-1);
12130
- try {
12131
- return createVNode(type2, props, children2);
12132
- } finally {
12133
- setBlockTracking(1);
12134
- }
12135
- };
12136
- const l = arguments.length;
12137
- if (l === 2) {
12138
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12139
- if (isVNode(propsOrChildren)) {
12140
- return doCreateVNode(type, null, [propsOrChildren]);
12152
+ const l = arguments.length;
12153
+ if (l === 2) {
12154
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12155
+ if (isVNode(propsOrChildren)) {
12156
+ return createVNode(type, null, [propsOrChildren]);
12157
+ }
12158
+ return createVNode(type, propsOrChildren);
12159
+ } else {
12160
+ return createVNode(type, null, propsOrChildren);
12141
12161
  }
12142
- return doCreateVNode(type, propsOrChildren);
12143
12162
  } else {
12144
- return doCreateVNode(type, null, propsOrChildren);
12145
- }
12146
- } else {
12147
- if (l > 3) {
12148
- children = Array.prototype.slice.call(arguments, 2);
12149
- } else if (l === 3 && isVNode(children)) {
12150
- children = [children];
12163
+ if (l > 3) {
12164
+ children = Array.prototype.slice.call(arguments, 2);
12165
+ } else if (l === 3 && isVNode(children)) {
12166
+ children = [children];
12167
+ }
12168
+ return createVNode(type, propsOrChildren, children);
12151
12169
  }
12152
- return doCreateVNode(type, propsOrChildren, children);
12170
+ } finally {
12171
+ setBlockTracking(1);
12153
12172
  }
12154
12173
  }
12155
12174
 
@@ -12359,7 +12378,7 @@ function isMemoSame(cached, memo) {
12359
12378
  return true;
12360
12379
  }
12361
12380
 
12362
- const version = "3.5.21";
12381
+ const version = "3.5.23";
12363
12382
  const warn = warn$1 ;
12364
12383
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12365
12384
  const devtools = devtools$1 ;
@@ -12629,11 +12648,11 @@ function resolveTransitionProps(rawProps) {
12629
12648
  addTransitionClass(el, legacyLeaveFromClass);
12630
12649
  }
12631
12650
  if (!el._enterCancelled) {
12632
- forceReflow();
12651
+ forceReflow(el);
12633
12652
  addTransitionClass(el, leaveActiveClass);
12634
12653
  } else {
12635
12654
  addTransitionClass(el, leaveActiveClass);
12636
- forceReflow();
12655
+ forceReflow(el);
12637
12656
  }
12638
12657
  nextFrame(() => {
12639
12658
  if (!el._isLeaving) {
@@ -12782,8 +12801,9 @@ function toMs(s) {
12782
12801
  if (s === "auto") return 0;
12783
12802
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12784
12803
  }
12785
- function forceReflow() {
12786
- return document.body.offsetHeight;
12804
+ function forceReflow(el) {
12805
+ const targetDocument = el ? el.ownerDocument : document;
12806
+ return targetDocument.body.offsetHeight;
12787
12807
  }
12788
12808
 
12789
12809
  function patchClass(el, value, isSVG) {
@@ -13268,6 +13288,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
13268
13288
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13269
13289
  return false;
13270
13290
  }
13291
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13292
+ return false;
13293
+ }
13271
13294
  if (key === "form") {
13272
13295
  return false;
13273
13296
  }
@@ -13328,6 +13351,8 @@ class VueElement extends BaseClass {
13328
13351
  this._nonce = this._def.nonce;
13329
13352
  this._connected = false;
13330
13353
  this._resolved = false;
13354
+ this._patching = false;
13355
+ this._dirty = false;
13331
13356
  this._numberProps = null;
13332
13357
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13333
13358
  this._ob = null;
@@ -13340,7 +13365,11 @@ class VueElement extends BaseClass {
13340
13365
  );
13341
13366
  }
13342
13367
  if (_def.shadowRoot !== false) {
13343
- this.attachShadow({ mode: "open" });
13368
+ this.attachShadow(
13369
+ extend({}, _def.shadowRootOptions, {
13370
+ mode: "open"
13371
+ })
13372
+ );
13344
13373
  this._root = this.shadowRoot;
13345
13374
  } else {
13346
13375
  this._root = this;
@@ -13400,9 +13429,18 @@ class VueElement extends BaseClass {
13400
13429
  this._app && this._app.unmount();
13401
13430
  if (this._instance) this._instance.ce = void 0;
13402
13431
  this._app = this._instance = null;
13432
+ if (this._teleportTargets) {
13433
+ this._teleportTargets.clear();
13434
+ this._teleportTargets = void 0;
13435
+ }
13403
13436
  }
13404
13437
  });
13405
13438
  }
13439
+ _processMutations(mutations) {
13440
+ for (const m of mutations) {
13441
+ this._setAttr(m.attributeName);
13442
+ }
13443
+ }
13406
13444
  /**
13407
13445
  * resolve inner component definition (handle possible async component)
13408
13446
  */
@@ -13413,11 +13451,7 @@ class VueElement extends BaseClass {
13413
13451
  for (let i = 0; i < this.attributes.length; i++) {
13414
13452
  this._setAttr(this.attributes[i].name);
13415
13453
  }
13416
- this._ob = new MutationObserver((mutations) => {
13417
- for (const m of mutations) {
13418
- this._setAttr(m.attributeName);
13419
- }
13420
- });
13454
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13421
13455
  this._ob.observe(this, { attributes: true });
13422
13456
  const resolve = (def, isAsync = false) => {
13423
13457
  this._resolved = true;
@@ -13494,7 +13528,7 @@ class VueElement extends BaseClass {
13494
13528
  return this._getProp(key);
13495
13529
  },
13496
13530
  set(val) {
13497
- this._setProp(key, val, true, true);
13531
+ this._setProp(key, val, true, !this._patching);
13498
13532
  }
13499
13533
  });
13500
13534
  }
@@ -13520,6 +13554,7 @@ class VueElement extends BaseClass {
13520
13554
  */
13521
13555
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13522
13556
  if (val !== this._props[key]) {
13557
+ this._dirty = true;
13523
13558
  if (val === REMOVAL) {
13524
13559
  delete this._props[key];
13525
13560
  } else {
@@ -13533,7 +13568,10 @@ class VueElement extends BaseClass {
13533
13568
  }
13534
13569
  if (shouldReflect) {
13535
13570
  const ob = this._ob;
13536
- ob && ob.disconnect();
13571
+ if (ob) {
13572
+ this._processMutations(ob.takeRecords());
13573
+ ob.disconnect();
13574
+ }
13537
13575
  if (val === true) {
13538
13576
  this.setAttribute(hyphenate(key), "");
13539
13577
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13637,7 +13675,7 @@ class VueElement extends BaseClass {
13637
13675
  * Only called when shadowRoot is false
13638
13676
  */
13639
13677
  _renderSlots() {
13640
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13678
+ const outlets = this._getSlots();
13641
13679
  const scopeId = this._instance.type.__scopeId;
13642
13680
  for (let i = 0; i < outlets.length; i++) {
13643
13681
  const o = outlets[i];
@@ -13663,12 +13701,45 @@ class VueElement extends BaseClass {
13663
13701
  parent.removeChild(o);
13664
13702
  }
13665
13703
  }
13704
+ /**
13705
+ * @internal
13706
+ */
13707
+ _getSlots() {
13708
+ const roots = [this];
13709
+ if (this._teleportTargets) {
13710
+ roots.push(...this._teleportTargets);
13711
+ }
13712
+ const slots = /* @__PURE__ */ new Set();
13713
+ for (const root of roots) {
13714
+ const found = root.querySelectorAll("slot");
13715
+ for (let i = 0; i < found.length; i++) {
13716
+ slots.add(found[i]);
13717
+ }
13718
+ }
13719
+ return Array.from(slots);
13720
+ }
13666
13721
  /**
13667
13722
  * @internal
13668
13723
  */
13669
13724
  _injectChildStyle(comp) {
13670
13725
  this._applyStyles(comp.styles, comp);
13671
13726
  }
13727
+ /**
13728
+ * @internal
13729
+ */
13730
+ _beginPatch() {
13731
+ this._patching = true;
13732
+ this._dirty = false;
13733
+ }
13734
+ /**
13735
+ * @internal
13736
+ */
13737
+ _endPatch() {
13738
+ this._patching = false;
13739
+ if (this._dirty && this._instance) {
13740
+ this._update();
13741
+ }
13742
+ }
13672
13743
  /**
13673
13744
  * @internal
13674
13745
  */
@@ -13767,7 +13838,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13767
13838
  prevChildren.forEach(callPendingCbs);
13768
13839
  prevChildren.forEach(recordPosition);
13769
13840
  const movedChildren = prevChildren.filter(applyTranslation);
13770
- forceReflow();
13841
+ forceReflow(instance.vnode.el);
13771
13842
  movedChildren.forEach((c) => {
13772
13843
  const el = c.el;
13773
13844
  const style = el.style;
@@ -13812,10 +13883,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13812
13883
  instance
13813
13884
  )
13814
13885
  );
13815
- positionMap.set(
13816
- child,
13817
- child.el.getBoundingClientRect()
13818
- );
13886
+ positionMap.set(child, {
13887
+ left: child.el.offsetLeft,
13888
+ top: child.el.offsetTop
13889
+ });
13819
13890
  }
13820
13891
  }
13821
13892
  }
@@ -13846,7 +13917,10 @@ function callPendingCbs(c) {
13846
13917
  }
13847
13918
  }
13848
13919
  function recordPosition(c) {
13849
- newPositionMap.set(c, c.el.getBoundingClientRect());
13920
+ newPositionMap.set(c, {
13921
+ left: c.el.offsetLeft,
13922
+ top: c.el.offsetTop
13923
+ });
13850
13924
  }
13851
13925
  function applyTranslation(c) {
13852
13926
  const oldPos = positionMap.get(c);
@@ -13892,24 +13966,22 @@ function onCompositionEnd(e) {
13892
13966
  }
13893
13967
  }
13894
13968
  const assignKey = Symbol("_assign");
13969
+ function castValue(value, trim, number) {
13970
+ if (trim) value = value.trim();
13971
+ if (number) value = looseToNumber(value);
13972
+ return value;
13973
+ }
13895
13974
  const vModelText = {
13896
13975
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13897
13976
  el[assignKey] = getModelAssigner(vnode);
13898
13977
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13899
13978
  addEventListener(el, lazy ? "change" : "input", (e) => {
13900
13979
  if (e.target.composing) return;
13901
- let domValue = el.value;
13902
- if (trim) {
13903
- domValue = domValue.trim();
13904
- }
13905
- if (castToNumber) {
13906
- domValue = looseToNumber(domValue);
13907
- }
13908
- el[assignKey](domValue);
13980
+ el[assignKey](castValue(el.value, trim, castToNumber));
13909
13981
  });
13910
- if (trim) {
13982
+ if (trim || castToNumber) {
13911
13983
  addEventListener(el, "change", () => {
13912
- el.value = el.value.trim();
13984
+ el.value = castValue(el.value, trim, castToNumber);
13913
13985
  });
13914
13986
  }
13915
13987
  if (!lazy) {