@vue/runtime-dom 3.1.0-beta.5 → 3.1.1
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 +38 -11
- package/dist/runtime-dom.cjs.prod.js +38 -11
- package/dist/runtime-dom.esm-browser.js +399 -331
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +38 -11
- package/dist/runtime-dom.global.js +399 -331
- package/dist/runtime-dom.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/runtime-dom.cjs.js
CHANGED
|
@@ -221,6 +221,9 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
221
221
|
if (el.value !== newValue) {
|
|
222
222
|
el.value = newValue;
|
|
223
223
|
}
|
|
224
|
+
if (value == null) {
|
|
225
|
+
el.removeAttribute(key);
|
|
226
|
+
}
|
|
224
227
|
return;
|
|
225
228
|
}
|
|
226
229
|
if (value === '' || value == null) {
|
|
@@ -488,6 +491,29 @@ const DOMTransitionPropsValidators = {
|
|
|
488
491
|
leaveToClass: String
|
|
489
492
|
};
|
|
490
493
|
const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ shared.extend({}, runtimeCore.BaseTransition.props, DOMTransitionPropsValidators));
|
|
494
|
+
/**
|
|
495
|
+
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
|
496
|
+
* with custom HOCs.
|
|
497
|
+
*/
|
|
498
|
+
const callHook = (hook, args = []) => {
|
|
499
|
+
if (shared.isArray(hook)) {
|
|
500
|
+
hook.forEach(h => h(...args));
|
|
501
|
+
}
|
|
502
|
+
else if (hook) {
|
|
503
|
+
hook(...args);
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Check if a hook expects a callback (2nd arg), which means the user
|
|
508
|
+
* intends to explicitly control the end of the transition.
|
|
509
|
+
*/
|
|
510
|
+
const hasExplicitCallback = (hook) => {
|
|
511
|
+
return hook
|
|
512
|
+
? shared.isArray(hook)
|
|
513
|
+
? hook.some(h => h.length > 1)
|
|
514
|
+
: hook.length > 1
|
|
515
|
+
: false;
|
|
516
|
+
};
|
|
491
517
|
function resolveTransitionProps(rawProps) {
|
|
492
518
|
const baseProps = {};
|
|
493
519
|
for (const key in rawProps) {
|
|
@@ -517,11 +543,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
517
543
|
return (el, done) => {
|
|
518
544
|
const hook = isAppear ? onAppear : onEnter;
|
|
519
545
|
const resolve = () => finishEnter(el, isAppear, done);
|
|
520
|
-
hook
|
|
546
|
+
callHook(hook, [el, resolve]);
|
|
521
547
|
nextFrame(() => {
|
|
522
548
|
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
523
549
|
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
524
|
-
if (!(hook
|
|
550
|
+
if (!hasExplicitCallback(hook)) {
|
|
525
551
|
whenTransitionEnds(el, type, enterDuration, resolve);
|
|
526
552
|
}
|
|
527
553
|
});
|
|
@@ -529,12 +555,12 @@ function resolveTransitionProps(rawProps) {
|
|
|
529
555
|
};
|
|
530
556
|
return shared.extend(baseProps, {
|
|
531
557
|
onBeforeEnter(el) {
|
|
532
|
-
onBeforeEnter
|
|
558
|
+
callHook(onBeforeEnter, [el]);
|
|
533
559
|
addTransitionClass(el, enterFromClass);
|
|
534
560
|
addTransitionClass(el, enterActiveClass);
|
|
535
561
|
},
|
|
536
562
|
onBeforeAppear(el) {
|
|
537
|
-
onBeforeAppear
|
|
563
|
+
callHook(onBeforeAppear, [el]);
|
|
538
564
|
addTransitionClass(el, appearFromClass);
|
|
539
565
|
addTransitionClass(el, appearActiveClass);
|
|
540
566
|
},
|
|
@@ -549,23 +575,23 @@ function resolveTransitionProps(rawProps) {
|
|
|
549
575
|
nextFrame(() => {
|
|
550
576
|
removeTransitionClass(el, leaveFromClass);
|
|
551
577
|
addTransitionClass(el, leaveToClass);
|
|
552
|
-
if (!(onLeave
|
|
578
|
+
if (!hasExplicitCallback(onLeave)) {
|
|
553
579
|
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
554
580
|
}
|
|
555
581
|
});
|
|
556
|
-
onLeave
|
|
582
|
+
callHook(onLeave, [el, resolve]);
|
|
557
583
|
},
|
|
558
584
|
onEnterCancelled(el) {
|
|
559
585
|
finishEnter(el, false);
|
|
560
|
-
onEnterCancelled
|
|
586
|
+
callHook(onEnterCancelled, [el]);
|
|
561
587
|
},
|
|
562
588
|
onAppearCancelled(el) {
|
|
563
589
|
finishEnter(el, true);
|
|
564
|
-
onAppearCancelled
|
|
590
|
+
callHook(onAppearCancelled, [el]);
|
|
565
591
|
},
|
|
566
592
|
onLeaveCancelled(el) {
|
|
567
593
|
finishLeave(el);
|
|
568
|
-
onLeaveCancelled
|
|
594
|
+
callHook(onLeaveCancelled, [el]);
|
|
569
595
|
}
|
|
570
596
|
});
|
|
571
597
|
}
|
|
@@ -1030,12 +1056,13 @@ function setSelected(el, value) {
|
|
|
1030
1056
|
}
|
|
1031
1057
|
else {
|
|
1032
1058
|
if (shared.looseEqual(getValue(option), value)) {
|
|
1033
|
-
el.selectedIndex
|
|
1059
|
+
if (el.selectedIndex !== i)
|
|
1060
|
+
el.selectedIndex = i;
|
|
1034
1061
|
return;
|
|
1035
1062
|
}
|
|
1036
1063
|
}
|
|
1037
1064
|
}
|
|
1038
|
-
if (!isMultiple) {
|
|
1065
|
+
if (!isMultiple && el.selectedIndex !== -1) {
|
|
1039
1066
|
el.selectedIndex = -1;
|
|
1040
1067
|
}
|
|
1041
1068
|
}
|
|
@@ -221,6 +221,9 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
221
221
|
if (el.value !== newValue) {
|
|
222
222
|
el.value = newValue;
|
|
223
223
|
}
|
|
224
|
+
if (value == null) {
|
|
225
|
+
el.removeAttribute(key);
|
|
226
|
+
}
|
|
224
227
|
return;
|
|
225
228
|
}
|
|
226
229
|
if (value === '' || value == null) {
|
|
@@ -481,6 +484,29 @@ const DOMTransitionPropsValidators = {
|
|
|
481
484
|
leaveToClass: String
|
|
482
485
|
};
|
|
483
486
|
const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ shared.extend({}, runtimeCore.BaseTransition.props, DOMTransitionPropsValidators));
|
|
487
|
+
/**
|
|
488
|
+
* #3227 Incoming hooks may be merged into arrays when wrapping Transition
|
|
489
|
+
* with custom HOCs.
|
|
490
|
+
*/
|
|
491
|
+
const callHook = (hook, args = []) => {
|
|
492
|
+
if (shared.isArray(hook)) {
|
|
493
|
+
hook.forEach(h => h(...args));
|
|
494
|
+
}
|
|
495
|
+
else if (hook) {
|
|
496
|
+
hook(...args);
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Check if a hook expects a callback (2nd arg), which means the user
|
|
501
|
+
* intends to explicitly control the end of the transition.
|
|
502
|
+
*/
|
|
503
|
+
const hasExplicitCallback = (hook) => {
|
|
504
|
+
return hook
|
|
505
|
+
? shared.isArray(hook)
|
|
506
|
+
? hook.some(h => h.length > 1)
|
|
507
|
+
: hook.length > 1
|
|
508
|
+
: false;
|
|
509
|
+
};
|
|
484
510
|
function resolveTransitionProps(rawProps) {
|
|
485
511
|
const baseProps = {};
|
|
486
512
|
for (const key in rawProps) {
|
|
@@ -510,11 +536,11 @@ function resolveTransitionProps(rawProps) {
|
|
|
510
536
|
return (el, done) => {
|
|
511
537
|
const hook = isAppear ? onAppear : onEnter;
|
|
512
538
|
const resolve = () => finishEnter(el, isAppear, done);
|
|
513
|
-
hook
|
|
539
|
+
callHook(hook, [el, resolve]);
|
|
514
540
|
nextFrame(() => {
|
|
515
541
|
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass);
|
|
516
542
|
addTransitionClass(el, isAppear ? appearToClass : enterToClass);
|
|
517
|
-
if (!(hook
|
|
543
|
+
if (!hasExplicitCallback(hook)) {
|
|
518
544
|
whenTransitionEnds(el, type, enterDuration, resolve);
|
|
519
545
|
}
|
|
520
546
|
});
|
|
@@ -522,12 +548,12 @@ function resolveTransitionProps(rawProps) {
|
|
|
522
548
|
};
|
|
523
549
|
return shared.extend(baseProps, {
|
|
524
550
|
onBeforeEnter(el) {
|
|
525
|
-
onBeforeEnter
|
|
551
|
+
callHook(onBeforeEnter, [el]);
|
|
526
552
|
addTransitionClass(el, enterFromClass);
|
|
527
553
|
addTransitionClass(el, enterActiveClass);
|
|
528
554
|
},
|
|
529
555
|
onBeforeAppear(el) {
|
|
530
|
-
onBeforeAppear
|
|
556
|
+
callHook(onBeforeAppear, [el]);
|
|
531
557
|
addTransitionClass(el, appearFromClass);
|
|
532
558
|
addTransitionClass(el, appearActiveClass);
|
|
533
559
|
},
|
|
@@ -542,23 +568,23 @@ function resolveTransitionProps(rawProps) {
|
|
|
542
568
|
nextFrame(() => {
|
|
543
569
|
removeTransitionClass(el, leaveFromClass);
|
|
544
570
|
addTransitionClass(el, leaveToClass);
|
|
545
|
-
if (!(onLeave
|
|
571
|
+
if (!hasExplicitCallback(onLeave)) {
|
|
546
572
|
whenTransitionEnds(el, type, leaveDuration, resolve);
|
|
547
573
|
}
|
|
548
574
|
});
|
|
549
|
-
onLeave
|
|
575
|
+
callHook(onLeave, [el, resolve]);
|
|
550
576
|
},
|
|
551
577
|
onEnterCancelled(el) {
|
|
552
578
|
finishEnter(el, false);
|
|
553
|
-
onEnterCancelled
|
|
579
|
+
callHook(onEnterCancelled, [el]);
|
|
554
580
|
},
|
|
555
581
|
onAppearCancelled(el) {
|
|
556
582
|
finishEnter(el, true);
|
|
557
|
-
onAppearCancelled
|
|
583
|
+
callHook(onAppearCancelled, [el]);
|
|
558
584
|
},
|
|
559
585
|
onLeaveCancelled(el) {
|
|
560
586
|
finishLeave(el);
|
|
561
|
-
onLeaveCancelled
|
|
587
|
+
callHook(onLeaveCancelled, [el]);
|
|
562
588
|
}
|
|
563
589
|
});
|
|
564
590
|
}
|
|
@@ -1007,12 +1033,13 @@ function setSelected(el, value) {
|
|
|
1007
1033
|
}
|
|
1008
1034
|
else {
|
|
1009
1035
|
if (shared.looseEqual(getValue(option), value)) {
|
|
1010
|
-
el.selectedIndex
|
|
1036
|
+
if (el.selectedIndex !== i)
|
|
1037
|
+
el.selectedIndex = i;
|
|
1011
1038
|
return;
|
|
1012
1039
|
}
|
|
1013
1040
|
}
|
|
1014
1041
|
}
|
|
1015
|
-
if (!isMultiple) {
|
|
1042
|
+
if (!isMultiple && el.selectedIndex !== -1) {
|
|
1016
1043
|
el.selectedIndex = -1;
|
|
1017
1044
|
}
|
|
1018
1045
|
}
|