@vue/runtime-dom 3.5.40 → 3.5.42
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.
- package/dist/runtime-dom.cjs.js +63 -14
- package/dist/runtime-dom.cjs.prod.js +58 -14
- package/dist/runtime-dom.d.ts +3 -1
- package/dist/runtime-dom.esm-browser.js +195 -34
- package/dist/runtime-dom.esm-browser.prod.js +4 -3
- package/dist/runtime-dom.esm-bundler.js +63 -14
- package/dist/runtime-dom.global.js +195 -34
- package/dist/runtime-dom.global.prod.js +4 -3
- package/package.json +4 -4
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.
|
|
2
|
+
* @vue/runtime-dom v3.5.42
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -517,7 +517,11 @@ function setStyle(style, name, val) {
|
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
if (name.startsWith("--")) {
|
|
520
|
-
|
|
520
|
+
if (importantRE.test(val)) {
|
|
521
|
+
style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
522
|
+
} else {
|
|
523
|
+
style.setProperty(name, val);
|
|
524
|
+
}
|
|
521
525
|
} else {
|
|
522
526
|
const prefixed = autoPrefix(style, name);
|
|
523
527
|
if (importantRE.test(val)) {
|
|
@@ -890,7 +894,9 @@ class VueElement extends BaseClass {
|
|
|
890
894
|
if (parent && parent._pendingResolve) {
|
|
891
895
|
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
892
896
|
this._pendingResolve = void 0;
|
|
893
|
-
this.
|
|
897
|
+
if (this.isConnected) {
|
|
898
|
+
return this._resolveDef();
|
|
899
|
+
}
|
|
894
900
|
});
|
|
895
901
|
} else {
|
|
896
902
|
this._resolveDef();
|
|
@@ -940,7 +946,7 @@ class VueElement extends BaseClass {
|
|
|
940
946
|
*/
|
|
941
947
|
_resolveDef() {
|
|
942
948
|
if (this._pendingResolve) {
|
|
943
|
-
return;
|
|
949
|
+
return this._pendingResolve;
|
|
944
950
|
}
|
|
945
951
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
946
952
|
this._setAttr(this.attributes[i].name);
|
|
@@ -980,6 +986,7 @@ class VueElement extends BaseClass {
|
|
|
980
986
|
def.configureApp = this._def.configureApp;
|
|
981
987
|
resolve(this._def = def, true);
|
|
982
988
|
});
|
|
989
|
+
return this._pendingResolve;
|
|
983
990
|
} else {
|
|
984
991
|
resolve(this._def);
|
|
985
992
|
}
|
|
@@ -1017,6 +1024,11 @@ class VueElement extends BaseClass {
|
|
|
1017
1024
|
}
|
|
1018
1025
|
}
|
|
1019
1026
|
for (const key of declaredPropKeys.map(shared.camelize)) {
|
|
1027
|
+
if (key in Object.getPrototypeOf(this)) {
|
|
1028
|
+
runtimeCore.warn(
|
|
1029
|
+
`Custom element prop "${key}" conflicts with an existing property on the element and will overwrite it.`
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1020
1032
|
Object.defineProperty(this, key, {
|
|
1021
1033
|
get() {
|
|
1022
1034
|
return this._getProp(key);
|
|
@@ -1501,6 +1513,7 @@ function onCompositionEnd(e) {
|
|
|
1501
1513
|
}
|
|
1502
1514
|
}
|
|
1503
1515
|
const assignKey = /* @__PURE__ */ Symbol("_assign");
|
|
1516
|
+
const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
|
|
1504
1517
|
function castValue(value, trim, number) {
|
|
1505
1518
|
if (trim) value = value.trim();
|
|
1506
1519
|
if (number) value = shared.looseToNumber(value);
|
|
@@ -1508,6 +1521,13 @@ function castValue(value, trim, number) {
|
|
|
1508
1521
|
}
|
|
1509
1522
|
const vModelText = {
|
|
1510
1523
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1524
|
+
if (el.parentNode) {
|
|
1525
|
+
if (el.type === "text") {
|
|
1526
|
+
el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
1527
|
+
} else if (el.type === "textarea") {
|
|
1528
|
+
el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1511
1531
|
el[assignKey] = getModelAssigner(vnode);
|
|
1512
1532
|
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
1513
1533
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
@@ -1526,8 +1546,15 @@ const vModelText = {
|
|
|
1526
1546
|
}
|
|
1527
1547
|
},
|
|
1528
1548
|
// set value on mounted so it's after min/max for type="range"
|
|
1529
|
-
mounted(el, { value }) {
|
|
1530
|
-
|
|
1549
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
1550
|
+
const newValue = value == null ? "" : value;
|
|
1551
|
+
const initialValue = el[initialValueKey];
|
|
1552
|
+
delete el[initialValueKey];
|
|
1553
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
|
|
1554
|
+
el[assignKey](castValue(el.value, trim, number));
|
|
1555
|
+
} else {
|
|
1556
|
+
el.value = newValue;
|
|
1557
|
+
}
|
|
1531
1558
|
},
|
|
1532
1559
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1533
1560
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -1628,13 +1655,21 @@ const vModelSelect = {
|
|
|
1628
1655
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
1629
1656
|
(o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
|
|
1630
1657
|
);
|
|
1631
|
-
el
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1658
|
+
const multiple = el.multiple;
|
|
1659
|
+
const assignedValue = multiple ? shared.isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
|
|
1660
|
+
const pending = el._pendingValue = [
|
|
1661
|
+
multiple,
|
|
1662
|
+
multiple ? shared.isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
|
|
1663
|
+
];
|
|
1664
|
+
try {
|
|
1665
|
+
el[assignKey](assignedValue);
|
|
1666
|
+
} finally {
|
|
1667
|
+
runtimeCore.nextTick(() => {
|
|
1668
|
+
if (el._pendingValue === pending) {
|
|
1669
|
+
el._pendingValue = void 0;
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1638
1673
|
});
|
|
1639
1674
|
el[assignKey] = getModelAssigner(vnode);
|
|
1640
1675
|
},
|
|
@@ -1648,11 +1683,25 @@ const vModelSelect = {
|
|
|
1648
1683
|
el[assignKey] = getModelAssigner(vnode);
|
|
1649
1684
|
},
|
|
1650
1685
|
updated(el, { value }) {
|
|
1651
|
-
|
|
1686
|
+
const pending = el._pendingValue;
|
|
1687
|
+
el._pendingValue = void 0;
|
|
1688
|
+
if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
|
|
1652
1689
|
setSelected(el, value);
|
|
1653
1690
|
}
|
|
1654
1691
|
}
|
|
1655
1692
|
};
|
|
1693
|
+
function isSameSelectValue(value, assignedValue, multiple) {
|
|
1694
|
+
if (!multiple) return shared.looseEqual(value, assignedValue);
|
|
1695
|
+
if (shared.isArray(value)) return shared.looseEqual(value, assignedValue);
|
|
1696
|
+
if (shared.isSet(value)) {
|
|
1697
|
+
if (value.size !== assignedValue.length) return false;
|
|
1698
|
+
for (const item of assignedValue) {
|
|
1699
|
+
if (!value.has(item)) return false;
|
|
1700
|
+
}
|
|
1701
|
+
return true;
|
|
1702
|
+
}
|
|
1703
|
+
return false;
|
|
1704
|
+
}
|
|
1656
1705
|
function setSelected(el, value) {
|
|
1657
1706
|
const isMultiple = el.multiple;
|
|
1658
1707
|
const isArrayValue = shared.isArray(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.5.
|
|
2
|
+
* @vue/runtime-dom v3.5.42
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -505,7 +505,11 @@ function setStyle(style, name, val) {
|
|
|
505
505
|
} else {
|
|
506
506
|
if (val == null) val = "";
|
|
507
507
|
if (name.startsWith("--")) {
|
|
508
|
-
|
|
508
|
+
if (importantRE.test(val)) {
|
|
509
|
+
style.setProperty(name, val.replace(importantRE, ""), "important");
|
|
510
|
+
} else {
|
|
511
|
+
style.setProperty(name, val);
|
|
512
|
+
}
|
|
509
513
|
} else {
|
|
510
514
|
const prefixed = autoPrefix(style, name);
|
|
511
515
|
if (importantRE.test(val)) {
|
|
@@ -857,7 +861,9 @@ class VueElement extends BaseClass {
|
|
|
857
861
|
if (parent && parent._pendingResolve) {
|
|
858
862
|
this._pendingResolve = parent._pendingResolve.then(() => {
|
|
859
863
|
this._pendingResolve = void 0;
|
|
860
|
-
this.
|
|
864
|
+
if (this.isConnected) {
|
|
865
|
+
return this._resolveDef();
|
|
866
|
+
}
|
|
861
867
|
});
|
|
862
868
|
} else {
|
|
863
869
|
this._resolveDef();
|
|
@@ -907,7 +913,7 @@ class VueElement extends BaseClass {
|
|
|
907
913
|
*/
|
|
908
914
|
_resolveDef() {
|
|
909
915
|
if (this._pendingResolve) {
|
|
910
|
-
return;
|
|
916
|
+
return this._pendingResolve;
|
|
911
917
|
}
|
|
912
918
|
for (let i = 0; i < this.attributes.length; i++) {
|
|
913
919
|
this._setAttr(this.attributes[i].name);
|
|
@@ -943,6 +949,7 @@ class VueElement extends BaseClass {
|
|
|
943
949
|
def.configureApp = this._def.configureApp;
|
|
944
950
|
resolve(this._def = def, true);
|
|
945
951
|
});
|
|
952
|
+
return this._pendingResolve;
|
|
946
953
|
} else {
|
|
947
954
|
resolve(this._def);
|
|
948
955
|
}
|
|
@@ -1407,6 +1414,7 @@ function onCompositionEnd(e) {
|
|
|
1407
1414
|
}
|
|
1408
1415
|
}
|
|
1409
1416
|
const assignKey = /* @__PURE__ */ Symbol("_assign");
|
|
1417
|
+
const initialValueKey = /* @__PURE__ */ Symbol("_initialValue");
|
|
1410
1418
|
function castValue(value, trim, number) {
|
|
1411
1419
|
if (trim) value = value.trim();
|
|
1412
1420
|
if (number) value = shared.looseToNumber(value);
|
|
@@ -1414,6 +1422,13 @@ function castValue(value, trim, number) {
|
|
|
1414
1422
|
}
|
|
1415
1423
|
const vModelText = {
|
|
1416
1424
|
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
1425
|
+
if (el.parentNode) {
|
|
1426
|
+
if (el.type === "text") {
|
|
1427
|
+
el[initialValueKey] = el.defaultValue.replace(/[\r\n]/g, "");
|
|
1428
|
+
} else if (el.type === "textarea") {
|
|
1429
|
+
el[initialValueKey] = el.defaultValue.replace(/\r\n?/g, "\n");
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1417
1432
|
el[assignKey] = getModelAssigner(vnode);
|
|
1418
1433
|
const castToNumber = number || vnode.props && vnode.props.type === "number";
|
|
1419
1434
|
addEventListener(el, lazy ? "change" : "input", (e) => {
|
|
@@ -1432,8 +1447,15 @@ const vModelText = {
|
|
|
1432
1447
|
}
|
|
1433
1448
|
},
|
|
1434
1449
|
// set value on mounted so it's after min/max for type="range"
|
|
1435
|
-
mounted(el, { value }) {
|
|
1436
|
-
|
|
1450
|
+
mounted(el, { value, modifiers: { trim, number } }) {
|
|
1451
|
+
const newValue = value == null ? "" : value;
|
|
1452
|
+
const initialValue = el[initialValueKey];
|
|
1453
|
+
delete el[initialValueKey];
|
|
1454
|
+
if (initialValue !== void 0 && (el.type === "text" || el.type === "textarea") && el.value !== initialValue) {
|
|
1455
|
+
el[assignKey](castValue(el.value, trim, number));
|
|
1456
|
+
} else {
|
|
1457
|
+
el.value = newValue;
|
|
1458
|
+
}
|
|
1437
1459
|
},
|
|
1438
1460
|
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim, number } }, vnode) {
|
|
1439
1461
|
el[assignKey] = getModelAssigner(vnode);
|
|
@@ -1534,13 +1556,21 @@ const vModelSelect = {
|
|
|
1534
1556
|
const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map(
|
|
1535
1557
|
(o) => number ? shared.looseToNumber(getValue(o)) : getValue(o)
|
|
1536
1558
|
);
|
|
1537
|
-
el
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1559
|
+
const multiple = el.multiple;
|
|
1560
|
+
const assignedValue = multiple ? shared.isSet(el._modelValue) ? new Set(selectedVal) : selectedVal : selectedVal[0];
|
|
1561
|
+
const pending = el._pendingValue = [
|
|
1562
|
+
multiple,
|
|
1563
|
+
multiple ? shared.isArray(assignedValue) ? selectedVal.slice() : selectedVal : assignedValue
|
|
1564
|
+
];
|
|
1565
|
+
try {
|
|
1566
|
+
el[assignKey](assignedValue);
|
|
1567
|
+
} finally {
|
|
1568
|
+
runtimeCore.nextTick(() => {
|
|
1569
|
+
if (el._pendingValue === pending) {
|
|
1570
|
+
el._pendingValue = void 0;
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1544
1574
|
});
|
|
1545
1575
|
el[assignKey] = getModelAssigner(vnode);
|
|
1546
1576
|
},
|
|
@@ -1554,11 +1584,25 @@ const vModelSelect = {
|
|
|
1554
1584
|
el[assignKey] = getModelAssigner(vnode);
|
|
1555
1585
|
},
|
|
1556
1586
|
updated(el, { value }) {
|
|
1557
|
-
|
|
1587
|
+
const pending = el._pendingValue;
|
|
1588
|
+
el._pendingValue = void 0;
|
|
1589
|
+
if (!pending || pending[0] !== el.multiple || !isSameSelectValue(value, pending[1], pending[0])) {
|
|
1558
1590
|
setSelected(el, value);
|
|
1559
1591
|
}
|
|
1560
1592
|
}
|
|
1561
1593
|
};
|
|
1594
|
+
function isSameSelectValue(value, assignedValue, multiple) {
|
|
1595
|
+
if (!multiple) return shared.looseEqual(value, assignedValue);
|
|
1596
|
+
if (shared.isArray(value)) return shared.looseEqual(value, assignedValue);
|
|
1597
|
+
if (shared.isSet(value)) {
|
|
1598
|
+
if (value.size !== assignedValue.length) return false;
|
|
1599
|
+
for (const item of assignedValue) {
|
|
1600
|
+
if (!value.has(item)) return false;
|
|
1601
|
+
}
|
|
1602
|
+
return true;
|
|
1603
|
+
}
|
|
1604
|
+
return false;
|
|
1605
|
+
}
|
|
1562
1606
|
function setSelected(el, value) {
|
|
1563
1607
|
const isMultiple = el.multiple;
|
|
1564
1608
|
const isArrayValue = shared.isArray(value);
|
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -80,9 +80,11 @@ type VOnDirective = Directive<any, any, VOnModifiers>;
|
|
|
80
80
|
|
|
81
81
|
type AssignerFn = (value: any) => void;
|
|
82
82
|
declare const assignKey: unique symbol;
|
|
83
|
+
declare const initialValueKey: unique symbol;
|
|
83
84
|
type ModelDirective<T, Modifiers extends string = string> = ObjectDirective<T & {
|
|
84
85
|
[assignKey]: AssignerFn;
|
|
85
|
-
|
|
86
|
+
[initialValueKey]?: string;
|
|
87
|
+
_pendingValue?: [multiple: boolean, value: any];
|
|
86
88
|
}, any, Modifiers>;
|
|
87
89
|
export declare const vModelText: ModelDirective<HTMLInputElement | HTMLTextAreaElement, 'trim' | 'number' | 'lazy'>;
|
|
88
90
|
export declare const vModelCheckbox: ModelDirective<HTMLInputElement>;
|