@vue/runtime-dom 3.4.21 → 3.4.22
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 +46 -22
- package/dist/runtime-dom.cjs.prod.js +35 -21
- package/dist/runtime-dom.d.ts +4 -3
- package/dist/runtime-dom.esm-browser.js +110 -77
- package/dist/runtime-dom.esm-browser.prod.js +6 -5
- package/dist/runtime-dom.esm-bundler.js +49 -25
- package/dist/runtime-dom.global.js +110 -77
- package/dist/runtime-dom.global.prod.js +6 -5
- package/package.json +3 -3
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.4.
|
|
2
|
+
* @vue/runtime-dom v3.4.22
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -596,11 +596,14 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
596
596
|
const invokers = el[veiKey] || (el[veiKey] = {});
|
|
597
597
|
const existingInvoker = invokers[rawName];
|
|
598
598
|
if (nextValue && existingInvoker) {
|
|
599
|
-
existingInvoker.value = nextValue;
|
|
599
|
+
existingInvoker.value = sanitizeEventValue(nextValue, rawName) ;
|
|
600
600
|
} else {
|
|
601
601
|
const [name, options] = parseName(rawName);
|
|
602
602
|
if (nextValue) {
|
|
603
|
-
const invoker = invokers[rawName] = createInvoker(
|
|
603
|
+
const invoker = invokers[rawName] = createInvoker(
|
|
604
|
+
sanitizeEventValue(nextValue, rawName) ,
|
|
605
|
+
instance
|
|
606
|
+
);
|
|
604
607
|
addEventListener(el, name, invoker, options);
|
|
605
608
|
} else if (existingInvoker) {
|
|
606
609
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -643,6 +646,16 @@ function createInvoker(initialValue, instance) {
|
|
|
643
646
|
invoker.attached = getNow();
|
|
644
647
|
return invoker;
|
|
645
648
|
}
|
|
649
|
+
function sanitizeEventValue(value, propName) {
|
|
650
|
+
if (shared.isFunction(value) || shared.isArray(value)) {
|
|
651
|
+
return value;
|
|
652
|
+
}
|
|
653
|
+
runtimeCore.warn(
|
|
654
|
+
`Wrong type passed as event handler to ${propName} - did you forget @ or : in front of your prop?
|
|
655
|
+
Expected function or array of functions, received type ${typeof value}.`
|
|
656
|
+
);
|
|
657
|
+
return shared.NOOP;
|
|
658
|
+
}
|
|
646
659
|
function patchStopImmediatePropagation(e, value) {
|
|
647
660
|
if (shared.isArray(value)) {
|
|
648
661
|
const originalStop = e.stopImmediatePropagation;
|
|
@@ -650,7 +663,9 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
650
663
|
originalStop.call(e);
|
|
651
664
|
e._stopped = true;
|
|
652
665
|
};
|
|
653
|
-
return value.map(
|
|
666
|
+
return value.map(
|
|
667
|
+
(fn) => (e2) => !e2._stopped && fn && fn(e2)
|
|
668
|
+
);
|
|
654
669
|
} else {
|
|
655
670
|
return value;
|
|
656
671
|
}
|
|
@@ -851,7 +866,7 @@ class VueElement extends BaseClass {
|
|
|
851
866
|
}
|
|
852
867
|
}
|
|
853
868
|
_setAttr(key) {
|
|
854
|
-
let value = this.getAttribute(key);
|
|
869
|
+
let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
|
|
855
870
|
const camelKey = shared.camelize(key);
|
|
856
871
|
if (this._numberProps && this._numberProps[camelKey]) {
|
|
857
872
|
value = shared.toNumber(value);
|
|
@@ -1017,7 +1032,28 @@ const TransitionGroupImpl = {
|
|
|
1017
1032
|
const rawProps = runtimeCore.toRaw(props);
|
|
1018
1033
|
const cssTransitionProps = resolveTransitionProps(rawProps);
|
|
1019
1034
|
let tag = rawProps.tag || runtimeCore.Fragment;
|
|
1020
|
-
prevChildren =
|
|
1035
|
+
prevChildren = [];
|
|
1036
|
+
if (children) {
|
|
1037
|
+
for (let i = 0; i < children.length; i++) {
|
|
1038
|
+
const child = children[i];
|
|
1039
|
+
if (child.el && child.el instanceof Element) {
|
|
1040
|
+
prevChildren.push(child);
|
|
1041
|
+
runtimeCore.setTransitionHooks(
|
|
1042
|
+
child,
|
|
1043
|
+
runtimeCore.resolveTransitionHooks(
|
|
1044
|
+
child,
|
|
1045
|
+
cssTransitionProps,
|
|
1046
|
+
state,
|
|
1047
|
+
instance
|
|
1048
|
+
)
|
|
1049
|
+
);
|
|
1050
|
+
positionMap.set(
|
|
1051
|
+
child,
|
|
1052
|
+
child.el.getBoundingClientRect()
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1021
1057
|
children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
|
|
1022
1058
|
for (let i = 0; i < children.length; i++) {
|
|
1023
1059
|
const child = children[i];
|
|
@@ -1030,16 +1066,6 @@ const TransitionGroupImpl = {
|
|
|
1030
1066
|
runtimeCore.warn(`<TransitionGroup> children must be keyed.`);
|
|
1031
1067
|
}
|
|
1032
1068
|
}
|
|
1033
|
-
if (prevChildren) {
|
|
1034
|
-
for (let i = 0; i < prevChildren.length; i++) {
|
|
1035
|
-
const child = prevChildren[i];
|
|
1036
|
-
runtimeCore.setTransitionHooks(
|
|
1037
|
-
child,
|
|
1038
|
-
runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
|
1039
|
-
);
|
|
1040
|
-
positionMap.set(child, child.el.getBoundingClientRect());
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
1069
|
return runtimeCore.createVNode(tag, null, children);
|
|
1044
1070
|
};
|
|
1045
1071
|
}
|
|
@@ -1138,7 +1164,7 @@ const vModelText = {
|
|
|
1138
1164
|
el[assignKey] = getModelAssigner(vnode);
|
|
1139
1165
|
if (el.composing)
|
|
1140
1166
|
return;
|
|
1141
|
-
const elValue = number || el.type === "number" ? shared.looseToNumber(el.value) : el.value;
|
|
1167
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
|
|
1142
1168
|
const newValue = value == null ? "" : value;
|
|
1143
1169
|
if (elValue === newValue) {
|
|
1144
1170
|
return;
|
|
@@ -1241,14 +1267,14 @@ const vModelSelect = {
|
|
|
1241
1267
|
// set value in mounted & updated because <select> relies on its children
|
|
1242
1268
|
// <option>s.
|
|
1243
1269
|
mounted(el, { value, modifiers: { number } }) {
|
|
1244
|
-
setSelected(el, value
|
|
1270
|
+
setSelected(el, value);
|
|
1245
1271
|
},
|
|
1246
1272
|
beforeUpdate(el, _binding, vnode) {
|
|
1247
1273
|
el[assignKey] = getModelAssigner(vnode);
|
|
1248
1274
|
},
|
|
1249
1275
|
updated(el, { value, modifiers: { number } }) {
|
|
1250
1276
|
if (!el._assigning) {
|
|
1251
|
-
setSelected(el, value
|
|
1277
|
+
setSelected(el, value);
|
|
1252
1278
|
}
|
|
1253
1279
|
}
|
|
1254
1280
|
};
|
|
@@ -1268,9 +1294,7 @@ function setSelected(el, value, number) {
|
|
|
1268
1294
|
if (isArrayValue) {
|
|
1269
1295
|
const optionType = typeof optionValue;
|
|
1270
1296
|
if (optionType === "string" || optionType === "number") {
|
|
1271
|
-
option.selected = value.
|
|
1272
|
-
number ? shared.looseToNumber(optionValue) : optionValue
|
|
1273
|
-
);
|
|
1297
|
+
option.selected = value.some((v) => String(v) === String(optionValue));
|
|
1274
1298
|
} else {
|
|
1275
1299
|
option.selected = shared.looseIndexOf(value, optionValue) > -1;
|
|
1276
1300
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.4.
|
|
2
|
+
* @vue/runtime-dom v3.4.22
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -580,7 +580,10 @@ function patchEvent(el, rawName, prevValue, nextValue, instance = null) {
|
|
|
580
580
|
} else {
|
|
581
581
|
const [name, options] = parseName(rawName);
|
|
582
582
|
if (nextValue) {
|
|
583
|
-
const invoker = invokers[rawName] = createInvoker(
|
|
583
|
+
const invoker = invokers[rawName] = createInvoker(
|
|
584
|
+
nextValue,
|
|
585
|
+
instance
|
|
586
|
+
);
|
|
584
587
|
addEventListener(el, name, invoker, options);
|
|
585
588
|
} else if (existingInvoker) {
|
|
586
589
|
removeEventListener(el, name, existingInvoker, options);
|
|
@@ -630,7 +633,9 @@ function patchStopImmediatePropagation(e, value) {
|
|
|
630
633
|
originalStop.call(e);
|
|
631
634
|
e._stopped = true;
|
|
632
635
|
};
|
|
633
|
-
return value.map(
|
|
636
|
+
return value.map(
|
|
637
|
+
(fn) => (e2) => !e2._stopped && fn && fn(e2)
|
|
638
|
+
);
|
|
634
639
|
} else {
|
|
635
640
|
return value;
|
|
636
641
|
}
|
|
@@ -826,7 +831,7 @@ class VueElement extends BaseClass {
|
|
|
826
831
|
}
|
|
827
832
|
}
|
|
828
833
|
_setAttr(key) {
|
|
829
|
-
let value = this.getAttribute(key);
|
|
834
|
+
let value = this.hasAttribute(key) ? this.getAttribute(key) : void 0;
|
|
830
835
|
const camelKey = shared.camelize(key);
|
|
831
836
|
if (this._numberProps && this._numberProps[camelKey]) {
|
|
832
837
|
value = shared.toNumber(value);
|
|
@@ -975,7 +980,28 @@ const TransitionGroupImpl = {
|
|
|
975
980
|
const rawProps = runtimeCore.toRaw(props);
|
|
976
981
|
const cssTransitionProps = resolveTransitionProps(rawProps);
|
|
977
982
|
let tag = rawProps.tag || runtimeCore.Fragment;
|
|
978
|
-
prevChildren =
|
|
983
|
+
prevChildren = [];
|
|
984
|
+
if (children) {
|
|
985
|
+
for (let i = 0; i < children.length; i++) {
|
|
986
|
+
const child = children[i];
|
|
987
|
+
if (child.el && child.el instanceof Element) {
|
|
988
|
+
prevChildren.push(child);
|
|
989
|
+
runtimeCore.setTransitionHooks(
|
|
990
|
+
child,
|
|
991
|
+
runtimeCore.resolveTransitionHooks(
|
|
992
|
+
child,
|
|
993
|
+
cssTransitionProps,
|
|
994
|
+
state,
|
|
995
|
+
instance
|
|
996
|
+
)
|
|
997
|
+
);
|
|
998
|
+
positionMap.set(
|
|
999
|
+
child,
|
|
1000
|
+
child.el.getBoundingClientRect()
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
979
1005
|
children = slots.default ? runtimeCore.getTransitionRawChildren(slots.default()) : [];
|
|
980
1006
|
for (let i = 0; i < children.length; i++) {
|
|
981
1007
|
const child = children[i];
|
|
@@ -986,16 +1012,6 @@ const TransitionGroupImpl = {
|
|
|
986
1012
|
);
|
|
987
1013
|
}
|
|
988
1014
|
}
|
|
989
|
-
if (prevChildren) {
|
|
990
|
-
for (let i = 0; i < prevChildren.length; i++) {
|
|
991
|
-
const child = prevChildren[i];
|
|
992
|
-
runtimeCore.setTransitionHooks(
|
|
993
|
-
child,
|
|
994
|
-
runtimeCore.resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
|
995
|
-
);
|
|
996
|
-
positionMap.set(child, child.el.getBoundingClientRect());
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
1015
|
return runtimeCore.createVNode(tag, null, children);
|
|
1000
1016
|
};
|
|
1001
1017
|
}
|
|
@@ -1094,7 +1110,7 @@ const vModelText = {
|
|
|
1094
1110
|
el[assignKey] = getModelAssigner(vnode);
|
|
1095
1111
|
if (el.composing)
|
|
1096
1112
|
return;
|
|
1097
|
-
const elValue = number || el.type === "number" ? shared.looseToNumber(el.value) : el.value;
|
|
1113
|
+
const elValue = (number || el.type === "number") && !/^0\d/.test(el.value) ? shared.looseToNumber(el.value) : el.value;
|
|
1098
1114
|
const newValue = value == null ? "" : value;
|
|
1099
1115
|
if (elValue === newValue) {
|
|
1100
1116
|
return;
|
|
@@ -1197,14 +1213,14 @@ const vModelSelect = {
|
|
|
1197
1213
|
// set value in mounted & updated because <select> relies on its children
|
|
1198
1214
|
// <option>s.
|
|
1199
1215
|
mounted(el, { value, modifiers: { number } }) {
|
|
1200
|
-
setSelected(el, value
|
|
1216
|
+
setSelected(el, value);
|
|
1201
1217
|
},
|
|
1202
1218
|
beforeUpdate(el, _binding, vnode) {
|
|
1203
1219
|
el[assignKey] = getModelAssigner(vnode);
|
|
1204
1220
|
},
|
|
1205
1221
|
updated(el, { value, modifiers: { number } }) {
|
|
1206
1222
|
if (!el._assigning) {
|
|
1207
|
-
setSelected(el, value
|
|
1223
|
+
setSelected(el, value);
|
|
1208
1224
|
}
|
|
1209
1225
|
}
|
|
1210
1226
|
};
|
|
@@ -1221,9 +1237,7 @@ function setSelected(el, value, number) {
|
|
|
1221
1237
|
if (isArrayValue) {
|
|
1222
1238
|
const optionType = typeof optionValue;
|
|
1223
1239
|
if (optionType === "string" || optionType === "number") {
|
|
1224
|
-
option.selected = value.
|
|
1225
|
-
number ? shared.looseToNumber(optionValue) : optionValue
|
|
1226
|
-
);
|
|
1240
|
+
option.selected = value.some((v) => String(v) === String(optionValue));
|
|
1227
1241
|
} else {
|
|
1228
1242
|
option.selected = shared.looseIndexOf(value, optionValue) > -1;
|
|
1229
1243
|
}
|
package/dist/runtime-dom.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export declare const vModelDynamic: ObjectDirective<HTMLInputElement | HTMLSelec
|
|
|
106
106
|
export declare const withModifiers: <T extends (event: Event, ...args: unknown[]) => any>(fn: T & {
|
|
107
107
|
_withMods?: {
|
|
108
108
|
[key: string]: T;
|
|
109
|
-
}
|
|
109
|
+
};
|
|
110
110
|
}, modifiers: string[]) => T;
|
|
111
111
|
/**
|
|
112
112
|
* @private
|
|
@@ -114,7 +114,7 @@ export declare const withModifiers: <T extends (event: Event, ...args: unknown[]
|
|
|
114
114
|
export declare const withKeys: <T extends (event: KeyboardEvent) => any>(fn: T & {
|
|
115
115
|
_withKeys?: {
|
|
116
116
|
[k: string]: T;
|
|
117
|
-
}
|
|
117
|
+
};
|
|
118
118
|
}, modifiers: string[]) => T;
|
|
119
119
|
|
|
120
120
|
declare const vShowOriginalDisplay: unique symbol;
|
|
@@ -1267,7 +1267,8 @@ export interface Events {
|
|
|
1267
1267
|
onVolumechange: Event;
|
|
1268
1268
|
onWaiting: Event;
|
|
1269
1269
|
onSelect: Event;
|
|
1270
|
-
onScroll:
|
|
1270
|
+
onScroll: Event;
|
|
1271
|
+
onScrollend: Event;
|
|
1271
1272
|
onTouchcancel: TouchEvent;
|
|
1272
1273
|
onTouchend: TouchEvent;
|
|
1273
1274
|
onTouchmove: TouchEvent;
|