@vue/runtime-dom 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/runtime-dom v3.5.21
2
+ * @vue/runtime-dom 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) {
@@ -2993,9 +2991,6 @@ const TeleportImpl = {
2993
2991
  insert(mainAnchor, container, anchor);
2994
2992
  const mount = (container2, anchor2) => {
2995
2993
  if (shapeFlag & 16) {
2996
- if (parentComponent && parentComponent.isCE) {
2997
- parentComponent.ce._teleportTarget = container2;
2998
- }
2999
2994
  mountChildren(
3000
2995
  children,
3001
2996
  container2,
@@ -3017,6 +3012,9 @@ const TeleportImpl = {
3017
3012
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3018
3013
  namespace = "mathml";
3019
3014
  }
3015
+ if (parentComponent && parentComponent.isCE) {
3016
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3017
+ }
3020
3018
  if (!disabled) {
3021
3019
  mount(target, targetAnchor);
3022
3020
  updateCssVars(n2, false);
@@ -4123,14 +4121,16 @@ Server rendered element contains more child nodes than client vdom.`
4123
4121
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4124
4122
  clientText = clientText.slice(1);
4125
4123
  }
4126
- if (el.textContent !== clientText) {
4124
+ const { textContent } = el;
4125
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4126
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4127
4127
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4128
4128
  warn$1(
4129
4129
  `Hydration text content mismatch on`,
4130
4130
  el,
4131
4131
  `
4132
- - rendered on server: ${el.textContent}
4133
- - expected on client: ${vnode.children}`
4132
+ - rendered on server: ${textContent}
4133
+ - expected on client: ${clientText}`
4134
4134
  );
4135
4135
  logMismatchError();
4136
4136
  }
@@ -4725,7 +4725,10 @@ function defineAsyncComponent(source) {
4725
4725
  error: error.value
4726
4726
  });
4727
4727
  } else if (loadingComponent && !delayed.value) {
4728
- return createVNode(loadingComponent);
4728
+ return createInnerComp(
4729
+ loadingComponent,
4730
+ instance
4731
+ );
4729
4732
  }
4730
4733
  };
4731
4734
  }
@@ -5182,12 +5185,13 @@ function createSlots(slots, dynamicSlots) {
5182
5185
 
5183
5186
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5184
5187
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5188
+ const hasProps = Object.keys(props).length > 0;
5185
5189
  if (name !== "default") props.name = name;
5186
5190
  return openBlock(), createBlock(
5187
5191
  Fragment,
5188
5192
  null,
5189
5193
  [createVNode("slot", props, fallback && fallback())],
5190
- 64
5194
+ hasProps ? -2 : 64
5191
5195
  );
5192
5196
  }
5193
5197
  let slot = slots[name];
@@ -7025,15 +7029,25 @@ function baseCreateRenderer(options, createHydrationFns) {
7025
7029
  optimized
7026
7030
  );
7027
7031
  } else {
7028
- patchElement(
7029
- n1,
7030
- n2,
7031
- parentComponent,
7032
- parentSuspense,
7033
- namespace,
7034
- slotScopeIds,
7035
- optimized
7036
- );
7032
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
7033
+ try {
7034
+ if (customElement) {
7035
+ customElement._beginPatch();
7036
+ }
7037
+ patchElement(
7038
+ n1,
7039
+ n2,
7040
+ parentComponent,
7041
+ parentSuspense,
7042
+ namespace,
7043
+ slotScopeIds,
7044
+ optimized
7045
+ );
7046
+ } finally {
7047
+ if (customElement) {
7048
+ customElement._endPatch();
7049
+ }
7050
+ }
7037
7051
  }
7038
7052
  };
7039
7053
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -9275,7 +9289,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9275
9289
  pendingId,
9276
9290
  effects,
9277
9291
  parentComponent: parentComponent2,
9278
- container: container2
9292
+ container: container2,
9293
+ isInFallback
9279
9294
  } = suspense;
9280
9295
  let delayEnter = false;
9281
9296
  if (suspense.isHydrating) {
@@ -9292,6 +9307,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9292
9307
  0
9293
9308
  );
9294
9309
  queuePostFlushCb(effects);
9310
+ if (isInFallback && vnode2.ssFallback) {
9311
+ vnode2.ssFallback.el = null;
9312
+ }
9295
9313
  }
9296
9314
  };
9297
9315
  }
@@ -9300,6 +9318,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9300
9318
  anchor = next(activeBranch);
9301
9319
  }
9302
9320
  unmount(activeBranch, parentComponent2, suspense, true);
9321
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
9322
+ vnode2.ssFallback.el = null;
9323
+ }
9303
9324
  }
9304
9325
  if (!delayEnter) {
9305
9326
  move(pendingBranch, container2, anchor, 0);
@@ -9418,6 +9439,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9418
9439
  optimized2
9419
9440
  );
9420
9441
  if (placeholder) {
9442
+ vnode2.placeholder = null;
9421
9443
  remove(placeholder);
9422
9444
  }
9423
9445
  updateHOCHostEl(instance, vnode2.el);
@@ -10362,31 +10384,28 @@ const computed = (getterOrOptions, debugOptions) => {
10362
10384
  };
10363
10385
 
10364
10386
  function h(type, propsOrChildren, children) {
10365
- const doCreateVNode = (type2, props, children2) => {
10387
+ try {
10366
10388
  setBlockTracking(-1);
10367
- try {
10368
- return createVNode(type2, props, children2);
10369
- } finally {
10370
- setBlockTracking(1);
10371
- }
10372
- };
10373
- const l = arguments.length;
10374
- if (l === 2) {
10375
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10376
- if (isVNode(propsOrChildren)) {
10377
- return doCreateVNode(type, null, [propsOrChildren]);
10389
+ const l = arguments.length;
10390
+ if (l === 2) {
10391
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10392
+ if (isVNode(propsOrChildren)) {
10393
+ return createVNode(type, null, [propsOrChildren]);
10394
+ }
10395
+ return createVNode(type, propsOrChildren);
10396
+ } else {
10397
+ return createVNode(type, null, propsOrChildren);
10378
10398
  }
10379
- return doCreateVNode(type, propsOrChildren);
10380
10399
  } else {
10381
- return doCreateVNode(type, null, propsOrChildren);
10382
- }
10383
- } else {
10384
- if (l > 3) {
10385
- children = Array.prototype.slice.call(arguments, 2);
10386
- } else if (l === 3 && isVNode(children)) {
10387
- children = [children];
10400
+ if (l > 3) {
10401
+ children = Array.prototype.slice.call(arguments, 2);
10402
+ } else if (l === 3 && isVNode(children)) {
10403
+ children = [children];
10404
+ }
10405
+ return createVNode(type, propsOrChildren, children);
10388
10406
  }
10389
- return doCreateVNode(type, propsOrChildren, children);
10407
+ } finally {
10408
+ setBlockTracking(1);
10390
10409
  }
10391
10410
  }
10392
10411
 
@@ -10596,7 +10615,7 @@ function isMemoSame(cached, memo) {
10596
10615
  return true;
10597
10616
  }
10598
10617
 
10599
- const version = "3.5.21";
10618
+ const version = "3.5.23";
10600
10619
  const warn = warn$1 ;
10601
10620
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10602
10621
  const devtools = devtools$1 ;
@@ -10825,11 +10844,11 @@ function resolveTransitionProps(rawProps) {
10825
10844
  const resolve = () => finishLeave(el, done);
10826
10845
  addTransitionClass(el, leaveFromClass);
10827
10846
  if (!el._enterCancelled) {
10828
- forceReflow();
10847
+ forceReflow(el);
10829
10848
  addTransitionClass(el, leaveActiveClass);
10830
10849
  } else {
10831
10850
  addTransitionClass(el, leaveActiveClass);
10832
- forceReflow();
10851
+ forceReflow(el);
10833
10852
  }
10834
10853
  nextFrame(() => {
10835
10854
  if (!el._isLeaving) {
@@ -10975,8 +10994,9 @@ function toMs(s) {
10975
10994
  if (s === "auto") return 0;
10976
10995
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
10977
10996
  }
10978
- function forceReflow() {
10979
- return document.body.offsetHeight;
10997
+ function forceReflow(el) {
10998
+ const targetDocument = el ? el.ownerDocument : document;
10999
+ return targetDocument.body.offsetHeight;
10980
11000
  }
10981
11001
 
10982
11002
  function patchClass(el, value, isSVG) {
@@ -11417,6 +11437,9 @@ function shouldSetAsProp(el, key, value, isSVG) {
11417
11437
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
11418
11438
  return false;
11419
11439
  }
11440
+ if (key === "sandbox" && el.tagName === "IFRAME") {
11441
+ return false;
11442
+ }
11420
11443
  if (key === "form") {
11421
11444
  return false;
11422
11445
  }
@@ -11477,6 +11500,8 @@ class VueElement extends BaseClass {
11477
11500
  this._nonce = this._def.nonce;
11478
11501
  this._connected = false;
11479
11502
  this._resolved = false;
11503
+ this._patching = false;
11504
+ this._dirty = false;
11480
11505
  this._numberProps = null;
11481
11506
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11482
11507
  this._ob = null;
@@ -11489,7 +11514,11 @@ class VueElement extends BaseClass {
11489
11514
  );
11490
11515
  }
11491
11516
  if (_def.shadowRoot !== false) {
11492
- this.attachShadow({ mode: "open" });
11517
+ this.attachShadow(
11518
+ extend({}, _def.shadowRootOptions, {
11519
+ mode: "open"
11520
+ })
11521
+ );
11493
11522
  this._root = this.shadowRoot;
11494
11523
  } else {
11495
11524
  this._root = this;
@@ -11549,9 +11578,18 @@ class VueElement extends BaseClass {
11549
11578
  this._app && this._app.unmount();
11550
11579
  if (this._instance) this._instance.ce = void 0;
11551
11580
  this._app = this._instance = null;
11581
+ if (this._teleportTargets) {
11582
+ this._teleportTargets.clear();
11583
+ this._teleportTargets = void 0;
11584
+ }
11552
11585
  }
11553
11586
  });
11554
11587
  }
11588
+ _processMutations(mutations) {
11589
+ for (const m of mutations) {
11590
+ this._setAttr(m.attributeName);
11591
+ }
11592
+ }
11555
11593
  /**
11556
11594
  * resolve inner component definition (handle possible async component)
11557
11595
  */
@@ -11562,11 +11600,7 @@ class VueElement extends BaseClass {
11562
11600
  for (let i = 0; i < this.attributes.length; i++) {
11563
11601
  this._setAttr(this.attributes[i].name);
11564
11602
  }
11565
- this._ob = new MutationObserver((mutations) => {
11566
- for (const m of mutations) {
11567
- this._setAttr(m.attributeName);
11568
- }
11569
- });
11603
+ this._ob = new MutationObserver(this._processMutations.bind(this));
11570
11604
  this._ob.observe(this, { attributes: true });
11571
11605
  const resolve = (def, isAsync = false) => {
11572
11606
  this._resolved = true;
@@ -11643,7 +11677,7 @@ class VueElement extends BaseClass {
11643
11677
  return this._getProp(key);
11644
11678
  },
11645
11679
  set(val) {
11646
- this._setProp(key, val, true, true);
11680
+ this._setProp(key, val, true, !this._patching);
11647
11681
  }
11648
11682
  });
11649
11683
  }
@@ -11669,6 +11703,7 @@ class VueElement extends BaseClass {
11669
11703
  */
11670
11704
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11671
11705
  if (val !== this._props[key]) {
11706
+ this._dirty = true;
11672
11707
  if (val === REMOVAL) {
11673
11708
  delete this._props[key];
11674
11709
  } else {
@@ -11682,7 +11717,10 @@ class VueElement extends BaseClass {
11682
11717
  }
11683
11718
  if (shouldReflect) {
11684
11719
  const ob = this._ob;
11685
- ob && ob.disconnect();
11720
+ if (ob) {
11721
+ this._processMutations(ob.takeRecords());
11722
+ ob.disconnect();
11723
+ }
11686
11724
  if (val === true) {
11687
11725
  this.setAttribute(hyphenate(key), "");
11688
11726
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11786,7 +11824,7 @@ class VueElement extends BaseClass {
11786
11824
  * Only called when shadowRoot is false
11787
11825
  */
11788
11826
  _renderSlots() {
11789
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11827
+ const outlets = this._getSlots();
11790
11828
  const scopeId = this._instance.type.__scopeId;
11791
11829
  for (let i = 0; i < outlets.length; i++) {
11792
11830
  const o = outlets[i];
@@ -11812,12 +11850,45 @@ class VueElement extends BaseClass {
11812
11850
  parent.removeChild(o);
11813
11851
  }
11814
11852
  }
11853
+ /**
11854
+ * @internal
11855
+ */
11856
+ _getSlots() {
11857
+ const roots = [this];
11858
+ if (this._teleportTargets) {
11859
+ roots.push(...this._teleportTargets);
11860
+ }
11861
+ const slots = /* @__PURE__ */ new Set();
11862
+ for (const root of roots) {
11863
+ const found = root.querySelectorAll("slot");
11864
+ for (let i = 0; i < found.length; i++) {
11865
+ slots.add(found[i]);
11866
+ }
11867
+ }
11868
+ return Array.from(slots);
11869
+ }
11815
11870
  /**
11816
11871
  * @internal
11817
11872
  */
11818
11873
  _injectChildStyle(comp) {
11819
11874
  this._applyStyles(comp.styles, comp);
11820
11875
  }
11876
+ /**
11877
+ * @internal
11878
+ */
11879
+ _beginPatch() {
11880
+ this._patching = true;
11881
+ this._dirty = false;
11882
+ }
11883
+ /**
11884
+ * @internal
11885
+ */
11886
+ _endPatch() {
11887
+ this._patching = false;
11888
+ if (this._dirty && this._instance) {
11889
+ this._update();
11890
+ }
11891
+ }
11821
11892
  /**
11822
11893
  * @internal
11823
11894
  */
@@ -11913,7 +11984,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11913
11984
  prevChildren.forEach(callPendingCbs);
11914
11985
  prevChildren.forEach(recordPosition);
11915
11986
  const movedChildren = prevChildren.filter(applyTranslation);
11916
- forceReflow();
11987
+ forceReflow(instance.vnode.el);
11917
11988
  movedChildren.forEach((c) => {
11918
11989
  const el = c.el;
11919
11990
  const style = el.style;
@@ -11952,10 +12023,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11952
12023
  instance
11953
12024
  )
11954
12025
  );
11955
- positionMap.set(
11956
- child,
11957
- child.el.getBoundingClientRect()
11958
- );
12026
+ positionMap.set(child, {
12027
+ left: child.el.offsetLeft,
12028
+ top: child.el.offsetTop
12029
+ });
11959
12030
  }
11960
12031
  }
11961
12032
  }
@@ -11986,7 +12057,10 @@ function callPendingCbs(c) {
11986
12057
  }
11987
12058
  }
11988
12059
  function recordPosition(c) {
11989
- newPositionMap.set(c, c.el.getBoundingClientRect());
12060
+ newPositionMap.set(c, {
12061
+ left: c.el.offsetLeft,
12062
+ top: c.el.offsetTop
12063
+ });
11990
12064
  }
11991
12065
  function applyTranslation(c) {
11992
12066
  const oldPos = positionMap.get(c);
@@ -12032,24 +12106,22 @@ function onCompositionEnd(e) {
12032
12106
  }
12033
12107
  }
12034
12108
  const assignKey = Symbol("_assign");
12109
+ function castValue(value, trim, number) {
12110
+ if (trim) value = value.trim();
12111
+ if (number) value = looseToNumber(value);
12112
+ return value;
12113
+ }
12035
12114
  const vModelText = {
12036
12115
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
12037
12116
  el[assignKey] = getModelAssigner(vnode);
12038
12117
  const castToNumber = number || vnode.props && vnode.props.type === "number";
12039
12118
  addEventListener(el, lazy ? "change" : "input", (e) => {
12040
12119
  if (e.target.composing) return;
12041
- let domValue = el.value;
12042
- if (trim) {
12043
- domValue = domValue.trim();
12044
- }
12045
- if (castToNumber) {
12046
- domValue = looseToNumber(domValue);
12047
- }
12048
- el[assignKey](domValue);
12120
+ el[assignKey](castValue(el.value, trim, castToNumber));
12049
12121
  });
12050
- if (trim) {
12122
+ if (trim || castToNumber) {
12051
12123
  addEventListener(el, "change", () => {
12052
- el.value = el.value.trim();
12124
+ el.value = castValue(el.value, trim, castToNumber);
12053
12125
  });
12054
12126
  }
12055
12127
  if (!lazy) {