@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
  **/
@@ -1146,7 +1146,7 @@ function iterator(self, method, wrapValue) {
1146
1146
  iter._next = iter.next;
1147
1147
  iter.next = () => {
1148
1148
  const result = iter._next();
1149
- if (result.value) {
1149
+ if (!result.done) {
1150
1150
  result.value = wrapValue(result.value);
1151
1151
  }
1152
1152
  return result;
@@ -1273,7 +1273,8 @@ class BaseReactiveHandler {
1273
1273
  return res;
1274
1274
  }
1275
1275
  if (isRef(res)) {
1276
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1276
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1277
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1277
1278
  }
1278
1279
  if (isObject(res)) {
1279
1280
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2634,14 +2635,11 @@ function checkRecursiveUpdates(seen, fn) {
2634
2635
  let isHmrUpdating = false;
2635
2636
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
2636
2637
  if (!!(process.env.NODE_ENV !== "production")) {
2637
- const g = getGlobalThis();
2638
- if (!g.__VUE_HMR_RUNTIME__) {
2639
- g.__VUE_HMR_RUNTIME__ = {
2640
- createRecord: tryWrap(createRecord),
2641
- rerender: tryWrap(rerender),
2642
- reload: tryWrap(reload)
2643
- };
2644
- }
2638
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
2639
+ createRecord: tryWrap(createRecord),
2640
+ rerender: tryWrap(rerender),
2641
+ reload: tryWrap(reload)
2642
+ };
2645
2643
  }
2646
2644
  const map = /* @__PURE__ */ new Map();
2647
2645
  function registerHMR(instance) {
@@ -3539,9 +3537,6 @@ const TeleportImpl = {
3539
3537
  insert(mainAnchor, container, anchor);
3540
3538
  const mount = (container2, anchor2) => {
3541
3539
  if (shapeFlag & 16) {
3542
- if (parentComponent && parentComponent.isCE) {
3543
- parentComponent.ce._teleportTarget = container2;
3544
- }
3545
3540
  mountChildren(
3546
3541
  children,
3547
3542
  container2,
@@ -3563,6 +3558,9 @@ const TeleportImpl = {
3563
3558
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3564
3559
  namespace = "mathml";
3565
3560
  }
3561
+ if (parentComponent && parentComponent.isCE) {
3562
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3563
+ }
3566
3564
  if (!disabled) {
3567
3565
  mount(target, targetAnchor);
3568
3566
  updateCssVars(n2, false);
@@ -4673,14 +4671,16 @@ Server rendered element contains more child nodes than client vdom.`
4673
4671
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4674
4672
  clientText = clientText.slice(1);
4675
4673
  }
4676
- if (el.textContent !== clientText) {
4674
+ const { textContent } = el;
4675
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4676
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4677
4677
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4678
4678
  (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(
4679
4679
  `Hydration text content mismatch on`,
4680
4680
  el,
4681
4681
  `
4682
- - rendered on server: ${el.textContent}
4683
- - expected on client: ${vnode.children}`
4682
+ - rendered on server: ${textContent}
4683
+ - expected on client: ${clientText}`
4684
4684
  );
4685
4685
  logMismatchError();
4686
4686
  }
@@ -5286,7 +5286,10 @@ function defineAsyncComponent(source) {
5286
5286
  error: error.value
5287
5287
  });
5288
5288
  } else if (loadingComponent && !delayed.value) {
5289
- return createVNode(loadingComponent);
5289
+ return createInnerComp(
5290
+ loadingComponent,
5291
+ instance
5292
+ );
5290
5293
  }
5291
5294
  };
5292
5295
  }
@@ -6034,12 +6037,13 @@ function createSlots(slots, dynamicSlots) {
6034
6037
 
6035
6038
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6036
6039
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6040
+ const hasProps = Object.keys(props).length > 0;
6037
6041
  if (name !== "default") props.name = name;
6038
6042
  return openBlock(), createBlock(
6039
6043
  Fragment,
6040
6044
  null,
6041
6045
  [createVNode("slot", props, fallback && fallback())],
6042
- 64
6046
+ hasProps ? -2 : 64
6043
6047
  );
6044
6048
  }
6045
6049
  let slot = slots[name];
@@ -6384,7 +6388,7 @@ const PublicInstanceProxyHandlers = {
6384
6388
  } else if (hasSetupBinding(setupState, key)) {
6385
6389
  accessCache[key] = 1 /* SETUP */;
6386
6390
  return setupState[key];
6387
- } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
6391
+ } else if (__VUE_OPTIONS_API__ && data !== EMPTY_OBJ && hasOwn(data, key)) {
6388
6392
  accessCache[key] = 2 /* DATA */;
6389
6393
  return data[key];
6390
6394
  } else if (
@@ -6456,7 +6460,7 @@ const PublicInstanceProxyHandlers = {
6456
6460
  } else if (!!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup && hasOwn(setupState, key)) {
6457
6461
  warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
6458
6462
  return false;
6459
- } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
6463
+ } else if (__VUE_OPTIONS_API__ && data !== EMPTY_OBJ && hasOwn(data, key)) {
6460
6464
  data[key] = value;
6461
6465
  return true;
6462
6466
  } else if (hasOwn(instance.props, key)) {
@@ -6485,7 +6489,7 @@ const PublicInstanceProxyHandlers = {
6485
6489
  _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6486
6490
  }, key) {
6487
6491
  let normalizedProps, cssModules;
6488
- return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
6492
+ return !!(accessCache[key] || __VUE_OPTIONS_API__ && data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
6489
6493
  },
6490
6494
  defineProperty(target, key, descriptor) {
6491
6495
  if (descriptor.get != null) {
@@ -7232,7 +7236,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7232
7236
  return vm;
7233
7237
  }
7234
7238
  }
7235
- Vue.version = `2.6.14-compat:${"3.5.21"}`;
7239
+ Vue.version = `2.6.14-compat:${"3.5.23"}`;
7236
7240
  Vue.config = singletonApp.config;
7237
7241
  Vue.use = (plugin, ...options) => {
7238
7242
  if (plugin && isFunction(plugin.install)) {
@@ -8707,15 +8711,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8707
8711
  optimized
8708
8712
  );
8709
8713
  } else {
8710
- patchElement(
8711
- n1,
8712
- n2,
8713
- parentComponent,
8714
- parentSuspense,
8715
- namespace,
8716
- slotScopeIds,
8717
- optimized
8718
- );
8714
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
8715
+ try {
8716
+ if (customElement) {
8717
+ customElement._beginPatch();
8718
+ }
8719
+ patchElement(
8720
+ n1,
8721
+ n2,
8722
+ parentComponent,
8723
+ parentSuspense,
8724
+ namespace,
8725
+ slotScopeIds,
8726
+ optimized
8727
+ );
8728
+ } finally {
8729
+ if (customElement) {
8730
+ customElement._endPatch();
8731
+ }
8732
+ }
8719
8733
  }
8720
8734
  };
8721
8735
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -11031,7 +11045,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11031
11045
  pendingId,
11032
11046
  effects,
11033
11047
  parentComponent: parentComponent2,
11034
- container: container2
11048
+ container: container2,
11049
+ isInFallback
11035
11050
  } = suspense;
11036
11051
  let delayEnter = false;
11037
11052
  if (suspense.isHydrating) {
@@ -11048,6 +11063,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11048
11063
  0
11049
11064
  );
11050
11065
  queuePostFlushCb(effects);
11066
+ if (isInFallback && vnode2.ssFallback) {
11067
+ vnode2.ssFallback.el = null;
11068
+ }
11051
11069
  }
11052
11070
  };
11053
11071
  }
@@ -11056,6 +11074,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11056
11074
  anchor = next(activeBranch);
11057
11075
  }
11058
11076
  unmount(activeBranch, parentComponent2, suspense, true);
11077
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11078
+ vnode2.ssFallback.el = null;
11079
+ }
11059
11080
  }
11060
11081
  if (!delayEnter) {
11061
11082
  move(pendingBranch, container2, anchor, 0);
@@ -11174,6 +11195,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11174
11195
  optimized2
11175
11196
  );
11176
11197
  if (placeholder) {
11198
+ vnode2.placeholder = null;
11177
11199
  remove(placeholder);
11178
11200
  }
11179
11201
  updateHOCHostEl(instance, vnode2.el);
@@ -12211,31 +12233,28 @@ const computed = (getterOrOptions, debugOptions) => {
12211
12233
  };
12212
12234
 
12213
12235
  function h(type, propsOrChildren, children) {
12214
- const doCreateVNode = (type2, props, children2) => {
12236
+ try {
12215
12237
  setBlockTracking(-1);
12216
- try {
12217
- return createVNode(type2, props, children2);
12218
- } finally {
12219
- setBlockTracking(1);
12220
- }
12221
- };
12222
- const l = arguments.length;
12223
- if (l === 2) {
12224
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12225
- if (isVNode(propsOrChildren)) {
12226
- return doCreateVNode(type, null, [propsOrChildren]);
12238
+ const l = arguments.length;
12239
+ if (l === 2) {
12240
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12241
+ if (isVNode(propsOrChildren)) {
12242
+ return createVNode(type, null, [propsOrChildren]);
12243
+ }
12244
+ return createVNode(type, propsOrChildren);
12245
+ } else {
12246
+ return createVNode(type, null, propsOrChildren);
12227
12247
  }
12228
- return doCreateVNode(type, propsOrChildren);
12229
12248
  } else {
12230
- return doCreateVNode(type, null, propsOrChildren);
12231
- }
12232
- } else {
12233
- if (l > 3) {
12234
- children = Array.prototype.slice.call(arguments, 2);
12235
- } else if (l === 3 && isVNode(children)) {
12236
- children = [children];
12249
+ if (l > 3) {
12250
+ children = Array.prototype.slice.call(arguments, 2);
12251
+ } else if (l === 3 && isVNode(children)) {
12252
+ children = [children];
12253
+ }
12254
+ return createVNode(type, propsOrChildren, children);
12237
12255
  }
12238
- return doCreateVNode(type, propsOrChildren, children);
12256
+ } finally {
12257
+ setBlockTracking(1);
12239
12258
  }
12240
12259
  }
12241
12260
 
@@ -12445,7 +12464,7 @@ function isMemoSame(cached, memo) {
12445
12464
  return true;
12446
12465
  }
12447
12466
 
12448
- const version = "3.5.21";
12467
+ const version = "3.5.23";
12449
12468
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12450
12469
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12451
12470
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12715,11 +12734,11 @@ function resolveTransitionProps(rawProps) {
12715
12734
  addTransitionClass(el, legacyLeaveFromClass);
12716
12735
  }
12717
12736
  if (!el._enterCancelled) {
12718
- forceReflow();
12737
+ forceReflow(el);
12719
12738
  addTransitionClass(el, leaveActiveClass);
12720
12739
  } else {
12721
12740
  addTransitionClass(el, leaveActiveClass);
12722
- forceReflow();
12741
+ forceReflow(el);
12723
12742
  }
12724
12743
  nextFrame(() => {
12725
12744
  if (!el._isLeaving) {
@@ -12868,8 +12887,9 @@ function toMs(s) {
12868
12887
  if (s === "auto") return 0;
12869
12888
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12870
12889
  }
12871
- function forceReflow() {
12872
- return document.body.offsetHeight;
12890
+ function forceReflow(el) {
12891
+ const targetDocument = el ? el.ownerDocument : document;
12892
+ return targetDocument.body.offsetHeight;
12873
12893
  }
12874
12894
 
12875
12895
  function patchClass(el, value, isSVG) {
@@ -13354,6 +13374,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
13354
13374
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13355
13375
  return false;
13356
13376
  }
13377
+ if (key === "sandbox" && el.tagName === "IFRAME") {
13378
+ return false;
13379
+ }
13357
13380
  if (key === "form") {
13358
13381
  return false;
13359
13382
  }
@@ -13414,6 +13437,8 @@ class VueElement extends BaseClass {
13414
13437
  this._nonce = this._def.nonce;
13415
13438
  this._connected = false;
13416
13439
  this._resolved = false;
13440
+ this._patching = false;
13441
+ this._dirty = false;
13417
13442
  this._numberProps = null;
13418
13443
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13419
13444
  this._ob = null;
@@ -13426,7 +13451,11 @@ class VueElement extends BaseClass {
13426
13451
  );
13427
13452
  }
13428
13453
  if (_def.shadowRoot !== false) {
13429
- this.attachShadow({ mode: "open" });
13454
+ this.attachShadow(
13455
+ extend({}, _def.shadowRootOptions, {
13456
+ mode: "open"
13457
+ })
13458
+ );
13430
13459
  this._root = this.shadowRoot;
13431
13460
  } else {
13432
13461
  this._root = this;
@@ -13486,9 +13515,18 @@ class VueElement extends BaseClass {
13486
13515
  this._app && this._app.unmount();
13487
13516
  if (this._instance) this._instance.ce = void 0;
13488
13517
  this._app = this._instance = null;
13518
+ if (this._teleportTargets) {
13519
+ this._teleportTargets.clear();
13520
+ this._teleportTargets = void 0;
13521
+ }
13489
13522
  }
13490
13523
  });
13491
13524
  }
13525
+ _processMutations(mutations) {
13526
+ for (const m of mutations) {
13527
+ this._setAttr(m.attributeName);
13528
+ }
13529
+ }
13492
13530
  /**
13493
13531
  * resolve inner component definition (handle possible async component)
13494
13532
  */
@@ -13499,11 +13537,7 @@ class VueElement extends BaseClass {
13499
13537
  for (let i = 0; i < this.attributes.length; i++) {
13500
13538
  this._setAttr(this.attributes[i].name);
13501
13539
  }
13502
- this._ob = new MutationObserver((mutations) => {
13503
- for (const m of mutations) {
13504
- this._setAttr(m.attributeName);
13505
- }
13506
- });
13540
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13507
13541
  this._ob.observe(this, { attributes: true });
13508
13542
  const resolve = (def, isAsync = false) => {
13509
13543
  this._resolved = true;
@@ -13580,7 +13614,7 @@ class VueElement extends BaseClass {
13580
13614
  return this._getProp(key);
13581
13615
  },
13582
13616
  set(val) {
13583
- this._setProp(key, val, true, true);
13617
+ this._setProp(key, val, true, !this._patching);
13584
13618
  }
13585
13619
  });
13586
13620
  }
@@ -13606,6 +13640,7 @@ class VueElement extends BaseClass {
13606
13640
  */
13607
13641
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13608
13642
  if (val !== this._props[key]) {
13643
+ this._dirty = true;
13609
13644
  if (val === REMOVAL) {
13610
13645
  delete this._props[key];
13611
13646
  } else {
@@ -13619,7 +13654,10 @@ class VueElement extends BaseClass {
13619
13654
  }
13620
13655
  if (shouldReflect) {
13621
13656
  const ob = this._ob;
13622
- ob && ob.disconnect();
13657
+ if (ob) {
13658
+ this._processMutations(ob.takeRecords());
13659
+ ob.disconnect();
13660
+ }
13623
13661
  if (val === true) {
13624
13662
  this.setAttribute(hyphenate(key), "");
13625
13663
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13723,7 +13761,7 @@ class VueElement extends BaseClass {
13723
13761
  * Only called when shadowRoot is false
13724
13762
  */
13725
13763
  _renderSlots() {
13726
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13764
+ const outlets = this._getSlots();
13727
13765
  const scopeId = this._instance.type.__scopeId;
13728
13766
  for (let i = 0; i < outlets.length; i++) {
13729
13767
  const o = outlets[i];
@@ -13749,12 +13787,45 @@ class VueElement extends BaseClass {
13749
13787
  parent.removeChild(o);
13750
13788
  }
13751
13789
  }
13790
+ /**
13791
+ * @internal
13792
+ */
13793
+ _getSlots() {
13794
+ const roots = [this];
13795
+ if (this._teleportTargets) {
13796
+ roots.push(...this._teleportTargets);
13797
+ }
13798
+ const slots = /* @__PURE__ */ new Set();
13799
+ for (const root of roots) {
13800
+ const found = root.querySelectorAll("slot");
13801
+ for (let i = 0; i < found.length; i++) {
13802
+ slots.add(found[i]);
13803
+ }
13804
+ }
13805
+ return Array.from(slots);
13806
+ }
13752
13807
  /**
13753
13808
  * @internal
13754
13809
  */
13755
13810
  _injectChildStyle(comp) {
13756
13811
  this._applyStyles(comp.styles, comp);
13757
13812
  }
13813
+ /**
13814
+ * @internal
13815
+ */
13816
+ _beginPatch() {
13817
+ this._patching = true;
13818
+ this._dirty = false;
13819
+ }
13820
+ /**
13821
+ * @internal
13822
+ */
13823
+ _endPatch() {
13824
+ this._patching = false;
13825
+ if (this._dirty && this._instance) {
13826
+ this._update();
13827
+ }
13828
+ }
13758
13829
  /**
13759
13830
  * @internal
13760
13831
  */
@@ -13853,7 +13924,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13853
13924
  prevChildren.forEach(callPendingCbs);
13854
13925
  prevChildren.forEach(recordPosition);
13855
13926
  const movedChildren = prevChildren.filter(applyTranslation);
13856
- forceReflow();
13927
+ forceReflow(instance.vnode.el);
13857
13928
  movedChildren.forEach((c) => {
13858
13929
  const el = c.el;
13859
13930
  const style = el.style;
@@ -13898,10 +13969,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13898
13969
  instance
13899
13970
  )
13900
13971
  );
13901
- positionMap.set(
13902
- child,
13903
- child.el.getBoundingClientRect()
13904
- );
13972
+ positionMap.set(child, {
13973
+ left: child.el.offsetLeft,
13974
+ top: child.el.offsetTop
13975
+ });
13905
13976
  }
13906
13977
  }
13907
13978
  }
@@ -13932,7 +14003,10 @@ function callPendingCbs(c) {
13932
14003
  }
13933
14004
  }
13934
14005
  function recordPosition(c) {
13935
- newPositionMap.set(c, c.el.getBoundingClientRect());
14006
+ newPositionMap.set(c, {
14007
+ left: c.el.offsetLeft,
14008
+ top: c.el.offsetTop
14009
+ });
13936
14010
  }
13937
14011
  function applyTranslation(c) {
13938
14012
  const oldPos = positionMap.get(c);
@@ -13978,24 +14052,22 @@ function onCompositionEnd(e) {
13978
14052
  }
13979
14053
  }
13980
14054
  const assignKey = Symbol("_assign");
14055
+ function castValue(value, trim, number) {
14056
+ if (trim) value = value.trim();
14057
+ if (number) value = looseToNumber(value);
14058
+ return value;
14059
+ }
13981
14060
  const vModelText = {
13982
14061
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
13983
14062
  el[assignKey] = getModelAssigner(vnode);
13984
14063
  const castToNumber = number || vnode.props && vnode.props.type === "number";
13985
14064
  addEventListener(el, lazy ? "change" : "input", (e) => {
13986
14065
  if (e.target.composing) return;
13987
- let domValue = el.value;
13988
- if (trim) {
13989
- domValue = domValue.trim();
13990
- }
13991
- if (castToNumber) {
13992
- domValue = looseToNumber(domValue);
13993
- }
13994
- el[assignKey](domValue);
14066
+ el[assignKey](castValue(el.value, trim, castToNumber));
13995
14067
  });
13996
- if (trim) {
14068
+ if (trim || castToNumber) {
13997
14069
  addEventListener(el, "change", () => {
13998
- el.value = el.value.trim();
14070
+ el.value = castValue(el.value, trim, castToNumber);
13999
14071
  });
14000
14072
  }
14001
14073
  if (!lazy) {