@vue/runtime-core 3.4.0-rc.2 → 3.4.0
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-core.cjs.js +36 -18
- package/dist/runtime-core.cjs.prod.js +64 -16
- package/dist/runtime-core.d.ts +20 -12
- package/dist/runtime-core.esm-bundler.js +36 -18
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -180,7 +180,7 @@ const ErrorTypeStrings$1 = {
|
|
|
180
180
|
[11]: "app warnHandler",
|
|
181
181
|
[12]: "ref function",
|
|
182
182
|
[13]: "async component loader",
|
|
183
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://
|
|
183
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
184
184
|
};
|
|
185
185
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
186
186
|
let res;
|
|
@@ -690,7 +690,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
690
690
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
691
691
|
instance,
|
|
692
692
|
instance.type
|
|
693
|
-
)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${shared.hyphenate(
|
|
693
|
+
)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${shared.hyphenate(
|
|
694
|
+
event
|
|
695
|
+
)}" instead of "${event}".`
|
|
694
696
|
);
|
|
695
697
|
}
|
|
696
698
|
}
|
|
@@ -1133,7 +1135,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
1133
1135
|
const selfName = getComponentName(
|
|
1134
1136
|
Component,
|
|
1135
1137
|
false
|
|
1136
|
-
/* do not include inferred name to avoid breaking existing code */
|
|
1137
1138
|
);
|
|
1138
1139
|
if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
|
1139
1140
|
return Component;
|
|
@@ -1663,6 +1664,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
1663
1664
|
parentSuspense,
|
|
1664
1665
|
parentComponent,
|
|
1665
1666
|
node.parentNode,
|
|
1667
|
+
// eslint-disable-next-line no-restricted-globals
|
|
1666
1668
|
document.createElement("div"),
|
|
1667
1669
|
null,
|
|
1668
1670
|
namespace,
|
|
@@ -1670,7 +1672,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
1670
1672
|
optimized,
|
|
1671
1673
|
rendererInternals,
|
|
1672
1674
|
true
|
|
1673
|
-
/* hydrating */
|
|
1674
1675
|
);
|
|
1675
1676
|
const result = hydrateNode(
|
|
1676
1677
|
node,
|
|
@@ -1772,7 +1773,14 @@ function watch(source, cb, options) {
|
|
|
1772
1773
|
}
|
|
1773
1774
|
return doWatch(source, cb, options);
|
|
1774
1775
|
}
|
|
1775
|
-
function doWatch(source, cb, {
|
|
1776
|
+
function doWatch(source, cb, {
|
|
1777
|
+
immediate,
|
|
1778
|
+
deep,
|
|
1779
|
+
flush,
|
|
1780
|
+
once,
|
|
1781
|
+
onTrack,
|
|
1782
|
+
onTrigger
|
|
1783
|
+
} = shared.EMPTY_OBJ) {
|
|
1776
1784
|
var _a;
|
|
1777
1785
|
if (cb && once) {
|
|
1778
1786
|
const _cb = cb;
|
|
@@ -2478,7 +2486,6 @@ function defineAsyncComponent(source) {
|
|
|
2478
2486
|
instance,
|
|
2479
2487
|
13,
|
|
2480
2488
|
!errorComponent
|
|
2481
|
-
/* do not throw in dev if user provided error component */
|
|
2482
2489
|
);
|
|
2483
2490
|
};
|
|
2484
2491
|
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
@@ -3256,7 +3263,7 @@ function useSlots() {
|
|
|
3256
3263
|
function useAttrs() {
|
|
3257
3264
|
return getContext().attrs;
|
|
3258
3265
|
}
|
|
3259
|
-
function useModel(props, name) {
|
|
3266
|
+
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
3260
3267
|
const i = getCurrentInstance();
|
|
3261
3268
|
if (!i) {
|
|
3262
3269
|
warn$1(`useModel() called without active instance.`);
|
|
@@ -3266,7 +3273,7 @@ function useModel(props, name) {
|
|
|
3266
3273
|
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
3267
3274
|
return reactivity.ref();
|
|
3268
3275
|
}
|
|
3269
|
-
|
|
3276
|
+
const res = reactivity.customRef((track, trigger) => {
|
|
3270
3277
|
let localValue;
|
|
3271
3278
|
watchSyncEffect(() => {
|
|
3272
3279
|
const propValue = props[name];
|
|
@@ -3278,7 +3285,7 @@ function useModel(props, name) {
|
|
|
3278
3285
|
return {
|
|
3279
3286
|
get() {
|
|
3280
3287
|
track();
|
|
3281
|
-
return localValue;
|
|
3288
|
+
return options.get ? options.get(localValue) : localValue;
|
|
3282
3289
|
},
|
|
3283
3290
|
set(value) {
|
|
3284
3291
|
const rawProps = i.vnode.props;
|
|
@@ -3286,10 +3293,24 @@ function useModel(props, name) {
|
|
|
3286
3293
|
localValue = value;
|
|
3287
3294
|
trigger();
|
|
3288
3295
|
}
|
|
3289
|
-
i.emit(`update:${name}`, value);
|
|
3296
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
3290
3297
|
}
|
|
3291
3298
|
};
|
|
3292
3299
|
});
|
|
3300
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
3301
|
+
res[Symbol.iterator] = () => {
|
|
3302
|
+
let i2 = 0;
|
|
3303
|
+
return {
|
|
3304
|
+
next() {
|
|
3305
|
+
if (i2 < 2) {
|
|
3306
|
+
return { value: i2++ ? props[modifierKey] : res, done: false };
|
|
3307
|
+
} else {
|
|
3308
|
+
return { done: true };
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
};
|
|
3312
|
+
};
|
|
3313
|
+
return res;
|
|
3293
3314
|
}
|
|
3294
3315
|
function getContext() {
|
|
3295
3316
|
const i = getCurrentInstance();
|
|
@@ -3579,7 +3600,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared
|
|
|
3579
3600
|
opt.from || key,
|
|
3580
3601
|
opt.default,
|
|
3581
3602
|
true
|
|
3582
|
-
/* treat default function as factory */
|
|
3583
3603
|
);
|
|
3584
3604
|
} else {
|
|
3585
3605
|
injected = inject(opt.from || key);
|
|
@@ -4065,7 +4085,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
4065
4085
|
value,
|
|
4066
4086
|
instance,
|
|
4067
4087
|
false
|
|
4068
|
-
/* isAbsent */
|
|
4069
4088
|
);
|
|
4070
4089
|
}
|
|
4071
4090
|
} else {
|
|
@@ -4097,7 +4116,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
4097
4116
|
void 0,
|
|
4098
4117
|
instance,
|
|
4099
4118
|
true
|
|
4100
|
-
/* isAbsent */
|
|
4101
4119
|
);
|
|
4102
4120
|
}
|
|
4103
4121
|
} else {
|
|
@@ -6963,7 +6981,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
|
|
|
6963
6981
|
dynamicProps,
|
|
6964
6982
|
shapeFlag,
|
|
6965
6983
|
true
|
|
6966
|
-
/* isBlock */
|
|
6967
6984
|
)
|
|
6968
6985
|
);
|
|
6969
6986
|
}
|
|
@@ -6976,7 +6993,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
|
|
|
6976
6993
|
patchFlag,
|
|
6977
6994
|
dynamicProps,
|
|
6978
6995
|
true
|
|
6979
|
-
/* isBlock: prevent a block from tracking itself */
|
|
6980
6996
|
)
|
|
6981
6997
|
);
|
|
6982
6998
|
}
|
|
@@ -7483,7 +7499,10 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7483
7499
|
setup,
|
|
7484
7500
|
instance,
|
|
7485
7501
|
0,
|
|
7486
|
-
[
|
|
7502
|
+
[
|
|
7503
|
+
reactivity.shallowReadonly(instance.props) ,
|
|
7504
|
+
setupContext
|
|
7505
|
+
]
|
|
7487
7506
|
);
|
|
7488
7507
|
reactivity.resetTracking();
|
|
7489
7508
|
unsetCurrentInstance();
|
|
@@ -7595,7 +7614,6 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
7595
7614
|
if (!compile && Component.template) {
|
|
7596
7615
|
warn$1(
|
|
7597
7616
|
`Component provided template option but runtime compilation is not supported in this build of Vue.` + (``)
|
|
7598
|
-
/* should not happen */
|
|
7599
7617
|
);
|
|
7600
7618
|
} else {
|
|
7601
7619
|
warn$1(`Component is missing template or render function.`);
|
|
@@ -7959,7 +7977,7 @@ function isMemoSame(cached, memo) {
|
|
|
7959
7977
|
return true;
|
|
7960
7978
|
}
|
|
7961
7979
|
|
|
7962
|
-
const version = "3.4.0
|
|
7980
|
+
const version = "3.4.0";
|
|
7963
7981
|
const warn = warn$1 ;
|
|
7964
7982
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
7965
7983
|
const devtools = devtools$1 ;
|
|
@@ -41,6 +41,37 @@ const ErrorCodes = {
|
|
|
41
41
|
"SCHEDULER": 14,
|
|
42
42
|
"14": "SCHEDULER"
|
|
43
43
|
};
|
|
44
|
+
const ErrorTypeStrings$1 = {
|
|
45
|
+
["sp"]: "serverPrefetch hook",
|
|
46
|
+
["bc"]: "beforeCreate hook",
|
|
47
|
+
["c"]: "created hook",
|
|
48
|
+
["bm"]: "beforeMount hook",
|
|
49
|
+
["m"]: "mounted hook",
|
|
50
|
+
["bu"]: "beforeUpdate hook",
|
|
51
|
+
["u"]: "updated",
|
|
52
|
+
["bum"]: "beforeUnmount hook",
|
|
53
|
+
["um"]: "unmounted hook",
|
|
54
|
+
["a"]: "activated hook",
|
|
55
|
+
["da"]: "deactivated hook",
|
|
56
|
+
["ec"]: "errorCaptured hook",
|
|
57
|
+
["rtc"]: "renderTracked hook",
|
|
58
|
+
["rtg"]: "renderTriggered hook",
|
|
59
|
+
[0]: "setup function",
|
|
60
|
+
[1]: "render function",
|
|
61
|
+
[2]: "watcher getter",
|
|
62
|
+
[3]: "watcher callback",
|
|
63
|
+
[4]: "watcher cleanup function",
|
|
64
|
+
[5]: "native event handler",
|
|
65
|
+
[6]: "component event handler",
|
|
66
|
+
[7]: "vnode hook",
|
|
67
|
+
[8]: "directive hook",
|
|
68
|
+
[9]: "transition hook",
|
|
69
|
+
[10]: "app errorHandler",
|
|
70
|
+
[11]: "app warnHandler",
|
|
71
|
+
[12]: "ref function",
|
|
72
|
+
[13]: "async component loader",
|
|
73
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
74
|
+
};
|
|
44
75
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
45
76
|
let res;
|
|
46
77
|
try {
|
|
@@ -612,7 +643,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
612
643
|
const selfName = getComponentName(
|
|
613
644
|
Component,
|
|
614
645
|
false
|
|
615
|
-
/* do not include inferred name to avoid breaking existing code */
|
|
616
646
|
);
|
|
617
647
|
if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
|
618
648
|
return Component;
|
|
@@ -1105,6 +1135,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
1105
1135
|
parentSuspense,
|
|
1106
1136
|
parentComponent,
|
|
1107
1137
|
node.parentNode,
|
|
1138
|
+
// eslint-disable-next-line no-restricted-globals
|
|
1108
1139
|
document.createElement("div"),
|
|
1109
1140
|
null,
|
|
1110
1141
|
namespace,
|
|
@@ -1112,7 +1143,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
1112
1143
|
optimized,
|
|
1113
1144
|
rendererInternals,
|
|
1114
1145
|
true
|
|
1115
|
-
/* hydrating */
|
|
1116
1146
|
);
|
|
1117
1147
|
const result = hydrateNode(
|
|
1118
1148
|
node,
|
|
@@ -1206,7 +1236,14 @@ const INITIAL_WATCHER_VALUE = {};
|
|
|
1206
1236
|
function watch(source, cb, options) {
|
|
1207
1237
|
return doWatch(source, cb, options);
|
|
1208
1238
|
}
|
|
1209
|
-
function doWatch(source, cb, {
|
|
1239
|
+
function doWatch(source, cb, {
|
|
1240
|
+
immediate,
|
|
1241
|
+
deep,
|
|
1242
|
+
flush,
|
|
1243
|
+
once,
|
|
1244
|
+
onTrack,
|
|
1245
|
+
onTrigger
|
|
1246
|
+
} = shared.EMPTY_OBJ) {
|
|
1210
1247
|
var _a;
|
|
1211
1248
|
if (cb && once) {
|
|
1212
1249
|
const _cb = cb;
|
|
@@ -1857,7 +1894,6 @@ function defineAsyncComponent(source) {
|
|
|
1857
1894
|
instance,
|
|
1858
1895
|
13,
|
|
1859
1896
|
!errorComponent
|
|
1860
|
-
/* do not throw in dev if user provided error component */
|
|
1861
1897
|
);
|
|
1862
1898
|
};
|
|
1863
1899
|
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
@@ -2476,9 +2512,9 @@ function useSlots() {
|
|
|
2476
2512
|
function useAttrs() {
|
|
2477
2513
|
return getContext().attrs;
|
|
2478
2514
|
}
|
|
2479
|
-
function useModel(props, name) {
|
|
2515
|
+
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
2480
2516
|
const i = getCurrentInstance();
|
|
2481
|
-
|
|
2517
|
+
const res = reactivity.customRef((track, trigger) => {
|
|
2482
2518
|
let localValue;
|
|
2483
2519
|
watchSyncEffect(() => {
|
|
2484
2520
|
const propValue = props[name];
|
|
@@ -2490,7 +2526,7 @@ function useModel(props, name) {
|
|
|
2490
2526
|
return {
|
|
2491
2527
|
get() {
|
|
2492
2528
|
track();
|
|
2493
|
-
return localValue;
|
|
2529
|
+
return options.get ? options.get(localValue) : localValue;
|
|
2494
2530
|
},
|
|
2495
2531
|
set(value) {
|
|
2496
2532
|
const rawProps = i.vnode.props;
|
|
@@ -2498,10 +2534,24 @@ function useModel(props, name) {
|
|
|
2498
2534
|
localValue = value;
|
|
2499
2535
|
trigger();
|
|
2500
2536
|
}
|
|
2501
|
-
i.emit(`update:${name}`, value);
|
|
2537
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
2502
2538
|
}
|
|
2503
2539
|
};
|
|
2504
2540
|
});
|
|
2541
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
2542
|
+
res[Symbol.iterator] = () => {
|
|
2543
|
+
let i2 = 0;
|
|
2544
|
+
return {
|
|
2545
|
+
next() {
|
|
2546
|
+
if (i2 < 2) {
|
|
2547
|
+
return { value: i2++ ? props[modifierKey] : res, done: false };
|
|
2548
|
+
} else {
|
|
2549
|
+
return { done: true };
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
};
|
|
2553
|
+
};
|
|
2554
|
+
return res;
|
|
2505
2555
|
}
|
|
2506
2556
|
function getContext() {
|
|
2507
2557
|
const i = getCurrentInstance();
|
|
@@ -2716,7 +2766,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared
|
|
|
2716
2766
|
opt.from || key,
|
|
2717
2767
|
opt.default,
|
|
2718
2768
|
true
|
|
2719
|
-
/* treat default function as factory */
|
|
2720
2769
|
);
|
|
2721
2770
|
} else {
|
|
2722
2771
|
injected = inject(opt.from || key);
|
|
@@ -3108,7 +3157,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3108
3157
|
value,
|
|
3109
3158
|
instance,
|
|
3110
3159
|
false
|
|
3111
|
-
/* isAbsent */
|
|
3112
3160
|
);
|
|
3113
3161
|
}
|
|
3114
3162
|
} else {
|
|
@@ -3140,7 +3188,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3140
3188
|
void 0,
|
|
3141
3189
|
instance,
|
|
3142
3190
|
true
|
|
3143
|
-
/* isAbsent */
|
|
3144
3191
|
);
|
|
3145
3192
|
}
|
|
3146
3193
|
} else {
|
|
@@ -5551,7 +5598,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
|
|
|
5551
5598
|
dynamicProps,
|
|
5552
5599
|
shapeFlag,
|
|
5553
5600
|
true
|
|
5554
|
-
/* isBlock */
|
|
5555
5601
|
)
|
|
5556
5602
|
);
|
|
5557
5603
|
}
|
|
@@ -5564,7 +5610,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
|
|
|
5564
5610
|
patchFlag,
|
|
5565
5611
|
dynamicProps,
|
|
5566
5612
|
true
|
|
5567
|
-
/* isBlock: prevent a block from tracking itself */
|
|
5568
5613
|
)
|
|
5569
5614
|
);
|
|
5570
5615
|
}
|
|
@@ -6002,7 +6047,10 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6002
6047
|
setup,
|
|
6003
6048
|
instance,
|
|
6004
6049
|
0,
|
|
6005
|
-
[
|
|
6050
|
+
[
|
|
6051
|
+
instance.props,
|
|
6052
|
+
setupContext
|
|
6053
|
+
]
|
|
6006
6054
|
);
|
|
6007
6055
|
reactivity.resetTracking();
|
|
6008
6056
|
unsetCurrentInstance();
|
|
@@ -6197,9 +6245,9 @@ function isMemoSame(cached, memo) {
|
|
|
6197
6245
|
return true;
|
|
6198
6246
|
}
|
|
6199
6247
|
|
|
6200
|
-
const version = "3.4.0
|
|
6248
|
+
const version = "3.4.0";
|
|
6201
6249
|
const warn$1 = shared.NOOP;
|
|
6202
|
-
const ErrorTypeStrings =
|
|
6250
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
6203
6251
|
const devtools = void 0;
|
|
6204
6252
|
const setDevtoolsHook = shared.NOOP;
|
|
6205
6253
|
const _ssrUtils = {
|
package/dist/runtime-core.d.ts
CHANGED
|
@@ -845,7 +845,7 @@ declare enum TeleportMoveTypes {
|
|
|
845
845
|
REORDER = 2
|
|
846
846
|
}
|
|
847
847
|
declare function moveTeleport(vnode: VNode, container: RendererElement, parentAnchor: RendererNode | null, { o: { insert }, m: move }: RendererInternals, moveType?: TeleportMoveTypes): void;
|
|
848
|
-
declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector } }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
848
|
+
declare function hydrateTeleport(node: Node, vnode: TeleportVNode, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean, { o: { nextSibling, parentNode, querySelector }, }: RendererInternals<Node, Element>, hydrateChildren: (node: Node | null, vnode: VNode, container: Element, parentComponent: ComponentInternalInstance | null, parentSuspense: SuspenseBoundary | null, slotScopeIds: string[] | null, optimized: boolean) => Node | null): Node | null;
|
|
849
849
|
export declare const Teleport: {
|
|
850
850
|
new (): {
|
|
851
851
|
$props: VNodeProps & TeleportProps;
|
|
@@ -1278,6 +1278,10 @@ export declare function defineOptions<RawBindings = {}, D = {}, C extends Comput
|
|
|
1278
1278
|
slots?: undefined;
|
|
1279
1279
|
}): void;
|
|
1280
1280
|
export declare function defineSlots<S extends Record<string, any> = Record<string, any>>(): StrictUnwrapSlotsType<SlotsType<S>>;
|
|
1281
|
+
export type ModelRef<T, M extends string | number | symbol = string> = Ref<T> & [
|
|
1282
|
+
ModelRef<T, M>,
|
|
1283
|
+
Record<M, true | undefined>
|
|
1284
|
+
];
|
|
1281
1285
|
/**
|
|
1282
1286
|
* Vue `<script setup>` compiler macro for declaring a
|
|
1283
1287
|
* two-way binding prop that can be consumed via `v-model` from the parent
|
|
@@ -1311,20 +1315,20 @@ export declare function defineSlots<S extends Record<string, any> = Record<strin
|
|
|
1311
1315
|
* const count = defineModel<number>('count', { default: 0 })
|
|
1312
1316
|
* ```
|
|
1313
1317
|
*/
|
|
1314
|
-
export declare function defineModel<T>(options: {
|
|
1318
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1315
1319
|
required: true;
|
|
1316
|
-
} & PropOptions<T>):
|
|
1317
|
-
export declare function defineModel<T>(options: {
|
|
1320
|
+
} & PropOptions<T> & UseModelOptions<T>): ModelRef<T, M>;
|
|
1321
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options: {
|
|
1318
1322
|
default: any;
|
|
1319
|
-
} & PropOptions<T>):
|
|
1320
|
-
export declare function defineModel<T>(options?: PropOptions<T>):
|
|
1321
|
-
export declare function defineModel<T>(name: string, options: {
|
|
1323
|
+
} & PropOptions<T> & UseModelOptions<T>): ModelRef<T, M>;
|
|
1324
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(options?: PropOptions<T> & UseModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1325
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1322
1326
|
required: true;
|
|
1323
|
-
} & PropOptions<T>):
|
|
1324
|
-
export declare function defineModel<T>(name: string, options: {
|
|
1327
|
+
} & PropOptions<T> & UseModelOptions<T>): ModelRef<T, M>;
|
|
1328
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options: {
|
|
1325
1329
|
default: any;
|
|
1326
|
-
} & PropOptions<T>):
|
|
1327
|
-
export declare function defineModel<T>(name: string, options?: PropOptions<T>):
|
|
1330
|
+
} & PropOptions<T> & UseModelOptions<T>): ModelRef<T, M>;
|
|
1331
|
+
export declare function defineModel<T, M extends string | number | symbol = string>(name: string, options?: PropOptions<T> & UseModelOptions<T>): ModelRef<T | undefined, M>;
|
|
1328
1332
|
type NotUndefined<T> = T extends undefined ? never : T;
|
|
1329
1333
|
type InferDefaults<T> = {
|
|
1330
1334
|
[K in keyof T]?: InferDefault<T, T[K]>;
|
|
@@ -1359,7 +1363,11 @@ type PropsWithDefaults<T, Defaults extends InferDefaults<T>, BKeys extends keyof
|
|
|
1359
1363
|
export declare function withDefaults<T, BKeys extends keyof T, Defaults extends InferDefaults<T>>(props: DefineProps<T, BKeys>, defaults: Defaults): PropsWithDefaults<T, Defaults, BKeys>;
|
|
1360
1364
|
export declare function useSlots(): SetupContext['slots'];
|
|
1361
1365
|
export declare function useAttrs(): SetupContext['attrs'];
|
|
1362
|
-
|
|
1366
|
+
type UseModelOptions<T = any> = {
|
|
1367
|
+
get?: (v: T) => any;
|
|
1368
|
+
set?: (v: T) => any;
|
|
1369
|
+
};
|
|
1370
|
+
export declare function useModel<M extends string | number | symbol, T extends Record<string, any>, K extends keyof T>(props: T, name: K, options?: UseModelOptions<T[K]>): ModelRef<T[K], M>;
|
|
1363
1371
|
|
|
1364
1372
|
type RawProps = VNodeProps & {
|
|
1365
1373
|
__v_isVNode?: never;
|
|
@@ -180,7 +180,7 @@ const ErrorTypeStrings$1 = {
|
|
|
180
180
|
[11]: "app warnHandler",
|
|
181
181
|
[12]: "ref function",
|
|
182
182
|
[13]: "async component loader",
|
|
183
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://
|
|
183
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
184
184
|
};
|
|
185
185
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
186
186
|
let res;
|
|
@@ -692,7 +692,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
692
692
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
693
693
|
instance,
|
|
694
694
|
instance.type
|
|
695
|
-
)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
|
|
695
|
+
)} but the handler is registered for "${event}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${hyphenate(
|
|
696
|
+
event
|
|
697
|
+
)}" instead of "${event}".`
|
|
696
698
|
);
|
|
697
699
|
}
|
|
698
700
|
}
|
|
@@ -1135,7 +1137,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
1135
1137
|
const selfName = getComponentName(
|
|
1136
1138
|
Component,
|
|
1137
1139
|
false
|
|
1138
|
-
/* do not include inferred name to avoid breaking existing code */
|
|
1139
1140
|
);
|
|
1140
1141
|
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
|
1141
1142
|
return Component;
|
|
@@ -1665,6 +1666,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
1665
1666
|
parentSuspense,
|
|
1666
1667
|
parentComponent,
|
|
1667
1668
|
node.parentNode,
|
|
1669
|
+
// eslint-disable-next-line no-restricted-globals
|
|
1668
1670
|
document.createElement("div"),
|
|
1669
1671
|
null,
|
|
1670
1672
|
namespace,
|
|
@@ -1672,7 +1674,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
1672
1674
|
optimized,
|
|
1673
1675
|
rendererInternals,
|
|
1674
1676
|
true
|
|
1675
|
-
/* hydrating */
|
|
1676
1677
|
);
|
|
1677
1678
|
const result = hydrateNode(
|
|
1678
1679
|
node,
|
|
@@ -1774,7 +1775,14 @@ function watch(source, cb, options) {
|
|
|
1774
1775
|
}
|
|
1775
1776
|
return doWatch(source, cb, options);
|
|
1776
1777
|
}
|
|
1777
|
-
function doWatch(source, cb, {
|
|
1778
|
+
function doWatch(source, cb, {
|
|
1779
|
+
immediate,
|
|
1780
|
+
deep,
|
|
1781
|
+
flush,
|
|
1782
|
+
once,
|
|
1783
|
+
onTrack,
|
|
1784
|
+
onTrigger
|
|
1785
|
+
} = EMPTY_OBJ) {
|
|
1778
1786
|
var _a;
|
|
1779
1787
|
if (cb && once) {
|
|
1780
1788
|
const _cb = cb;
|
|
@@ -2482,7 +2490,6 @@ function defineAsyncComponent(source) {
|
|
|
2482
2490
|
instance,
|
|
2483
2491
|
13,
|
|
2484
2492
|
!errorComponent
|
|
2485
|
-
/* do not throw in dev if user provided error component */
|
|
2486
2493
|
);
|
|
2487
2494
|
};
|
|
2488
2495
|
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
@@ -3260,7 +3267,7 @@ function useSlots() {
|
|
|
3260
3267
|
function useAttrs() {
|
|
3261
3268
|
return getContext().attrs;
|
|
3262
3269
|
}
|
|
3263
|
-
function useModel(props, name) {
|
|
3270
|
+
function useModel(props, name, options = EMPTY_OBJ) {
|
|
3264
3271
|
const i = getCurrentInstance();
|
|
3265
3272
|
if (!!(process.env.NODE_ENV !== "production") && !i) {
|
|
3266
3273
|
warn$1(`useModel() called without active instance.`);
|
|
@@ -3270,7 +3277,7 @@ function useModel(props, name) {
|
|
|
3270
3277
|
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
3271
3278
|
return ref();
|
|
3272
3279
|
}
|
|
3273
|
-
|
|
3280
|
+
const res = customRef((track, trigger) => {
|
|
3274
3281
|
let localValue;
|
|
3275
3282
|
watchSyncEffect(() => {
|
|
3276
3283
|
const propValue = props[name];
|
|
@@ -3282,7 +3289,7 @@ function useModel(props, name) {
|
|
|
3282
3289
|
return {
|
|
3283
3290
|
get() {
|
|
3284
3291
|
track();
|
|
3285
|
-
return localValue;
|
|
3292
|
+
return options.get ? options.get(localValue) : localValue;
|
|
3286
3293
|
},
|
|
3287
3294
|
set(value) {
|
|
3288
3295
|
const rawProps = i.vnode.props;
|
|
@@ -3290,10 +3297,24 @@ function useModel(props, name) {
|
|
|
3290
3297
|
localValue = value;
|
|
3291
3298
|
trigger();
|
|
3292
3299
|
}
|
|
3293
|
-
i.emit(`update:${name}`, value);
|
|
3300
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
3294
3301
|
}
|
|
3295
3302
|
};
|
|
3296
3303
|
});
|
|
3304
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
3305
|
+
res[Symbol.iterator] = () => {
|
|
3306
|
+
let i2 = 0;
|
|
3307
|
+
return {
|
|
3308
|
+
next() {
|
|
3309
|
+
if (i2 < 2) {
|
|
3310
|
+
return { value: i2++ ? props[modifierKey] : res, done: false };
|
|
3311
|
+
} else {
|
|
3312
|
+
return { done: true };
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
};
|
|
3316
|
+
};
|
|
3317
|
+
return res;
|
|
3297
3318
|
}
|
|
3298
3319
|
function getContext() {
|
|
3299
3320
|
const i = getCurrentInstance();
|
|
@@ -3585,7 +3606,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
3585
3606
|
opt.from || key,
|
|
3586
3607
|
opt.default,
|
|
3587
3608
|
true
|
|
3588
|
-
/* treat default function as factory */
|
|
3589
3609
|
);
|
|
3590
3610
|
} else {
|
|
3591
3611
|
injected = inject(opt.from || key);
|
|
@@ -4073,7 +4093,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
4073
4093
|
value,
|
|
4074
4094
|
instance,
|
|
4075
4095
|
false
|
|
4076
|
-
/* isAbsent */
|
|
4077
4096
|
);
|
|
4078
4097
|
}
|
|
4079
4098
|
} else {
|
|
@@ -4105,7 +4124,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
4105
4124
|
void 0,
|
|
4106
4125
|
instance,
|
|
4107
4126
|
true
|
|
4108
|
-
/* isAbsent */
|
|
4109
4127
|
);
|
|
4110
4128
|
}
|
|
4111
4129
|
} else {
|
|
@@ -7019,7 +7037,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
|
|
|
7019
7037
|
dynamicProps,
|
|
7020
7038
|
shapeFlag,
|
|
7021
7039
|
true
|
|
7022
|
-
/* isBlock */
|
|
7023
7040
|
)
|
|
7024
7041
|
);
|
|
7025
7042
|
}
|
|
@@ -7032,7 +7049,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
|
|
|
7032
7049
|
patchFlag,
|
|
7033
7050
|
dynamicProps,
|
|
7034
7051
|
true
|
|
7035
|
-
/* isBlock: prevent a block from tracking itself */
|
|
7036
7052
|
)
|
|
7037
7053
|
);
|
|
7038
7054
|
}
|
|
@@ -7541,7 +7557,10 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7541
7557
|
setup,
|
|
7542
7558
|
instance,
|
|
7543
7559
|
0,
|
|
7544
|
-
[
|
|
7560
|
+
[
|
|
7561
|
+
!!(process.env.NODE_ENV !== "production") ? shallowReadonly(instance.props) : instance.props,
|
|
7562
|
+
setupContext
|
|
7563
|
+
]
|
|
7545
7564
|
);
|
|
7546
7565
|
resetTracking();
|
|
7547
7566
|
unsetCurrentInstance();
|
|
@@ -7653,7 +7672,6 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
7653
7672
|
if (!compile && Component.template) {
|
|
7654
7673
|
warn$1(
|
|
7655
7674
|
`Component provided template option but runtime compilation is not supported in this build of Vue.` + (` Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".` )
|
|
7656
|
-
/* should not happen */
|
|
7657
7675
|
);
|
|
7658
7676
|
} else {
|
|
7659
7677
|
warn$1(`Component is missing template or render function.`);
|
|
@@ -8031,7 +8049,7 @@ function isMemoSame(cached, memo) {
|
|
|
8031
8049
|
return true;
|
|
8032
8050
|
}
|
|
8033
8051
|
|
|
8034
|
-
const version = "3.4.0
|
|
8052
|
+
const version = "3.4.0";
|
|
8035
8053
|
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
8036
8054
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
8037
8055
|
const devtools = !!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__ ? devtools$1 : void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-core",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "@vue/runtime-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.4.0
|
|
36
|
-
"@vue/reactivity": "3.4.0
|
|
35
|
+
"@vue/shared": "3.4.0",
|
|
36
|
+
"@vue/reactivity": "3.4.0"
|
|
37
37
|
}
|
|
38
38
|
}
|