@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
  **/
@@ -1145,7 +1145,7 @@ var VueRuntimeDOM = (function (exports) {
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 VueRuntimeDOM = (function (exports) {
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 VueRuntimeDOM = (function (exports) {
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) {
@@ -2996,9 +2994,6 @@ var VueRuntimeDOM = (function (exports) {
2996
2994
  insert(mainAnchor, container, anchor);
2997
2995
  const mount = (container2, anchor2) => {
2998
2996
  if (shapeFlag & 16) {
2999
- if (parentComponent && parentComponent.isCE) {
3000
- parentComponent.ce._teleportTarget = container2;
3001
- }
3002
2997
  mountChildren(
3003
2998
  children,
3004
2999
  container2,
@@ -3020,6 +3015,9 @@ var VueRuntimeDOM = (function (exports) {
3020
3015
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3021
3016
  namespace = "mathml";
3022
3017
  }
3018
+ if (parentComponent && parentComponent.isCE) {
3019
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3020
+ }
3023
3021
  if (!disabled) {
3024
3022
  mount(target, targetAnchor);
3025
3023
  updateCssVars(n2, false);
@@ -4126,14 +4124,16 @@ Server rendered element contains more child nodes than client vdom.`
4126
4124
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4127
4125
  clientText = clientText.slice(1);
4128
4126
  }
4129
- if (el.textContent !== clientText) {
4127
+ const { textContent } = el;
4128
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4129
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4130
4130
  if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4131
4131
  warn$1(
4132
4132
  `Hydration text content mismatch on`,
4133
4133
  el,
4134
4134
  `
4135
- - rendered on server: ${el.textContent}
4136
- - expected on client: ${vnode.children}`
4135
+ - rendered on server: ${textContent}
4136
+ - expected on client: ${clientText}`
4137
4137
  );
4138
4138
  logMismatchError();
4139
4139
  }
@@ -4728,7 +4728,10 @@ Server rendered element contains fewer child nodes than client vdom.`
4728
4728
  error: error.value
4729
4729
  });
4730
4730
  } else if (loadingComponent && !delayed.value) {
4731
- return createVNode(loadingComponent);
4731
+ return createInnerComp(
4732
+ loadingComponent,
4733
+ instance
4734
+ );
4732
4735
  }
4733
4736
  };
4734
4737
  }
@@ -5179,12 +5182,13 @@ If this is a native custom element, make sure to exclude it from component resol
5179
5182
 
5180
5183
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5181
5184
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
5185
+ const hasProps = Object.keys(props).length > 0;
5182
5186
  if (name !== "default") props.name = name;
5183
5187
  return openBlock(), createBlock(
5184
5188
  Fragment,
5185
5189
  null,
5186
5190
  [createVNode("slot", props, fallback && fallback())],
5187
- 64
5191
+ hasProps ? -2 : 64
5188
5192
  );
5189
5193
  }
5190
5194
  let slot = slots[name];
@@ -7019,15 +7023,25 @@ If you want to remount the same app, move your app creation logic into a factory
7019
7023
  optimized
7020
7024
  );
7021
7025
  } else {
7022
- patchElement(
7023
- n1,
7024
- n2,
7025
- parentComponent,
7026
- parentSuspense,
7027
- namespace,
7028
- slotScopeIds,
7029
- optimized
7030
- );
7026
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
7027
+ try {
7028
+ if (customElement) {
7029
+ customElement._beginPatch();
7030
+ }
7031
+ patchElement(
7032
+ n1,
7033
+ n2,
7034
+ parentComponent,
7035
+ parentSuspense,
7036
+ namespace,
7037
+ slotScopeIds,
7038
+ optimized
7039
+ );
7040
+ } finally {
7041
+ if (customElement) {
7042
+ customElement._endPatch();
7043
+ }
7044
+ }
7031
7045
  }
7032
7046
  };
7033
7047
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -9241,7 +9255,8 @@ If you want to remount the same app, move your app creation logic into a factory
9241
9255
  pendingId,
9242
9256
  effects,
9243
9257
  parentComponent: parentComponent2,
9244
- container: container2
9258
+ container: container2,
9259
+ isInFallback
9245
9260
  } = suspense;
9246
9261
  let delayEnter = false;
9247
9262
  if (suspense.isHydrating) {
@@ -9258,6 +9273,9 @@ If you want to remount the same app, move your app creation logic into a factory
9258
9273
  0
9259
9274
  );
9260
9275
  queuePostFlushCb(effects);
9276
+ if (isInFallback && vnode2.ssFallback) {
9277
+ vnode2.ssFallback.el = null;
9278
+ }
9261
9279
  }
9262
9280
  };
9263
9281
  }
@@ -9266,6 +9284,9 @@ If you want to remount the same app, move your app creation logic into a factory
9266
9284
  anchor = next(activeBranch);
9267
9285
  }
9268
9286
  unmount(activeBranch, parentComponent2, suspense, true);
9287
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
9288
+ vnode2.ssFallback.el = null;
9289
+ }
9269
9290
  }
9270
9291
  if (!delayEnter) {
9271
9292
  move(pendingBranch, container2, anchor, 0);
@@ -9384,6 +9405,7 @@ If you want to remount the same app, move your app creation logic into a factory
9384
9405
  optimized2
9385
9406
  );
9386
9407
  if (placeholder) {
9408
+ vnode2.placeholder = null;
9387
9409
  remove(placeholder);
9388
9410
  }
9389
9411
  updateHOCHostEl(instance, vnode2.el);
@@ -10314,31 +10336,28 @@ Component that was made reactive: `,
10314
10336
  };
10315
10337
 
10316
10338
  function h(type, propsOrChildren, children) {
10317
- const doCreateVNode = (type2, props, children2) => {
10339
+ try {
10318
10340
  setBlockTracking(-1);
10319
- try {
10320
- return createVNode(type2, props, children2);
10321
- } finally {
10322
- setBlockTracking(1);
10323
- }
10324
- };
10325
- const l = arguments.length;
10326
- if (l === 2) {
10327
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10328
- if (isVNode(propsOrChildren)) {
10329
- return doCreateVNode(type, null, [propsOrChildren]);
10341
+ const l = arguments.length;
10342
+ if (l === 2) {
10343
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10344
+ if (isVNode(propsOrChildren)) {
10345
+ return createVNode(type, null, [propsOrChildren]);
10346
+ }
10347
+ return createVNode(type, propsOrChildren);
10348
+ } else {
10349
+ return createVNode(type, null, propsOrChildren);
10330
10350
  }
10331
- return doCreateVNode(type, propsOrChildren);
10332
10351
  } else {
10333
- return doCreateVNode(type, null, propsOrChildren);
10334
- }
10335
- } else {
10336
- if (l > 3) {
10337
- children = Array.prototype.slice.call(arguments, 2);
10338
- } else if (l === 3 && isVNode(children)) {
10339
- children = [children];
10352
+ if (l > 3) {
10353
+ children = Array.prototype.slice.call(arguments, 2);
10354
+ } else if (l === 3 && isVNode(children)) {
10355
+ children = [children];
10356
+ }
10357
+ return createVNode(type, propsOrChildren, children);
10340
10358
  }
10341
- return doCreateVNode(type, propsOrChildren, children);
10359
+ } finally {
10360
+ setBlockTracking(1);
10342
10361
  }
10343
10362
  }
10344
10363
 
@@ -10548,7 +10567,7 @@ Component that was made reactive: `,
10548
10567
  return true;
10549
10568
  }
10550
10569
 
10551
- const version = "3.5.21";
10570
+ const version = "3.5.23";
10552
10571
  const warn = warn$1 ;
10553
10572
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10554
10573
  const devtools = devtools$1 ;
@@ -10765,11 +10784,11 @@ Component that was made reactive: `,
10765
10784
  const resolve = () => finishLeave(el, done);
10766
10785
  addTransitionClass(el, leaveFromClass);
10767
10786
  if (!el._enterCancelled) {
10768
- forceReflow();
10787
+ forceReflow(el);
10769
10788
  addTransitionClass(el, leaveActiveClass);
10770
10789
  } else {
10771
10790
  addTransitionClass(el, leaveActiveClass);
10772
- forceReflow();
10791
+ forceReflow(el);
10773
10792
  }
10774
10793
  nextFrame(() => {
10775
10794
  if (!el._isLeaving) {
@@ -10915,8 +10934,9 @@ Component that was made reactive: `,
10915
10934
  if (s === "auto") return 0;
10916
10935
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
10917
10936
  }
10918
- function forceReflow() {
10919
- return document.body.offsetHeight;
10937
+ function forceReflow(el) {
10938
+ const targetDocument = el ? el.ownerDocument : document;
10939
+ return targetDocument.body.offsetHeight;
10920
10940
  }
10921
10941
 
10922
10942
  function patchClass(el, value, isSVG) {
@@ -11350,6 +11370,9 @@ Expected function or array of functions, received type ${typeof value}.`
11350
11370
  if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
11351
11371
  return false;
11352
11372
  }
11373
+ if (key === "sandbox" && el.tagName === "IFRAME") {
11374
+ return false;
11375
+ }
11353
11376
  if (key === "form") {
11354
11377
  return false;
11355
11378
  }
@@ -11410,6 +11433,8 @@ Expected function or array of functions, received type ${typeof value}.`
11410
11433
  this._nonce = this._def.nonce;
11411
11434
  this._connected = false;
11412
11435
  this._resolved = false;
11436
+ this._patching = false;
11437
+ this._dirty = false;
11413
11438
  this._numberProps = null;
11414
11439
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11415
11440
  this._ob = null;
@@ -11422,7 +11447,11 @@ Expected function or array of functions, received type ${typeof value}.`
11422
11447
  );
11423
11448
  }
11424
11449
  if (_def.shadowRoot !== false) {
11425
- this.attachShadow({ mode: "open" });
11450
+ this.attachShadow(
11451
+ extend({}, _def.shadowRootOptions, {
11452
+ mode: "open"
11453
+ })
11454
+ );
11426
11455
  this._root = this.shadowRoot;
11427
11456
  } else {
11428
11457
  this._root = this;
@@ -11482,9 +11511,18 @@ Expected function or array of functions, received type ${typeof value}.`
11482
11511
  this._app && this._app.unmount();
11483
11512
  if (this._instance) this._instance.ce = void 0;
11484
11513
  this._app = this._instance = null;
11514
+ if (this._teleportTargets) {
11515
+ this._teleportTargets.clear();
11516
+ this._teleportTargets = void 0;
11517
+ }
11485
11518
  }
11486
11519
  });
11487
11520
  }
11521
+ _processMutations(mutations) {
11522
+ for (const m of mutations) {
11523
+ this._setAttr(m.attributeName);
11524
+ }
11525
+ }
11488
11526
  /**
11489
11527
  * resolve inner component definition (handle possible async component)
11490
11528
  */
@@ -11495,11 +11533,7 @@ Expected function or array of functions, received type ${typeof value}.`
11495
11533
  for (let i = 0; i < this.attributes.length; i++) {
11496
11534
  this._setAttr(this.attributes[i].name);
11497
11535
  }
11498
- this._ob = new MutationObserver((mutations) => {
11499
- for (const m of mutations) {
11500
- this._setAttr(m.attributeName);
11501
- }
11502
- });
11536
+ this._ob = new MutationObserver(this._processMutations.bind(this));
11503
11537
  this._ob.observe(this, { attributes: true });
11504
11538
  const resolve = (def, isAsync = false) => {
11505
11539
  this._resolved = true;
@@ -11576,7 +11610,7 @@ Expected function or array of functions, received type ${typeof value}.`
11576
11610
  return this._getProp(key);
11577
11611
  },
11578
11612
  set(val) {
11579
- this._setProp(key, val, true, true);
11613
+ this._setProp(key, val, true, !this._patching);
11580
11614
  }
11581
11615
  });
11582
11616
  }
@@ -11602,6 +11636,7 @@ Expected function or array of functions, received type ${typeof value}.`
11602
11636
  */
11603
11637
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11604
11638
  if (val !== this._props[key]) {
11639
+ this._dirty = true;
11605
11640
  if (val === REMOVAL) {
11606
11641
  delete this._props[key];
11607
11642
  } else {
@@ -11615,7 +11650,10 @@ Expected function or array of functions, received type ${typeof value}.`
11615
11650
  }
11616
11651
  if (shouldReflect) {
11617
11652
  const ob = this._ob;
11618
- ob && ob.disconnect();
11653
+ if (ob) {
11654
+ this._processMutations(ob.takeRecords());
11655
+ ob.disconnect();
11656
+ }
11619
11657
  if (val === true) {
11620
11658
  this.setAttribute(hyphenate(key), "");
11621
11659
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11719,7 +11757,7 @@ Expected function or array of functions, received type ${typeof value}.`
11719
11757
  * Only called when shadowRoot is false
11720
11758
  */
11721
11759
  _renderSlots() {
11722
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11760
+ const outlets = this._getSlots();
11723
11761
  const scopeId = this._instance.type.__scopeId;
11724
11762
  for (let i = 0; i < outlets.length; i++) {
11725
11763
  const o = outlets[i];
@@ -11745,12 +11783,45 @@ Expected function or array of functions, received type ${typeof value}.`
11745
11783
  parent.removeChild(o);
11746
11784
  }
11747
11785
  }
11786
+ /**
11787
+ * @internal
11788
+ */
11789
+ _getSlots() {
11790
+ const roots = [this];
11791
+ if (this._teleportTargets) {
11792
+ roots.push(...this._teleportTargets);
11793
+ }
11794
+ const slots = /* @__PURE__ */ new Set();
11795
+ for (const root of roots) {
11796
+ const found = root.querySelectorAll("slot");
11797
+ for (let i = 0; i < found.length; i++) {
11798
+ slots.add(found[i]);
11799
+ }
11800
+ }
11801
+ return Array.from(slots);
11802
+ }
11748
11803
  /**
11749
11804
  * @internal
11750
11805
  */
11751
11806
  _injectChildStyle(comp) {
11752
11807
  this._applyStyles(comp.styles, comp);
11753
11808
  }
11809
+ /**
11810
+ * @internal
11811
+ */
11812
+ _beginPatch() {
11813
+ this._patching = true;
11814
+ this._dirty = false;
11815
+ }
11816
+ /**
11817
+ * @internal
11818
+ */
11819
+ _endPatch() {
11820
+ this._patching = false;
11821
+ if (this._dirty && this._instance) {
11822
+ this._update();
11823
+ }
11824
+ }
11754
11825
  /**
11755
11826
  * @internal
11756
11827
  */
@@ -11834,7 +11905,7 @@ Expected function or array of functions, received type ${typeof value}.`
11834
11905
  prevChildren.forEach(callPendingCbs);
11835
11906
  prevChildren.forEach(recordPosition);
11836
11907
  const movedChildren = prevChildren.filter(applyTranslation);
11837
- forceReflow();
11908
+ forceReflow(instance.vnode.el);
11838
11909
  movedChildren.forEach((c) => {
11839
11910
  const el = c.el;
11840
11911
  const style = el.style;
@@ -11873,10 +11944,10 @@ Expected function or array of functions, received type ${typeof value}.`
11873
11944
  instance
11874
11945
  )
11875
11946
  );
11876
- positionMap.set(
11877
- child,
11878
- child.el.getBoundingClientRect()
11879
- );
11947
+ positionMap.set(child, {
11948
+ left: child.el.offsetLeft,
11949
+ top: child.el.offsetTop
11950
+ });
11880
11951
  }
11881
11952
  }
11882
11953
  }
@@ -11907,7 +11978,10 @@ Expected function or array of functions, received type ${typeof value}.`
11907
11978
  }
11908
11979
  }
11909
11980
  function recordPosition(c) {
11910
- newPositionMap.set(c, c.el.getBoundingClientRect());
11981
+ newPositionMap.set(c, {
11982
+ left: c.el.offsetLeft,
11983
+ top: c.el.offsetTop
11984
+ });
11911
11985
  }
11912
11986
  function applyTranslation(c) {
11913
11987
  const oldPos = positionMap.get(c);
@@ -11953,24 +12027,22 @@ Expected function or array of functions, received type ${typeof value}.`
11953
12027
  }
11954
12028
  }
11955
12029
  const assignKey = Symbol("_assign");
12030
+ function castValue(value, trim, number) {
12031
+ if (trim) value = value.trim();
12032
+ if (number) value = looseToNumber(value);
12033
+ return value;
12034
+ }
11956
12035
  const vModelText = {
11957
12036
  created(el, { modifiers: { lazy, trim, number } }, vnode) {
11958
12037
  el[assignKey] = getModelAssigner(vnode);
11959
12038
  const castToNumber = number || vnode.props && vnode.props.type === "number";
11960
12039
  addEventListener(el, lazy ? "change" : "input", (e) => {
11961
12040
  if (e.target.composing) return;
11962
- let domValue = el.value;
11963
- if (trim) {
11964
- domValue = domValue.trim();
11965
- }
11966
- if (castToNumber) {
11967
- domValue = looseToNumber(domValue);
11968
- }
11969
- el[assignKey](domValue);
12041
+ el[assignKey](castValue(el.value, trim, castToNumber));
11970
12042
  });
11971
- if (trim) {
12043
+ if (trim || castToNumber) {
11972
12044
  addEventListener(el, "change", () => {
11973
- el.value = el.value.trim();
12045
+ el.value = castValue(el.value, trim, castToNumber);
11974
12046
  });
11975
12047
  }
11976
12048
  if (!lazy) {