@vue/compat 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/vue.cjs.js +45 -31
- package/dist/vue.cjs.prod.js +73 -29
- package/dist/vue.esm-browser.js +44 -30
- package/dist/vue.esm-browser.prod.js +4 -4
- package/dist/vue.esm-bundler.js +44 -30
- package/dist/vue.global.js +44 -30
- package/dist/vue.global.prod.js +2 -2
- package/dist/vue.runtime.esm-browser.js +40 -26
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +40 -26
- package/dist/vue.runtime.global.js +40 -26
- package/dist/vue.runtime.global.prod.js +2 -2
- package/package.json +2 -2
package/dist/vue.cjs.js
CHANGED
|
@@ -1777,7 +1777,7 @@ const ErrorTypeStrings$1 = {
|
|
|
1777
1777
|
[11]: "app warnHandler",
|
|
1778
1778
|
[12]: "ref function",
|
|
1779
1779
|
[13]: "async component loader",
|
|
1780
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://
|
|
1780
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
1781
1781
|
};
|
|
1782
1782
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1783
1783
|
let res;
|
|
@@ -2775,7 +2775,9 @@ function emit(instance, event, ...rawArgs) {
|
|
|
2775
2775
|
`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(
|
|
2776
2776
|
instance,
|
|
2777
2777
|
instance.type
|
|
2778
|
-
)} 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(
|
|
2778
|
+
)} 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(
|
|
2779
|
+
event
|
|
2780
|
+
)}" instead of "${event}".`
|
|
2779
2781
|
);
|
|
2780
2782
|
}
|
|
2781
2783
|
}
|
|
@@ -3251,7 +3253,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
3251
3253
|
const selfName = getComponentName(
|
|
3252
3254
|
Component,
|
|
3253
3255
|
false
|
|
3254
|
-
/* do not include inferred name to avoid breaking existing code */
|
|
3255
3256
|
);
|
|
3256
3257
|
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
|
3257
3258
|
return Component;
|
|
@@ -3781,6 +3782,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
3781
3782
|
parentSuspense,
|
|
3782
3783
|
parentComponent,
|
|
3783
3784
|
node.parentNode,
|
|
3785
|
+
// eslint-disable-next-line no-restricted-globals
|
|
3784
3786
|
document.createElement("div"),
|
|
3785
3787
|
null,
|
|
3786
3788
|
namespace,
|
|
@@ -3788,7 +3790,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
3788
3790
|
optimized,
|
|
3789
3791
|
rendererInternals,
|
|
3790
3792
|
true
|
|
3791
|
-
/* hydrating */
|
|
3792
3793
|
);
|
|
3793
3794
|
const result = hydrateNode(
|
|
3794
3795
|
node,
|
|
@@ -3928,7 +3929,14 @@ function watch(source, cb, options) {
|
|
|
3928
3929
|
}
|
|
3929
3930
|
return doWatch(source, cb, options);
|
|
3930
3931
|
}
|
|
3931
|
-
function doWatch(source, cb, {
|
|
3932
|
+
function doWatch(source, cb, {
|
|
3933
|
+
immediate,
|
|
3934
|
+
deep,
|
|
3935
|
+
flush,
|
|
3936
|
+
once,
|
|
3937
|
+
onTrack,
|
|
3938
|
+
onTrigger
|
|
3939
|
+
} = EMPTY_OBJ) {
|
|
3932
3940
|
var _a;
|
|
3933
3941
|
if (cb && once) {
|
|
3934
3942
|
const _cb = cb;
|
|
@@ -4650,7 +4658,6 @@ function defineAsyncComponent(source) {
|
|
|
4650
4658
|
instance,
|
|
4651
4659
|
13,
|
|
4652
4660
|
!errorComponent
|
|
4653
|
-
/* do not throw in dev if user provided error component */
|
|
4654
4661
|
);
|
|
4655
4662
|
};
|
|
4656
4663
|
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
@@ -5052,8 +5059,8 @@ function getCompatListeners(instance) {
|
|
|
5052
5059
|
}
|
|
5053
5060
|
|
|
5054
5061
|
function convertLegacyRenderFn(instance) {
|
|
5055
|
-
const
|
|
5056
|
-
const render =
|
|
5062
|
+
const Component = instance.type;
|
|
5063
|
+
const render = Component.render;
|
|
5057
5064
|
if (!render || render._rc || render._compatChecked || render._compatWrapped) {
|
|
5058
5065
|
return;
|
|
5059
5066
|
}
|
|
@@ -5062,7 +5069,7 @@ function convertLegacyRenderFn(instance) {
|
|
|
5062
5069
|
return;
|
|
5063
5070
|
}
|
|
5064
5071
|
if (checkCompatEnabled$1("RENDER_FUNCTION", instance)) {
|
|
5065
|
-
const wrapped =
|
|
5072
|
+
const wrapped = Component.render = function compatRender() {
|
|
5066
5073
|
return render.call(this, compatH);
|
|
5067
5074
|
};
|
|
5068
5075
|
wrapped._compatWrapped = true;
|
|
@@ -5221,12 +5228,10 @@ function defineLegacyVNodeProperties(vnode) {
|
|
|
5221
5228
|
"RENDER_FUNCTION",
|
|
5222
5229
|
currentRenderingInstance,
|
|
5223
5230
|
true
|
|
5224
|
-
/* enable for built-ins */
|
|
5225
5231
|
) && isCompatEnabled$1(
|
|
5226
5232
|
"PRIVATE_APIS",
|
|
5227
5233
|
currentRenderingInstance,
|
|
5228
5234
|
true
|
|
5229
|
-
/* enable for built-ins */
|
|
5230
5235
|
)) {
|
|
5231
5236
|
const context = currentRenderingInstance;
|
|
5232
5237
|
const getInstance = () => vnode.component && vnode.component.proxy;
|
|
@@ -5556,7 +5561,6 @@ function installCompatInstanceProperties(map) {
|
|
|
5556
5561
|
assertCompatEnabled(
|
|
5557
5562
|
"GLOBAL_MOUNT",
|
|
5558
5563
|
null
|
|
5559
|
-
/* this warning is global */
|
|
5560
5564
|
);
|
|
5561
5565
|
return i.ctx._compat_mount || NOOP;
|
|
5562
5566
|
},
|
|
@@ -5950,7 +5954,7 @@ function useSlots() {
|
|
|
5950
5954
|
function useAttrs() {
|
|
5951
5955
|
return getContext().attrs;
|
|
5952
5956
|
}
|
|
5953
|
-
function useModel(props, name) {
|
|
5957
|
+
function useModel(props, name, options = EMPTY_OBJ) {
|
|
5954
5958
|
const i = getCurrentInstance();
|
|
5955
5959
|
if (!i) {
|
|
5956
5960
|
warn$1(`useModel() called without active instance.`);
|
|
@@ -5960,7 +5964,7 @@ function useModel(props, name) {
|
|
|
5960
5964
|
warn$1(`useModel() called with prop "${name}" which is not declared.`);
|
|
5961
5965
|
return ref();
|
|
5962
5966
|
}
|
|
5963
|
-
|
|
5967
|
+
const res = customRef((track, trigger) => {
|
|
5964
5968
|
let localValue;
|
|
5965
5969
|
watchSyncEffect(() => {
|
|
5966
5970
|
const propValue = props[name];
|
|
@@ -5972,7 +5976,7 @@ function useModel(props, name) {
|
|
|
5972
5976
|
return {
|
|
5973
5977
|
get() {
|
|
5974
5978
|
track();
|
|
5975
|
-
return localValue;
|
|
5979
|
+
return options.get ? options.get(localValue) : localValue;
|
|
5976
5980
|
},
|
|
5977
5981
|
set(value) {
|
|
5978
5982
|
const rawProps = i.vnode.props;
|
|
@@ -5980,10 +5984,24 @@ function useModel(props, name) {
|
|
|
5980
5984
|
localValue = value;
|
|
5981
5985
|
trigger();
|
|
5982
5986
|
}
|
|
5983
|
-
i.emit(`update:${name}`, value);
|
|
5987
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
5984
5988
|
}
|
|
5985
5989
|
};
|
|
5986
5990
|
});
|
|
5991
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
5992
|
+
res[Symbol.iterator] = () => {
|
|
5993
|
+
let i2 = 0;
|
|
5994
|
+
return {
|
|
5995
|
+
next() {
|
|
5996
|
+
if (i2 < 2) {
|
|
5997
|
+
return { value: i2++ ? props[modifierKey] : res, done: false };
|
|
5998
|
+
} else {
|
|
5999
|
+
return { done: true };
|
|
6000
|
+
}
|
|
6001
|
+
}
|
|
6002
|
+
};
|
|
6003
|
+
};
|
|
6004
|
+
return res;
|
|
5987
6005
|
}
|
|
5988
6006
|
function getContext() {
|
|
5989
6007
|
const i = getCurrentInstance();
|
|
@@ -6284,7 +6302,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
6284
6302
|
opt.from || key,
|
|
6285
6303
|
opt.default,
|
|
6286
6304
|
true
|
|
6287
|
-
/* treat default function as factory */
|
|
6288
6305
|
);
|
|
6289
6306
|
} else {
|
|
6290
6307
|
injected = inject(opt.from || key);
|
|
@@ -6557,7 +6574,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6557
6574
|
return vm;
|
|
6558
6575
|
}
|
|
6559
6576
|
}
|
|
6560
|
-
Vue.version = `2.6.14-compat:${"3.4.0
|
|
6577
|
+
Vue.version = `2.6.14-compat:${"3.4.0"}`;
|
|
6561
6578
|
Vue.config = singletonApp.config;
|
|
6562
6579
|
Vue.use = (p, ...options) => {
|
|
6563
6580
|
if (p && isFunction(p.install)) {
|
|
@@ -7264,7 +7281,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
7264
7281
|
value,
|
|
7265
7282
|
instance,
|
|
7266
7283
|
false
|
|
7267
|
-
/* isAbsent */
|
|
7268
7284
|
);
|
|
7269
7285
|
}
|
|
7270
7286
|
} else {
|
|
@@ -7303,7 +7319,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
7303
7319
|
void 0,
|
|
7304
7320
|
instance,
|
|
7305
7321
|
true
|
|
7306
|
-
/* isAbsent */
|
|
7307
7322
|
);
|
|
7308
7323
|
}
|
|
7309
7324
|
} else {
|
|
@@ -10278,7 +10293,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
|
|
|
10278
10293
|
dynamicProps,
|
|
10279
10294
|
shapeFlag,
|
|
10280
10295
|
true
|
|
10281
|
-
/* isBlock */
|
|
10282
10296
|
)
|
|
10283
10297
|
);
|
|
10284
10298
|
}
|
|
@@ -10291,7 +10305,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
|
|
|
10291
10305
|
patchFlag,
|
|
10292
10306
|
dynamicProps,
|
|
10293
10307
|
true
|
|
10294
|
-
/* isBlock: prevent a block from tracking itself */
|
|
10295
10308
|
)
|
|
10296
10309
|
);
|
|
10297
10310
|
}
|
|
@@ -10808,7 +10821,10 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
10808
10821
|
setup,
|
|
10809
10822
|
instance,
|
|
10810
10823
|
0,
|
|
10811
|
-
[
|
|
10824
|
+
[
|
|
10825
|
+
shallowReadonly(instance.props) ,
|
|
10826
|
+
setupContext
|
|
10827
|
+
]
|
|
10812
10828
|
);
|
|
10813
10829
|
resetTracking();
|
|
10814
10830
|
unsetCurrentInstance();
|
|
@@ -10932,7 +10948,6 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
10932
10948
|
if (!compile$1 && Component.template) {
|
|
10933
10949
|
warn$1(
|
|
10934
10950
|
`Component provided template option but runtime compilation is not supported in this build of Vue.` + (``)
|
|
10935
|
-
/* should not happen */
|
|
10936
10951
|
);
|
|
10937
10952
|
} else {
|
|
10938
10953
|
warn$1(`Component is missing template or render function.`);
|
|
@@ -11292,7 +11307,7 @@ function isMemoSame(cached, memo) {
|
|
|
11292
11307
|
return true;
|
|
11293
11308
|
}
|
|
11294
11309
|
|
|
11295
|
-
const version = "3.4.0
|
|
11310
|
+
const version = "3.4.0";
|
|
11296
11311
|
const warn = warn$1 ;
|
|
11297
11312
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11298
11313
|
const devtools = devtools$1 ;
|
|
@@ -16135,7 +16150,6 @@ function createRootCodegen(root, context) {
|
|
|
16135
16150
|
true,
|
|
16136
16151
|
void 0,
|
|
16137
16152
|
false
|
|
16138
|
-
/* isComponent */
|
|
16139
16153
|
);
|
|
16140
16154
|
} else ;
|
|
16141
16155
|
}
|
|
@@ -16326,7 +16340,7 @@ function createCodegenContext(ast, {
|
|
|
16326
16340
|
generatedLine: context.line,
|
|
16327
16341
|
generatedColumn: context.column - 1,
|
|
16328
16342
|
source: filename,
|
|
16329
|
-
// @ts-
|
|
16343
|
+
// @ts-expect-error it is possible to be null
|
|
16330
16344
|
name
|
|
16331
16345
|
});
|
|
16332
16346
|
}
|
|
@@ -17530,7 +17544,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
17530
17544
|
true,
|
|
17531
17545
|
void 0,
|
|
17532
17546
|
false
|
|
17533
|
-
/* isComponent */
|
|
17534
17547
|
);
|
|
17535
17548
|
} else {
|
|
17536
17549
|
childBlock = children[0].codegenNode;
|
|
@@ -17587,7 +17600,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
17587
17600
|
createForLoopParams(forNode.parseResult),
|
|
17588
17601
|
childBlock,
|
|
17589
17602
|
true
|
|
17590
|
-
/* force newline */
|
|
17591
17603
|
)
|
|
17592
17604
|
);
|
|
17593
17605
|
}
|
|
@@ -17845,13 +17857,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
17845
17857
|
createForLoopParams(parseResult),
|
|
17846
17858
|
buildDynamicSlot(slotName, slotFunction),
|
|
17847
17859
|
true
|
|
17848
|
-
/* force newline */
|
|
17849
17860
|
)
|
|
17850
17861
|
])
|
|
17851
17862
|
);
|
|
17852
17863
|
} else {
|
|
17853
17864
|
context.onError(
|
|
17854
|
-
createCompilerError(
|
|
17865
|
+
createCompilerError(
|
|
17866
|
+
32,
|
|
17867
|
+
vFor.loc
|
|
17868
|
+
)
|
|
17855
17869
|
);
|
|
17856
17870
|
}
|
|
17857
17871
|
} else {
|
package/dist/vue.cjs.prod.js
CHANGED
|
@@ -1484,6 +1484,37 @@ const ErrorCodes = {
|
|
|
1484
1484
|
"SCHEDULER": 14,
|
|
1485
1485
|
"14": "SCHEDULER"
|
|
1486
1486
|
};
|
|
1487
|
+
const ErrorTypeStrings$1 = {
|
|
1488
|
+
["sp"]: "serverPrefetch hook",
|
|
1489
|
+
["bc"]: "beforeCreate hook",
|
|
1490
|
+
["c"]: "created hook",
|
|
1491
|
+
["bm"]: "beforeMount hook",
|
|
1492
|
+
["m"]: "mounted hook",
|
|
1493
|
+
["bu"]: "beforeUpdate hook",
|
|
1494
|
+
["u"]: "updated",
|
|
1495
|
+
["bum"]: "beforeUnmount hook",
|
|
1496
|
+
["um"]: "unmounted hook",
|
|
1497
|
+
["a"]: "activated hook",
|
|
1498
|
+
["da"]: "deactivated hook",
|
|
1499
|
+
["ec"]: "errorCaptured hook",
|
|
1500
|
+
["rtc"]: "renderTracked hook",
|
|
1501
|
+
["rtg"]: "renderTriggered hook",
|
|
1502
|
+
[0]: "setup function",
|
|
1503
|
+
[1]: "render function",
|
|
1504
|
+
[2]: "watcher getter",
|
|
1505
|
+
[3]: "watcher callback",
|
|
1506
|
+
[4]: "watcher cleanup function",
|
|
1507
|
+
[5]: "native event handler",
|
|
1508
|
+
[6]: "component event handler",
|
|
1509
|
+
[7]: "vnode hook",
|
|
1510
|
+
[8]: "directive hook",
|
|
1511
|
+
[9]: "transition hook",
|
|
1512
|
+
[10]: "app errorHandler",
|
|
1513
|
+
[11]: "app warnHandler",
|
|
1514
|
+
[12]: "ref function",
|
|
1515
|
+
[13]: "async component loader",
|
|
1516
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
1517
|
+
};
|
|
1487
1518
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1488
1519
|
let res;
|
|
1489
1520
|
try {
|
|
@@ -2294,7 +2325,6 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
2294
2325
|
const selfName = getComponentName(
|
|
2295
2326
|
Component,
|
|
2296
2327
|
false
|
|
2297
|
-
/* do not include inferred name to avoid breaking existing code */
|
|
2298
2328
|
);
|
|
2299
2329
|
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
|
2300
2330
|
return Component;
|
|
@@ -2787,6 +2817,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
2787
2817
|
parentSuspense,
|
|
2788
2818
|
parentComponent,
|
|
2789
2819
|
node.parentNode,
|
|
2820
|
+
// eslint-disable-next-line no-restricted-globals
|
|
2790
2821
|
document.createElement("div"),
|
|
2791
2822
|
null,
|
|
2792
2823
|
namespace,
|
|
@@ -2794,7 +2825,6 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
|
|
|
2794
2825
|
optimized,
|
|
2795
2826
|
rendererInternals,
|
|
2796
2827
|
true
|
|
2797
|
-
/* hydrating */
|
|
2798
2828
|
);
|
|
2799
2829
|
const result = hydrateNode(
|
|
2800
2830
|
node,
|
|
@@ -2926,7 +2956,14 @@ const INITIAL_WATCHER_VALUE = {};
|
|
|
2926
2956
|
function watch(source, cb, options) {
|
|
2927
2957
|
return doWatch(source, cb, options);
|
|
2928
2958
|
}
|
|
2929
|
-
function doWatch(source, cb, {
|
|
2959
|
+
function doWatch(source, cb, {
|
|
2960
|
+
immediate,
|
|
2961
|
+
deep,
|
|
2962
|
+
flush,
|
|
2963
|
+
once,
|
|
2964
|
+
onTrack,
|
|
2965
|
+
onTrigger
|
|
2966
|
+
} = EMPTY_OBJ) {
|
|
2930
2967
|
var _a;
|
|
2931
2968
|
if (cb && once) {
|
|
2932
2969
|
const _cb = cb;
|
|
@@ -3593,7 +3630,6 @@ function defineAsyncComponent(source) {
|
|
|
3593
3630
|
instance,
|
|
3594
3631
|
13,
|
|
3595
3632
|
!errorComponent
|
|
3596
|
-
/* do not throw in dev if user provided error component */
|
|
3597
3633
|
);
|
|
3598
3634
|
};
|
|
3599
3635
|
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
@@ -3978,8 +4014,8 @@ function getCompatListeners(instance) {
|
|
|
3978
4014
|
}
|
|
3979
4015
|
|
|
3980
4016
|
function convertLegacyRenderFn(instance) {
|
|
3981
|
-
const
|
|
3982
|
-
const render =
|
|
4017
|
+
const Component = instance.type;
|
|
4018
|
+
const render = Component.render;
|
|
3983
4019
|
if (!render || render._rc || render._compatChecked || render._compatWrapped) {
|
|
3984
4020
|
return;
|
|
3985
4021
|
}
|
|
@@ -3988,7 +4024,7 @@ function convertLegacyRenderFn(instance) {
|
|
|
3988
4024
|
return;
|
|
3989
4025
|
}
|
|
3990
4026
|
if (checkCompatEnabled$1("RENDER_FUNCTION", instance)) {
|
|
3991
|
-
const wrapped =
|
|
4027
|
+
const wrapped = Component.render = function compatRender() {
|
|
3992
4028
|
return render.call(this, compatH);
|
|
3993
4029
|
};
|
|
3994
4030
|
wrapped._compatWrapped = true;
|
|
@@ -4147,12 +4183,10 @@ function defineLegacyVNodeProperties(vnode) {
|
|
|
4147
4183
|
"RENDER_FUNCTION",
|
|
4148
4184
|
currentRenderingInstance,
|
|
4149
4185
|
true
|
|
4150
|
-
/* enable for built-ins */
|
|
4151
4186
|
) && isCompatEnabled$1(
|
|
4152
4187
|
"PRIVATE_APIS",
|
|
4153
4188
|
currentRenderingInstance,
|
|
4154
4189
|
true
|
|
4155
|
-
/* enable for built-ins */
|
|
4156
4190
|
)) {
|
|
4157
4191
|
const context = currentRenderingInstance;
|
|
4158
4192
|
const getInstance = () => vnode.component && vnode.component.proxy;
|
|
@@ -4469,7 +4503,6 @@ function installCompatInstanceProperties(map) {
|
|
|
4469
4503
|
assertCompatEnabled(
|
|
4470
4504
|
"GLOBAL_MOUNT",
|
|
4471
4505
|
null
|
|
4472
|
-
/* this warning is global */
|
|
4473
4506
|
);
|
|
4474
4507
|
return i.ctx._compat_mount || NOOP;
|
|
4475
4508
|
},
|
|
@@ -4733,9 +4766,9 @@ function useSlots() {
|
|
|
4733
4766
|
function useAttrs() {
|
|
4734
4767
|
return getContext().attrs;
|
|
4735
4768
|
}
|
|
4736
|
-
function useModel(props, name) {
|
|
4769
|
+
function useModel(props, name, options = EMPTY_OBJ) {
|
|
4737
4770
|
const i = getCurrentInstance();
|
|
4738
|
-
|
|
4771
|
+
const res = customRef((track, trigger) => {
|
|
4739
4772
|
let localValue;
|
|
4740
4773
|
watchSyncEffect(() => {
|
|
4741
4774
|
const propValue = props[name];
|
|
@@ -4747,7 +4780,7 @@ function useModel(props, name) {
|
|
|
4747
4780
|
return {
|
|
4748
4781
|
get() {
|
|
4749
4782
|
track();
|
|
4750
|
-
return localValue;
|
|
4783
|
+
return options.get ? options.get(localValue) : localValue;
|
|
4751
4784
|
},
|
|
4752
4785
|
set(value) {
|
|
4753
4786
|
const rawProps = i.vnode.props;
|
|
@@ -4755,10 +4788,24 @@ function useModel(props, name) {
|
|
|
4755
4788
|
localValue = value;
|
|
4756
4789
|
trigger();
|
|
4757
4790
|
}
|
|
4758
|
-
i.emit(`update:${name}`, value);
|
|
4791
|
+
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
4759
4792
|
}
|
|
4760
4793
|
};
|
|
4761
4794
|
});
|
|
4795
|
+
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
4796
|
+
res[Symbol.iterator] = () => {
|
|
4797
|
+
let i2 = 0;
|
|
4798
|
+
return {
|
|
4799
|
+
next() {
|
|
4800
|
+
if (i2 < 2) {
|
|
4801
|
+
return { value: i2++ ? props[modifierKey] : res, done: false };
|
|
4802
|
+
} else {
|
|
4803
|
+
return { done: true };
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
};
|
|
4807
|
+
};
|
|
4808
|
+
return res;
|
|
4762
4809
|
}
|
|
4763
4810
|
function getContext() {
|
|
4764
4811
|
const i = getCurrentInstance();
|
|
@@ -4984,7 +5031,6 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
|
|
|
4984
5031
|
opt.from || key,
|
|
4985
5032
|
opt.default,
|
|
4986
5033
|
true
|
|
4987
|
-
/* treat default function as factory */
|
|
4988
5034
|
);
|
|
4989
5035
|
} else {
|
|
4990
5036
|
injected = inject(opt.from || key);
|
|
@@ -5219,7 +5265,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
5219
5265
|
return vm;
|
|
5220
5266
|
}
|
|
5221
5267
|
}
|
|
5222
|
-
Vue.version = `2.6.14-compat:${"3.4.0
|
|
5268
|
+
Vue.version = `2.6.14-compat:${"3.4.0"}`;
|
|
5223
5269
|
Vue.config = singletonApp.config;
|
|
5224
5270
|
Vue.use = (p, ...options) => {
|
|
5225
5271
|
if (p && isFunction(p.install)) {
|
|
@@ -5806,7 +5852,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5806
5852
|
value,
|
|
5807
5853
|
instance,
|
|
5808
5854
|
false
|
|
5809
|
-
/* isAbsent */
|
|
5810
5855
|
);
|
|
5811
5856
|
}
|
|
5812
5857
|
} else {
|
|
@@ -5845,7 +5890,6 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5845
5890
|
void 0,
|
|
5846
5891
|
instance,
|
|
5847
5892
|
true
|
|
5848
|
-
/* isAbsent */
|
|
5849
5893
|
);
|
|
5850
5894
|
}
|
|
5851
5895
|
} else {
|
|
@@ -8363,7 +8407,6 @@ function createElementBlock(type, props, children, patchFlag, dynamicProps, shap
|
|
|
8363
8407
|
dynamicProps,
|
|
8364
8408
|
shapeFlag,
|
|
8365
8409
|
true
|
|
8366
|
-
/* isBlock */
|
|
8367
8410
|
)
|
|
8368
8411
|
);
|
|
8369
8412
|
}
|
|
@@ -8376,7 +8419,6 @@ function createBlock(type, props, children, patchFlag, dynamicProps) {
|
|
|
8376
8419
|
patchFlag,
|
|
8377
8420
|
dynamicProps,
|
|
8378
8421
|
true
|
|
8379
|
-
/* isBlock: prevent a block from tracking itself */
|
|
8380
8422
|
)
|
|
8381
8423
|
);
|
|
8382
8424
|
}
|
|
@@ -8824,7 +8866,10 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
8824
8866
|
setup,
|
|
8825
8867
|
instance,
|
|
8826
8868
|
0,
|
|
8827
|
-
[
|
|
8869
|
+
[
|
|
8870
|
+
instance.props,
|
|
8871
|
+
setupContext
|
|
8872
|
+
]
|
|
8828
8873
|
);
|
|
8829
8874
|
resetTracking();
|
|
8830
8875
|
unsetCurrentInstance();
|
|
@@ -9028,9 +9073,9 @@ function isMemoSame(cached, memo) {
|
|
|
9028
9073
|
return true;
|
|
9029
9074
|
}
|
|
9030
9075
|
|
|
9031
|
-
const version = "3.4.0
|
|
9076
|
+
const version = "3.4.0";
|
|
9032
9077
|
const warn$1 = NOOP;
|
|
9033
|
-
const ErrorTypeStrings =
|
|
9078
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9034
9079
|
const devtools = void 0;
|
|
9035
9080
|
const setDevtoolsHook = NOOP;
|
|
9036
9081
|
const _ssrUtils = {
|
|
@@ -13639,7 +13684,6 @@ function createRootCodegen(root, context) {
|
|
|
13639
13684
|
true,
|
|
13640
13685
|
void 0,
|
|
13641
13686
|
false
|
|
13642
|
-
/* isComponent */
|
|
13643
13687
|
);
|
|
13644
13688
|
} else ;
|
|
13645
13689
|
}
|
|
@@ -13830,7 +13874,7 @@ function createCodegenContext(ast, {
|
|
|
13830
13874
|
generatedLine: context.line,
|
|
13831
13875
|
generatedColumn: context.column - 1,
|
|
13832
13876
|
source: filename,
|
|
13833
|
-
// @ts-
|
|
13877
|
+
// @ts-expect-error it is possible to be null
|
|
13834
13878
|
name
|
|
13835
13879
|
});
|
|
13836
13880
|
}
|
|
@@ -15011,7 +15055,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15011
15055
|
true,
|
|
15012
15056
|
void 0,
|
|
15013
15057
|
false
|
|
15014
|
-
/* isComponent */
|
|
15015
15058
|
);
|
|
15016
15059
|
} else {
|
|
15017
15060
|
childBlock = children[0].codegenNode;
|
|
@@ -15068,7 +15111,6 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
15068
15111
|
createForLoopParams(forNode.parseResult),
|
|
15069
15112
|
childBlock,
|
|
15070
15113
|
true
|
|
15071
|
-
/* force newline */
|
|
15072
15114
|
)
|
|
15073
15115
|
);
|
|
15074
15116
|
}
|
|
@@ -15326,13 +15368,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15326
15368
|
createForLoopParams(parseResult),
|
|
15327
15369
|
buildDynamicSlot(slotName, slotFunction),
|
|
15328
15370
|
true
|
|
15329
|
-
/* force newline */
|
|
15330
15371
|
)
|
|
15331
15372
|
])
|
|
15332
15373
|
);
|
|
15333
15374
|
} else {
|
|
15334
15375
|
context.onError(
|
|
15335
|
-
createCompilerError(
|
|
15376
|
+
createCompilerError(
|
|
15377
|
+
32,
|
|
15378
|
+
vFor.loc
|
|
15379
|
+
)
|
|
15336
15380
|
);
|
|
15337
15381
|
}
|
|
15338
15382
|
} else {
|