@vue/runtime-core 3.3.0-alpha.8 → 3.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/runtime-core.cjs.js +771 -669
- package/dist/runtime-core.cjs.prod.js +398 -322
- package/dist/runtime-core.d.ts +102 -22
- package/dist/runtime-core.esm-bundler.js +774 -663
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -449,6 +449,8 @@ function reload(id, newComp) {
|
|
|
449
449
|
}
|
|
450
450
|
hmrDirtyComponents.add(oldComp);
|
|
451
451
|
}
|
|
452
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
453
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
452
454
|
instance.appContext.optionsCache.delete(instance.type);
|
|
453
455
|
if (instance.ceReload) {
|
|
454
456
|
hmrDirtyComponents.add(oldComp);
|
|
@@ -1291,7 +1293,8 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
|
|
|
1291
1293
|
}
|
|
1292
1294
|
}
|
|
1293
1295
|
let hasWarned = false;
|
|
1294
|
-
function createSuspenseBoundary(vnode,
|
|
1296
|
+
function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
|
1297
|
+
var _a;
|
|
1295
1298
|
if (!hasWarned) {
|
|
1296
1299
|
hasWarned = true;
|
|
1297
1300
|
console[console.info ? "info" : "log"](
|
|
@@ -1305,13 +1308,21 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1305
1308
|
n: next,
|
|
1306
1309
|
o: { parentNode, remove }
|
|
1307
1310
|
} = rendererInternals;
|
|
1311
|
+
let parentSuspenseId;
|
|
1312
|
+
const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
|
|
1313
|
+
if (isSuspensible) {
|
|
1314
|
+
if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
|
|
1315
|
+
parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
|
|
1316
|
+
parentSuspense.deps++;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1308
1319
|
const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
|
|
1309
1320
|
{
|
|
1310
1321
|
assertNumber(timeout, `Suspense timeout`);
|
|
1311
1322
|
}
|
|
1312
1323
|
const suspense = {
|
|
1313
1324
|
vnode,
|
|
1314
|
-
parent,
|
|
1325
|
+
parent: parentSuspense,
|
|
1315
1326
|
parentComponent,
|
|
1316
1327
|
isSVG,
|
|
1317
1328
|
container,
|
|
@@ -1371,20 +1382,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1371
1382
|
setActiveBranch(suspense, pendingBranch);
|
|
1372
1383
|
suspense.pendingBranch = null;
|
|
1373
1384
|
suspense.isInFallback = false;
|
|
1374
|
-
let
|
|
1385
|
+
let parent = suspense.parent;
|
|
1375
1386
|
let hasUnresolvedAncestor = false;
|
|
1376
|
-
while (
|
|
1377
|
-
if (
|
|
1378
|
-
|
|
1387
|
+
while (parent) {
|
|
1388
|
+
if (parent.pendingBranch) {
|
|
1389
|
+
parent.effects.push(...effects);
|
|
1379
1390
|
hasUnresolvedAncestor = true;
|
|
1380
1391
|
break;
|
|
1381
1392
|
}
|
|
1382
|
-
|
|
1393
|
+
parent = parent.parent;
|
|
1383
1394
|
}
|
|
1384
1395
|
if (!hasUnresolvedAncestor) {
|
|
1385
1396
|
queuePostFlushCb(effects);
|
|
1386
1397
|
}
|
|
1387
1398
|
suspense.effects = [];
|
|
1399
|
+
if (isSuspensible) {
|
|
1400
|
+
if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
|
1401
|
+
parentSuspense.deps--;
|
|
1402
|
+
if (parentSuspense.deps === 0) {
|
|
1403
|
+
parentSuspense.resolve();
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1388
1407
|
triggerEvent(vnode2, "onResolve");
|
|
1389
1408
|
},
|
|
1390
1409
|
fallback(fallbackVNode) {
|
|
@@ -1484,13 +1503,13 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1484
1503
|
}
|
|
1485
1504
|
});
|
|
1486
1505
|
},
|
|
1487
|
-
unmount(
|
|
1506
|
+
unmount(parentSuspense2, doRemove) {
|
|
1488
1507
|
suspense.isUnmounted = true;
|
|
1489
1508
|
if (suspense.activeBranch) {
|
|
1490
1509
|
unmount(
|
|
1491
1510
|
suspense.activeBranch,
|
|
1492
1511
|
parentComponent,
|
|
1493
|
-
|
|
1512
|
+
parentSuspense2,
|
|
1494
1513
|
doRemove
|
|
1495
1514
|
);
|
|
1496
1515
|
}
|
|
@@ -1498,7 +1517,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1498
1517
|
unmount(
|
|
1499
1518
|
suspense.pendingBranch,
|
|
1500
1519
|
parentComponent,
|
|
1501
|
-
|
|
1520
|
+
parentSuspense2,
|
|
1502
1521
|
doRemove
|
|
1503
1522
|
);
|
|
1504
1523
|
}
|
|
@@ -1591,36 +1610,6 @@ function setActiveBranch(suspense, branch) {
|
|
|
1591
1610
|
}
|
|
1592
1611
|
}
|
|
1593
1612
|
|
|
1594
|
-
function provide(key, value) {
|
|
1595
|
-
if (!currentInstance) {
|
|
1596
|
-
{
|
|
1597
|
-
warn(`provide() can only be used inside setup().`);
|
|
1598
|
-
}
|
|
1599
|
-
} else {
|
|
1600
|
-
let provides = currentInstance.provides;
|
|
1601
|
-
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
1602
|
-
if (parentProvides === provides) {
|
|
1603
|
-
provides = currentInstance.provides = Object.create(parentProvides);
|
|
1604
|
-
}
|
|
1605
|
-
provides[key] = value;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
1609
|
-
const instance = currentInstance || currentRenderingInstance;
|
|
1610
|
-
if (instance) {
|
|
1611
|
-
const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
|
|
1612
|
-
if (provides && key in provides) {
|
|
1613
|
-
return provides[key];
|
|
1614
|
-
} else if (arguments.length > 1) {
|
|
1615
|
-
return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
|
|
1616
|
-
} else {
|
|
1617
|
-
warn(`injection "${String(key)}" not found.`);
|
|
1618
|
-
}
|
|
1619
|
-
} else {
|
|
1620
|
-
warn(`inject() can only be used inside setup() or functional components.`);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
1613
|
function watchEffect(effect, options) {
|
|
1625
1614
|
return doWatch(effect, null, options);
|
|
1626
1615
|
}
|
|
@@ -1867,6 +1856,65 @@ function traverse(value, seen) {
|
|
|
1867
1856
|
return value;
|
|
1868
1857
|
}
|
|
1869
1858
|
|
|
1859
|
+
function validateDirectiveName(name) {
|
|
1860
|
+
if (shared.isBuiltInDirective(name)) {
|
|
1861
|
+
warn("Do not use built-in directive ids as custom directive id: " + name);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
function withDirectives(vnode, directives) {
|
|
1865
|
+
const internalInstance = currentRenderingInstance;
|
|
1866
|
+
if (internalInstance === null) {
|
|
1867
|
+
warn(`withDirectives can only be used inside render functions.`);
|
|
1868
|
+
return vnode;
|
|
1869
|
+
}
|
|
1870
|
+
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
|
|
1871
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
1872
|
+
for (let i = 0; i < directives.length; i++) {
|
|
1873
|
+
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
1874
|
+
if (dir) {
|
|
1875
|
+
if (shared.isFunction(dir)) {
|
|
1876
|
+
dir = {
|
|
1877
|
+
mounted: dir,
|
|
1878
|
+
updated: dir
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
if (dir.deep) {
|
|
1882
|
+
traverse(value);
|
|
1883
|
+
}
|
|
1884
|
+
bindings.push({
|
|
1885
|
+
dir,
|
|
1886
|
+
instance,
|
|
1887
|
+
value,
|
|
1888
|
+
oldValue: void 0,
|
|
1889
|
+
arg,
|
|
1890
|
+
modifiers
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
return vnode;
|
|
1895
|
+
}
|
|
1896
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
1897
|
+
const bindings = vnode.dirs;
|
|
1898
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
1899
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
1900
|
+
const binding = bindings[i];
|
|
1901
|
+
if (oldBindings) {
|
|
1902
|
+
binding.oldValue = oldBindings[i].value;
|
|
1903
|
+
}
|
|
1904
|
+
let hook = binding.dir[name];
|
|
1905
|
+
if (hook) {
|
|
1906
|
+
reactivity.pauseTracking();
|
|
1907
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
1908
|
+
vnode.el,
|
|
1909
|
+
binding,
|
|
1910
|
+
vnode,
|
|
1911
|
+
prevVNode
|
|
1912
|
+
]);
|
|
1913
|
+
reactivity.resetTracking();
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1870
1918
|
function useTransitionState() {
|
|
1871
1919
|
const state = {
|
|
1872
1920
|
isMounted: false,
|
|
@@ -2630,65 +2678,6 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2630
2678
|
injectHook("ec", hook, target);
|
|
2631
2679
|
}
|
|
2632
2680
|
|
|
2633
|
-
function validateDirectiveName(name) {
|
|
2634
|
-
if (shared.isBuiltInDirective(name)) {
|
|
2635
|
-
warn("Do not use built-in directive ids as custom directive id: " + name);
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
function withDirectives(vnode, directives) {
|
|
2639
|
-
const internalInstance = currentRenderingInstance;
|
|
2640
|
-
if (internalInstance === null) {
|
|
2641
|
-
warn(`withDirectives can only be used inside render functions.`);
|
|
2642
|
-
return vnode;
|
|
2643
|
-
}
|
|
2644
|
-
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
|
|
2645
|
-
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2646
|
-
for (let i = 0; i < directives.length; i++) {
|
|
2647
|
-
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
2648
|
-
if (dir) {
|
|
2649
|
-
if (shared.isFunction(dir)) {
|
|
2650
|
-
dir = {
|
|
2651
|
-
mounted: dir,
|
|
2652
|
-
updated: dir
|
|
2653
|
-
};
|
|
2654
|
-
}
|
|
2655
|
-
if (dir.deep) {
|
|
2656
|
-
traverse(value);
|
|
2657
|
-
}
|
|
2658
|
-
bindings.push({
|
|
2659
|
-
dir,
|
|
2660
|
-
instance,
|
|
2661
|
-
value,
|
|
2662
|
-
oldValue: void 0,
|
|
2663
|
-
arg,
|
|
2664
|
-
modifiers
|
|
2665
|
-
});
|
|
2666
|
-
}
|
|
2667
|
-
}
|
|
2668
|
-
return vnode;
|
|
2669
|
-
}
|
|
2670
|
-
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
2671
|
-
const bindings = vnode.dirs;
|
|
2672
|
-
const oldBindings = prevVNode && prevVNode.dirs;
|
|
2673
|
-
for (let i = 0; i < bindings.length; i++) {
|
|
2674
|
-
const binding = bindings[i];
|
|
2675
|
-
if (oldBindings) {
|
|
2676
|
-
binding.oldValue = oldBindings[i].value;
|
|
2677
|
-
}
|
|
2678
|
-
let hook = binding.dir[name];
|
|
2679
|
-
if (hook) {
|
|
2680
|
-
reactivity.pauseTracking();
|
|
2681
|
-
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
2682
|
-
vnode.el,
|
|
2683
|
-
binding,
|
|
2684
|
-
vnode,
|
|
2685
|
-
prevVNode
|
|
2686
|
-
]);
|
|
2687
|
-
reactivity.resetTracking();
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
}
|
|
2691
|
-
|
|
2692
2681
|
const COMPONENTS = "components";
|
|
2693
2682
|
const DIRECTIVES = "directives";
|
|
2694
2683
|
function resolveComponent(name, maybeSelfReference) {
|
|
@@ -2937,6 +2926,8 @@ const PublicInstanceProxyHandlers = {
|
|
|
2937
2926
|
if (key === "$attrs") {
|
|
2938
2927
|
reactivity.track(instance, "get", key);
|
|
2939
2928
|
markAttrsAccessed();
|
|
2929
|
+
} else if (key === "$slots") {
|
|
2930
|
+
reactivity.track(instance, "get", key);
|
|
2940
2931
|
}
|
|
2941
2932
|
return publicGetter(instance);
|
|
2942
2933
|
} else if (
|
|
@@ -3106,96 +3097,246 @@ function exposeSetupStateOnRenderContext(instance) {
|
|
|
3106
3097
|
});
|
|
3107
3098
|
}
|
|
3108
3099
|
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
cache[key] = type;
|
|
3116
|
-
}
|
|
3117
|
-
};
|
|
3118
|
-
}
|
|
3119
|
-
let shouldCacheAccess = true;
|
|
3120
|
-
function applyOptions(instance) {
|
|
3121
|
-
const options = resolveMergedOptions(instance);
|
|
3122
|
-
const publicThis = instance.proxy;
|
|
3123
|
-
const ctx = instance.ctx;
|
|
3124
|
-
shouldCacheAccess = false;
|
|
3125
|
-
if (options.beforeCreate) {
|
|
3126
|
-
callHook(options.beforeCreate, instance, "bc");
|
|
3100
|
+
const warnRuntimeUsage = (method) => warn(
|
|
3101
|
+
`${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
|
|
3102
|
+
);
|
|
3103
|
+
function defineProps() {
|
|
3104
|
+
{
|
|
3105
|
+
warnRuntimeUsage(`defineProps`);
|
|
3127
3106
|
}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
computed: computedOptions,
|
|
3132
|
-
methods,
|
|
3133
|
-
watch: watchOptions,
|
|
3134
|
-
provide: provideOptions,
|
|
3135
|
-
inject: injectOptions,
|
|
3136
|
-
// lifecycle
|
|
3137
|
-
created,
|
|
3138
|
-
beforeMount,
|
|
3139
|
-
mounted,
|
|
3140
|
-
beforeUpdate,
|
|
3141
|
-
updated,
|
|
3142
|
-
activated,
|
|
3143
|
-
deactivated,
|
|
3144
|
-
beforeDestroy,
|
|
3145
|
-
beforeUnmount,
|
|
3146
|
-
destroyed,
|
|
3147
|
-
unmounted,
|
|
3148
|
-
render,
|
|
3149
|
-
renderTracked,
|
|
3150
|
-
renderTriggered,
|
|
3151
|
-
errorCaptured,
|
|
3152
|
-
serverPrefetch,
|
|
3153
|
-
// public API
|
|
3154
|
-
expose,
|
|
3155
|
-
inheritAttrs,
|
|
3156
|
-
// assets
|
|
3157
|
-
components,
|
|
3158
|
-
directives,
|
|
3159
|
-
filters
|
|
3160
|
-
} = options;
|
|
3161
|
-
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
3107
|
+
return null;
|
|
3108
|
+
}
|
|
3109
|
+
function defineEmits() {
|
|
3162
3110
|
{
|
|
3163
|
-
|
|
3164
|
-
if (propsOptions) {
|
|
3165
|
-
for (const key in propsOptions) {
|
|
3166
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3111
|
+
warnRuntimeUsage(`defineEmits`);
|
|
3169
3112
|
}
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
instance.appContext.config.unwrapInjectedRef
|
|
3176
|
-
);
|
|
3113
|
+
return null;
|
|
3114
|
+
}
|
|
3115
|
+
function defineExpose(exposed) {
|
|
3116
|
+
{
|
|
3117
|
+
warnRuntimeUsage(`defineExpose`);
|
|
3177
3118
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3119
|
+
}
|
|
3120
|
+
function defineOptions(options) {
|
|
3121
|
+
{
|
|
3122
|
+
warnRuntimeUsage(`defineOptions`);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
function defineSlots() {
|
|
3126
|
+
{
|
|
3127
|
+
warnRuntimeUsage(`defineSlots`);
|
|
3128
|
+
}
|
|
3129
|
+
return null;
|
|
3130
|
+
}
|
|
3131
|
+
function defineModel() {
|
|
3132
|
+
{
|
|
3133
|
+
warnRuntimeUsage("defineModel");
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
function withDefaults(props, defaults) {
|
|
3137
|
+
{
|
|
3138
|
+
warnRuntimeUsage(`withDefaults`);
|
|
3139
|
+
}
|
|
3140
|
+
return null;
|
|
3141
|
+
}
|
|
3142
|
+
function useSlots() {
|
|
3143
|
+
return getContext().slots;
|
|
3144
|
+
}
|
|
3145
|
+
function useAttrs() {
|
|
3146
|
+
return getContext().attrs;
|
|
3147
|
+
}
|
|
3148
|
+
function useModel(props, name, options) {
|
|
3149
|
+
const i = getCurrentInstance();
|
|
3150
|
+
if (!i) {
|
|
3151
|
+
warn(`useModel() called without active instance.`);
|
|
3152
|
+
return reactivity.ref();
|
|
3153
|
+
}
|
|
3154
|
+
if (!i.propsOptions[0][name]) {
|
|
3155
|
+
warn(`useModel() called with prop "${name}" which is not declared.`);
|
|
3156
|
+
return reactivity.ref();
|
|
3157
|
+
}
|
|
3158
|
+
if (options && options.local) {
|
|
3159
|
+
const proxy = reactivity.ref(props[name]);
|
|
3160
|
+
watch(
|
|
3161
|
+
() => props[name],
|
|
3162
|
+
(v) => proxy.value = v
|
|
3163
|
+
);
|
|
3164
|
+
watch(proxy, (value) => {
|
|
3165
|
+
if (value !== props[name]) {
|
|
3166
|
+
i.emit(`update:${name}`, value);
|
|
3167
|
+
}
|
|
3168
|
+
});
|
|
3169
|
+
return proxy;
|
|
3170
|
+
} else {
|
|
3171
|
+
return {
|
|
3172
|
+
__v_isRef: true,
|
|
3173
|
+
get value() {
|
|
3174
|
+
return props[name];
|
|
3175
|
+
},
|
|
3176
|
+
set value(value) {
|
|
3177
|
+
i.emit(`update:${name}`, value);
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
function getContext() {
|
|
3183
|
+
const i = getCurrentInstance();
|
|
3184
|
+
if (!i) {
|
|
3185
|
+
warn(`useContext() called without active instance.`);
|
|
3186
|
+
}
|
|
3187
|
+
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
3188
|
+
}
|
|
3189
|
+
function normalizePropsOrEmits(props) {
|
|
3190
|
+
return shared.isArray(props) ? props.reduce(
|
|
3191
|
+
(normalized, p) => (normalized[p] = null, normalized),
|
|
3192
|
+
{}
|
|
3193
|
+
) : props;
|
|
3194
|
+
}
|
|
3195
|
+
function mergeDefaults(raw, defaults) {
|
|
3196
|
+
const props = normalizePropsOrEmits(raw);
|
|
3197
|
+
for (const key in defaults) {
|
|
3198
|
+
if (key.startsWith("__skip"))
|
|
3199
|
+
continue;
|
|
3200
|
+
let opt = props[key];
|
|
3201
|
+
if (opt) {
|
|
3202
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
3203
|
+
opt = props[key] = { type: opt, default: defaults[key] };
|
|
3204
|
+
} else {
|
|
3205
|
+
opt.default = defaults[key];
|
|
3206
|
+
}
|
|
3207
|
+
} else if (opt === null) {
|
|
3208
|
+
opt = props[key] = { default: defaults[key] };
|
|
3209
|
+
} else {
|
|
3210
|
+
warn(`props default key "${key}" has no corresponding declaration.`);
|
|
3211
|
+
}
|
|
3212
|
+
if (opt && defaults[`__skip_${key}`]) {
|
|
3213
|
+
opt.skipFactory = true;
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
return props;
|
|
3217
|
+
}
|
|
3218
|
+
function mergeModels(a, b) {
|
|
3219
|
+
if (!a || !b)
|
|
3220
|
+
return a || b;
|
|
3221
|
+
if (shared.isArray(a) && shared.isArray(b))
|
|
3222
|
+
return a.concat(b);
|
|
3223
|
+
return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
|
3224
|
+
}
|
|
3225
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
3226
|
+
const ret = {};
|
|
3227
|
+
for (const key in props) {
|
|
3228
|
+
if (!excludedKeys.includes(key)) {
|
|
3229
|
+
Object.defineProperty(ret, key, {
|
|
3230
|
+
enumerable: true,
|
|
3231
|
+
get: () => props[key]
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
return ret;
|
|
3236
|
+
}
|
|
3237
|
+
function withAsyncContext(getAwaitable) {
|
|
3238
|
+
const ctx = getCurrentInstance();
|
|
3239
|
+
if (!ctx) {
|
|
3240
|
+
warn(
|
|
3241
|
+
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
3242
|
+
);
|
|
3243
|
+
}
|
|
3244
|
+
let awaitable = getAwaitable();
|
|
3245
|
+
unsetCurrentInstance();
|
|
3246
|
+
if (shared.isPromise(awaitable)) {
|
|
3247
|
+
awaitable = awaitable.catch((e) => {
|
|
3248
|
+
setCurrentInstance(ctx);
|
|
3249
|
+
throw e;
|
|
3250
|
+
});
|
|
3251
|
+
}
|
|
3252
|
+
return [awaitable, () => setCurrentInstance(ctx)];
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
function createDuplicateChecker() {
|
|
3256
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
3257
|
+
return (type, key) => {
|
|
3258
|
+
if (cache[key]) {
|
|
3259
|
+
warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
3260
|
+
} else {
|
|
3261
|
+
cache[key] = type;
|
|
3262
|
+
}
|
|
3263
|
+
};
|
|
3264
|
+
}
|
|
3265
|
+
let shouldCacheAccess = true;
|
|
3266
|
+
function applyOptions(instance) {
|
|
3267
|
+
const options = resolveMergedOptions(instance);
|
|
3268
|
+
const publicThis = instance.proxy;
|
|
3269
|
+
const ctx = instance.ctx;
|
|
3270
|
+
shouldCacheAccess = false;
|
|
3271
|
+
if (options.beforeCreate) {
|
|
3272
|
+
callHook(options.beforeCreate, instance, "bc");
|
|
3273
|
+
}
|
|
3274
|
+
const {
|
|
3275
|
+
// state
|
|
3276
|
+
data: dataOptions,
|
|
3277
|
+
computed: computedOptions,
|
|
3278
|
+
methods,
|
|
3279
|
+
watch: watchOptions,
|
|
3280
|
+
provide: provideOptions,
|
|
3281
|
+
inject: injectOptions,
|
|
3282
|
+
// lifecycle
|
|
3283
|
+
created,
|
|
3284
|
+
beforeMount,
|
|
3285
|
+
mounted,
|
|
3286
|
+
beforeUpdate,
|
|
3287
|
+
updated,
|
|
3288
|
+
activated,
|
|
3289
|
+
deactivated,
|
|
3290
|
+
beforeDestroy,
|
|
3291
|
+
beforeUnmount,
|
|
3292
|
+
destroyed,
|
|
3293
|
+
unmounted,
|
|
3294
|
+
render,
|
|
3295
|
+
renderTracked,
|
|
3296
|
+
renderTriggered,
|
|
3297
|
+
errorCaptured,
|
|
3298
|
+
serverPrefetch,
|
|
3299
|
+
// public API
|
|
3300
|
+
expose,
|
|
3301
|
+
inheritAttrs,
|
|
3302
|
+
// assets
|
|
3303
|
+
components,
|
|
3304
|
+
directives,
|
|
3305
|
+
filters
|
|
3306
|
+
} = options;
|
|
3307
|
+
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
3308
|
+
{
|
|
3309
|
+
const [propsOptions] = instance.propsOptions;
|
|
3310
|
+
if (propsOptions) {
|
|
3311
|
+
for (const key in propsOptions) {
|
|
3312
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
if (injectOptions) {
|
|
3317
|
+
resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
|
3318
|
+
}
|
|
3319
|
+
if (methods) {
|
|
3320
|
+
for (const key in methods) {
|
|
3321
|
+
const methodHandler = methods[key];
|
|
3322
|
+
if (shared.isFunction(methodHandler)) {
|
|
3323
|
+
{
|
|
3324
|
+
Object.defineProperty(ctx, key, {
|
|
3325
|
+
value: methodHandler.bind(publicThis),
|
|
3326
|
+
configurable: true,
|
|
3327
|
+
enumerable: true,
|
|
3328
|
+
writable: true
|
|
3329
|
+
});
|
|
3330
|
+
}
|
|
3331
|
+
{
|
|
3332
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
3333
|
+
}
|
|
3334
|
+
} else {
|
|
3335
|
+
warn(
|
|
3336
|
+
`Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
|
3337
|
+
);
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3199
3340
|
}
|
|
3200
3341
|
if (dataOptions) {
|
|
3201
3342
|
if (!shared.isFunction(dataOptions)) {
|
|
@@ -3313,7 +3454,7 @@ function applyOptions(instance) {
|
|
|
3313
3454
|
if (directives)
|
|
3314
3455
|
instance.directives = directives;
|
|
3315
3456
|
}
|
|
3316
|
-
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP
|
|
3457
|
+
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared.NOOP) {
|
|
3317
3458
|
if (shared.isArray(injectOptions)) {
|
|
3318
3459
|
injectOptions = normalizeInject(injectOptions);
|
|
3319
3460
|
}
|
|
@@ -3335,21 +3476,12 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared
|
|
|
3335
3476
|
injected = inject(opt);
|
|
3336
3477
|
}
|
|
3337
3478
|
if (reactivity.isRef(injected)) {
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
});
|
|
3345
|
-
} else {
|
|
3346
|
-
{
|
|
3347
|
-
warn(
|
|
3348
|
-
`injected property "${key}" is a ref and will be auto-unwrapped and no longer needs \`.value\` in the next minor release. To opt-in to the new behavior now, set \`app.config.unwrapInjectedRef = true\` (this config is temporary and will not be needed in the future.)`
|
|
3349
|
-
);
|
|
3350
|
-
}
|
|
3351
|
-
ctx[key] = injected;
|
|
3352
|
-
}
|
|
3479
|
+
Object.defineProperty(ctx, key, {
|
|
3480
|
+
enumerable: true,
|
|
3481
|
+
configurable: true,
|
|
3482
|
+
get: () => injected.value,
|
|
3483
|
+
set: (v) => injected.value = v
|
|
3484
|
+
});
|
|
3353
3485
|
} else {
|
|
3354
3486
|
ctx[key] = injected;
|
|
3355
3487
|
}
|
|
@@ -3445,10 +3577,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
|
|
|
3445
3577
|
}
|
|
3446
3578
|
const internalOptionMergeStrats = {
|
|
3447
3579
|
data: mergeDataFn,
|
|
3448
|
-
props:
|
|
3449
|
-
|
|
3450
|
-
emits: mergeObjectOptions,
|
|
3451
|
-
// TODO
|
|
3580
|
+
props: mergeEmitsOrPropsOptions,
|
|
3581
|
+
emits: mergeEmitsOrPropsOptions,
|
|
3452
3582
|
// objects
|
|
3453
3583
|
methods: mergeObjectOptions,
|
|
3454
3584
|
computed: mergeObjectOptions,
|
|
@@ -3507,7 +3637,21 @@ function mergeAsArray(to, from) {
|
|
|
3507
3637
|
return to ? [...new Set([].concat(to, from))] : from;
|
|
3508
3638
|
}
|
|
3509
3639
|
function mergeObjectOptions(to, from) {
|
|
3510
|
-
return to ? shared.extend(
|
|
3640
|
+
return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
|
|
3641
|
+
}
|
|
3642
|
+
function mergeEmitsOrPropsOptions(to, from) {
|
|
3643
|
+
if (to) {
|
|
3644
|
+
if (shared.isArray(to) && shared.isArray(from)) {
|
|
3645
|
+
return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
3646
|
+
}
|
|
3647
|
+
return shared.extend(
|
|
3648
|
+
/* @__PURE__ */ Object.create(null),
|
|
3649
|
+
normalizePropsOrEmits(to),
|
|
3650
|
+
normalizePropsOrEmits(from != null ? from : {})
|
|
3651
|
+
);
|
|
3652
|
+
} else {
|
|
3653
|
+
return from;
|
|
3654
|
+
}
|
|
3511
3655
|
}
|
|
3512
3656
|
function mergeWatchOptions(to, from) {
|
|
3513
3657
|
if (!to)
|
|
@@ -3521,32 +3665,256 @@ function mergeWatchOptions(to, from) {
|
|
|
3521
3665
|
return merged;
|
|
3522
3666
|
}
|
|
3523
3667
|
|
|
3524
|
-
function
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3668
|
+
function createAppContext() {
|
|
3669
|
+
return {
|
|
3670
|
+
app: null,
|
|
3671
|
+
config: {
|
|
3672
|
+
isNativeTag: shared.NO,
|
|
3673
|
+
performance: false,
|
|
3674
|
+
globalProperties: {},
|
|
3675
|
+
optionMergeStrategies: {},
|
|
3676
|
+
errorHandler: void 0,
|
|
3677
|
+
warnHandler: void 0,
|
|
3678
|
+
compilerOptions: {}
|
|
3679
|
+
},
|
|
3680
|
+
mixins: [],
|
|
3681
|
+
components: {},
|
|
3682
|
+
directives: {},
|
|
3683
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
3684
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
3685
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
3686
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
3687
|
+
};
|
|
3688
|
+
}
|
|
3689
|
+
let uid$1 = 0;
|
|
3690
|
+
function createAppAPI(render, hydrate) {
|
|
3691
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
3692
|
+
if (!shared.isFunction(rootComponent)) {
|
|
3693
|
+
rootComponent = shared.extend({}, rootComponent);
|
|
3533
3694
|
}
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
}
|
|
3538
|
-
if (isStateful) {
|
|
3539
|
-
instance.props = isSSR ? props : reactivity.shallowReactive(props);
|
|
3540
|
-
} else {
|
|
3541
|
-
if (!instance.type.props) {
|
|
3542
|
-
instance.props = attrs;
|
|
3543
|
-
} else {
|
|
3544
|
-
instance.props = props;
|
|
3695
|
+
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
3696
|
+
warn(`root props passed to app.mount() must be an object.`);
|
|
3697
|
+
rootProps = null;
|
|
3545
3698
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3699
|
+
const context = createAppContext();
|
|
3700
|
+
{
|
|
3701
|
+
Object.defineProperty(context.config, "unwrapInjectedRef", {
|
|
3702
|
+
get() {
|
|
3703
|
+
return true;
|
|
3704
|
+
},
|
|
3705
|
+
set() {
|
|
3706
|
+
warn(
|
|
3707
|
+
`app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
|
|
3708
|
+
);
|
|
3709
|
+
}
|
|
3710
|
+
});
|
|
3711
|
+
}
|
|
3712
|
+
const installedPlugins = /* @__PURE__ */ new Set();
|
|
3713
|
+
let isMounted = false;
|
|
3714
|
+
const app = context.app = {
|
|
3715
|
+
_uid: uid$1++,
|
|
3716
|
+
_component: rootComponent,
|
|
3717
|
+
_props: rootProps,
|
|
3718
|
+
_container: null,
|
|
3719
|
+
_context: context,
|
|
3720
|
+
_instance: null,
|
|
3721
|
+
version,
|
|
3722
|
+
get config() {
|
|
3723
|
+
return context.config;
|
|
3724
|
+
},
|
|
3725
|
+
set config(v) {
|
|
3726
|
+
{
|
|
3727
|
+
warn(
|
|
3728
|
+
`app.config cannot be replaced. Modify individual options instead.`
|
|
3729
|
+
);
|
|
3730
|
+
}
|
|
3731
|
+
},
|
|
3732
|
+
use(plugin, ...options) {
|
|
3733
|
+
if (installedPlugins.has(plugin)) {
|
|
3734
|
+
warn(`Plugin has already been applied to target app.`);
|
|
3735
|
+
} else if (plugin && shared.isFunction(plugin.install)) {
|
|
3736
|
+
installedPlugins.add(plugin);
|
|
3737
|
+
plugin.install(app, ...options);
|
|
3738
|
+
} else if (shared.isFunction(plugin)) {
|
|
3739
|
+
installedPlugins.add(plugin);
|
|
3740
|
+
plugin(app, ...options);
|
|
3741
|
+
} else {
|
|
3742
|
+
warn(
|
|
3743
|
+
`A plugin must either be a function or an object with an "install" function.`
|
|
3744
|
+
);
|
|
3745
|
+
}
|
|
3746
|
+
return app;
|
|
3747
|
+
},
|
|
3748
|
+
mixin(mixin) {
|
|
3749
|
+
{
|
|
3750
|
+
if (!context.mixins.includes(mixin)) {
|
|
3751
|
+
context.mixins.push(mixin);
|
|
3752
|
+
} else {
|
|
3753
|
+
warn(
|
|
3754
|
+
"Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
|
3755
|
+
);
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
return app;
|
|
3759
|
+
},
|
|
3760
|
+
component(name, component) {
|
|
3761
|
+
{
|
|
3762
|
+
validateComponentName(name, context.config);
|
|
3763
|
+
}
|
|
3764
|
+
if (!component) {
|
|
3765
|
+
return context.components[name];
|
|
3766
|
+
}
|
|
3767
|
+
if (context.components[name]) {
|
|
3768
|
+
warn(`Component "${name}" has already been registered in target app.`);
|
|
3769
|
+
}
|
|
3770
|
+
context.components[name] = component;
|
|
3771
|
+
return app;
|
|
3772
|
+
},
|
|
3773
|
+
directive(name, directive) {
|
|
3774
|
+
{
|
|
3775
|
+
validateDirectiveName(name);
|
|
3776
|
+
}
|
|
3777
|
+
if (!directive) {
|
|
3778
|
+
return context.directives[name];
|
|
3779
|
+
}
|
|
3780
|
+
if (context.directives[name]) {
|
|
3781
|
+
warn(`Directive "${name}" has already been registered in target app.`);
|
|
3782
|
+
}
|
|
3783
|
+
context.directives[name] = directive;
|
|
3784
|
+
return app;
|
|
3785
|
+
},
|
|
3786
|
+
mount(rootContainer, isHydrate, isSVG) {
|
|
3787
|
+
if (!isMounted) {
|
|
3788
|
+
if (rootContainer.__vue_app__) {
|
|
3789
|
+
warn(
|
|
3790
|
+
`There is already an app instance mounted on the host container.
|
|
3791
|
+
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
3792
|
+
);
|
|
3793
|
+
}
|
|
3794
|
+
const vnode = createVNode(
|
|
3795
|
+
rootComponent,
|
|
3796
|
+
rootProps
|
|
3797
|
+
);
|
|
3798
|
+
vnode.appContext = context;
|
|
3799
|
+
{
|
|
3800
|
+
context.reload = () => {
|
|
3801
|
+
render(cloneVNode(vnode), rootContainer, isSVG);
|
|
3802
|
+
};
|
|
3803
|
+
}
|
|
3804
|
+
if (isHydrate && hydrate) {
|
|
3805
|
+
hydrate(vnode, rootContainer);
|
|
3806
|
+
} else {
|
|
3807
|
+
render(vnode, rootContainer, isSVG);
|
|
3808
|
+
}
|
|
3809
|
+
isMounted = true;
|
|
3810
|
+
app._container = rootContainer;
|
|
3811
|
+
rootContainer.__vue_app__ = app;
|
|
3812
|
+
{
|
|
3813
|
+
app._instance = vnode.component;
|
|
3814
|
+
devtoolsInitApp(app, version);
|
|
3815
|
+
}
|
|
3816
|
+
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
3817
|
+
} else {
|
|
3818
|
+
warn(
|
|
3819
|
+
`App has already been mounted.
|
|
3820
|
+
If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
|
|
3821
|
+
);
|
|
3822
|
+
}
|
|
3823
|
+
},
|
|
3824
|
+
unmount() {
|
|
3825
|
+
if (isMounted) {
|
|
3826
|
+
render(null, app._container);
|
|
3827
|
+
{
|
|
3828
|
+
app._instance = null;
|
|
3829
|
+
devtoolsUnmountApp(app);
|
|
3830
|
+
}
|
|
3831
|
+
delete app._container.__vue_app__;
|
|
3832
|
+
} else {
|
|
3833
|
+
warn(`Cannot unmount an app that is not mounted.`);
|
|
3834
|
+
}
|
|
3835
|
+
},
|
|
3836
|
+
provide(key, value) {
|
|
3837
|
+
if (key in context.provides) {
|
|
3838
|
+
warn(
|
|
3839
|
+
`App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
|
3840
|
+
);
|
|
3841
|
+
}
|
|
3842
|
+
context.provides[key] = value;
|
|
3843
|
+
return app;
|
|
3844
|
+
},
|
|
3845
|
+
runWithContext(fn) {
|
|
3846
|
+
currentApp = app;
|
|
3847
|
+
try {
|
|
3848
|
+
return fn();
|
|
3849
|
+
} finally {
|
|
3850
|
+
currentApp = null;
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
};
|
|
3854
|
+
return app;
|
|
3855
|
+
};
|
|
3856
|
+
}
|
|
3857
|
+
let currentApp = null;
|
|
3858
|
+
|
|
3859
|
+
function provide(key, value) {
|
|
3860
|
+
if (!currentInstance) {
|
|
3861
|
+
{
|
|
3862
|
+
warn(`provide() can only be used inside setup().`);
|
|
3863
|
+
}
|
|
3864
|
+
} else {
|
|
3865
|
+
let provides = currentInstance.provides;
|
|
3866
|
+
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
3867
|
+
if (parentProvides === provides) {
|
|
3868
|
+
provides = currentInstance.provides = Object.create(parentProvides);
|
|
3869
|
+
}
|
|
3870
|
+
provides[key] = value;
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
3874
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
3875
|
+
if (instance || currentApp) {
|
|
3876
|
+
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
|
3877
|
+
if (provides && key in provides) {
|
|
3878
|
+
return provides[key];
|
|
3879
|
+
} else if (arguments.length > 1) {
|
|
3880
|
+
return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
3881
|
+
} else {
|
|
3882
|
+
warn(`injection "${String(key)}" not found.`);
|
|
3883
|
+
}
|
|
3884
|
+
} else {
|
|
3885
|
+
warn(`inject() can only be used inside setup() or functional components.`);
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
function hasInjectionContext() {
|
|
3889
|
+
return !!(currentInstance || currentRenderingInstance || currentApp);
|
|
3890
|
+
}
|
|
3891
|
+
|
|
3892
|
+
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
3893
|
+
const props = {};
|
|
3894
|
+
const attrs = {};
|
|
3895
|
+
shared.def(attrs, InternalObjectKey, 1);
|
|
3896
|
+
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
3897
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
3898
|
+
for (const key in instance.propsOptions[0]) {
|
|
3899
|
+
if (!(key in props)) {
|
|
3900
|
+
props[key] = void 0;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
{
|
|
3904
|
+
validateProps(rawProps || {}, props, instance);
|
|
3905
|
+
}
|
|
3906
|
+
if (isStateful) {
|
|
3907
|
+
instance.props = isSSR ? props : reactivity.shallowReactive(props);
|
|
3908
|
+
} else {
|
|
3909
|
+
if (!instance.type.props) {
|
|
3910
|
+
instance.props = attrs;
|
|
3911
|
+
} else {
|
|
3912
|
+
instance.props = props;
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
instance.attrs = attrs;
|
|
3916
|
+
}
|
|
3917
|
+
function isInHmrContext(instance) {
|
|
3550
3918
|
while (instance) {
|
|
3551
3919
|
if (instance.type.__hmrId)
|
|
3552
3920
|
return true;
|
|
@@ -3836,7 +4204,7 @@ function validateProp(name, value, prop, isAbsent) {
|
|
|
3836
4204
|
warn('Missing required prop: "' + name + '"');
|
|
3837
4205
|
return;
|
|
3838
4206
|
}
|
|
3839
|
-
if (value == null && !
|
|
4207
|
+
if (value == null && !required) {
|
|
3840
4208
|
return;
|
|
3841
4209
|
}
|
|
3842
4210
|
if (type != null && type !== true && !skipCheck) {
|
|
@@ -3870,319 +4238,150 @@ function assertType(value, type) {
|
|
|
3870
4238
|
valid = value instanceof type;
|
|
3871
4239
|
}
|
|
3872
4240
|
} else if (expectedType === "Object") {
|
|
3873
|
-
valid = shared.isObject(value);
|
|
3874
|
-
} else if (expectedType === "Array") {
|
|
3875
|
-
valid = shared.isArray(value);
|
|
3876
|
-
} else if (expectedType === "null") {
|
|
3877
|
-
valid = value === null;
|
|
3878
|
-
} else {
|
|
3879
|
-
valid = value instanceof type;
|
|
3880
|
-
}
|
|
3881
|
-
return {
|
|
3882
|
-
valid,
|
|
3883
|
-
expectedType
|
|
3884
|
-
};
|
|
3885
|
-
}
|
|
3886
|
-
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
3887
|
-
let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
|
|
3888
|
-
const expectedType = expectedTypes[0];
|
|
3889
|
-
const receivedType = shared.toRawType(value);
|
|
3890
|
-
const expectedValue = styleValue(value, expectedType);
|
|
3891
|
-
const receivedValue = styleValue(value, receivedType);
|
|
3892
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
|
3893
|
-
message += ` with value ${expectedValue}`;
|
|
3894
|
-
}
|
|
3895
|
-
message += `, got ${receivedType} `;
|
|
3896
|
-
if (isExplicable(receivedType)) {
|
|
3897
|
-
message += `with value ${receivedValue}.`;
|
|
3898
|
-
}
|
|
3899
|
-
return message;
|
|
3900
|
-
}
|
|
3901
|
-
function styleValue(value, type) {
|
|
3902
|
-
if (type === "String") {
|
|
3903
|
-
return `"${value}"`;
|
|
3904
|
-
} else if (type === "Number") {
|
|
3905
|
-
return `${Number(value)}`;
|
|
3906
|
-
} else {
|
|
3907
|
-
return `${value}`;
|
|
3908
|
-
}
|
|
3909
|
-
}
|
|
3910
|
-
function isExplicable(type) {
|
|
3911
|
-
const explicitTypes = ["string", "number", "boolean"];
|
|
3912
|
-
return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
|
3913
|
-
}
|
|
3914
|
-
function isBoolean(...args) {
|
|
3915
|
-
return args.some((elem) => elem.toLowerCase() === "boolean");
|
|
3916
|
-
}
|
|
3917
|
-
|
|
3918
|
-
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
|
3919
|
-
const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
|
3920
|
-
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
3921
|
-
if (rawSlot._n) {
|
|
3922
|
-
return rawSlot;
|
|
3923
|
-
}
|
|
3924
|
-
const normalized = withCtx((...args) => {
|
|
3925
|
-
if (currentInstance) {
|
|
3926
|
-
warn(
|
|
3927
|
-
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
|
|
3928
|
-
);
|
|
3929
|
-
}
|
|
3930
|
-
return normalizeSlotValue(rawSlot(...args));
|
|
3931
|
-
}, ctx);
|
|
3932
|
-
normalized._c = false;
|
|
3933
|
-
return normalized;
|
|
3934
|
-
};
|
|
3935
|
-
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
3936
|
-
const ctx = rawSlots._ctx;
|
|
3937
|
-
for (const key in rawSlots) {
|
|
3938
|
-
if (isInternalKey(key))
|
|
3939
|
-
continue;
|
|
3940
|
-
const value = rawSlots[key];
|
|
3941
|
-
if (shared.isFunction(value)) {
|
|
3942
|
-
slots[key] = normalizeSlot(key, value, ctx);
|
|
3943
|
-
} else if (value != null) {
|
|
3944
|
-
{
|
|
3945
|
-
warn(
|
|
3946
|
-
`Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
|
3947
|
-
);
|
|
3948
|
-
}
|
|
3949
|
-
const normalized = normalizeSlotValue(value);
|
|
3950
|
-
slots[key] = () => normalized;
|
|
3951
|
-
}
|
|
3952
|
-
}
|
|
3953
|
-
};
|
|
3954
|
-
const normalizeVNodeSlots = (instance, children) => {
|
|
3955
|
-
if (!isKeepAlive(instance.vnode) && true) {
|
|
3956
|
-
warn(
|
|
3957
|
-
`Non-function value encountered for default slot. Prefer function slots for better performance.`
|
|
3958
|
-
);
|
|
3959
|
-
}
|
|
3960
|
-
const normalized = normalizeSlotValue(children);
|
|
3961
|
-
instance.slots.default = () => normalized;
|
|
3962
|
-
};
|
|
3963
|
-
const initSlots = (instance, children) => {
|
|
3964
|
-
if (instance.vnode.shapeFlag & 32) {
|
|
3965
|
-
const type = children._;
|
|
3966
|
-
if (type) {
|
|
3967
|
-
instance.slots = reactivity.toRaw(children);
|
|
3968
|
-
shared.def(children, "_", type);
|
|
3969
|
-
} else {
|
|
3970
|
-
normalizeObjectSlots(
|
|
3971
|
-
children,
|
|
3972
|
-
instance.slots = {});
|
|
3973
|
-
}
|
|
3974
|
-
} else {
|
|
3975
|
-
instance.slots = {};
|
|
3976
|
-
if (children) {
|
|
3977
|
-
normalizeVNodeSlots(instance, children);
|
|
3978
|
-
}
|
|
3979
|
-
}
|
|
3980
|
-
shared.def(instance.slots, InternalObjectKey, 1);
|
|
3981
|
-
};
|
|
3982
|
-
const updateSlots = (instance, children, optimized) => {
|
|
3983
|
-
const { vnode, slots } = instance;
|
|
3984
|
-
let needDeletionCheck = true;
|
|
3985
|
-
let deletionComparisonTarget = shared.EMPTY_OBJ;
|
|
3986
|
-
if (vnode.shapeFlag & 32) {
|
|
3987
|
-
const type = children._;
|
|
3988
|
-
if (type) {
|
|
3989
|
-
if (isHmrUpdating) {
|
|
3990
|
-
shared.extend(slots, children);
|
|
3991
|
-
} else if (optimized && type === 1) {
|
|
3992
|
-
needDeletionCheck = false;
|
|
3993
|
-
} else {
|
|
3994
|
-
shared.extend(slots, children);
|
|
3995
|
-
if (!optimized && type === 1) {
|
|
3996
|
-
delete slots._;
|
|
3997
|
-
}
|
|
3998
|
-
}
|
|
3999
|
-
} else {
|
|
4000
|
-
needDeletionCheck = !children.$stable;
|
|
4001
|
-
normalizeObjectSlots(children, slots);
|
|
4002
|
-
}
|
|
4003
|
-
deletionComparisonTarget = children;
|
|
4004
|
-
} else if (children) {
|
|
4005
|
-
normalizeVNodeSlots(instance, children);
|
|
4006
|
-
deletionComparisonTarget = { default: 1 };
|
|
4007
|
-
}
|
|
4008
|
-
if (needDeletionCheck) {
|
|
4009
|
-
for (const key in slots) {
|
|
4010
|
-
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
|
4011
|
-
delete slots[key];
|
|
4012
|
-
}
|
|
4013
|
-
}
|
|
4014
|
-
}
|
|
4015
|
-
};
|
|
4016
|
-
|
|
4017
|
-
function createAppContext() {
|
|
4018
|
-
return {
|
|
4019
|
-
app: null,
|
|
4020
|
-
config: {
|
|
4021
|
-
isNativeTag: shared.NO,
|
|
4022
|
-
performance: false,
|
|
4023
|
-
globalProperties: {},
|
|
4024
|
-
optionMergeStrategies: {},
|
|
4025
|
-
errorHandler: void 0,
|
|
4026
|
-
warnHandler: void 0,
|
|
4027
|
-
compilerOptions: {}
|
|
4028
|
-
},
|
|
4029
|
-
mixins: [],
|
|
4030
|
-
components: {},
|
|
4031
|
-
directives: {},
|
|
4032
|
-
provides: /* @__PURE__ */ Object.create(null),
|
|
4033
|
-
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
4034
|
-
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
4035
|
-
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
4036
|
-
};
|
|
4037
|
-
}
|
|
4038
|
-
let uid$1 = 0;
|
|
4039
|
-
function createAppAPI(render, hydrate) {
|
|
4040
|
-
return function createApp(rootComponent, rootProps = null) {
|
|
4041
|
-
if (!shared.isFunction(rootComponent)) {
|
|
4042
|
-
rootComponent = shared.extend({}, rootComponent);
|
|
4043
|
-
}
|
|
4044
|
-
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
4045
|
-
warn(`root props passed to app.mount() must be an object.`);
|
|
4046
|
-
rootProps = null;
|
|
4047
|
-
}
|
|
4048
|
-
const context = createAppContext();
|
|
4049
|
-
const installedPlugins = /* @__PURE__ */ new Set();
|
|
4050
|
-
let isMounted = false;
|
|
4051
|
-
const app = context.app = {
|
|
4052
|
-
_uid: uid$1++,
|
|
4053
|
-
_component: rootComponent,
|
|
4054
|
-
_props: rootProps,
|
|
4055
|
-
_container: null,
|
|
4056
|
-
_context: context,
|
|
4057
|
-
_instance: null,
|
|
4058
|
-
version,
|
|
4059
|
-
get config() {
|
|
4060
|
-
return context.config;
|
|
4061
|
-
},
|
|
4062
|
-
set config(v) {
|
|
4063
|
-
{
|
|
4064
|
-
warn(
|
|
4065
|
-
`app.config cannot be replaced. Modify individual options instead.`
|
|
4066
|
-
);
|
|
4067
|
-
}
|
|
4068
|
-
},
|
|
4069
|
-
use(plugin, ...options) {
|
|
4070
|
-
if (installedPlugins.has(plugin)) {
|
|
4071
|
-
warn(`Plugin has already been applied to target app.`);
|
|
4072
|
-
} else if (plugin && shared.isFunction(plugin.install)) {
|
|
4073
|
-
installedPlugins.add(plugin);
|
|
4074
|
-
plugin.install(app, ...options);
|
|
4075
|
-
} else if (shared.isFunction(plugin)) {
|
|
4076
|
-
installedPlugins.add(plugin);
|
|
4077
|
-
plugin(app, ...options);
|
|
4078
|
-
} else {
|
|
4079
|
-
warn(
|
|
4080
|
-
`A plugin must either be a function or an object with an "install" function.`
|
|
4081
|
-
);
|
|
4082
|
-
}
|
|
4083
|
-
return app;
|
|
4084
|
-
},
|
|
4085
|
-
mixin(mixin) {
|
|
4086
|
-
{
|
|
4087
|
-
if (!context.mixins.includes(mixin)) {
|
|
4088
|
-
context.mixins.push(mixin);
|
|
4089
|
-
} else {
|
|
4090
|
-
warn(
|
|
4091
|
-
"Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
|
4092
|
-
);
|
|
4093
|
-
}
|
|
4094
|
-
}
|
|
4095
|
-
return app;
|
|
4096
|
-
},
|
|
4097
|
-
component(name, component) {
|
|
4098
|
-
{
|
|
4099
|
-
validateComponentName(name, context.config);
|
|
4100
|
-
}
|
|
4101
|
-
if (!component) {
|
|
4102
|
-
return context.components[name];
|
|
4103
|
-
}
|
|
4104
|
-
if (context.components[name]) {
|
|
4105
|
-
warn(`Component "${name}" has already been registered in target app.`);
|
|
4106
|
-
}
|
|
4107
|
-
context.components[name] = component;
|
|
4108
|
-
return app;
|
|
4109
|
-
},
|
|
4110
|
-
directive(name, directive) {
|
|
4111
|
-
{
|
|
4112
|
-
validateDirectiveName(name);
|
|
4113
|
-
}
|
|
4114
|
-
if (!directive) {
|
|
4115
|
-
return context.directives[name];
|
|
4116
|
-
}
|
|
4117
|
-
if (context.directives[name]) {
|
|
4118
|
-
warn(`Directive "${name}" has already been registered in target app.`);
|
|
4119
|
-
}
|
|
4120
|
-
context.directives[name] = directive;
|
|
4121
|
-
return app;
|
|
4122
|
-
},
|
|
4123
|
-
mount(rootContainer, isHydrate, isSVG) {
|
|
4124
|
-
if (!isMounted) {
|
|
4125
|
-
if (rootContainer.__vue_app__) {
|
|
4126
|
-
warn(
|
|
4127
|
-
`There is already an app instance mounted on the host container.
|
|
4128
|
-
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
4129
|
-
);
|
|
4130
|
-
}
|
|
4131
|
-
const vnode = createVNode(
|
|
4132
|
-
rootComponent,
|
|
4133
|
-
rootProps
|
|
4134
|
-
);
|
|
4135
|
-
vnode.appContext = context;
|
|
4136
|
-
{
|
|
4137
|
-
context.reload = () => {
|
|
4138
|
-
render(cloneVNode(vnode), rootContainer, isSVG);
|
|
4139
|
-
};
|
|
4140
|
-
}
|
|
4141
|
-
if (isHydrate && hydrate) {
|
|
4142
|
-
hydrate(vnode, rootContainer);
|
|
4143
|
-
} else {
|
|
4144
|
-
render(vnode, rootContainer, isSVG);
|
|
4145
|
-
}
|
|
4146
|
-
isMounted = true;
|
|
4147
|
-
app._container = rootContainer;
|
|
4148
|
-
rootContainer.__vue_app__ = app;
|
|
4149
|
-
{
|
|
4150
|
-
app._instance = vnode.component;
|
|
4151
|
-
devtoolsInitApp(app, version);
|
|
4152
|
-
}
|
|
4153
|
-
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
4154
|
-
} else {
|
|
4155
|
-
warn(
|
|
4156
|
-
`App has already been mounted.
|
|
4157
|
-
If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
|
|
4158
|
-
);
|
|
4159
|
-
}
|
|
4160
|
-
},
|
|
4161
|
-
unmount() {
|
|
4162
|
-
if (isMounted) {
|
|
4163
|
-
render(null, app._container);
|
|
4164
|
-
{
|
|
4165
|
-
app._instance = null;
|
|
4166
|
-
devtoolsUnmountApp(app);
|
|
4167
|
-
}
|
|
4168
|
-
delete app._container.__vue_app__;
|
|
4169
|
-
} else {
|
|
4170
|
-
warn(`Cannot unmount an app that is not mounted.`);
|
|
4171
|
-
}
|
|
4172
|
-
},
|
|
4173
|
-
provide(key, value) {
|
|
4174
|
-
if (key in context.provides) {
|
|
4175
|
-
warn(
|
|
4176
|
-
`App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
|
4177
|
-
);
|
|
4178
|
-
}
|
|
4179
|
-
context.provides[key] = value;
|
|
4180
|
-
return app;
|
|
4181
|
-
}
|
|
4182
|
-
};
|
|
4183
|
-
return app;
|
|
4241
|
+
valid = shared.isObject(value);
|
|
4242
|
+
} else if (expectedType === "Array") {
|
|
4243
|
+
valid = shared.isArray(value);
|
|
4244
|
+
} else if (expectedType === "null") {
|
|
4245
|
+
valid = value === null;
|
|
4246
|
+
} else {
|
|
4247
|
+
valid = value instanceof type;
|
|
4248
|
+
}
|
|
4249
|
+
return {
|
|
4250
|
+
valid,
|
|
4251
|
+
expectedType
|
|
4184
4252
|
};
|
|
4185
4253
|
}
|
|
4254
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
4255
|
+
let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
|
|
4256
|
+
const expectedType = expectedTypes[0];
|
|
4257
|
+
const receivedType = shared.toRawType(value);
|
|
4258
|
+
const expectedValue = styleValue(value, expectedType);
|
|
4259
|
+
const receivedValue = styleValue(value, receivedType);
|
|
4260
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
|
4261
|
+
message += ` with value ${expectedValue}`;
|
|
4262
|
+
}
|
|
4263
|
+
message += `, got ${receivedType} `;
|
|
4264
|
+
if (isExplicable(receivedType)) {
|
|
4265
|
+
message += `with value ${receivedValue}.`;
|
|
4266
|
+
}
|
|
4267
|
+
return message;
|
|
4268
|
+
}
|
|
4269
|
+
function styleValue(value, type) {
|
|
4270
|
+
if (type === "String") {
|
|
4271
|
+
return `"${value}"`;
|
|
4272
|
+
} else if (type === "Number") {
|
|
4273
|
+
return `${Number(value)}`;
|
|
4274
|
+
} else {
|
|
4275
|
+
return `${value}`;
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
function isExplicable(type) {
|
|
4279
|
+
const explicitTypes = ["string", "number", "boolean"];
|
|
4280
|
+
return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
|
4281
|
+
}
|
|
4282
|
+
function isBoolean(...args) {
|
|
4283
|
+
return args.some((elem) => elem.toLowerCase() === "boolean");
|
|
4284
|
+
}
|
|
4285
|
+
|
|
4286
|
+
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
|
4287
|
+
const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
|
4288
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
4289
|
+
if (rawSlot._n) {
|
|
4290
|
+
return rawSlot;
|
|
4291
|
+
}
|
|
4292
|
+
const normalized = withCtx((...args) => {
|
|
4293
|
+
if (currentInstance) {
|
|
4294
|
+
warn(
|
|
4295
|
+
`Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
|
|
4296
|
+
);
|
|
4297
|
+
}
|
|
4298
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
4299
|
+
}, ctx);
|
|
4300
|
+
normalized._c = false;
|
|
4301
|
+
return normalized;
|
|
4302
|
+
};
|
|
4303
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
4304
|
+
const ctx = rawSlots._ctx;
|
|
4305
|
+
for (const key in rawSlots) {
|
|
4306
|
+
if (isInternalKey(key))
|
|
4307
|
+
continue;
|
|
4308
|
+
const value = rawSlots[key];
|
|
4309
|
+
if (shared.isFunction(value)) {
|
|
4310
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
4311
|
+
} else if (value != null) {
|
|
4312
|
+
{
|
|
4313
|
+
warn(
|
|
4314
|
+
`Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
|
4315
|
+
);
|
|
4316
|
+
}
|
|
4317
|
+
const normalized = normalizeSlotValue(value);
|
|
4318
|
+
slots[key] = () => normalized;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
};
|
|
4322
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
4323
|
+
if (!isKeepAlive(instance.vnode) && true) {
|
|
4324
|
+
warn(
|
|
4325
|
+
`Non-function value encountered for default slot. Prefer function slots for better performance.`
|
|
4326
|
+
);
|
|
4327
|
+
}
|
|
4328
|
+
const normalized = normalizeSlotValue(children);
|
|
4329
|
+
instance.slots.default = () => normalized;
|
|
4330
|
+
};
|
|
4331
|
+
const initSlots = (instance, children) => {
|
|
4332
|
+
if (instance.vnode.shapeFlag & 32) {
|
|
4333
|
+
const type = children._;
|
|
4334
|
+
if (type) {
|
|
4335
|
+
instance.slots = reactivity.toRaw(children);
|
|
4336
|
+
shared.def(children, "_", type);
|
|
4337
|
+
} else {
|
|
4338
|
+
normalizeObjectSlots(
|
|
4339
|
+
children,
|
|
4340
|
+
instance.slots = {});
|
|
4341
|
+
}
|
|
4342
|
+
} else {
|
|
4343
|
+
instance.slots = {};
|
|
4344
|
+
if (children) {
|
|
4345
|
+
normalizeVNodeSlots(instance, children);
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
shared.def(instance.slots, InternalObjectKey, 1);
|
|
4349
|
+
};
|
|
4350
|
+
const updateSlots = (instance, children, optimized) => {
|
|
4351
|
+
const { vnode, slots } = instance;
|
|
4352
|
+
let needDeletionCheck = true;
|
|
4353
|
+
let deletionComparisonTarget = shared.EMPTY_OBJ;
|
|
4354
|
+
if (vnode.shapeFlag & 32) {
|
|
4355
|
+
const type = children._;
|
|
4356
|
+
if (type) {
|
|
4357
|
+
if (isHmrUpdating) {
|
|
4358
|
+
shared.extend(slots, children);
|
|
4359
|
+
reactivity.trigger(instance, "set", "$slots");
|
|
4360
|
+
} else if (optimized && type === 1) {
|
|
4361
|
+
needDeletionCheck = false;
|
|
4362
|
+
} else {
|
|
4363
|
+
shared.extend(slots, children);
|
|
4364
|
+
if (!optimized && type === 1) {
|
|
4365
|
+
delete slots._;
|
|
4366
|
+
}
|
|
4367
|
+
}
|
|
4368
|
+
} else {
|
|
4369
|
+
needDeletionCheck = !children.$stable;
|
|
4370
|
+
normalizeObjectSlots(children, slots);
|
|
4371
|
+
}
|
|
4372
|
+
deletionComparisonTarget = children;
|
|
4373
|
+
} else if (children) {
|
|
4374
|
+
normalizeVNodeSlots(instance, children);
|
|
4375
|
+
deletionComparisonTarget = { default: 1 };
|
|
4376
|
+
}
|
|
4377
|
+
if (needDeletionCheck) {
|
|
4378
|
+
for (const key in slots) {
|
|
4379
|
+
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
|
4380
|
+
delete slots[key];
|
|
4381
|
+
}
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
};
|
|
4186
4385
|
|
|
4187
4386
|
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4188
4387
|
if (shared.isArray(rawRef)) {
|
|
@@ -5086,7 +5285,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5086
5285
|
areChildrenSVG,
|
|
5087
5286
|
slotScopeIds
|
|
5088
5287
|
);
|
|
5089
|
-
|
|
5288
|
+
{
|
|
5090
5289
|
traverseStaticChildren(n1, n2);
|
|
5091
5290
|
}
|
|
5092
5291
|
} else if (!optimized) {
|
|
@@ -5282,21 +5481,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5282
5481
|
isSVG,
|
|
5283
5482
|
slotScopeIds
|
|
5284
5483
|
);
|
|
5285
|
-
|
|
5484
|
+
{
|
|
5286
5485
|
traverseStaticChildren(n1, n2);
|
|
5287
|
-
} else if (
|
|
5288
|
-
// #2080 if the stable fragment has a key, it's a <template v-for> that may
|
|
5289
|
-
// get moved around. Make sure all root level vnodes inherit el.
|
|
5290
|
-
// #2134 or if it's a component root, it may also get moved around
|
|
5291
|
-
// as the component is being moved.
|
|
5292
|
-
n2.key != null || parentComponent && n2 === parentComponent.subTree
|
|
5293
|
-
) {
|
|
5294
|
-
traverseStaticChildren(
|
|
5295
|
-
n1,
|
|
5296
|
-
n2,
|
|
5297
|
-
true
|
|
5298
|
-
/* shallow */
|
|
5299
|
-
);
|
|
5300
5486
|
}
|
|
5301
5487
|
} else {
|
|
5302
5488
|
patchChildren(
|
|
@@ -6870,6 +7056,8 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6870
7056
|
refs: shared.EMPTY_OBJ,
|
|
6871
7057
|
setupState: shared.EMPTY_OBJ,
|
|
6872
7058
|
setupContext: null,
|
|
7059
|
+
attrsProxy: null,
|
|
7060
|
+
slotsProxy: null,
|
|
6873
7061
|
// suspense related
|
|
6874
7062
|
suspense,
|
|
6875
7063
|
suspenseId: suspense ? suspense.pendingId : 0,
|
|
@@ -7109,8 +7297,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
7109
7297
|
}
|
|
7110
7298
|
}
|
|
7111
7299
|
}
|
|
7112
|
-
function
|
|
7113
|
-
return new Proxy(
|
|
7300
|
+
function getAttrsProxy(instance) {
|
|
7301
|
+
return instance.attrsProxy || (instance.attrsProxy = new Proxy(
|
|
7114
7302
|
instance.attrs,
|
|
7115
7303
|
{
|
|
7116
7304
|
get(target, key) {
|
|
@@ -7127,7 +7315,23 @@ function createAttrsProxy(instance) {
|
|
|
7127
7315
|
return false;
|
|
7128
7316
|
}
|
|
7129
7317
|
}
|
|
7130
|
-
);
|
|
7318
|
+
));
|
|
7319
|
+
}
|
|
7320
|
+
function getSlotsProxy(instance) {
|
|
7321
|
+
return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
|
|
7322
|
+
get(target, key) {
|
|
7323
|
+
reactivity.track(instance, "get", "$slots");
|
|
7324
|
+
return target[key];
|
|
7325
|
+
},
|
|
7326
|
+
set() {
|
|
7327
|
+
warn(`setupContext.slots is readonly.`);
|
|
7328
|
+
return false;
|
|
7329
|
+
},
|
|
7330
|
+
deleteProperty() {
|
|
7331
|
+
warn(`setupContext.slots is readonly.`);
|
|
7332
|
+
return false;
|
|
7333
|
+
}
|
|
7334
|
+
}));
|
|
7131
7335
|
}
|
|
7132
7336
|
function createSetupContext(instance) {
|
|
7133
7337
|
const expose = (exposed) => {
|
|
@@ -7153,14 +7357,13 @@ function createSetupContext(instance) {
|
|
|
7153
7357
|
}
|
|
7154
7358
|
instance.exposed = exposed || {};
|
|
7155
7359
|
};
|
|
7156
|
-
let attrs;
|
|
7157
7360
|
{
|
|
7158
7361
|
return Object.freeze({
|
|
7159
7362
|
get attrs() {
|
|
7160
|
-
return
|
|
7363
|
+
return getAttrsProxy(instance);
|
|
7161
7364
|
},
|
|
7162
7365
|
get slots() {
|
|
7163
|
-
return
|
|
7366
|
+
return getSlotsProxy(instance);
|
|
7164
7367
|
},
|
|
7165
7368
|
get emit() {
|
|
7166
7369
|
return (event, ...args) => instance.emit(event, ...args);
|
|
@@ -7220,111 +7423,6 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
7220
7423
|
return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
7221
7424
|
};
|
|
7222
7425
|
|
|
7223
|
-
const warnRuntimeUsage = (method) => warn(
|
|
7224
|
-
`${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
|
|
7225
|
-
);
|
|
7226
|
-
function defineProps() {
|
|
7227
|
-
{
|
|
7228
|
-
warnRuntimeUsage(`defineProps`);
|
|
7229
|
-
}
|
|
7230
|
-
return null;
|
|
7231
|
-
}
|
|
7232
|
-
function defineEmits() {
|
|
7233
|
-
{
|
|
7234
|
-
warnRuntimeUsage(`defineEmits`);
|
|
7235
|
-
}
|
|
7236
|
-
return null;
|
|
7237
|
-
}
|
|
7238
|
-
function defineExpose(exposed) {
|
|
7239
|
-
{
|
|
7240
|
-
warnRuntimeUsage(`defineExpose`);
|
|
7241
|
-
}
|
|
7242
|
-
}
|
|
7243
|
-
function defineOptions(options) {
|
|
7244
|
-
{
|
|
7245
|
-
warnRuntimeUsage(`defineOptions`);
|
|
7246
|
-
}
|
|
7247
|
-
}
|
|
7248
|
-
function defineSlots() {
|
|
7249
|
-
{
|
|
7250
|
-
warnRuntimeUsage(`defineSlots`);
|
|
7251
|
-
}
|
|
7252
|
-
}
|
|
7253
|
-
function withDefaults(props, defaults) {
|
|
7254
|
-
{
|
|
7255
|
-
warnRuntimeUsage(`withDefaults`);
|
|
7256
|
-
}
|
|
7257
|
-
return null;
|
|
7258
|
-
}
|
|
7259
|
-
function useSlots() {
|
|
7260
|
-
return getContext().slots;
|
|
7261
|
-
}
|
|
7262
|
-
function useAttrs() {
|
|
7263
|
-
return getContext().attrs;
|
|
7264
|
-
}
|
|
7265
|
-
function getContext() {
|
|
7266
|
-
const i = getCurrentInstance();
|
|
7267
|
-
if (!i) {
|
|
7268
|
-
warn(`useContext() called without active instance.`);
|
|
7269
|
-
}
|
|
7270
|
-
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
7271
|
-
}
|
|
7272
|
-
function mergeDefaults(raw, defaults) {
|
|
7273
|
-
const props = shared.isArray(raw) ? raw.reduce(
|
|
7274
|
-
(normalized, p) => (normalized[p] = {}, normalized),
|
|
7275
|
-
{}
|
|
7276
|
-
) : raw;
|
|
7277
|
-
for (const key in defaults) {
|
|
7278
|
-
if (key.startsWith("__skip"))
|
|
7279
|
-
continue;
|
|
7280
|
-
let opt = props[key];
|
|
7281
|
-
if (opt) {
|
|
7282
|
-
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
7283
|
-
opt = props[key] = { type: opt, default: defaults[key] };
|
|
7284
|
-
} else {
|
|
7285
|
-
opt.default = defaults[key];
|
|
7286
|
-
}
|
|
7287
|
-
} else if (opt === null) {
|
|
7288
|
-
opt = props[key] = { default: defaults[key] };
|
|
7289
|
-
} else {
|
|
7290
|
-
warn(`props default key "${key}" has no corresponding declaration.`);
|
|
7291
|
-
}
|
|
7292
|
-
if (opt && defaults[`__skip_${key}`]) {
|
|
7293
|
-
opt.skipFactory = true;
|
|
7294
|
-
}
|
|
7295
|
-
}
|
|
7296
|
-
return props;
|
|
7297
|
-
}
|
|
7298
|
-
function createPropsRestProxy(props, excludedKeys) {
|
|
7299
|
-
const ret = {};
|
|
7300
|
-
for (const key in props) {
|
|
7301
|
-
if (!excludedKeys.includes(key)) {
|
|
7302
|
-
Object.defineProperty(ret, key, {
|
|
7303
|
-
enumerable: true,
|
|
7304
|
-
get: () => props[key]
|
|
7305
|
-
});
|
|
7306
|
-
}
|
|
7307
|
-
}
|
|
7308
|
-
return ret;
|
|
7309
|
-
}
|
|
7310
|
-
function withAsyncContext(getAwaitable) {
|
|
7311
|
-
const ctx = getCurrentInstance();
|
|
7312
|
-
if (!ctx) {
|
|
7313
|
-
warn(
|
|
7314
|
-
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
7315
|
-
);
|
|
7316
|
-
}
|
|
7317
|
-
let awaitable = getAwaitable();
|
|
7318
|
-
unsetCurrentInstance();
|
|
7319
|
-
if (shared.isPromise(awaitable)) {
|
|
7320
|
-
awaitable = awaitable.catch((e) => {
|
|
7321
|
-
setCurrentInstance(ctx);
|
|
7322
|
-
throw e;
|
|
7323
|
-
});
|
|
7324
|
-
}
|
|
7325
|
-
return [awaitable, () => setCurrentInstance(ctx)];
|
|
7326
|
-
}
|
|
7327
|
-
|
|
7328
7426
|
function h(type, propsOrChildren, children) {
|
|
7329
7427
|
const l = arguments.length;
|
|
7330
7428
|
if (l === 2) {
|
|
@@ -7564,7 +7662,7 @@ function isMemoSame(cached, memo) {
|
|
|
7564
7662
|
return true;
|
|
7565
7663
|
}
|
|
7566
7664
|
|
|
7567
|
-
const version = "3.3.0-
|
|
7665
|
+
const version = "3.3.0-beta.1";
|
|
7568
7666
|
const _ssrUtils = {
|
|
7569
7667
|
createComponentInstance,
|
|
7570
7668
|
setupComponent,
|
|
@@ -7641,6 +7739,7 @@ exports.defineAsyncComponent = defineAsyncComponent;
|
|
|
7641
7739
|
exports.defineComponent = defineComponent;
|
|
7642
7740
|
exports.defineEmits = defineEmits;
|
|
7643
7741
|
exports.defineExpose = defineExpose;
|
|
7742
|
+
exports.defineModel = defineModel;
|
|
7644
7743
|
exports.defineOptions = defineOptions;
|
|
7645
7744
|
exports.defineProps = defineProps;
|
|
7646
7745
|
exports.defineSlots = defineSlots;
|
|
@@ -7649,12 +7748,14 @@ exports.getTransitionRawChildren = getTransitionRawChildren;
|
|
|
7649
7748
|
exports.guardReactiveProps = guardReactiveProps;
|
|
7650
7749
|
exports.h = h;
|
|
7651
7750
|
exports.handleError = handleError;
|
|
7751
|
+
exports.hasInjectionContext = hasInjectionContext;
|
|
7652
7752
|
exports.initCustomFormatter = initCustomFormatter;
|
|
7653
7753
|
exports.inject = inject;
|
|
7654
7754
|
exports.isMemoSame = isMemoSame;
|
|
7655
7755
|
exports.isRuntimeOnly = isRuntimeOnly;
|
|
7656
7756
|
exports.isVNode = isVNode;
|
|
7657
7757
|
exports.mergeDefaults = mergeDefaults;
|
|
7758
|
+
exports.mergeModels = mergeModels;
|
|
7658
7759
|
exports.mergeProps = mergeProps;
|
|
7659
7760
|
exports.nextTick = nextTick;
|
|
7660
7761
|
exports.onActivated = onActivated;
|
|
@@ -7690,6 +7791,7 @@ exports.ssrUtils = ssrUtils;
|
|
|
7690
7791
|
exports.toHandlers = toHandlers;
|
|
7691
7792
|
exports.transformVNodeArgs = transformVNodeArgs;
|
|
7692
7793
|
exports.useAttrs = useAttrs;
|
|
7794
|
+
exports.useModel = useModel;
|
|
7693
7795
|
exports.useSSRContext = useSSRContext;
|
|
7694
7796
|
exports.useSlots = useSlots;
|
|
7695
7797
|
exports.useTransitionState = useTransitionState;
|