@vue/runtime-dom 3.4.26 → 3.4.28

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,11 +1,11 @@
1
1
  /**
2
- * @vue/runtime-dom v3.4.26
2
+ * @vue/runtime-dom v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
6
  import { h, BaseTransition, BaseTransitionPropsValidators, assertNumber, getCurrentInstance, warn, onMounted, watchPostEffect, onUnmounted, Fragment, Static, camelize, callWithAsyncErrorHandling, defineComponent, nextTick, createVNode, useTransitionState, onUpdated, toRaw, getTransitionRawChildren, setTransitionHooks, resolveTransitionHooks, isRuntimeOnly, createRenderer, createHydrationRenderer } from '@vue/runtime-core';
7
7
  export * from '@vue/runtime-core';
8
- import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, isSpecialBooleanAttr, includeBooleanAttr, isFunction, NOOP, isOn, isModelListener, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
8
+ import { extend, isObject, toNumber, isArray, isString, hyphenate, capitalize, includeBooleanAttr, isSpecialBooleanAttr, isFunction, NOOP, isOn, isModelListener, camelize as camelize$1, EMPTY_OBJ, looseToNumber, looseIndexOf, isSet, looseEqual, invokeArrayFns, isHTMLTag, isSVGTag, isMathMLTag } from '@vue/shared';
9
9
 
10
10
  const svgNS = "http://www.w3.org/2000/svg";
11
11
  const mathmlNS = "http://www.w3.org/1998/Math/MathML";
@@ -22,7 +22,7 @@ const nodeOps = {
22
22
  }
23
23
  },
24
24
  createElement: (tag, namespace, is, props) => {
25
- const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : doc.createElement(tag, is ? { is } : void 0);
25
+ const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag);
26
26
  if (tag === "select" && props && props.multiple != null) {
27
27
  el.setAttribute("multiple", props.multiple);
28
28
  }
@@ -51,8 +51,7 @@ const nodeOps = {
51
51
  if (start && (start === end || start.nextSibling)) {
52
52
  while (true) {
53
53
  parent.insertBefore(start.cloneNode(true), anchor);
54
- if (start === end || !(start = start.nextSibling))
55
- break;
54
+ if (start === end || !(start = start.nextSibling)) break;
56
55
  }
57
56
  } else {
58
57
  templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content;
@@ -336,8 +335,7 @@ function getTimeout(delays, durations) {
336
335
  return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i])));
337
336
  }
338
337
  function toMs(s) {
339
- if (s === "auto")
340
- return 0;
338
+ if (s === "auto") return 0;
341
339
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
342
340
  }
343
341
  function forceReflow() {
@@ -375,8 +373,7 @@ const vShow = {
375
373
  }
376
374
  },
377
375
  updated(el, { value, oldValue }, { transition }) {
378
- if (!value === !oldValue)
379
- return;
376
+ if (!value === !oldValue) return;
380
377
  if (transition) {
381
378
  if (value) {
382
379
  transition.beforeEnter(el);
@@ -458,8 +455,7 @@ function setVarsOnVNode(vnode, vars) {
458
455
  let { el, anchor } = vnode;
459
456
  while (el) {
460
457
  setVarsOnNode(el, vars);
461
- if (el === anchor)
462
- break;
458
+ if (el === anchor) break;
463
459
  el = el.nextSibling;
464
460
  }
465
461
  }
@@ -531,8 +527,7 @@ function setStyle(style, name, val) {
531
527
  if (isArray(val)) {
532
528
  val.forEach((v) => setStyle(style, name, v));
533
529
  } else {
534
- if (val == null)
535
- val = "";
530
+ if (val == null) val = "";
536
531
  if (!!(process.env.NODE_ENV !== "production")) {
537
532
  if (semicolonRE.test(val)) {
538
533
  warn(
@@ -578,7 +573,7 @@ function autoPrefix(style, rawName) {
578
573
  }
579
574
 
580
575
  const xlinkNS = "http://www.w3.org/1999/xlink";
581
- function patchAttr(el, key, value, isSVG, instance) {
576
+ function patchAttr(el, key, value, isSVG, instance, isBoolean = isSpecialBooleanAttr(key)) {
582
577
  if (isSVG && key.startsWith("xlink:")) {
583
578
  if (value == null) {
584
579
  el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
@@ -586,11 +581,10 @@ function patchAttr(el, key, value, isSVG, instance) {
586
581
  el.setAttributeNS(xlinkNS, key, value);
587
582
  }
588
583
  } else {
589
- const isBoolean = isSpecialBooleanAttr(key);
590
584
  if (value == null || isBoolean && !includeBooleanAttr(value)) {
591
585
  el.removeAttribute(key);
592
586
  } else {
593
- el.setAttribute(key, isBoolean ? "" : value);
587
+ el.setAttribute(key, isBoolean ? "" : String(value));
594
588
  }
595
589
  }
596
590
  }
@@ -607,7 +601,7 @@ function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspe
607
601
  if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally
608
602
  !tag.includes("-")) {
609
603
  const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value;
610
- const newValue = value == null ? "" : value;
604
+ const newValue = value == null ? "" : String(value);
611
605
  if (oldValue !== newValue || !("_value" in el)) {
612
606
  el.value = newValue;
613
607
  }
@@ -751,6 +745,9 @@ const patchProp = (el, key, prevValue, nextValue, namespace, prevChildren, paren
751
745
  parentSuspense,
752
746
  unmountChildren
753
747
  );
748
+ if (key === "value" || key === "checked" || key === "selected") {
749
+ patchAttr(el, key, nextValue, isSVG, parentComponent, key !== "value");
750
+ }
754
751
  } else {
755
752
  if (key === "true-value") {
756
753
  el._trueValue = nextValue;
@@ -851,12 +848,12 @@ class VueElement extends BaseClass {
851
848
  }
852
849
  disconnectedCallback() {
853
850
  this._connected = false;
854
- if (this._ob) {
855
- this._ob.disconnect();
856
- this._ob = null;
857
- }
858
851
  nextTick(() => {
859
852
  if (!this._connected) {
853
+ if (this._ob) {
854
+ this._ob.disconnect();
855
+ this._ob = null;
856
+ }
860
857
  render(null, this.shadowRoot);
861
858
  this._instance = null;
862
859
  }
@@ -1192,8 +1189,7 @@ const vModelText = {
1192
1189
  el[assignKey] = getModelAssigner(vnode);
1193
1190
  const castToNumber = number || vnode.props && vnode.props.type === "number";
1194
1191
  addEventListener(el, lazy ? "change" : "input", (e) => {
1195
- if (e.target.composing)
1196
- return;
1192
+ if (e.target.composing) return;
1197
1193
  let domValue = el.value;
1198
1194
  if (trim) {
1199
1195
  domValue = domValue.trim();
@@ -1218,17 +1214,16 @@ const vModelText = {
1218
1214
  mounted(el, { value }) {
1219
1215
  el.value = value == null ? "" : value;
1220
1216
  },
1221
- beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
1217
+ beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
1222
1218
  el[assignKey] = getModelAssigner(vnode);
1223
- if (el.composing)
1224
- return;
1219
+ if (el.composing) return;
1225
1220
  const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value;
1226
1221
  const newValue = value == null ? "" : value;
1227
1222
  if (elValue === newValue) {
1228
1223
  return;
1229
1224
  }
1230
1225
  if (document.activeElement === el && el.type !== "range") {
1231
- if (lazy) {
1226
+ if (lazy && value === oldValue) {
1232
1227
  return;
1233
1228
  }
1234
1229
  if (trim && el.value.trim() === newValue) {
@@ -1360,8 +1355,7 @@ function setSelected(el, value, number) {
1360
1355
  option.selected = value.has(optionValue);
1361
1356
  }
1362
1357
  } else if (looseEqual(getValue(option), value)) {
1363
- if (el.selectedIndex !== i)
1364
- el.selectedIndex = i;
1358
+ if (el.selectedIndex !== i) el.selectedIndex = i;
1365
1359
  return;
1366
1360
  }
1367
1361
  }
@@ -1470,8 +1464,7 @@ const withModifiers = (fn, modifiers) => {
1470
1464
  return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
1471
1465
  for (let i = 0; i < modifiers.length; i++) {
1472
1466
  const guard = modifierGuards[modifiers[i]];
1473
- if (guard && guard(event, modifiers))
1474
- return;
1467
+ if (guard && guard(event, modifiers)) return;
1475
1468
  }
1476
1469
  return fn(event, ...args);
1477
1470
  });
@@ -1525,8 +1518,7 @@ const createApp = (...args) => {
1525
1518
  const { mount } = app;
1526
1519
  app.mount = (containerOrSelector) => {
1527
1520
  const container = normalizeContainer(containerOrSelector);
1528
- if (!container)
1529
- return;
1521
+ if (!container) return;
1530
1522
  const component = app._component;
1531
1523
  if (!isFunction(component) && !component.render && !component.template) {
1532
1524
  component.template = container.innerHTML;