@dcloudio/uni-mp-vue 3.0.0-alpha-3060220220914001 → 3.0.0-alpha-3060220220914002
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/vue.runtime.esm.js +258 -254
- package/package.json +4 -4
package/dist/vue.runtime.esm.js
CHANGED
|
@@ -295,7 +295,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
295
295
|
return;
|
|
296
296
|
}
|
|
297
297
|
let deps = [];
|
|
298
|
-
if (type === "clear" /* CLEAR */) {
|
|
298
|
+
if (type === "clear" /* TriggerOpTypes.CLEAR */) {
|
|
299
299
|
// collection being cleared
|
|
300
300
|
// trigger all effects for target
|
|
301
301
|
deps = [...depsMap.values()];
|
|
@@ -314,7 +314,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
314
314
|
}
|
|
315
315
|
// also run for iteration key on ADD | DELETE | Map.SET
|
|
316
316
|
switch (type) {
|
|
317
|
-
case "add" /* ADD */:
|
|
317
|
+
case "add" /* TriggerOpTypes.ADD */:
|
|
318
318
|
if (!isArray(target)) {
|
|
319
319
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
320
320
|
if (isMap(target)) {
|
|
@@ -326,7 +326,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
326
326
|
deps.push(depsMap.get('length'));
|
|
327
327
|
}
|
|
328
328
|
break;
|
|
329
|
-
case "delete" /* DELETE */:
|
|
329
|
+
case "delete" /* TriggerOpTypes.DELETE */:
|
|
330
330
|
if (!isArray(target)) {
|
|
331
331
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
332
332
|
if (isMap(target)) {
|
|
@@ -334,7 +334,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
break;
|
|
337
|
-
case "set" /* SET */:
|
|
337
|
+
case "set" /* TriggerOpTypes.SET */:
|
|
338
338
|
if (isMap(target)) {
|
|
339
339
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
340
340
|
}
|
|
@@ -418,7 +418,7 @@ function createArrayInstrumentations() {
|
|
|
418
418
|
instrumentations[key] = function (...args) {
|
|
419
419
|
const arr = toRaw(this);
|
|
420
420
|
for (let i = 0, l = this.length; i < l; i++) {
|
|
421
|
-
track(arr, "get" /* GET */, i + '');
|
|
421
|
+
track(arr, "get" /* TrackOpTypes.GET */, i + '');
|
|
422
422
|
}
|
|
423
423
|
// we run the method using the original args first (which may be reactive)
|
|
424
424
|
const res = arr[key](...args);
|
|
@@ -443,16 +443,16 @@ function createArrayInstrumentations() {
|
|
|
443
443
|
}
|
|
444
444
|
function createGetter(isReadonly = false, shallow = false) {
|
|
445
445
|
return function get(target, key, receiver) {
|
|
446
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
446
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
447
447
|
return !isReadonly;
|
|
448
448
|
}
|
|
449
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
449
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
450
450
|
return isReadonly;
|
|
451
451
|
}
|
|
452
|
-
else if (key === "__v_isShallow" /* IS_SHALLOW */) {
|
|
452
|
+
else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
|
|
453
453
|
return shallow;
|
|
454
454
|
}
|
|
455
|
-
else if (key === "__v_raw" /* RAW */ &&
|
|
455
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
|
|
456
456
|
receiver ===
|
|
457
457
|
(isReadonly
|
|
458
458
|
? shallow
|
|
@@ -472,7 +472,7 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
472
472
|
return res;
|
|
473
473
|
}
|
|
474
474
|
if (!isReadonly) {
|
|
475
|
-
track(target, "get" /* GET */, key);
|
|
475
|
+
track(target, "get" /* TrackOpTypes.GET */, key);
|
|
476
476
|
}
|
|
477
477
|
if (shallow) {
|
|
478
478
|
return res;
|
|
@@ -498,10 +498,10 @@ function createSetter(shallow = false) {
|
|
|
498
498
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
499
499
|
return false;
|
|
500
500
|
}
|
|
501
|
-
if (!shallow
|
|
502
|
-
if (!isShallow(value)) {
|
|
503
|
-
value = toRaw(value);
|
|
501
|
+
if (!shallow) {
|
|
502
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
504
503
|
oldValue = toRaw(oldValue);
|
|
504
|
+
value = toRaw(value);
|
|
505
505
|
}
|
|
506
506
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
507
507
|
oldValue.value = value;
|
|
@@ -515,10 +515,10 @@ function createSetter(shallow = false) {
|
|
|
515
515
|
// don't trigger if target is something up in the prototype chain of original
|
|
516
516
|
if (target === toRaw(receiver)) {
|
|
517
517
|
if (!hadKey) {
|
|
518
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
518
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
519
519
|
}
|
|
520
520
|
else if (hasChanged(value, oldValue)) {
|
|
521
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
521
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
return result;
|
|
@@ -529,19 +529,19 @@ function deleteProperty(target, key) {
|
|
|
529
529
|
const oldValue = target[key];
|
|
530
530
|
const result = Reflect.deleteProperty(target, key);
|
|
531
531
|
if (result && hadKey) {
|
|
532
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
532
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
533
533
|
}
|
|
534
534
|
return result;
|
|
535
535
|
}
|
|
536
536
|
function has(target, key) {
|
|
537
537
|
const result = Reflect.has(target, key);
|
|
538
538
|
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
539
|
-
track(target, "has" /* HAS */, key);
|
|
539
|
+
track(target, "has" /* TrackOpTypes.HAS */, key);
|
|
540
540
|
}
|
|
541
541
|
return result;
|
|
542
542
|
}
|
|
543
543
|
function ownKeys(target) {
|
|
544
|
-
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
544
|
+
track(target, "iterate" /* TrackOpTypes.ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
545
545
|
return Reflect.ownKeys(target);
|
|
546
546
|
}
|
|
547
547
|
const mutableHandlers = {
|
|
@@ -582,14 +582,14 @@ const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
|
582
582
|
function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
583
583
|
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
|
584
584
|
// of the value
|
|
585
|
-
target = target["__v_raw" /* RAW */];
|
|
585
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
586
586
|
const rawTarget = toRaw(target);
|
|
587
587
|
const rawKey = toRaw(key);
|
|
588
588
|
if (!isReadonly) {
|
|
589
589
|
if (key !== rawKey) {
|
|
590
|
-
track(rawTarget, "get" /* GET */, key);
|
|
590
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, key);
|
|
591
591
|
}
|
|
592
|
-
track(rawTarget, "get" /* GET */, rawKey);
|
|
592
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey);
|
|
593
593
|
}
|
|
594
594
|
const { has } = getProto(rawTarget);
|
|
595
595
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
@@ -606,22 +606,22 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
function has$1(key, isReadonly = false) {
|
|
609
|
-
const target = this["__v_raw" /* RAW */];
|
|
609
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
610
610
|
const rawTarget = toRaw(target);
|
|
611
611
|
const rawKey = toRaw(key);
|
|
612
612
|
if (!isReadonly) {
|
|
613
613
|
if (key !== rawKey) {
|
|
614
|
-
track(rawTarget, "has" /* HAS */, key);
|
|
614
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, key);
|
|
615
615
|
}
|
|
616
|
-
track(rawTarget, "has" /* HAS */, rawKey);
|
|
616
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
|
|
617
617
|
}
|
|
618
618
|
return key === rawKey
|
|
619
619
|
? target.has(key)
|
|
620
620
|
: target.has(key) || target.has(rawKey);
|
|
621
621
|
}
|
|
622
622
|
function size(target, isReadonly = false) {
|
|
623
|
-
target = target["__v_raw" /* RAW */];
|
|
624
|
-
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
|
623
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
624
|
+
!isReadonly && track(toRaw(target), "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
625
625
|
return Reflect.get(target, 'size', target);
|
|
626
626
|
}
|
|
627
627
|
function add(value) {
|
|
@@ -631,7 +631,7 @@ function add(value) {
|
|
|
631
631
|
const hadKey = proto.has.call(target, value);
|
|
632
632
|
if (!hadKey) {
|
|
633
633
|
target.add(value);
|
|
634
|
-
trigger(target, "add" /* ADD */, value, value);
|
|
634
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, value, value);
|
|
635
635
|
}
|
|
636
636
|
return this;
|
|
637
637
|
}
|
|
@@ -650,10 +650,10 @@ function set$1$1(key, value) {
|
|
|
650
650
|
const oldValue = get.call(target, key);
|
|
651
651
|
target.set(key, value);
|
|
652
652
|
if (!hadKey) {
|
|
653
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
653
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
654
654
|
}
|
|
655
655
|
else if (hasChanged(value, oldValue)) {
|
|
656
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
656
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
657
657
|
}
|
|
658
658
|
return this;
|
|
659
659
|
}
|
|
@@ -672,7 +672,7 @@ function deleteEntry(key) {
|
|
|
672
672
|
// forward the operation before queueing reactions
|
|
673
673
|
const result = target.delete(key);
|
|
674
674
|
if (hadKey) {
|
|
675
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
675
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
676
676
|
}
|
|
677
677
|
return result;
|
|
678
678
|
}
|
|
@@ -687,17 +687,17 @@ function clear() {
|
|
|
687
687
|
// forward the operation before queueing reactions
|
|
688
688
|
const result = target.clear();
|
|
689
689
|
if (hadItems) {
|
|
690
|
-
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
|
690
|
+
trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
|
|
691
691
|
}
|
|
692
692
|
return result;
|
|
693
693
|
}
|
|
694
694
|
function createForEach(isReadonly, isShallow) {
|
|
695
695
|
return function forEach(callback, thisArg) {
|
|
696
696
|
const observed = this;
|
|
697
|
-
const target = observed["__v_raw" /* RAW */];
|
|
697
|
+
const target = observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
698
698
|
const rawTarget = toRaw(target);
|
|
699
699
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
700
|
-
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
|
700
|
+
!isReadonly && track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
701
701
|
return target.forEach((value, key) => {
|
|
702
702
|
// important: make sure the callback is
|
|
703
703
|
// 1. invoked with the reactive map as `this` and 3rd arg
|
|
@@ -708,7 +708,7 @@ function createForEach(isReadonly, isShallow) {
|
|
|
708
708
|
}
|
|
709
709
|
function createIterableMethod(method, isReadonly, isShallow) {
|
|
710
710
|
return function (...args) {
|
|
711
|
-
const target = this["__v_raw" /* RAW */];
|
|
711
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
712
712
|
const rawTarget = toRaw(target);
|
|
713
713
|
const targetIsMap = isMap(rawTarget);
|
|
714
714
|
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
|
@@ -716,7 +716,7 @@ function createIterableMethod(method, isReadonly, isShallow) {
|
|
|
716
716
|
const innerIterator = target[method](...args);
|
|
717
717
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
718
718
|
!isReadonly &&
|
|
719
|
-
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
719
|
+
track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
720
720
|
// return a wrapped iterator which returns observed versions of the
|
|
721
721
|
// values emitted from the real iterator
|
|
722
722
|
return {
|
|
@@ -743,7 +743,7 @@ function createReadonlyMethod(type) {
|
|
|
743
743
|
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
744
744
|
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
|
745
745
|
}
|
|
746
|
-
return type === "delete" /* DELETE */ ? false : this;
|
|
746
|
+
return type === "delete" /* TriggerOpTypes.DELETE */ ? false : this;
|
|
747
747
|
};
|
|
748
748
|
}
|
|
749
749
|
function createInstrumentations() {
|
|
@@ -785,10 +785,10 @@ function createInstrumentations() {
|
|
|
785
785
|
has(key) {
|
|
786
786
|
return has$1.call(this, key, true);
|
|
787
787
|
},
|
|
788
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
789
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
790
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
791
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
788
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
789
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
790
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
791
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
792
792
|
forEach: createForEach(true, false)
|
|
793
793
|
};
|
|
794
794
|
const shallowReadonlyInstrumentations = {
|
|
@@ -801,10 +801,10 @@ function createInstrumentations() {
|
|
|
801
801
|
has(key) {
|
|
802
802
|
return has$1.call(this, key, true);
|
|
803
803
|
},
|
|
804
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
805
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
806
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
807
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
804
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
805
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
806
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
807
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
808
808
|
forEach: createForEach(true, true)
|
|
809
809
|
};
|
|
810
810
|
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
|
@@ -831,13 +831,13 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
831
831
|
? readonlyInstrumentations
|
|
832
832
|
: mutableInstrumentations;
|
|
833
833
|
return (target, key, receiver) => {
|
|
834
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
834
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
835
835
|
return !isReadonly;
|
|
836
836
|
}
|
|
837
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
837
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
838
838
|
return isReadonly;
|
|
839
839
|
}
|
|
840
|
-
else if (key === "__v_raw" /* RAW */) {
|
|
840
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */) {
|
|
841
841
|
return target;
|
|
842
842
|
}
|
|
843
843
|
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
|
@@ -877,19 +877,19 @@ function targetTypeMap(rawType) {
|
|
|
877
877
|
switch (rawType) {
|
|
878
878
|
case 'Object':
|
|
879
879
|
case 'Array':
|
|
880
|
-
return 1 /* COMMON */;
|
|
880
|
+
return 1 /* TargetType.COMMON */;
|
|
881
881
|
case 'Map':
|
|
882
882
|
case 'Set':
|
|
883
883
|
case 'WeakMap':
|
|
884
884
|
case 'WeakSet':
|
|
885
|
-
return 2 /* COLLECTION */;
|
|
885
|
+
return 2 /* TargetType.COLLECTION */;
|
|
886
886
|
default:
|
|
887
|
-
return 0 /* INVALID */;
|
|
887
|
+
return 0 /* TargetType.INVALID */;
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
890
|
function getTargetType(value) {
|
|
891
|
-
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
|
892
|
-
? 0 /* INVALID */
|
|
891
|
+
return value["__v_skip" /* ReactiveFlags.SKIP */] || !Object.isExtensible(value)
|
|
892
|
+
? 0 /* TargetType.INVALID */
|
|
893
893
|
: targetTypeMap(toRawType(value));
|
|
894
894
|
}
|
|
895
895
|
function reactive(target) {
|
|
@@ -932,8 +932,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
932
932
|
}
|
|
933
933
|
// target is already a Proxy, return it.
|
|
934
934
|
// exception: calling readonly() on a reactive object
|
|
935
|
-
if (target["__v_raw" /* RAW */] &&
|
|
936
|
-
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
|
935
|
+
if (target["__v_raw" /* ReactiveFlags.RAW */] &&
|
|
936
|
+
!(isReadonly && target["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */])) {
|
|
937
937
|
return target;
|
|
938
938
|
}
|
|
939
939
|
// target already has corresponding Proxy
|
|
@@ -943,34 +943,34 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
943
943
|
}
|
|
944
944
|
// only specific value types can be observed.
|
|
945
945
|
const targetType = getTargetType(target);
|
|
946
|
-
if (targetType === 0 /* INVALID */) {
|
|
946
|
+
if (targetType === 0 /* TargetType.INVALID */) {
|
|
947
947
|
return target;
|
|
948
948
|
}
|
|
949
|
-
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
949
|
+
const proxy = new Proxy(target, targetType === 2 /* TargetType.COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
950
950
|
proxyMap.set(target, proxy);
|
|
951
951
|
return proxy;
|
|
952
952
|
}
|
|
953
953
|
function isReactive(value) {
|
|
954
954
|
if (isReadonly(value)) {
|
|
955
|
-
return isReactive(value["__v_raw" /* RAW */]);
|
|
955
|
+
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
956
956
|
}
|
|
957
|
-
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
|
957
|
+
return !!(value && value["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */]);
|
|
958
958
|
}
|
|
959
959
|
function isReadonly(value) {
|
|
960
|
-
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
|
960
|
+
return !!(value && value["__v_isReadonly" /* ReactiveFlags.IS_READONLY */]);
|
|
961
961
|
}
|
|
962
962
|
function isShallow(value) {
|
|
963
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
963
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
964
964
|
}
|
|
965
965
|
function isProxy(value) {
|
|
966
966
|
return isReactive(value) || isReadonly(value);
|
|
967
967
|
}
|
|
968
968
|
function toRaw(observed) {
|
|
969
|
-
const raw = observed && observed["__v_raw" /* RAW */];
|
|
969
|
+
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
970
970
|
return raw ? toRaw(raw) : observed;
|
|
971
971
|
}
|
|
972
972
|
function markRaw(value) {
|
|
973
|
-
def(value, "__v_skip" /* SKIP */, true);
|
|
973
|
+
def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
|
|
974
974
|
return value;
|
|
975
975
|
}
|
|
976
976
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
@@ -982,7 +982,7 @@ function trackRefValue(ref) {
|
|
|
982
982
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
983
983
|
trackEffects(ref.dep || (ref.dep = createDep()), {
|
|
984
984
|
target: ref,
|
|
985
|
-
type: "get" /* GET */,
|
|
985
|
+
type: "get" /* TrackOpTypes.GET */,
|
|
986
986
|
key: 'value'
|
|
987
987
|
});
|
|
988
988
|
}
|
|
@@ -997,7 +997,7 @@ function triggerRefValue(ref, newVal) {
|
|
|
997
997
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
998
998
|
triggerEffects(ref.dep, {
|
|
999
999
|
target: ref,
|
|
1000
|
-
type: "set" /* SET */,
|
|
1000
|
+
type: "set" /* TriggerOpTypes.SET */,
|
|
1001
1001
|
key: 'value',
|
|
1002
1002
|
newValue: newVal
|
|
1003
1003
|
});
|
|
@@ -1035,10 +1035,11 @@ class RefImpl {
|
|
|
1035
1035
|
return this._value;
|
|
1036
1036
|
}
|
|
1037
1037
|
set value(newVal) {
|
|
1038
|
-
|
|
1038
|
+
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
|
|
1039
|
+
newVal = useDirectValue ? newVal : toRaw(newVal);
|
|
1039
1040
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1040
1041
|
this._rawValue = newVal;
|
|
1041
|
-
this._value =
|
|
1042
|
+
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1042
1043
|
triggerRefValue(this, newVal);
|
|
1043
1044
|
}
|
|
1044
1045
|
}
|
|
@@ -1117,11 +1118,13 @@ function toRef(object, key, defaultValue) {
|
|
|
1117
1118
|
: new ObjectRefImpl(object, key, defaultValue);
|
|
1118
1119
|
}
|
|
1119
1120
|
|
|
1121
|
+
var _a;
|
|
1120
1122
|
class ComputedRefImpl {
|
|
1121
1123
|
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1122
1124
|
this._setter = _setter;
|
|
1123
1125
|
this.dep = undefined;
|
|
1124
1126
|
this.__v_isRef = true;
|
|
1127
|
+
this[_a] = false;
|
|
1125
1128
|
this._dirty = true;
|
|
1126
1129
|
this.effect = new ReactiveEffect(getter, () => {
|
|
1127
1130
|
if (!this._dirty) {
|
|
@@ -1131,7 +1134,7 @@ class ComputedRefImpl {
|
|
|
1131
1134
|
});
|
|
1132
1135
|
this.effect.computed = this;
|
|
1133
1136
|
this.effect.active = this._cacheable = !isSSR;
|
|
1134
|
-
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
|
1137
|
+
this["__v_isReadonly" /* ReactiveFlags.IS_READONLY */] = isReadonly;
|
|
1135
1138
|
}
|
|
1136
1139
|
get value() {
|
|
1137
1140
|
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
|
|
@@ -1147,6 +1150,7 @@ class ComputedRefImpl {
|
|
|
1147
1150
|
this._setter(newValue);
|
|
1148
1151
|
}
|
|
1149
1152
|
}
|
|
1153
|
+
_a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1150
1154
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1151
1155
|
let getter;
|
|
1152
1156
|
let setter;
|
|
@@ -1186,7 +1190,7 @@ function warn$1(msg, ...args) {
|
|
|
1186
1190
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1187
1191
|
const trace = getComponentTrace();
|
|
1188
1192
|
if (appWarnHandler) {
|
|
1189
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
1193
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
1190
1194
|
msg + args.join(''),
|
|
1191
1195
|
instance && instance.proxy,
|
|
1192
1196
|
trace
|
|
@@ -1286,35 +1290,35 @@ function formatProp(key, value, raw) {
|
|
|
1286
1290
|
}
|
|
1287
1291
|
|
|
1288
1292
|
const ErrorTypeStrings = {
|
|
1289
|
-
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1290
|
-
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1291
|
-
["c" /* CREATED */]: 'created hook',
|
|
1292
|
-
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1293
|
-
["m" /* MOUNTED */]: 'mounted hook',
|
|
1294
|
-
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1295
|
-
["u" /* UPDATED */]: 'updated',
|
|
1296
|
-
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1297
|
-
["um" /* UNMOUNTED */]: 'unmounted hook',
|
|
1298
|
-
["a" /* ACTIVATED */]: 'activated hook',
|
|
1299
|
-
["da" /* DEACTIVATED */]: 'deactivated hook',
|
|
1300
|
-
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1301
|
-
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
|
1302
|
-
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1303
|
-
[0 /* SETUP_FUNCTION */]: 'setup function',
|
|
1304
|
-
[1 /* RENDER_FUNCTION */]: 'render function',
|
|
1305
|
-
[2 /* WATCH_GETTER */]: 'watcher getter',
|
|
1306
|
-
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
|
1307
|
-
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1308
|
-
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1309
|
-
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1310
|
-
[7 /* VNODE_HOOK */]: 'vnode hook',
|
|
1311
|
-
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
|
1312
|
-
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
|
1313
|
-
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1314
|
-
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1315
|
-
[12 /* FUNCTION_REF */]: 'ref function',
|
|
1316
|
-
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1317
|
-
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1293
|
+
["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1294
|
+
["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1295
|
+
["c" /* LifecycleHooks.CREATED */]: 'created hook',
|
|
1296
|
+
["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1297
|
+
["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
|
|
1298
|
+
["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1299
|
+
["u" /* LifecycleHooks.UPDATED */]: 'updated',
|
|
1300
|
+
["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1301
|
+
["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
|
|
1302
|
+
["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
|
|
1303
|
+
["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
|
|
1304
|
+
["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1305
|
+
["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
|
|
1306
|
+
["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1307
|
+
[0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
|
|
1308
|
+
[1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
|
|
1309
|
+
[2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
|
|
1310
|
+
[3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
|
|
1311
|
+
[4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1312
|
+
[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1313
|
+
[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1314
|
+
[7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
|
|
1315
|
+
[8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
|
|
1316
|
+
[9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
|
|
1317
|
+
[10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1318
|
+
[11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1319
|
+
[12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
|
|
1320
|
+
[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1321
|
+
[14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1318
1322
|
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
1319
1323
|
};
|
|
1320
1324
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
@@ -1365,7 +1369,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1365
1369
|
// app-level handling
|
|
1366
1370
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
1367
1371
|
if (appErrorHandler) {
|
|
1368
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
1372
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
1369
1373
|
return;
|
|
1370
1374
|
}
|
|
1371
1375
|
}
|
|
@@ -1402,15 +1406,11 @@ let isFlushPending = false;
|
|
|
1402
1406
|
// fixed by xxxxxx
|
|
1403
1407
|
const queue = [];
|
|
1404
1408
|
let flushIndex = 0;
|
|
1405
|
-
const pendingPreFlushCbs = [];
|
|
1406
|
-
let activePreFlushCbs = null;
|
|
1407
|
-
let preFlushIndex = 0;
|
|
1408
1409
|
const pendingPostFlushCbs = [];
|
|
1409
1410
|
let activePostFlushCbs = null;
|
|
1410
1411
|
let postFlushIndex = 0;
|
|
1411
1412
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
1412
1413
|
let currentFlushPromise = null;
|
|
1413
|
-
let currentPreFlushParentJob = null;
|
|
1414
1414
|
const RECURSION_LIMIT = 100;
|
|
1415
1415
|
function nextTick(fn) {
|
|
1416
1416
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -1438,9 +1438,8 @@ function queueJob(job) {
|
|
|
1438
1438
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
1439
1439
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
1440
1440
|
// ensure it doesn't end up in an infinite loop.
|
|
1441
|
-
if (
|
|
1442
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
1443
|
-
job !== currentPreFlushParentJob) {
|
|
1441
|
+
if (!queue.length ||
|
|
1442
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
1444
1443
|
if (job.id == null) {
|
|
1445
1444
|
queue.push(job);
|
|
1446
1445
|
}
|
|
@@ -1465,52 +1464,40 @@ function invalidateJob(job) {
|
|
|
1465
1464
|
queue.splice(i, 1);
|
|
1466
1465
|
}
|
|
1467
1466
|
}
|
|
1468
|
-
function
|
|
1467
|
+
function queuePostFlushCb(cb) {
|
|
1469
1468
|
if (!isArray(cb)) {
|
|
1470
|
-
if (!
|
|
1471
|
-
!
|
|
1472
|
-
|
|
1469
|
+
if (!activePostFlushCbs ||
|
|
1470
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
1471
|
+
pendingPostFlushCbs.push(cb);
|
|
1473
1472
|
}
|
|
1474
1473
|
}
|
|
1475
1474
|
else {
|
|
1476
1475
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
1477
1476
|
// triggered by a job, which is already deduped in the main queue, so
|
|
1478
1477
|
// we can skip duplicate check here to improve perf
|
|
1479
|
-
|
|
1478
|
+
pendingPostFlushCbs.push(...cb);
|
|
1480
1479
|
}
|
|
1481
1480
|
queueFlush();
|
|
1482
1481
|
}
|
|
1483
|
-
function
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
pendingPreFlushCbs.length = 0;
|
|
1494
|
-
if ((process.env.NODE_ENV !== 'production')) {
|
|
1495
|
-
seen = seen || new Map();
|
|
1496
|
-
}
|
|
1497
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
1498
|
-
if ((process.env.NODE_ENV !== 'production') &&
|
|
1499
|
-
checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
|
1482
|
+
function flushPreFlushCbs(seen,
|
|
1483
|
+
// if currently flushing, skip the current job itself
|
|
1484
|
+
i = isFlushing ? flushIndex + 1 : 0) {
|
|
1485
|
+
if ((process.env.NODE_ENV !== 'production')) {
|
|
1486
|
+
seen = seen || new Map();
|
|
1487
|
+
}
|
|
1488
|
+
for (; i < queue.length; i++) {
|
|
1489
|
+
const cb = queue[i];
|
|
1490
|
+
if (cb && cb.pre) {
|
|
1491
|
+
if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, cb)) {
|
|
1500
1492
|
continue;
|
|
1501
1493
|
}
|
|
1502
|
-
|
|
1494
|
+
queue.splice(i, 1);
|
|
1495
|
+
i--;
|
|
1496
|
+
cb();
|
|
1503
1497
|
}
|
|
1504
|
-
activePreFlushCbs = null;
|
|
1505
|
-
preFlushIndex = 0;
|
|
1506
|
-
currentPreFlushParentJob = null;
|
|
1507
|
-
// recursively flush until it drains
|
|
1508
|
-
flushPreFlushCbs(seen, parentJob);
|
|
1509
1498
|
}
|
|
1510
1499
|
}
|
|
1511
1500
|
function flushPostFlushCbs(seen) {
|
|
1512
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1513
|
-
flushPreFlushCbs();
|
|
1514
1501
|
if (pendingPostFlushCbs.length) {
|
|
1515
1502
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1516
1503
|
pendingPostFlushCbs.length = 0;
|
|
@@ -1536,13 +1523,22 @@ function flushPostFlushCbs(seen) {
|
|
|
1536
1523
|
}
|
|
1537
1524
|
}
|
|
1538
1525
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
1526
|
+
const comparator = (a, b) => {
|
|
1527
|
+
const diff = getId(a) - getId(b);
|
|
1528
|
+
if (diff === 0) {
|
|
1529
|
+
if (a.pre && !b.pre)
|
|
1530
|
+
return -1;
|
|
1531
|
+
if (b.pre && !a.pre)
|
|
1532
|
+
return 1;
|
|
1533
|
+
}
|
|
1534
|
+
return diff;
|
|
1535
|
+
};
|
|
1539
1536
|
function flushJobs(seen) {
|
|
1540
1537
|
isFlushPending = false;
|
|
1541
1538
|
isFlushing = true;
|
|
1542
1539
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
1543
1540
|
seen = seen || new Map();
|
|
1544
1541
|
}
|
|
1545
|
-
flushPreFlushCbs(seen);
|
|
1546
1542
|
// Sort queue before flush.
|
|
1547
1543
|
// This ensures that:
|
|
1548
1544
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -1550,7 +1546,7 @@ function flushJobs(seen) {
|
|
|
1550
1546
|
// priority number)
|
|
1551
1547
|
// 2. If a component is unmounted during a parent component's update,
|
|
1552
1548
|
// its update can be skipped.
|
|
1553
|
-
queue.sort(
|
|
1549
|
+
queue.sort(comparator);
|
|
1554
1550
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
1555
1551
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
1556
1552
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -1567,7 +1563,7 @@ function flushJobs(seen) {
|
|
|
1567
1563
|
continue;
|
|
1568
1564
|
}
|
|
1569
1565
|
// console.log(`running:`, job.id)
|
|
1570
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
1566
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
1571
1567
|
}
|
|
1572
1568
|
}
|
|
1573
1569
|
}
|
|
@@ -1579,9 +1575,7 @@ function flushJobs(seen) {
|
|
|
1579
1575
|
currentFlushPromise = null;
|
|
1580
1576
|
// some postFlushCb queued jobs!
|
|
1581
1577
|
// keep flushing until it drains.
|
|
1582
|
-
if (queue.length ||
|
|
1583
|
-
pendingPreFlushCbs.length ||
|
|
1584
|
-
pendingPostFlushCbs.length) {
|
|
1578
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1585
1579
|
flushJobs(seen);
|
|
1586
1580
|
}
|
|
1587
1581
|
}
|
|
@@ -1611,14 +1605,14 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
1611
1605
|
function emit(event, ...args) {
|
|
1612
1606
|
}
|
|
1613
1607
|
const devtoolsComponentUpdated =
|
|
1614
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
1608
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
|
|
1615
1609
|
function createDevtoolsComponentHook(hook) {
|
|
1616
1610
|
return (component) => {
|
|
1617
1611
|
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
1618
1612
|
};
|
|
1619
1613
|
}
|
|
1620
1614
|
function devtoolsComponentEmit(component, event, params) {
|
|
1621
|
-
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
1615
|
+
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
1622
1616
|
}
|
|
1623
1617
|
|
|
1624
1618
|
function emit$1(instance, event, ...rawArgs) {
|
|
@@ -1683,7 +1677,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
1683
1677
|
handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
|
|
1684
1678
|
}
|
|
1685
1679
|
if (handler) {
|
|
1686
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
1680
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
1687
1681
|
}
|
|
1688
1682
|
const onceHandler = props[handlerName + `Once`];
|
|
1689
1683
|
if (onceHandler) {
|
|
@@ -1694,7 +1688,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
1694
1688
|
return;
|
|
1695
1689
|
}
|
|
1696
1690
|
instance.emitted[handlerName] = true;
|
|
1697
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
1691
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
1698
1692
|
}
|
|
1699
1693
|
}
|
|
1700
1694
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -1726,7 +1720,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1726
1720
|
}
|
|
1727
1721
|
}
|
|
1728
1722
|
if (!raw && !hasExtends) {
|
|
1729
|
-
|
|
1723
|
+
if (isObject(comp)) {
|
|
1724
|
+
cache.set(comp, null);
|
|
1725
|
+
}
|
|
1730
1726
|
return null;
|
|
1731
1727
|
}
|
|
1732
1728
|
if (isArray(raw)) {
|
|
@@ -1735,7 +1731,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
1735
1731
|
else {
|
|
1736
1732
|
extend(normalized, raw);
|
|
1737
1733
|
}
|
|
1738
|
-
|
|
1734
|
+
if (isObject(comp)) {
|
|
1735
|
+
cache.set(comp, normalized);
|
|
1736
|
+
}
|
|
1739
1737
|
return normalized;
|
|
1740
1738
|
}
|
|
1741
1739
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -1939,7 +1937,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1939
1937
|
return traverse(s);
|
|
1940
1938
|
}
|
|
1941
1939
|
else if (isFunction(s)) {
|
|
1942
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
1940
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1943
1941
|
}
|
|
1944
1942
|
else {
|
|
1945
1943
|
(process.env.NODE_ENV !== 'production') && warnInvalidSource(s);
|
|
@@ -1949,7 +1947,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1949
1947
|
else if (isFunction(source)) {
|
|
1950
1948
|
if (cb) {
|
|
1951
1949
|
// getter with cb
|
|
1952
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
1950
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1953
1951
|
}
|
|
1954
1952
|
else {
|
|
1955
1953
|
// no cb -> simple effect
|
|
@@ -1960,7 +1958,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1960
1958
|
if (cleanup) {
|
|
1961
1959
|
cleanup();
|
|
1962
1960
|
}
|
|
1963
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
1961
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
1964
1962
|
};
|
|
1965
1963
|
}
|
|
1966
1964
|
}
|
|
@@ -1975,7 +1973,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1975
1973
|
let cleanup;
|
|
1976
1974
|
let onCleanup = (fn) => {
|
|
1977
1975
|
cleanup = effect.onStop = () => {
|
|
1978
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
1976
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
1979
1977
|
};
|
|
1980
1978
|
};
|
|
1981
1979
|
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
@@ -1996,7 +1994,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1996
1994
|
if (cleanup) {
|
|
1997
1995
|
cleanup();
|
|
1998
1996
|
}
|
|
1999
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1997
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
2000
1998
|
newValue,
|
|
2001
1999
|
// pass undefined as the old value when it's changed for the first time
|
|
2002
2000
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -2022,17 +2020,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2022
2020
|
}
|
|
2023
2021
|
else {
|
|
2024
2022
|
// default: 'pre'
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
else {
|
|
2030
|
-
// with 'pre' option, the first call must happen before
|
|
2031
|
-
// the component is mounted so it is called synchronously.
|
|
2032
|
-
// fixed by xxxxxx https://github.com/dcloudio/uni-app/issues/3648
|
|
2033
|
-
job();
|
|
2034
|
-
}
|
|
2035
|
-
};
|
|
2023
|
+
job.pre = true;
|
|
2024
|
+
if (instance)
|
|
2025
|
+
job.id = instance.uid;
|
|
2026
|
+
scheduler = () => queueJob(job);
|
|
2036
2027
|
}
|
|
2037
2028
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
2038
2029
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -2099,7 +2090,7 @@ function createPathGetter(ctx, path) {
|
|
|
2099
2090
|
};
|
|
2100
2091
|
}
|
|
2101
2092
|
function traverse(value, seen) {
|
|
2102
|
-
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
2093
|
+
if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
2103
2094
|
return value;
|
|
2104
2095
|
}
|
|
2105
2096
|
seen = seen || new Set();
|
|
@@ -2135,10 +2126,10 @@ function defineComponent(options) {
|
|
|
2135
2126
|
|
|
2136
2127
|
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
2137
2128
|
function onActivated(hook, target) {
|
|
2138
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
2129
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
2139
2130
|
}
|
|
2140
2131
|
function onDeactivated(hook, target) {
|
|
2141
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
2132
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
2142
2133
|
}
|
|
2143
2134
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
2144
2135
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -2227,19 +2218,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2227
2218
|
}
|
|
2228
2219
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2229
2220
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2230
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
2221
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2231
2222
|
injectHook(lifecycle, hook, target);
|
|
2232
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
2233
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
2234
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
2235
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
2236
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
2237
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
2238
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
2239
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
2240
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
2223
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2224
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2225
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
2226
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
2227
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
2228
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
2229
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
2230
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
2231
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
2241
2232
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
2242
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2233
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
2243
2234
|
}
|
|
2244
2235
|
|
|
2245
2236
|
/**
|
|
@@ -2359,14 +2350,16 @@ function resolve(registry, name) {
|
|
|
2359
2350
|
* For prefixing keys in v-on="obj" with "on"
|
|
2360
2351
|
* @private
|
|
2361
2352
|
*/
|
|
2362
|
-
function toHandlers(obj) {
|
|
2353
|
+
function toHandlers(obj, preserveCaseIfNecessary) {
|
|
2363
2354
|
const ret = {};
|
|
2364
2355
|
if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
|
|
2365
2356
|
warn$1(`v-on with no argument expects an object value.`);
|
|
2366
2357
|
return ret;
|
|
2367
2358
|
}
|
|
2368
2359
|
for (const key in obj) {
|
|
2369
|
-
ret[
|
|
2360
|
+
ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
|
|
2361
|
+
? `on:${key}`
|
|
2362
|
+
: toHandlerKey(key)] = obj[key];
|
|
2370
2363
|
}
|
|
2371
2364
|
return ret;
|
|
2372
2365
|
}
|
|
@@ -2433,23 +2426,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
2433
2426
|
const n = accessCache[key];
|
|
2434
2427
|
if (n !== undefined) {
|
|
2435
2428
|
switch (n) {
|
|
2436
|
-
case 1 /* SETUP */:
|
|
2429
|
+
case 1 /* AccessTypes.SETUP */:
|
|
2437
2430
|
return setupState[key];
|
|
2438
|
-
case 2 /* DATA */:
|
|
2431
|
+
case 2 /* AccessTypes.DATA */:
|
|
2439
2432
|
return data[key];
|
|
2440
|
-
case 4 /* CONTEXT */:
|
|
2433
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
2441
2434
|
return ctx[key];
|
|
2442
|
-
case 3 /* PROPS */:
|
|
2435
|
+
case 3 /* AccessTypes.PROPS */:
|
|
2443
2436
|
return props[key];
|
|
2444
2437
|
// default: just fallthrough
|
|
2445
2438
|
}
|
|
2446
2439
|
}
|
|
2447
2440
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
2448
|
-
accessCache[key] = 1 /* SETUP */;
|
|
2441
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
2449
2442
|
return setupState[key];
|
|
2450
2443
|
}
|
|
2451
2444
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
2452
|
-
accessCache[key] = 2 /* DATA */;
|
|
2445
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
2453
2446
|
return data[key];
|
|
2454
2447
|
}
|
|
2455
2448
|
else if (
|
|
@@ -2457,15 +2450,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
2457
2450
|
// props
|
|
2458
2451
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
2459
2452
|
hasOwn(normalizedProps, key)) {
|
|
2460
|
-
accessCache[key] = 3 /* PROPS */;
|
|
2453
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
2461
2454
|
return props[key];
|
|
2462
2455
|
}
|
|
2463
2456
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
2464
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
2457
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
2465
2458
|
return ctx[key];
|
|
2466
2459
|
}
|
|
2467
2460
|
else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
|
|
2468
|
-
accessCache[key] = 0 /* OTHER */;
|
|
2461
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
2469
2462
|
}
|
|
2470
2463
|
}
|
|
2471
2464
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -2473,7 +2466,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
2473
2466
|
// public $xxx properties
|
|
2474
2467
|
if (publicGetter) {
|
|
2475
2468
|
if (key === '$attrs') {
|
|
2476
|
-
track(instance, "get" /* GET */, key);
|
|
2469
|
+
track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
2477
2470
|
(process.env.NODE_ENV !== 'production') && markAttrsAccessed();
|
|
2478
2471
|
}
|
|
2479
2472
|
return publicGetter(instance);
|
|
@@ -2486,7 +2479,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
2486
2479
|
}
|
|
2487
2480
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
2488
2481
|
// user may set custom properties to `this` that start with `$`
|
|
2489
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
2482
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
2490
2483
|
return ctx[key];
|
|
2491
2484
|
}
|
|
2492
2485
|
else if (
|
|
@@ -2656,7 +2649,7 @@ function applyOptions$1(instance) {
|
|
|
2656
2649
|
// call beforeCreate first before accessing other options since
|
|
2657
2650
|
// the hook may mutate resolved options (#2791)
|
|
2658
2651
|
if (options.beforeCreate) {
|
|
2659
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
2652
|
+
callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
2660
2653
|
}
|
|
2661
2654
|
const {
|
|
2662
2655
|
// state
|
|
@@ -2672,7 +2665,7 @@ function applyOptions$1(instance) {
|
|
|
2672
2665
|
const [propsOptions] = instance.propsOptions;
|
|
2673
2666
|
if (propsOptions) {
|
|
2674
2667
|
for (const key in propsOptions) {
|
|
2675
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
2668
|
+
checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
|
|
2676
2669
|
}
|
|
2677
2670
|
}
|
|
2678
2671
|
}
|
|
@@ -2706,7 +2699,7 @@ function applyOptions$1(instance) {
|
|
|
2706
2699
|
ctx[key] = methodHandler.bind(publicThis);
|
|
2707
2700
|
}
|
|
2708
2701
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
2709
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
2702
|
+
checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
|
|
2710
2703
|
}
|
|
2711
2704
|
}
|
|
2712
2705
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -2733,7 +2726,7 @@ function applyOptions$1(instance) {
|
|
|
2733
2726
|
instance.data = reactive(data);
|
|
2734
2727
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
2735
2728
|
for (const key in data) {
|
|
2736
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
2729
|
+
checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
|
|
2737
2730
|
// expose data on ctx during dev
|
|
2738
2731
|
if (!isReservedPrefix(key[0])) {
|
|
2739
2732
|
Object.defineProperty(ctx, key, {
|
|
@@ -2778,7 +2771,7 @@ function applyOptions$1(instance) {
|
|
|
2778
2771
|
set: v => (c.value = v)
|
|
2779
2772
|
});
|
|
2780
2773
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
2781
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
2774
|
+
checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
|
|
2782
2775
|
}
|
|
2783
2776
|
}
|
|
2784
2777
|
}
|
|
@@ -2802,13 +2795,13 @@ function applyOptions$1(instance) {
|
|
|
2802
2795
|
if (__VUE_CREATED_DEFERRED__) {
|
|
2803
2796
|
ctx.$callCreatedHook = function (name) {
|
|
2804
2797
|
if (created) {
|
|
2805
|
-
return callHook(created, instance, "c" /* CREATED */);
|
|
2798
|
+
return callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
2806
2799
|
}
|
|
2807
2800
|
};
|
|
2808
2801
|
}
|
|
2809
2802
|
else {
|
|
2810
2803
|
if (created) {
|
|
2811
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
2804
|
+
callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
2812
2805
|
}
|
|
2813
2806
|
}
|
|
2814
2807
|
function registerLifecycleHook(register, hook) {
|
|
@@ -2906,7 +2899,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
2906
2899
|
ctx[key] = injected;
|
|
2907
2900
|
}
|
|
2908
2901
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
2909
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
2902
|
+
checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
|
|
2910
2903
|
}
|
|
2911
2904
|
}
|
|
2912
2905
|
}
|
|
@@ -2977,7 +2970,9 @@ function resolveMergedOptions(instance) {
|
|
|
2977
2970
|
}
|
|
2978
2971
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2979
2972
|
}
|
|
2980
|
-
|
|
2973
|
+
if (isObject(base)) {
|
|
2974
|
+
cache.set(base, resolved);
|
|
2975
|
+
}
|
|
2981
2976
|
return resolved;
|
|
2982
2977
|
}
|
|
2983
2978
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -3107,6 +3102,13 @@ isSSR = false) {
|
|
|
3107
3102
|
}
|
|
3108
3103
|
instance.attrs = attrs;
|
|
3109
3104
|
}
|
|
3105
|
+
function isInHmrContext(instance) {
|
|
3106
|
+
while (instance) {
|
|
3107
|
+
if (instance.type.__hmrId)
|
|
3108
|
+
return true;
|
|
3109
|
+
instance = instance.parent;
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3110
3112
|
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
3111
3113
|
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
3112
3114
|
const rawCurrentProps = toRaw(props);
|
|
@@ -3116,12 +3118,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3116
3118
|
// always force full diff in dev
|
|
3117
3119
|
// - #1942 if hmr is enabled with sfc component
|
|
3118
3120
|
// - vite#872 non-sfc component used by sfc component
|
|
3119
|
-
!((process.env.NODE_ENV !== 'production') &&
|
|
3120
|
-
(instance.type.__hmrId ||
|
|
3121
|
-
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
3121
|
+
!((process.env.NODE_ENV !== 'production') && isInHmrContext(instance)) &&
|
|
3122
3122
|
(optimized || patchFlag > 0) &&
|
|
3123
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
3124
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
3123
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
3124
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
3125
3125
|
// Compiler-generated props & no keys change, just set the updated
|
|
3126
3126
|
// the props.
|
|
3127
3127
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -3200,7 +3200,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3200
3200
|
}
|
|
3201
3201
|
// trigger updates for $attrs in case it's used in component slots
|
|
3202
3202
|
if (hasAttrsChanged) {
|
|
3203
|
-
trigger(instance, "set" /* SET */, '$attrs');
|
|
3203
|
+
trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
3204
3204
|
}
|
|
3205
3205
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
3206
3206
|
validateProps(rawProps || {}, props, instance);
|
|
@@ -3269,11 +3269,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3269
3269
|
}
|
|
3270
3270
|
}
|
|
3271
3271
|
// boolean casting
|
|
3272
|
-
if (opt[0 /* shouldCast */]) {
|
|
3272
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
3273
3273
|
if (isAbsent && !hasDefault) {
|
|
3274
3274
|
value = false;
|
|
3275
3275
|
}
|
|
3276
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
3276
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
3277
3277
|
(value === '' || value === hyphenate(key))) {
|
|
3278
3278
|
value = true;
|
|
3279
3279
|
}
|
|
@@ -3311,7 +3311,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3311
3311
|
}
|
|
3312
3312
|
}
|
|
3313
3313
|
if (!raw && !hasExtends) {
|
|
3314
|
-
|
|
3314
|
+
if (isObject(comp)) {
|
|
3315
|
+
cache.set(comp, EMPTY_ARR);
|
|
3316
|
+
}
|
|
3315
3317
|
return EMPTY_ARR;
|
|
3316
3318
|
}
|
|
3317
3319
|
if (isArray(raw)) {
|
|
@@ -3338,8 +3340,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3338
3340
|
if (prop) {
|
|
3339
3341
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
3340
3342
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
3341
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
3342
|
-
prop[1 /* shouldCastTrue */] =
|
|
3343
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
3344
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
3343
3345
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
3344
3346
|
// if the prop needs boolean casting or default value
|
|
3345
3347
|
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
@@ -3350,7 +3352,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3350
3352
|
}
|
|
3351
3353
|
}
|
|
3352
3354
|
const res = [normalized, needCastKeys];
|
|
3353
|
-
|
|
3355
|
+
if (isObject(comp)) {
|
|
3356
|
+
cache.set(comp, res);
|
|
3357
|
+
}
|
|
3354
3358
|
return res;
|
|
3355
3359
|
}
|
|
3356
3360
|
function validatePropName(key) {
|
|
@@ -3691,7 +3695,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
3691
3695
|
: ref
|
|
3692
3696
|
: null);
|
|
3693
3697
|
};
|
|
3694
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
3698
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
3695
3699
|
const vnode = {
|
|
3696
3700
|
__v_isVNode: true,
|
|
3697
3701
|
__v_skip: true,
|
|
@@ -3726,8 +3730,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
3726
3730
|
// compiled element vnode - if children is passed, only possible types are
|
|
3727
3731
|
// string or Array.
|
|
3728
3732
|
vnode.shapeFlag |= isString(children)
|
|
3729
|
-
? 8 /* TEXT_CHILDREN */
|
|
3730
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
3733
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
3734
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
3731
3735
|
}
|
|
3732
3736
|
// validate key
|
|
3733
3737
|
if ((process.env.NODE_ENV !== 'production') && vnode.key !== vnode.key) {
|
|
@@ -3743,10 +3747,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
3743
3747
|
// component nodes also should always be patched, because even if the
|
|
3744
3748
|
// component doesn't need to update, it needs to persist the instance on to
|
|
3745
3749
|
// the next vnode so that it can be properly unmounted later.
|
|
3746
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
3750
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
3747
3751
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
3748
3752
|
// vnode should not be considered dynamic due to handler caching.
|
|
3749
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
3753
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
3750
3754
|
currentBlock.push(vnode);
|
|
3751
3755
|
}
|
|
3752
3756
|
return vnode;
|
|
@@ -3768,14 +3772,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
3768
3772
|
normalizeChildren(cloned, children);
|
|
3769
3773
|
}
|
|
3770
3774
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
3771
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
3775
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
3772
3776
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
3773
3777
|
}
|
|
3774
3778
|
else {
|
|
3775
3779
|
currentBlock.push(cloned);
|
|
3776
3780
|
}
|
|
3777
3781
|
}
|
|
3778
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
3782
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
3779
3783
|
return cloned;
|
|
3780
3784
|
}
|
|
3781
3785
|
// class component normalization.
|
|
@@ -3801,15 +3805,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
3801
3805
|
}
|
|
3802
3806
|
// encode the vnode type information into a bitmap
|
|
3803
3807
|
const shapeFlag = isString(type)
|
|
3804
|
-
? 1 /* ELEMENT */
|
|
3808
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
3805
3809
|
: isTeleport(type)
|
|
3806
|
-
? 64 /* TELEPORT */
|
|
3810
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
3807
3811
|
: isObject(type)
|
|
3808
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
3812
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
3809
3813
|
: isFunction(type)
|
|
3810
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
3814
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
3811
3815
|
: 0;
|
|
3812
|
-
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
3816
|
+
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
3813
3817
|
type = toRaw(type);
|
|
3814
3818
|
warn$1(`Vue received a Component which was made a reactive object. This can ` +
|
|
3815
3819
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -3848,7 +3852,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
3848
3852
|
: ref,
|
|
3849
3853
|
scopeId: vnode.scopeId,
|
|
3850
3854
|
slotScopeIds: vnode.slotScopeIds,
|
|
3851
|
-
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
3855
|
+
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
3852
3856
|
? children.map(deepCloneVNode)
|
|
3853
3857
|
: children,
|
|
3854
3858
|
target: vnode.target,
|
|
@@ -3861,8 +3865,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
3861
3865
|
// fast paths only.
|
|
3862
3866
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
3863
3867
|
? patchFlag === -1 // hoisted node
|
|
3864
|
-
? 16 /* FULL_PROPS */
|
|
3865
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
3868
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
3869
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
3866
3870
|
: patchFlag,
|
|
3867
3871
|
dynamicProps: vnode.dynamicProps,
|
|
3868
3872
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -3906,10 +3910,10 @@ function normalizeChildren(vnode, children) {
|
|
|
3906
3910
|
children = null;
|
|
3907
3911
|
}
|
|
3908
3912
|
else if (isArray(children)) {
|
|
3909
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
3913
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
3910
3914
|
}
|
|
3911
3915
|
else if (typeof children === 'object') {
|
|
3912
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
3916
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
3913
3917
|
// Normalize slot to plain children for plain element and Teleport
|
|
3914
3918
|
const slot = children.default;
|
|
3915
3919
|
if (slot) {
|
|
@@ -3921,37 +3925,37 @@ function normalizeChildren(vnode, children) {
|
|
|
3921
3925
|
return;
|
|
3922
3926
|
}
|
|
3923
3927
|
else {
|
|
3924
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
3928
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
3925
3929
|
const slotFlag = children._;
|
|
3926
3930
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
3927
3931
|
children._ctx = currentRenderingInstance;
|
|
3928
3932
|
}
|
|
3929
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
3933
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
3930
3934
|
// a child component receives forwarded slots from the parent.
|
|
3931
3935
|
// its slot type is determined by its parent's slot type.
|
|
3932
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
3933
|
-
children._ = 1 /* STABLE */;
|
|
3936
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
3937
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
3934
3938
|
}
|
|
3935
3939
|
else {
|
|
3936
|
-
children._ = 2 /* DYNAMIC */;
|
|
3937
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
3940
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
3941
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
3938
3942
|
}
|
|
3939
3943
|
}
|
|
3940
3944
|
}
|
|
3941
3945
|
}
|
|
3942
3946
|
else if (isFunction(children)) {
|
|
3943
3947
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
3944
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
3948
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
3945
3949
|
}
|
|
3946
3950
|
else {
|
|
3947
3951
|
children = String(children);
|
|
3948
3952
|
// force teleport children to array so it can be moved around
|
|
3949
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
3950
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
3953
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
3954
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
3951
3955
|
children = [createTextVNode(children)];
|
|
3952
3956
|
}
|
|
3953
3957
|
else {
|
|
3954
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
3958
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
3955
3959
|
}
|
|
3956
3960
|
}
|
|
3957
3961
|
vnode.children = children;
|
|
@@ -4094,7 +4098,7 @@ function validateComponentName(name, config) {
|
|
|
4094
4098
|
}
|
|
4095
4099
|
}
|
|
4096
4100
|
function isStatefulComponent(instance) {
|
|
4097
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
4101
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
4098
4102
|
}
|
|
4099
4103
|
let isInSSRComponentSetup = false;
|
|
4100
4104
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -4149,7 +4153,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
4149
4153
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
4150
4154
|
setCurrentInstance(instance);
|
|
4151
4155
|
pauseTracking();
|
|
4152
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
4156
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
4153
4157
|
resetTracking();
|
|
4154
4158
|
unsetCurrentInstance();
|
|
4155
4159
|
if (isPromise(setupResult)) {
|
|
@@ -4232,7 +4236,7 @@ function createAttrsProxy(instance) {
|
|
|
4232
4236
|
return new Proxy(instance.attrs, (process.env.NODE_ENV !== 'production')
|
|
4233
4237
|
? {
|
|
4234
4238
|
get(target, key) {
|
|
4235
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
4239
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
4236
4240
|
return target[key];
|
|
4237
4241
|
},
|
|
4238
4242
|
set() {
|
|
@@ -4246,7 +4250,7 @@ function createAttrsProxy(instance) {
|
|
|
4246
4250
|
}
|
|
4247
4251
|
: {
|
|
4248
4252
|
get(target, key) {
|
|
4249
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
4253
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
4250
4254
|
return target[key];
|
|
4251
4255
|
}
|
|
4252
4256
|
});
|
|
@@ -4491,7 +4495,7 @@ const useSSRContext = () => {
|
|
|
4491
4495
|
};
|
|
4492
4496
|
|
|
4493
4497
|
// Core API ------------------------------------------------------------------
|
|
4494
|
-
const version = "3.2.
|
|
4498
|
+
const version = "3.2.39";
|
|
4495
4499
|
/**
|
|
4496
4500
|
* @internal only exposed in compat builds
|
|
4497
4501
|
*/
|
|
@@ -4623,7 +4627,7 @@ function flushCallbacks(instance) {
|
|
|
4623
4627
|
const ctx = instance.ctx;
|
|
4624
4628
|
const callbacks = ctx.__next_tick_callbacks;
|
|
4625
4629
|
if (callbacks && callbacks.length) {
|
|
4626
|
-
if (process.env.
|
|
4630
|
+
if (process.env.UNI_DEBUG) {
|
|
4627
4631
|
const mpInstance = ctx.$scope;
|
|
4628
4632
|
console.log('[' +
|
|
4629
4633
|
+new Date() +
|
|
@@ -4645,7 +4649,7 @@ function flushCallbacks(instance) {
|
|
|
4645
4649
|
function nextTick$1(instance, fn) {
|
|
4646
4650
|
const ctx = instance.ctx;
|
|
4647
4651
|
if (!ctx.__next_tick_pending && !hasComponentEffect(instance)) {
|
|
4648
|
-
if (process.env.
|
|
4652
|
+
if (process.env.UNI_DEBUG) {
|
|
4649
4653
|
const mpInstance = ctx.$scope;
|
|
4650
4654
|
console.log('[' +
|
|
4651
4655
|
+new Date() +
|
|
@@ -4657,7 +4661,7 @@ function nextTick$1(instance, fn) {
|
|
|
4657
4661
|
}
|
|
4658
4662
|
return nextTick(fn && fn.bind(instance.proxy));
|
|
4659
4663
|
}
|
|
4660
|
-
if (process.env.
|
|
4664
|
+
if (process.env.UNI_DEBUG) {
|
|
4661
4665
|
const mpInstance = ctx.$scope;
|
|
4662
4666
|
console.log('[' +
|
|
4663
4667
|
+new Date() +
|
|
@@ -4673,7 +4677,7 @@ function nextTick$1(instance, fn) {
|
|
|
4673
4677
|
}
|
|
4674
4678
|
ctx.__next_tick_callbacks.push(() => {
|
|
4675
4679
|
if (fn) {
|
|
4676
|
-
callWithErrorHandling(fn.bind(instance.proxy), instance, 14 /* SCHEDULER */);
|
|
4680
|
+
callWithErrorHandling(fn.bind(instance.proxy), instance, 14 /* ErrorCodes.SCHEDULER */);
|
|
4677
4681
|
}
|
|
4678
4682
|
else if (_resolve) {
|
|
4679
4683
|
_resolve(instance.proxy);
|
|
@@ -4771,7 +4775,7 @@ function patch(instance, data, oldData) {
|
|
|
4771
4775
|
flushCallbacks(instance);
|
|
4772
4776
|
});
|
|
4773
4777
|
// props update may have triggered pre-flush watchers.
|
|
4774
|
-
flushPreFlushCbs(
|
|
4778
|
+
flushPreFlushCbs();
|
|
4775
4779
|
}
|
|
4776
4780
|
else {
|
|
4777
4781
|
flushCallbacks(instance);
|
|
@@ -4960,7 +4964,7 @@ function renderComponentRoot(instance) {
|
|
|
4960
4964
|
let result;
|
|
4961
4965
|
const prev = setCurrentRenderingInstance(instance);
|
|
4962
4966
|
try {
|
|
4963
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
4967
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
4964
4968
|
fallthroughAttrs(inheritAttrs, props, propsOptions, attrs);
|
|
4965
4969
|
// withProxy is a proxy with a different `has` trap only for
|
|
4966
4970
|
// runtime-compiled render functions using `with` block.
|
|
@@ -4978,7 +4982,7 @@ function renderComponentRoot(instance) {
|
|
|
4978
4982
|
}
|
|
4979
4983
|
}
|
|
4980
4984
|
catch (err) {
|
|
4981
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
4985
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
4982
4986
|
result = false;
|
|
4983
4987
|
}
|
|
4984
4988
|
setRef$1(instance);
|
|
@@ -5007,7 +5011,7 @@ const updateComponentPreRender = (instance) => {
|
|
|
5007
5011
|
pauseTracking();
|
|
5008
5012
|
// props update may have triggered pre-flush watchers.
|
|
5009
5013
|
// flush them before the render update.
|
|
5010
|
-
flushPreFlushCbs(
|
|
5014
|
+
flushPreFlushCbs();
|
|
5011
5015
|
resetTracking();
|
|
5012
5016
|
};
|
|
5013
5017
|
function componentUpdateScopedSlotsFn() {
|
|
@@ -5067,7 +5071,7 @@ function setupRenderEffect(instance) {
|
|
|
5067
5071
|
const { bu, u } = instance;
|
|
5068
5072
|
// Disallow component effect recursion during pre-lifecycle hooks.
|
|
5069
5073
|
toggleRecurse(instance, false);
|
|
5070
|
-
updateComponentPreRender(
|
|
5074
|
+
updateComponentPreRender();
|
|
5071
5075
|
// beforeUpdate hook
|
|
5072
5076
|
if (bu) {
|
|
5073
5077
|
invokeArrayFns(bu);
|
|
@@ -5128,7 +5132,7 @@ function createVueApp(rootComponent, rootProps = null) {
|
|
|
5128
5132
|
initAppConfig(appContext.config);
|
|
5129
5133
|
const createVNode = initialVNode => {
|
|
5130
5134
|
initialVNode.appContext = appContext;
|
|
5131
|
-
initialVNode.shapeFlag = 6 /* COMPONENT */;
|
|
5135
|
+
initialVNode.shapeFlag = 6 /* ShapeFlags.COMPONENT */;
|
|
5132
5136
|
return initialVNode;
|
|
5133
5137
|
};
|
|
5134
5138
|
const createComponent = function createComponent(initialVNode, options) {
|
|
@@ -5460,7 +5464,7 @@ function createInvoker(initialValue, instance) {
|
|
|
5460
5464
|
args = e.detail.__args__;
|
|
5461
5465
|
}
|
|
5462
5466
|
const eventValue = invoker.value;
|
|
5463
|
-
const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e, eventValue), instance, 5 /* NATIVE_EVENT_HANDLER */, args);
|
|
5467
|
+
const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e, eventValue), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, args);
|
|
5464
5468
|
// 冒泡事件触发时,启用延迟策略,避免同一批次的事件执行时机不正确,对性能可能有略微影响 https://github.com/dcloudio/uni-app/issues/3228
|
|
5465
5469
|
const eventTarget = e.target;
|
|
5466
5470
|
const eventSync = eventTarget
|