@vue/runtime-core 3.3.0-alpha.1 → 3.3.0-alpha.10
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 +773 -663
- package/dist/runtime-core.cjs.prod.js +383 -292
- package/dist/runtime-core.d.ts +356 -248
- package/dist/runtime-core.esm-bundler.js +786 -677
- 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);
|
|
@@ -1591,36 +1593,6 @@ function setActiveBranch(suspense, branch) {
|
|
|
1591
1593
|
}
|
|
1592
1594
|
}
|
|
1593
1595
|
|
|
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
1596
|
function watchEffect(effect, options) {
|
|
1625
1597
|
return doWatch(effect, null, options);
|
|
1626
1598
|
}
|
|
@@ -1867,6 +1839,65 @@ function traverse(value, seen) {
|
|
|
1867
1839
|
return value;
|
|
1868
1840
|
}
|
|
1869
1841
|
|
|
1842
|
+
function validateDirectiveName(name) {
|
|
1843
|
+
if (shared.isBuiltInDirective(name)) {
|
|
1844
|
+
warn("Do not use built-in directive ids as custom directive id: " + name);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
function withDirectives(vnode, directives) {
|
|
1848
|
+
const internalInstance = currentRenderingInstance;
|
|
1849
|
+
if (internalInstance === null) {
|
|
1850
|
+
warn(`withDirectives can only be used inside render functions.`);
|
|
1851
|
+
return vnode;
|
|
1852
|
+
}
|
|
1853
|
+
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
|
|
1854
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
1855
|
+
for (let i = 0; i < directives.length; i++) {
|
|
1856
|
+
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
1857
|
+
if (dir) {
|
|
1858
|
+
if (shared.isFunction(dir)) {
|
|
1859
|
+
dir = {
|
|
1860
|
+
mounted: dir,
|
|
1861
|
+
updated: dir
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
if (dir.deep) {
|
|
1865
|
+
traverse(value);
|
|
1866
|
+
}
|
|
1867
|
+
bindings.push({
|
|
1868
|
+
dir,
|
|
1869
|
+
instance,
|
|
1870
|
+
value,
|
|
1871
|
+
oldValue: void 0,
|
|
1872
|
+
arg,
|
|
1873
|
+
modifiers
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
return vnode;
|
|
1878
|
+
}
|
|
1879
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
1880
|
+
const bindings = vnode.dirs;
|
|
1881
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
1882
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
1883
|
+
const binding = bindings[i];
|
|
1884
|
+
if (oldBindings) {
|
|
1885
|
+
binding.oldValue = oldBindings[i].value;
|
|
1886
|
+
}
|
|
1887
|
+
let hook = binding.dir[name];
|
|
1888
|
+
if (hook) {
|
|
1889
|
+
reactivity.pauseTracking();
|
|
1890
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
1891
|
+
vnode.el,
|
|
1892
|
+
binding,
|
|
1893
|
+
vnode,
|
|
1894
|
+
prevVNode
|
|
1895
|
+
]);
|
|
1896
|
+
reactivity.resetTracking();
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1870
1901
|
function useTransitionState() {
|
|
1871
1902
|
const state = {
|
|
1872
1903
|
isMounted: false,
|
|
@@ -2191,8 +2222,8 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
2191
2222
|
return ret;
|
|
2192
2223
|
}
|
|
2193
2224
|
|
|
2194
|
-
function defineComponent(options) {
|
|
2195
|
-
return shared.isFunction(options) ? { setup: options, name: options.name } : options;
|
|
2225
|
+
function defineComponent(options, extraOptions) {
|
|
2226
|
+
return shared.isFunction(options) ? shared.extend({}, extraOptions, { setup: options, name: options.name }) : options;
|
|
2196
2227
|
}
|
|
2197
2228
|
|
|
2198
2229
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
@@ -2630,71 +2661,12 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2630
2661
|
injectHook("ec", hook, target);
|
|
2631
2662
|
}
|
|
2632
2663
|
|
|
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
2664
|
const COMPONENTS = "components";
|
|
2693
2665
|
const DIRECTIVES = "directives";
|
|
2694
2666
|
function resolveComponent(name, maybeSelfReference) {
|
|
2695
2667
|
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
2696
2668
|
}
|
|
2697
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
2669
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
2698
2670
|
function resolveDynamicComponent(component) {
|
|
2699
2671
|
if (shared.isString(component)) {
|
|
2700
2672
|
return resolveAsset(COMPONENTS, component, false) || component;
|
|
@@ -3106,103 +3078,258 @@ function exposeSetupStateOnRenderContext(instance) {
|
|
|
3106
3078
|
});
|
|
3107
3079
|
}
|
|
3108
3080
|
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
};
|
|
3081
|
+
const warnRuntimeUsage = (method) => warn(
|
|
3082
|
+
`${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.`
|
|
3083
|
+
);
|
|
3084
|
+
function defineProps() {
|
|
3085
|
+
{
|
|
3086
|
+
warnRuntimeUsage(`defineProps`);
|
|
3087
|
+
}
|
|
3088
|
+
return null;
|
|
3118
3089
|
}
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
const publicThis = instance.proxy;
|
|
3123
|
-
const ctx = instance.ctx;
|
|
3124
|
-
shouldCacheAccess = false;
|
|
3125
|
-
if (options.beforeCreate) {
|
|
3126
|
-
callHook(options.beforeCreate, instance, "bc");
|
|
3090
|
+
function defineEmits() {
|
|
3091
|
+
{
|
|
3092
|
+
warnRuntimeUsage(`defineEmits`);
|
|
3127
3093
|
}
|
|
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() ;
|
|
3094
|
+
return null;
|
|
3095
|
+
}
|
|
3096
|
+
function defineExpose(exposed) {
|
|
3162
3097
|
{
|
|
3163
|
-
|
|
3164
|
-
if (propsOptions) {
|
|
3165
|
-
for (const key in propsOptions) {
|
|
3166
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3098
|
+
warnRuntimeUsage(`defineExpose`);
|
|
3169
3099
|
}
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
checkDuplicateProperties,
|
|
3175
|
-
instance.appContext.config.unwrapInjectedRef
|
|
3176
|
-
);
|
|
3100
|
+
}
|
|
3101
|
+
function defineOptions(options) {
|
|
3102
|
+
{
|
|
3103
|
+
warnRuntimeUsage(`defineOptions`);
|
|
3177
3104
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
{
|
|
3183
|
-
Object.defineProperty(ctx, key, {
|
|
3184
|
-
value: methodHandler.bind(publicThis),
|
|
3185
|
-
configurable: true,
|
|
3186
|
-
enumerable: true,
|
|
3187
|
-
writable: true
|
|
3188
|
-
});
|
|
3189
|
-
}
|
|
3190
|
-
{
|
|
3191
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
3192
|
-
}
|
|
3193
|
-
} else {
|
|
3194
|
-
warn(
|
|
3195
|
-
`Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
|
3196
|
-
);
|
|
3197
|
-
}
|
|
3198
|
-
}
|
|
3105
|
+
}
|
|
3106
|
+
function defineSlots() {
|
|
3107
|
+
{
|
|
3108
|
+
warnRuntimeUsage(`defineSlots`);
|
|
3199
3109
|
}
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3110
|
+
return null;
|
|
3111
|
+
}
|
|
3112
|
+
function defineModel() {
|
|
3113
|
+
{
|
|
3114
|
+
warnRuntimeUsage("defineModel");
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
function withDefaults(props, defaults) {
|
|
3118
|
+
{
|
|
3119
|
+
warnRuntimeUsage(`withDefaults`);
|
|
3120
|
+
}
|
|
3121
|
+
return null;
|
|
3122
|
+
}
|
|
3123
|
+
function useSlots() {
|
|
3124
|
+
return getContext().slots;
|
|
3125
|
+
}
|
|
3126
|
+
function useAttrs() {
|
|
3127
|
+
return getContext().attrs;
|
|
3128
|
+
}
|
|
3129
|
+
function useModel(props, name, options) {
|
|
3130
|
+
const i = getCurrentInstance();
|
|
3131
|
+
if (!i) {
|
|
3132
|
+
warn(`useModel() called without active instance.`);
|
|
3133
|
+
return reactivity.ref();
|
|
3134
|
+
}
|
|
3135
|
+
if (!i.propsOptions[0][name]) {
|
|
3136
|
+
warn(`useModel() called with prop "${name}" which is not declared.`);
|
|
3137
|
+
return reactivity.ref();
|
|
3138
|
+
}
|
|
3139
|
+
if (options && options.local) {
|
|
3140
|
+
const proxy = reactivity.ref(props[name]);
|
|
3141
|
+
watch(
|
|
3142
|
+
() => props[name],
|
|
3143
|
+
(v) => proxy.value = v
|
|
3144
|
+
);
|
|
3145
|
+
watch(proxy, (value) => {
|
|
3146
|
+
if (value !== props[name]) {
|
|
3147
|
+
i.emit(`update:${name}`, value);
|
|
3148
|
+
}
|
|
3149
|
+
});
|
|
3150
|
+
return proxy;
|
|
3151
|
+
} else {
|
|
3152
|
+
return {
|
|
3153
|
+
__v_isRef: true,
|
|
3154
|
+
get value() {
|
|
3155
|
+
return props[name];
|
|
3156
|
+
},
|
|
3157
|
+
set value(value) {
|
|
3158
|
+
i.emit(`update:${name}`, value);
|
|
3159
|
+
}
|
|
3160
|
+
};
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
function getContext() {
|
|
3164
|
+
const i = getCurrentInstance();
|
|
3165
|
+
if (!i) {
|
|
3166
|
+
warn(`useContext() called without active instance.`);
|
|
3167
|
+
}
|
|
3168
|
+
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
3169
|
+
}
|
|
3170
|
+
function normalizePropsOrEmits(props) {
|
|
3171
|
+
return shared.isArray(props) ? props.reduce(
|
|
3172
|
+
(normalized, p) => (normalized[p] = null, normalized),
|
|
3173
|
+
{}
|
|
3174
|
+
) : props;
|
|
3175
|
+
}
|
|
3176
|
+
function mergeDefaults(raw, defaults) {
|
|
3177
|
+
const props = normalizePropsOrEmits(raw);
|
|
3178
|
+
for (const key in defaults) {
|
|
3179
|
+
if (key.startsWith("__skip"))
|
|
3180
|
+
continue;
|
|
3181
|
+
let opt = props[key];
|
|
3182
|
+
if (opt) {
|
|
3183
|
+
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
3184
|
+
opt = props[key] = { type: opt, default: defaults[key] };
|
|
3185
|
+
} else {
|
|
3186
|
+
opt.default = defaults[key];
|
|
3187
|
+
}
|
|
3188
|
+
} else if (opt === null) {
|
|
3189
|
+
opt = props[key] = { default: defaults[key] };
|
|
3190
|
+
} else {
|
|
3191
|
+
warn(`props default key "${key}" has no corresponding declaration.`);
|
|
3192
|
+
}
|
|
3193
|
+
if (opt && defaults[`__skip_${key}`]) {
|
|
3194
|
+
opt.skipFactory = true;
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
return props;
|
|
3198
|
+
}
|
|
3199
|
+
function mergeModels(a, b) {
|
|
3200
|
+
if (!a || !b)
|
|
3201
|
+
return a || b;
|
|
3202
|
+
if (shared.isArray(a) && shared.isArray(b))
|
|
3203
|
+
return a.concat(b);
|
|
3204
|
+
return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
|
3205
|
+
}
|
|
3206
|
+
function createPropsRestProxy(props, excludedKeys) {
|
|
3207
|
+
const ret = {};
|
|
3208
|
+
for (const key in props) {
|
|
3209
|
+
if (!excludedKeys.includes(key)) {
|
|
3210
|
+
Object.defineProperty(ret, key, {
|
|
3211
|
+
enumerable: true,
|
|
3212
|
+
get: () => props[key]
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
return ret;
|
|
3217
|
+
}
|
|
3218
|
+
function withAsyncContext(getAwaitable) {
|
|
3219
|
+
const ctx = getCurrentInstance();
|
|
3220
|
+
if (!ctx) {
|
|
3221
|
+
warn(
|
|
3222
|
+
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
3223
|
+
);
|
|
3224
|
+
}
|
|
3225
|
+
let awaitable = getAwaitable();
|
|
3226
|
+
unsetCurrentInstance();
|
|
3227
|
+
if (shared.isPromise(awaitable)) {
|
|
3228
|
+
awaitable = awaitable.catch((e) => {
|
|
3229
|
+
setCurrentInstance(ctx);
|
|
3230
|
+
throw e;
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
return [awaitable, () => setCurrentInstance(ctx)];
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
function createDuplicateChecker() {
|
|
3237
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
3238
|
+
return (type, key) => {
|
|
3239
|
+
if (cache[key]) {
|
|
3240
|
+
warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
3241
|
+
} else {
|
|
3242
|
+
cache[key] = type;
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
let shouldCacheAccess = true;
|
|
3247
|
+
function applyOptions(instance) {
|
|
3248
|
+
const options = resolveMergedOptions(instance);
|
|
3249
|
+
const publicThis = instance.proxy;
|
|
3250
|
+
const ctx = instance.ctx;
|
|
3251
|
+
shouldCacheAccess = false;
|
|
3252
|
+
if (options.beforeCreate) {
|
|
3253
|
+
callHook(options.beforeCreate, instance, "bc");
|
|
3254
|
+
}
|
|
3255
|
+
const {
|
|
3256
|
+
// state
|
|
3257
|
+
data: dataOptions,
|
|
3258
|
+
computed: computedOptions,
|
|
3259
|
+
methods,
|
|
3260
|
+
watch: watchOptions,
|
|
3261
|
+
provide: provideOptions,
|
|
3262
|
+
inject: injectOptions,
|
|
3263
|
+
// lifecycle
|
|
3264
|
+
created,
|
|
3265
|
+
beforeMount,
|
|
3266
|
+
mounted,
|
|
3267
|
+
beforeUpdate,
|
|
3268
|
+
updated,
|
|
3269
|
+
activated,
|
|
3270
|
+
deactivated,
|
|
3271
|
+
beforeDestroy,
|
|
3272
|
+
beforeUnmount,
|
|
3273
|
+
destroyed,
|
|
3274
|
+
unmounted,
|
|
3275
|
+
render,
|
|
3276
|
+
renderTracked,
|
|
3277
|
+
renderTriggered,
|
|
3278
|
+
errorCaptured,
|
|
3279
|
+
serverPrefetch,
|
|
3280
|
+
// public API
|
|
3281
|
+
expose,
|
|
3282
|
+
inheritAttrs,
|
|
3283
|
+
// assets
|
|
3284
|
+
components,
|
|
3285
|
+
directives,
|
|
3286
|
+
filters
|
|
3287
|
+
} = options;
|
|
3288
|
+
const checkDuplicateProperties = createDuplicateChecker() ;
|
|
3289
|
+
{
|
|
3290
|
+
const [propsOptions] = instance.propsOptions;
|
|
3291
|
+
if (propsOptions) {
|
|
3292
|
+
for (const key in propsOptions) {
|
|
3293
|
+
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
if (injectOptions) {
|
|
3298
|
+
resolveInjections(
|
|
3299
|
+
injectOptions,
|
|
3300
|
+
ctx,
|
|
3301
|
+
checkDuplicateProperties,
|
|
3302
|
+
instance.appContext.config.unwrapInjectedRef
|
|
3303
|
+
);
|
|
3304
|
+
}
|
|
3305
|
+
if (methods) {
|
|
3306
|
+
for (const key in methods) {
|
|
3307
|
+
const methodHandler = methods[key];
|
|
3308
|
+
if (shared.isFunction(methodHandler)) {
|
|
3309
|
+
{
|
|
3310
|
+
Object.defineProperty(ctx, key, {
|
|
3311
|
+
value: methodHandler.bind(publicThis),
|
|
3312
|
+
configurable: true,
|
|
3313
|
+
enumerable: true,
|
|
3314
|
+
writable: true
|
|
3315
|
+
});
|
|
3316
|
+
}
|
|
3317
|
+
{
|
|
3318
|
+
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
3319
|
+
}
|
|
3320
|
+
} else {
|
|
3321
|
+
warn(
|
|
3322
|
+
`Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
|
|
3323
|
+
);
|
|
3324
|
+
}
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
if (dataOptions) {
|
|
3328
|
+
if (!shared.isFunction(dataOptions)) {
|
|
3329
|
+
warn(
|
|
3330
|
+
`The data option must be a function. Plain object usage is no longer supported.`
|
|
3331
|
+
);
|
|
3332
|
+
}
|
|
3206
3333
|
const data = dataOptions.call(publicThis, publicThis);
|
|
3207
3334
|
if (shared.isPromise(data)) {
|
|
3208
3335
|
warn(
|
|
@@ -3445,10 +3572,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
|
|
|
3445
3572
|
}
|
|
3446
3573
|
const internalOptionMergeStrats = {
|
|
3447
3574
|
data: mergeDataFn,
|
|
3448
|
-
props:
|
|
3449
|
-
|
|
3450
|
-
emits: mergeObjectOptions,
|
|
3451
|
-
// TODO
|
|
3575
|
+
props: mergeEmitsOrPropsOptions,
|
|
3576
|
+
emits: mergeEmitsOrPropsOptions,
|
|
3452
3577
|
// objects
|
|
3453
3578
|
methods: mergeObjectOptions,
|
|
3454
3579
|
computed: mergeObjectOptions,
|
|
@@ -3507,7 +3632,21 @@ function mergeAsArray(to, from) {
|
|
|
3507
3632
|
return to ? [...new Set([].concat(to, from))] : from;
|
|
3508
3633
|
}
|
|
3509
3634
|
function mergeObjectOptions(to, from) {
|
|
3510
|
-
return to ? shared.extend(
|
|
3635
|
+
return to ? shared.extend(/* @__PURE__ */ Object.create(null), to, from) : from;
|
|
3636
|
+
}
|
|
3637
|
+
function mergeEmitsOrPropsOptions(to, from) {
|
|
3638
|
+
if (to) {
|
|
3639
|
+
if (shared.isArray(to) && shared.isArray(from)) {
|
|
3640
|
+
return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
3641
|
+
}
|
|
3642
|
+
return shared.extend(
|
|
3643
|
+
/* @__PURE__ */ Object.create(null),
|
|
3644
|
+
normalizePropsOrEmits(to),
|
|
3645
|
+
normalizePropsOrEmits(from != null ? from : {})
|
|
3646
|
+
);
|
|
3647
|
+
} else {
|
|
3648
|
+
return from;
|
|
3649
|
+
}
|
|
3511
3650
|
}
|
|
3512
3651
|
function mergeWatchOptions(to, from) {
|
|
3513
3652
|
if (!to)
|
|
@@ -3521,45 +3660,254 @@ function mergeWatchOptions(to, from) {
|
|
|
3521
3660
|
return merged;
|
|
3522
3661
|
}
|
|
3523
3662
|
|
|
3524
|
-
function
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3663
|
+
function createAppContext() {
|
|
3664
|
+
return {
|
|
3665
|
+
app: null,
|
|
3666
|
+
config: {
|
|
3667
|
+
isNativeTag: shared.NO,
|
|
3668
|
+
performance: false,
|
|
3669
|
+
globalProperties: {},
|
|
3670
|
+
optionMergeStrategies: {},
|
|
3671
|
+
errorHandler: void 0,
|
|
3672
|
+
warnHandler: void 0,
|
|
3673
|
+
compilerOptions: {}
|
|
3674
|
+
},
|
|
3675
|
+
mixins: [],
|
|
3676
|
+
components: {},
|
|
3677
|
+
directives: {},
|
|
3678
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
3679
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
3680
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
3681
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
3682
|
+
};
|
|
3683
|
+
}
|
|
3684
|
+
let uid$1 = 0;
|
|
3685
|
+
function createAppAPI(render, hydrate) {
|
|
3686
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
3687
|
+
if (!shared.isFunction(rootComponent)) {
|
|
3688
|
+
rootComponent = shared.extend({}, rootComponent);
|
|
3533
3689
|
}
|
|
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;
|
|
3690
|
+
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
3691
|
+
warn(`root props passed to app.mount() must be an object.`);
|
|
3692
|
+
rootProps = null;
|
|
3545
3693
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3694
|
+
const context = createAppContext();
|
|
3695
|
+
const installedPlugins = /* @__PURE__ */ new Set();
|
|
3696
|
+
let isMounted = false;
|
|
3697
|
+
const app = context.app = {
|
|
3698
|
+
_uid: uid$1++,
|
|
3699
|
+
_component: rootComponent,
|
|
3700
|
+
_props: rootProps,
|
|
3701
|
+
_container: null,
|
|
3702
|
+
_context: context,
|
|
3703
|
+
_instance: null,
|
|
3704
|
+
version,
|
|
3705
|
+
get config() {
|
|
3706
|
+
return context.config;
|
|
3707
|
+
},
|
|
3708
|
+
set config(v) {
|
|
3709
|
+
{
|
|
3710
|
+
warn(
|
|
3711
|
+
`app.config cannot be replaced. Modify individual options instead.`
|
|
3712
|
+
);
|
|
3713
|
+
}
|
|
3714
|
+
},
|
|
3715
|
+
use(plugin, ...options) {
|
|
3716
|
+
if (installedPlugins.has(plugin)) {
|
|
3717
|
+
warn(`Plugin has already been applied to target app.`);
|
|
3718
|
+
} else if (plugin && shared.isFunction(plugin.install)) {
|
|
3719
|
+
installedPlugins.add(plugin);
|
|
3720
|
+
plugin.install(app, ...options);
|
|
3721
|
+
} else if (shared.isFunction(plugin)) {
|
|
3722
|
+
installedPlugins.add(plugin);
|
|
3723
|
+
plugin(app, ...options);
|
|
3724
|
+
} else {
|
|
3725
|
+
warn(
|
|
3726
|
+
`A plugin must either be a function or an object with an "install" function.`
|
|
3727
|
+
);
|
|
3728
|
+
}
|
|
3729
|
+
return app;
|
|
3730
|
+
},
|
|
3731
|
+
mixin(mixin) {
|
|
3732
|
+
{
|
|
3733
|
+
if (!context.mixins.includes(mixin)) {
|
|
3734
|
+
context.mixins.push(mixin);
|
|
3735
|
+
} else {
|
|
3736
|
+
warn(
|
|
3737
|
+
"Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
|
3738
|
+
);
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
return app;
|
|
3742
|
+
},
|
|
3743
|
+
component(name, component) {
|
|
3744
|
+
{
|
|
3745
|
+
validateComponentName(name, context.config);
|
|
3746
|
+
}
|
|
3747
|
+
if (!component) {
|
|
3748
|
+
return context.components[name];
|
|
3749
|
+
}
|
|
3750
|
+
if (context.components[name]) {
|
|
3751
|
+
warn(`Component "${name}" has already been registered in target app.`);
|
|
3752
|
+
}
|
|
3753
|
+
context.components[name] = component;
|
|
3754
|
+
return app;
|
|
3755
|
+
},
|
|
3756
|
+
directive(name, directive) {
|
|
3757
|
+
{
|
|
3758
|
+
validateDirectiveName(name);
|
|
3759
|
+
}
|
|
3760
|
+
if (!directive) {
|
|
3761
|
+
return context.directives[name];
|
|
3762
|
+
}
|
|
3763
|
+
if (context.directives[name]) {
|
|
3764
|
+
warn(`Directive "${name}" has already been registered in target app.`);
|
|
3765
|
+
}
|
|
3766
|
+
context.directives[name] = directive;
|
|
3767
|
+
return app;
|
|
3768
|
+
},
|
|
3769
|
+
mount(rootContainer, isHydrate, isSVG) {
|
|
3770
|
+
if (!isMounted) {
|
|
3771
|
+
if (rootContainer.__vue_app__) {
|
|
3772
|
+
warn(
|
|
3773
|
+
`There is already an app instance mounted on the host container.
|
|
3774
|
+
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
3775
|
+
);
|
|
3776
|
+
}
|
|
3777
|
+
const vnode = createVNode(
|
|
3778
|
+
rootComponent,
|
|
3779
|
+
rootProps
|
|
3780
|
+
);
|
|
3781
|
+
vnode.appContext = context;
|
|
3782
|
+
{
|
|
3783
|
+
context.reload = () => {
|
|
3784
|
+
render(cloneVNode(vnode), rootContainer, isSVG);
|
|
3785
|
+
};
|
|
3786
|
+
}
|
|
3787
|
+
if (isHydrate && hydrate) {
|
|
3788
|
+
hydrate(vnode, rootContainer);
|
|
3789
|
+
} else {
|
|
3790
|
+
render(vnode, rootContainer, isSVG);
|
|
3791
|
+
}
|
|
3792
|
+
isMounted = true;
|
|
3793
|
+
app._container = rootContainer;
|
|
3794
|
+
rootContainer.__vue_app__ = app;
|
|
3795
|
+
{
|
|
3796
|
+
app._instance = vnode.component;
|
|
3797
|
+
devtoolsInitApp(app, version);
|
|
3798
|
+
}
|
|
3799
|
+
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
3800
|
+
} else {
|
|
3801
|
+
warn(
|
|
3802
|
+
`App has already been mounted.
|
|
3803
|
+
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)\``
|
|
3804
|
+
);
|
|
3805
|
+
}
|
|
3806
|
+
},
|
|
3807
|
+
unmount() {
|
|
3808
|
+
if (isMounted) {
|
|
3809
|
+
render(null, app._container);
|
|
3810
|
+
{
|
|
3811
|
+
app._instance = null;
|
|
3812
|
+
devtoolsUnmountApp(app);
|
|
3813
|
+
}
|
|
3814
|
+
delete app._container.__vue_app__;
|
|
3815
|
+
} else {
|
|
3816
|
+
warn(`Cannot unmount an app that is not mounted.`);
|
|
3817
|
+
}
|
|
3818
|
+
},
|
|
3819
|
+
provide(key, value) {
|
|
3820
|
+
if (key in context.provides) {
|
|
3821
|
+
warn(
|
|
3822
|
+
`App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
|
3823
|
+
);
|
|
3824
|
+
}
|
|
3825
|
+
context.provides[key] = value;
|
|
3826
|
+
return app;
|
|
3827
|
+
},
|
|
3828
|
+
runWithContext(fn) {
|
|
3829
|
+
currentApp = app;
|
|
3830
|
+
try {
|
|
3831
|
+
return fn();
|
|
3832
|
+
} finally {
|
|
3833
|
+
currentApp = null;
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
};
|
|
3837
|
+
return app;
|
|
3838
|
+
};
|
|
3839
|
+
}
|
|
3840
|
+
let currentApp = null;
|
|
3841
|
+
|
|
3842
|
+
function provide(key, value) {
|
|
3843
|
+
if (!currentInstance) {
|
|
3844
|
+
{
|
|
3845
|
+
warn(`provide() can only be used inside setup().`);
|
|
3846
|
+
}
|
|
3847
|
+
} else {
|
|
3848
|
+
let provides = currentInstance.provides;
|
|
3849
|
+
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
3850
|
+
if (parentProvides === provides) {
|
|
3851
|
+
provides = currentInstance.provides = Object.create(parentProvides);
|
|
3852
|
+
}
|
|
3853
|
+
provides[key] = value;
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
3857
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
3858
|
+
if (instance || currentApp) {
|
|
3859
|
+
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
|
3860
|
+
if (provides && key in provides) {
|
|
3861
|
+
return provides[key];
|
|
3862
|
+
} else if (arguments.length > 1) {
|
|
3863
|
+
return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
3864
|
+
} else {
|
|
3865
|
+
warn(`injection "${String(key)}" not found.`);
|
|
3866
|
+
}
|
|
3867
|
+
} else {
|
|
3868
|
+
warn(`inject() can only be used inside setup() or functional components.`);
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
3873
|
+
const props = {};
|
|
3874
|
+
const attrs = {};
|
|
3875
|
+
shared.def(attrs, InternalObjectKey, 1);
|
|
3876
|
+
instance.propsDefaults = /* @__PURE__ */ Object.create(null);
|
|
3877
|
+
setFullProps(instance, rawProps, props, attrs);
|
|
3878
|
+
for (const key in instance.propsOptions[0]) {
|
|
3879
|
+
if (!(key in props)) {
|
|
3880
|
+
props[key] = void 0;
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
{
|
|
3884
|
+
validateProps(rawProps || {}, props, instance);
|
|
3885
|
+
}
|
|
3886
|
+
if (isStateful) {
|
|
3887
|
+
instance.props = isSSR ? props : reactivity.shallowReactive(props);
|
|
3888
|
+
} else {
|
|
3889
|
+
if (!instance.type.props) {
|
|
3890
|
+
instance.props = attrs;
|
|
3891
|
+
} else {
|
|
3892
|
+
instance.props = props;
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
instance.attrs = attrs;
|
|
3896
|
+
}
|
|
3897
|
+
function isInHmrContext(instance) {
|
|
3898
|
+
while (instance) {
|
|
3899
|
+
if (instance.type.__hmrId)
|
|
3900
|
+
return true;
|
|
3901
|
+
instance = instance.parent;
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3904
|
+
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
3905
|
+
const {
|
|
3906
|
+
props,
|
|
3907
|
+
attrs,
|
|
3908
|
+
vnode: { patchFlag }
|
|
3909
|
+
} = instance;
|
|
3910
|
+
const rawCurrentProps = reactivity.toRaw(props);
|
|
3563
3911
|
const [options] = instance.propsOptions;
|
|
3564
3912
|
let hasAttrsChanged = false;
|
|
3565
3913
|
if (
|
|
@@ -3695,7 +4043,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3695
4043
|
const hasDefault = shared.hasOwn(opt, "default");
|
|
3696
4044
|
if (hasDefault && value === void 0) {
|
|
3697
4045
|
const defaultValue = opt.default;
|
|
3698
|
-
if (opt.type !== Function && shared.isFunction(defaultValue)) {
|
|
4046
|
+
if (opt.type !== Function && !opt.skipFactory && shared.isFunction(defaultValue)) {
|
|
3699
4047
|
const { propsDefaults } = instance;
|
|
3700
4048
|
if (key in propsDefaults) {
|
|
3701
4049
|
value = propsDefaults[key];
|
|
@@ -3831,358 +4179,188 @@ function validateProps(rawProps, props, instance) {
|
|
|
3831
4179
|
}
|
|
3832
4180
|
}
|
|
3833
4181
|
function validateProp(name, value, prop, isAbsent) {
|
|
3834
|
-
const { type, required, validator } = prop;
|
|
4182
|
+
const { type, required, validator, skipCheck } = prop;
|
|
3835
4183
|
if (required && isAbsent) {
|
|
3836
4184
|
warn('Missing required prop: "' + name + '"');
|
|
3837
4185
|
return;
|
|
3838
4186
|
}
|
|
3839
|
-
if (value == null && !
|
|
4187
|
+
if (value == null && !required) {
|
|
3840
4188
|
return;
|
|
3841
4189
|
}
|
|
3842
|
-
if (type != null && type !== true) {
|
|
4190
|
+
if (type != null && type !== true && !skipCheck) {
|
|
3843
4191
|
let isValid = false;
|
|
3844
4192
|
const types = shared.isArray(type) ? type : [type];
|
|
3845
4193
|
const expectedTypes = [];
|
|
3846
4194
|
for (let i = 0; i < types.length && !isValid; i++) {
|
|
3847
4195
|
const { valid, expectedType } = assertType(value, types[i]);
|
|
3848
|
-
expectedTypes.push(expectedType || "");
|
|
3849
|
-
isValid = valid;
|
|
3850
|
-
}
|
|
3851
|
-
if (!isValid) {
|
|
3852
|
-
warn(getInvalidTypeMessage(name, value, expectedTypes));
|
|
3853
|
-
return;
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
if (validator && !validator(value)) {
|
|
3857
|
-
warn('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
3858
|
-
}
|
|
3859
|
-
}
|
|
3860
|
-
const isSimpleType = /* @__PURE__ */ shared.makeMap(
|
|
3861
|
-
"String,Number,Boolean,Function,Symbol,BigInt"
|
|
3862
|
-
);
|
|
3863
|
-
function assertType(value, type) {
|
|
3864
|
-
let valid;
|
|
3865
|
-
const expectedType = getType(type);
|
|
3866
|
-
if (isSimpleType(expectedType)) {
|
|
3867
|
-
const t = typeof value;
|
|
3868
|
-
valid = t === expectedType.toLowerCase();
|
|
3869
|
-
if (!valid && t === "object") {
|
|
3870
|
-
valid = value instanceof type;
|
|
3871
|
-
}
|
|
3872
|
-
} 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;
|
|
4196
|
+
expectedTypes.push(expectedType || "");
|
|
4197
|
+
isValid = valid;
|
|
4198
|
+
}
|
|
4199
|
+
if (!isValid) {
|
|
4200
|
+
warn(getInvalidTypeMessage(name, value, expectedTypes));
|
|
4201
|
+
return;
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
if (validator && !validator(value)) {
|
|
4205
|
+
warn('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
const isSimpleType = /* @__PURE__ */ shared.makeMap(
|
|
4209
|
+
"String,Number,Boolean,Function,Symbol,BigInt"
|
|
4210
|
+
);
|
|
4211
|
+
function assertType(value, type) {
|
|
4212
|
+
let valid;
|
|
4213
|
+
const expectedType = getType(type);
|
|
4214
|
+
if (isSimpleType(expectedType)) {
|
|
4215
|
+
const t = typeof value;
|
|
4216
|
+
valid = t === expectedType.toLowerCase();
|
|
4217
|
+
if (!valid && t === "object") {
|
|
4218
|
+
valid = value instanceof type;
|
|
4219
|
+
}
|
|
4220
|
+
} else if (expectedType === "Object") {
|
|
4221
|
+
valid = shared.isObject(value);
|
|
4222
|
+
} else if (expectedType === "Array") {
|
|
4223
|
+
valid = shared.isArray(value);
|
|
4224
|
+
} else if (expectedType === "null") {
|
|
4225
|
+
valid = value === null;
|
|
4226
|
+
} else {
|
|
4227
|
+
valid = value instanceof type;
|
|
4228
|
+
}
|
|
4229
|
+
return {
|
|
4230
|
+
valid,
|
|
4231
|
+
expectedType
|
|
4184
4232
|
};
|
|
4185
4233
|
}
|
|
4234
|
+
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
4235
|
+
let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(shared.capitalize).join(" | ")}`;
|
|
4236
|
+
const expectedType = expectedTypes[0];
|
|
4237
|
+
const receivedType = shared.toRawType(value);
|
|
4238
|
+
const expectedValue = styleValue(value, expectedType);
|
|
4239
|
+
const receivedValue = styleValue(value, receivedType);
|
|
4240
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
|
4241
|
+
message += ` with value ${expectedValue}`;
|
|
4242
|
+
}
|
|
4243
|
+
message += `, got ${receivedType} `;
|
|
4244
|
+
if (isExplicable(receivedType)) {
|
|
4245
|
+
message += `with value ${receivedValue}.`;
|
|
4246
|
+
}
|
|
4247
|
+
return message;
|
|
4248
|
+
}
|
|
4249
|
+
function styleValue(value, type) {
|
|
4250
|
+
if (type === "String") {
|
|
4251
|
+
return `"${value}"`;
|
|
4252
|
+
} else if (type === "Number") {
|
|
4253
|
+
return `${Number(value)}`;
|
|
4254
|
+
} else {
|
|
4255
|
+
return `${value}`;
|
|
4256
|
+
}
|
|
4257
|
+
}
|
|
4258
|
+
function isExplicable(type) {
|
|
4259
|
+
const explicitTypes = ["string", "number", "boolean"];
|
|
4260
|
+
return explicitTypes.some((elem) => type.toLowerCase() === elem);
|
|
4261
|
+
}
|
|
4262
|
+
function isBoolean(...args) {
|
|
4263
|
+
return args.some((elem) => elem.toLowerCase() === "boolean");
|
|
4264
|
+
}
|
|
4265
|
+
|
|
4266
|
+
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
|
4267
|
+
const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
|
4268
|
+
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
4269
|
+
if (rawSlot._n) {
|
|
4270
|
+
return rawSlot;
|
|
4271
|
+
}
|
|
4272
|
+
const normalized = withCtx((...args) => {
|
|
4273
|
+
if (currentInstance) {
|
|
4274
|
+
warn(
|
|
4275
|
+
`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.`
|
|
4276
|
+
);
|
|
4277
|
+
}
|
|
4278
|
+
return normalizeSlotValue(rawSlot(...args));
|
|
4279
|
+
}, ctx);
|
|
4280
|
+
normalized._c = false;
|
|
4281
|
+
return normalized;
|
|
4282
|
+
};
|
|
4283
|
+
const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
4284
|
+
const ctx = rawSlots._ctx;
|
|
4285
|
+
for (const key in rawSlots) {
|
|
4286
|
+
if (isInternalKey(key))
|
|
4287
|
+
continue;
|
|
4288
|
+
const value = rawSlots[key];
|
|
4289
|
+
if (shared.isFunction(value)) {
|
|
4290
|
+
slots[key] = normalizeSlot(key, value, ctx);
|
|
4291
|
+
} else if (value != null) {
|
|
4292
|
+
{
|
|
4293
|
+
warn(
|
|
4294
|
+
`Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
|
|
4295
|
+
);
|
|
4296
|
+
}
|
|
4297
|
+
const normalized = normalizeSlotValue(value);
|
|
4298
|
+
slots[key] = () => normalized;
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
};
|
|
4302
|
+
const normalizeVNodeSlots = (instance, children) => {
|
|
4303
|
+
if (!isKeepAlive(instance.vnode) && true) {
|
|
4304
|
+
warn(
|
|
4305
|
+
`Non-function value encountered for default slot. Prefer function slots for better performance.`
|
|
4306
|
+
);
|
|
4307
|
+
}
|
|
4308
|
+
const normalized = normalizeSlotValue(children);
|
|
4309
|
+
instance.slots.default = () => normalized;
|
|
4310
|
+
};
|
|
4311
|
+
const initSlots = (instance, children) => {
|
|
4312
|
+
if (instance.vnode.shapeFlag & 32) {
|
|
4313
|
+
const type = children._;
|
|
4314
|
+
if (type) {
|
|
4315
|
+
instance.slots = reactivity.toRaw(children);
|
|
4316
|
+
shared.def(children, "_", type);
|
|
4317
|
+
} else {
|
|
4318
|
+
normalizeObjectSlots(
|
|
4319
|
+
children,
|
|
4320
|
+
instance.slots = {});
|
|
4321
|
+
}
|
|
4322
|
+
} else {
|
|
4323
|
+
instance.slots = {};
|
|
4324
|
+
if (children) {
|
|
4325
|
+
normalizeVNodeSlots(instance, children);
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
shared.def(instance.slots, InternalObjectKey, 1);
|
|
4329
|
+
};
|
|
4330
|
+
const updateSlots = (instance, children, optimized) => {
|
|
4331
|
+
const { vnode, slots } = instance;
|
|
4332
|
+
let needDeletionCheck = true;
|
|
4333
|
+
let deletionComparisonTarget = shared.EMPTY_OBJ;
|
|
4334
|
+
if (vnode.shapeFlag & 32) {
|
|
4335
|
+
const type = children._;
|
|
4336
|
+
if (type) {
|
|
4337
|
+
if (isHmrUpdating) {
|
|
4338
|
+
shared.extend(slots, children);
|
|
4339
|
+
} else if (optimized && type === 1) {
|
|
4340
|
+
needDeletionCheck = false;
|
|
4341
|
+
} else {
|
|
4342
|
+
shared.extend(slots, children);
|
|
4343
|
+
if (!optimized && type === 1) {
|
|
4344
|
+
delete slots._;
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
} else {
|
|
4348
|
+
needDeletionCheck = !children.$stable;
|
|
4349
|
+
normalizeObjectSlots(children, slots);
|
|
4350
|
+
}
|
|
4351
|
+
deletionComparisonTarget = children;
|
|
4352
|
+
} else if (children) {
|
|
4353
|
+
normalizeVNodeSlots(instance, children);
|
|
4354
|
+
deletionComparisonTarget = { default: 1 };
|
|
4355
|
+
}
|
|
4356
|
+
if (needDeletionCheck) {
|
|
4357
|
+
for (const key in slots) {
|
|
4358
|
+
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
|
4359
|
+
delete slots[key];
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
};
|
|
4186
4364
|
|
|
4187
4365
|
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4188
4366
|
if (shared.isArray(rawRef)) {
|
|
@@ -6452,10 +6630,10 @@ function updateCssVars(vnode) {
|
|
|
6452
6630
|
}
|
|
6453
6631
|
}
|
|
6454
6632
|
|
|
6455
|
-
const Fragment = Symbol("
|
|
6456
|
-
const Text = Symbol("
|
|
6457
|
-
const Comment = Symbol("
|
|
6458
|
-
const Static = Symbol("
|
|
6633
|
+
const Fragment = Symbol.for("v-fgt");
|
|
6634
|
+
const Text = Symbol.for("v-txt");
|
|
6635
|
+
const Comment = Symbol.for("v-cmt");
|
|
6636
|
+
const Static = Symbol.for("v-stc");
|
|
6459
6637
|
const blockStack = [];
|
|
6460
6638
|
let currentBlock = null;
|
|
6461
6639
|
function openBlock(disableTracking = false) {
|
|
@@ -6907,13 +7085,29 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6907
7085
|
}
|
|
6908
7086
|
let currentInstance = null;
|
|
6909
7087
|
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
7088
|
+
let internalSetCurrentInstance;
|
|
7089
|
+
let globalCurrentInstanceSetters;
|
|
7090
|
+
let settersKey = "__VUE_INSTANCE_SETTERS__";
|
|
7091
|
+
{
|
|
7092
|
+
if (!(globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey])) {
|
|
7093
|
+
globalCurrentInstanceSetters = shared.getGlobalThis()[settersKey] = [];
|
|
7094
|
+
}
|
|
7095
|
+
globalCurrentInstanceSetters.push((i) => currentInstance = i);
|
|
7096
|
+
internalSetCurrentInstance = (instance) => {
|
|
7097
|
+
if (globalCurrentInstanceSetters.length > 1) {
|
|
7098
|
+
globalCurrentInstanceSetters.forEach((s) => s(instance));
|
|
7099
|
+
} else {
|
|
7100
|
+
globalCurrentInstanceSetters[0](instance);
|
|
7101
|
+
}
|
|
7102
|
+
};
|
|
7103
|
+
}
|
|
6910
7104
|
const setCurrentInstance = (instance) => {
|
|
6911
|
-
|
|
7105
|
+
internalSetCurrentInstance(instance);
|
|
6912
7106
|
instance.scope.on();
|
|
6913
7107
|
};
|
|
6914
7108
|
const unsetCurrentInstance = () => {
|
|
6915
7109
|
currentInstance && currentInstance.scope.off();
|
|
6916
|
-
|
|
7110
|
+
internalSetCurrentInstance(null);
|
|
6917
7111
|
};
|
|
6918
7112
|
const isBuiltInTag = /* @__PURE__ */ shared.makeMap("slot,component");
|
|
6919
7113
|
function validateComponentName(name, config) {
|
|
@@ -7204,96 +7398,6 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
7204
7398
|
return reactivity.computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
7205
7399
|
};
|
|
7206
7400
|
|
|
7207
|
-
const warnRuntimeUsage = (method) => warn(
|
|
7208
|
-
`${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.`
|
|
7209
|
-
);
|
|
7210
|
-
function defineProps() {
|
|
7211
|
-
{
|
|
7212
|
-
warnRuntimeUsage(`defineProps`);
|
|
7213
|
-
}
|
|
7214
|
-
return null;
|
|
7215
|
-
}
|
|
7216
|
-
function defineEmits() {
|
|
7217
|
-
{
|
|
7218
|
-
warnRuntimeUsage(`defineEmits`);
|
|
7219
|
-
}
|
|
7220
|
-
return null;
|
|
7221
|
-
}
|
|
7222
|
-
function defineExpose(exposed) {
|
|
7223
|
-
{
|
|
7224
|
-
warnRuntimeUsage(`defineExpose`);
|
|
7225
|
-
}
|
|
7226
|
-
}
|
|
7227
|
-
function withDefaults(props, defaults) {
|
|
7228
|
-
{
|
|
7229
|
-
warnRuntimeUsage(`withDefaults`);
|
|
7230
|
-
}
|
|
7231
|
-
return null;
|
|
7232
|
-
}
|
|
7233
|
-
function useSlots() {
|
|
7234
|
-
return getContext().slots;
|
|
7235
|
-
}
|
|
7236
|
-
function useAttrs() {
|
|
7237
|
-
return getContext().attrs;
|
|
7238
|
-
}
|
|
7239
|
-
function getContext() {
|
|
7240
|
-
const i = getCurrentInstance();
|
|
7241
|
-
if (!i) {
|
|
7242
|
-
warn(`useContext() called without active instance.`);
|
|
7243
|
-
}
|
|
7244
|
-
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
7245
|
-
}
|
|
7246
|
-
function mergeDefaults(raw, defaults) {
|
|
7247
|
-
const props = shared.isArray(raw) ? raw.reduce(
|
|
7248
|
-
(normalized, p) => (normalized[p] = {}, normalized),
|
|
7249
|
-
{}
|
|
7250
|
-
) : raw;
|
|
7251
|
-
for (const key in defaults) {
|
|
7252
|
-
const opt = props[key];
|
|
7253
|
-
if (opt) {
|
|
7254
|
-
if (shared.isArray(opt) || shared.isFunction(opt)) {
|
|
7255
|
-
props[key] = { type: opt, default: defaults[key] };
|
|
7256
|
-
} else {
|
|
7257
|
-
opt.default = defaults[key];
|
|
7258
|
-
}
|
|
7259
|
-
} else if (opt === null) {
|
|
7260
|
-
props[key] = { default: defaults[key] };
|
|
7261
|
-
} else {
|
|
7262
|
-
warn(`props default key "${key}" has no corresponding declaration.`);
|
|
7263
|
-
}
|
|
7264
|
-
}
|
|
7265
|
-
return props;
|
|
7266
|
-
}
|
|
7267
|
-
function createPropsRestProxy(props, excludedKeys) {
|
|
7268
|
-
const ret = {};
|
|
7269
|
-
for (const key in props) {
|
|
7270
|
-
if (!excludedKeys.includes(key)) {
|
|
7271
|
-
Object.defineProperty(ret, key, {
|
|
7272
|
-
enumerable: true,
|
|
7273
|
-
get: () => props[key]
|
|
7274
|
-
});
|
|
7275
|
-
}
|
|
7276
|
-
}
|
|
7277
|
-
return ret;
|
|
7278
|
-
}
|
|
7279
|
-
function withAsyncContext(getAwaitable) {
|
|
7280
|
-
const ctx = getCurrentInstance();
|
|
7281
|
-
if (!ctx) {
|
|
7282
|
-
warn(
|
|
7283
|
-
`withAsyncContext called without active current instance. This is likely a bug.`
|
|
7284
|
-
);
|
|
7285
|
-
}
|
|
7286
|
-
let awaitable = getAwaitable();
|
|
7287
|
-
unsetCurrentInstance();
|
|
7288
|
-
if (shared.isPromise(awaitable)) {
|
|
7289
|
-
awaitable = awaitable.catch((e) => {
|
|
7290
|
-
setCurrentInstance(ctx);
|
|
7291
|
-
throw e;
|
|
7292
|
-
});
|
|
7293
|
-
}
|
|
7294
|
-
return [awaitable, () => setCurrentInstance(ctx)];
|
|
7295
|
-
}
|
|
7296
|
-
|
|
7297
7401
|
function h(type, propsOrChildren, children) {
|
|
7298
7402
|
const l = arguments.length;
|
|
7299
7403
|
if (l === 2) {
|
|
@@ -7315,7 +7419,7 @@ function h(type, propsOrChildren, children) {
|
|
|
7315
7419
|
}
|
|
7316
7420
|
}
|
|
7317
7421
|
|
|
7318
|
-
const ssrContextKey = Symbol(
|
|
7422
|
+
const ssrContextKey = Symbol.for("v-scx");
|
|
7319
7423
|
const useSSRContext = () => {
|
|
7320
7424
|
{
|
|
7321
7425
|
const ctx = inject(ssrContextKey);
|
|
@@ -7533,7 +7637,7 @@ function isMemoSame(cached, memo) {
|
|
|
7533
7637
|
return true;
|
|
7534
7638
|
}
|
|
7535
7639
|
|
|
7536
|
-
const version = "3.3.0-alpha.
|
|
7640
|
+
const version = "3.3.0-alpha.10";
|
|
7537
7641
|
const _ssrUtils = {
|
|
7538
7642
|
createComponentInstance,
|
|
7539
7643
|
setupComponent,
|
|
@@ -7570,6 +7674,7 @@ exports.stop = reactivity.stop;
|
|
|
7570
7674
|
exports.toRaw = reactivity.toRaw;
|
|
7571
7675
|
exports.toRef = reactivity.toRef;
|
|
7572
7676
|
exports.toRefs = reactivity.toRefs;
|
|
7677
|
+
exports.toValue = reactivity.toValue;
|
|
7573
7678
|
exports.triggerRef = reactivity.triggerRef;
|
|
7574
7679
|
exports.unref = reactivity.unref;
|
|
7575
7680
|
exports.camelize = shared.camelize;
|
|
@@ -7609,7 +7714,10 @@ exports.defineAsyncComponent = defineAsyncComponent;
|
|
|
7609
7714
|
exports.defineComponent = defineComponent;
|
|
7610
7715
|
exports.defineEmits = defineEmits;
|
|
7611
7716
|
exports.defineExpose = defineExpose;
|
|
7717
|
+
exports.defineModel = defineModel;
|
|
7718
|
+
exports.defineOptions = defineOptions;
|
|
7612
7719
|
exports.defineProps = defineProps;
|
|
7720
|
+
exports.defineSlots = defineSlots;
|
|
7613
7721
|
exports.getCurrentInstance = getCurrentInstance;
|
|
7614
7722
|
exports.getTransitionRawChildren = getTransitionRawChildren;
|
|
7615
7723
|
exports.guardReactiveProps = guardReactiveProps;
|
|
@@ -7621,6 +7729,7 @@ exports.isMemoSame = isMemoSame;
|
|
|
7621
7729
|
exports.isRuntimeOnly = isRuntimeOnly;
|
|
7622
7730
|
exports.isVNode = isVNode;
|
|
7623
7731
|
exports.mergeDefaults = mergeDefaults;
|
|
7732
|
+
exports.mergeModels = mergeModels;
|
|
7624
7733
|
exports.mergeProps = mergeProps;
|
|
7625
7734
|
exports.nextTick = nextTick;
|
|
7626
7735
|
exports.onActivated = onActivated;
|
|
@@ -7656,6 +7765,7 @@ exports.ssrUtils = ssrUtils;
|
|
|
7656
7765
|
exports.toHandlers = toHandlers;
|
|
7657
7766
|
exports.transformVNodeArgs = transformVNodeArgs;
|
|
7658
7767
|
exports.useAttrs = useAttrs;
|
|
7768
|
+
exports.useModel = useModel;
|
|
7659
7769
|
exports.useSSRContext = useSSRContext;
|
|
7660
7770
|
exports.useSlots = useSlots;
|
|
7661
7771
|
exports.useTransitionState = useTransitionState;
|