@vue/runtime-core 3.3.0-alpha.8 → 3.3.0-alpha.9
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 +351 -289
- package/dist/runtime-core.cjs.prod.js +241 -190
- package/dist/runtime-core.d.ts +86 -20
- package/dist/runtime-core.esm-bundler.js +352 -293
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';
|
|
2
2
|
export { EffectScope, ReactiveEffect, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';
|
|
3
|
-
import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, invokeArrayFns, isRegExp,
|
|
3
|
+
import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, capitalize, isGloballyWhitelisted, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, normalizeStyle } from '@vue/shared';
|
|
4
4
|
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
5
5
|
|
|
6
6
|
const stack = [];
|
|
@@ -1595,36 +1595,6 @@ function setActiveBranch(suspense, branch) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
}
|
|
1597
1597
|
|
|
1598
|
-
function provide(key, value) {
|
|
1599
|
-
if (!currentInstance) {
|
|
1600
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1601
|
-
warn(`provide() can only be used inside setup().`);
|
|
1602
|
-
}
|
|
1603
|
-
} else {
|
|
1604
|
-
let provides = currentInstance.provides;
|
|
1605
|
-
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
1606
|
-
if (parentProvides === provides) {
|
|
1607
|
-
provides = currentInstance.provides = Object.create(parentProvides);
|
|
1608
|
-
}
|
|
1609
|
-
provides[key] = value;
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
1613
|
-
const instance = currentInstance || currentRenderingInstance;
|
|
1614
|
-
if (instance) {
|
|
1615
|
-
const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
|
|
1616
|
-
if (provides && key in provides) {
|
|
1617
|
-
return provides[key];
|
|
1618
|
-
} else if (arguments.length > 1) {
|
|
1619
|
-
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
|
|
1620
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
1621
|
-
warn(`injection "${String(key)}" not found.`);
|
|
1622
|
-
}
|
|
1623
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
1624
|
-
warn(`inject() can only be used inside setup() or functional components.`);
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
1598
|
function watchEffect(effect, options) {
|
|
1629
1599
|
return doWatch(effect, null, options);
|
|
1630
1600
|
}
|
|
@@ -1871,6 +1841,65 @@ function traverse(value, seen) {
|
|
|
1871
1841
|
return value;
|
|
1872
1842
|
}
|
|
1873
1843
|
|
|
1844
|
+
function validateDirectiveName(name) {
|
|
1845
|
+
if (isBuiltInDirective(name)) {
|
|
1846
|
+
warn("Do not use built-in directive ids as custom directive id: " + name);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
function withDirectives(vnode, directives) {
|
|
1850
|
+
const internalInstance = currentRenderingInstance;
|
|
1851
|
+
if (internalInstance === null) {
|
|
1852
|
+
process.env.NODE_ENV !== "production" && warn(`withDirectives can only be used inside render functions.`);
|
|
1853
|
+
return vnode;
|
|
1854
|
+
}
|
|
1855
|
+
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
|
|
1856
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
1857
|
+
for (let i = 0; i < directives.length; i++) {
|
|
1858
|
+
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
1859
|
+
if (dir) {
|
|
1860
|
+
if (isFunction(dir)) {
|
|
1861
|
+
dir = {
|
|
1862
|
+
mounted: dir,
|
|
1863
|
+
updated: dir
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
if (dir.deep) {
|
|
1867
|
+
traverse(value);
|
|
1868
|
+
}
|
|
1869
|
+
bindings.push({
|
|
1870
|
+
dir,
|
|
1871
|
+
instance,
|
|
1872
|
+
value,
|
|
1873
|
+
oldValue: void 0,
|
|
1874
|
+
arg,
|
|
1875
|
+
modifiers
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
return vnode;
|
|
1880
|
+
}
|
|
1881
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
1882
|
+
const bindings = vnode.dirs;
|
|
1883
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
1884
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
1885
|
+
const binding = bindings[i];
|
|
1886
|
+
if (oldBindings) {
|
|
1887
|
+
binding.oldValue = oldBindings[i].value;
|
|
1888
|
+
}
|
|
1889
|
+
let hook = binding.dir[name];
|
|
1890
|
+
if (hook) {
|
|
1891
|
+
pauseTracking();
|
|
1892
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
1893
|
+
vnode.el,
|
|
1894
|
+
binding,
|
|
1895
|
+
vnode,
|
|
1896
|
+
prevVNode
|
|
1897
|
+
]);
|
|
1898
|
+
resetTracking();
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1874
1903
|
function useTransitionState() {
|
|
1875
1904
|
const state = {
|
|
1876
1905
|
isMounted: false,
|
|
@@ -2636,65 +2665,6 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2636
2665
|
injectHook("ec", hook, target);
|
|
2637
2666
|
}
|
|
2638
2667
|
|
|
2639
|
-
function validateDirectiveName(name) {
|
|
2640
|
-
if (isBuiltInDirective(name)) {
|
|
2641
|
-
warn("Do not use built-in directive ids as custom directive id: " + name);
|
|
2642
|
-
}
|
|
2643
|
-
}
|
|
2644
|
-
function withDirectives(vnode, directives) {
|
|
2645
|
-
const internalInstance = currentRenderingInstance;
|
|
2646
|
-
if (internalInstance === null) {
|
|
2647
|
-
process.env.NODE_ENV !== "production" && warn(`withDirectives can only be used inside render functions.`);
|
|
2648
|
-
return vnode;
|
|
2649
|
-
}
|
|
2650
|
-
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
|
|
2651
|
-
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
2652
|
-
for (let i = 0; i < directives.length; i++) {
|
|
2653
|
-
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
|
|
2654
|
-
if (dir) {
|
|
2655
|
-
if (isFunction(dir)) {
|
|
2656
|
-
dir = {
|
|
2657
|
-
mounted: dir,
|
|
2658
|
-
updated: dir
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
if (dir.deep) {
|
|
2662
|
-
traverse(value);
|
|
2663
|
-
}
|
|
2664
|
-
bindings.push({
|
|
2665
|
-
dir,
|
|
2666
|
-
instance,
|
|
2667
|
-
value,
|
|
2668
|
-
oldValue: void 0,
|
|
2669
|
-
arg,
|
|
2670
|
-
modifiers
|
|
2671
|
-
});
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
return vnode;
|
|
2675
|
-
}
|
|
2676
|
-
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
2677
|
-
const bindings = vnode.dirs;
|
|
2678
|
-
const oldBindings = prevVNode && prevVNode.dirs;
|
|
2679
|
-
for (let i = 0; i < bindings.length; i++) {
|
|
2680
|
-
const binding = bindings[i];
|
|
2681
|
-
if (oldBindings) {
|
|
2682
|
-
binding.oldValue = oldBindings[i].value;
|
|
2683
|
-
}
|
|
2684
|
-
let hook = binding.dir[name];
|
|
2685
|
-
if (hook) {
|
|
2686
|
-
pauseTracking();
|
|
2687
|
-
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
2688
|
-
vnode.el,
|
|
2689
|
-
binding,
|
|
2690
|
-
vnode,
|
|
2691
|
-
prevVNode
|
|
2692
|
-
]);
|
|
2693
|
-
resetTracking();
|
|
2694
|
-
}
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
2668
|
const COMPONENTS = "components";
|
|
2699
2669
|
const DIRECTIVES = "directives";
|
|
2700
2670
|
function resolveComponent(name, maybeSelfReference) {
|
|
@@ -3498,35 +3468,246 @@ function mergeDataFn(to, from) {
|
|
|
3498
3468
|
);
|
|
3499
3469
|
};
|
|
3500
3470
|
}
|
|
3501
|
-
function mergeInject(to, from) {
|
|
3502
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
3503
|
-
}
|
|
3504
|
-
function normalizeInject(raw) {
|
|
3505
|
-
if (isArray(raw)) {
|
|
3506
|
-
const res = {};
|
|
3507
|
-
for (let i = 0; i < raw.length; i++) {
|
|
3508
|
-
res[raw[i]] = raw[i];
|
|
3471
|
+
function mergeInject(to, from) {
|
|
3472
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
3473
|
+
}
|
|
3474
|
+
function normalizeInject(raw) {
|
|
3475
|
+
if (isArray(raw)) {
|
|
3476
|
+
const res = {};
|
|
3477
|
+
for (let i = 0; i < raw.length; i++) {
|
|
3478
|
+
res[raw[i]] = raw[i];
|
|
3479
|
+
}
|
|
3480
|
+
return res;
|
|
3481
|
+
}
|
|
3482
|
+
return raw;
|
|
3483
|
+
}
|
|
3484
|
+
function mergeAsArray(to, from) {
|
|
3485
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
3486
|
+
}
|
|
3487
|
+
function mergeObjectOptions(to, from) {
|
|
3488
|
+
return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
|
|
3489
|
+
}
|
|
3490
|
+
function mergeWatchOptions(to, from) {
|
|
3491
|
+
if (!to)
|
|
3492
|
+
return from;
|
|
3493
|
+
if (!from)
|
|
3494
|
+
return to;
|
|
3495
|
+
const merged = extend(/* @__PURE__ */ Object.create(null), to);
|
|
3496
|
+
for (const key in from) {
|
|
3497
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
3498
|
+
}
|
|
3499
|
+
return merged;
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
function createAppContext() {
|
|
3503
|
+
return {
|
|
3504
|
+
app: null,
|
|
3505
|
+
config: {
|
|
3506
|
+
isNativeTag: NO,
|
|
3507
|
+
performance: false,
|
|
3508
|
+
globalProperties: {},
|
|
3509
|
+
optionMergeStrategies: {},
|
|
3510
|
+
errorHandler: void 0,
|
|
3511
|
+
warnHandler: void 0,
|
|
3512
|
+
compilerOptions: {}
|
|
3513
|
+
},
|
|
3514
|
+
mixins: [],
|
|
3515
|
+
components: {},
|
|
3516
|
+
directives: {},
|
|
3517
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
3518
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
3519
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
3520
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
3521
|
+
};
|
|
3522
|
+
}
|
|
3523
|
+
let uid$1 = 0;
|
|
3524
|
+
function createAppAPI(render, hydrate) {
|
|
3525
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
3526
|
+
if (!isFunction(rootComponent)) {
|
|
3527
|
+
rootComponent = extend({}, rootComponent);
|
|
3528
|
+
}
|
|
3529
|
+
if (rootProps != null && !isObject(rootProps)) {
|
|
3530
|
+
process.env.NODE_ENV !== "production" && warn(`root props passed to app.mount() must be an object.`);
|
|
3531
|
+
rootProps = null;
|
|
3532
|
+
}
|
|
3533
|
+
const context = createAppContext();
|
|
3534
|
+
const installedPlugins = /* @__PURE__ */ new Set();
|
|
3535
|
+
let isMounted = false;
|
|
3536
|
+
const app = context.app = {
|
|
3537
|
+
_uid: uid$1++,
|
|
3538
|
+
_component: rootComponent,
|
|
3539
|
+
_props: rootProps,
|
|
3540
|
+
_container: null,
|
|
3541
|
+
_context: context,
|
|
3542
|
+
_instance: null,
|
|
3543
|
+
version,
|
|
3544
|
+
get config() {
|
|
3545
|
+
return context.config;
|
|
3546
|
+
},
|
|
3547
|
+
set config(v) {
|
|
3548
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3549
|
+
warn(
|
|
3550
|
+
`app.config cannot be replaced. Modify individual options instead.`
|
|
3551
|
+
);
|
|
3552
|
+
}
|
|
3553
|
+
},
|
|
3554
|
+
use(plugin, ...options) {
|
|
3555
|
+
if (installedPlugins.has(plugin)) {
|
|
3556
|
+
process.env.NODE_ENV !== "production" && warn(`Plugin has already been applied to target app.`);
|
|
3557
|
+
} else if (plugin && isFunction(plugin.install)) {
|
|
3558
|
+
installedPlugins.add(plugin);
|
|
3559
|
+
plugin.install(app, ...options);
|
|
3560
|
+
} else if (isFunction(plugin)) {
|
|
3561
|
+
installedPlugins.add(plugin);
|
|
3562
|
+
plugin(app, ...options);
|
|
3563
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3564
|
+
warn(
|
|
3565
|
+
`A plugin must either be a function or an object with an "install" function.`
|
|
3566
|
+
);
|
|
3567
|
+
}
|
|
3568
|
+
return app;
|
|
3569
|
+
},
|
|
3570
|
+
mixin(mixin) {
|
|
3571
|
+
if (__VUE_OPTIONS_API__) {
|
|
3572
|
+
if (!context.mixins.includes(mixin)) {
|
|
3573
|
+
context.mixins.push(mixin);
|
|
3574
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3575
|
+
warn(
|
|
3576
|
+
"Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
|
3577
|
+
);
|
|
3578
|
+
}
|
|
3579
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3580
|
+
warn("Mixins are only available in builds supporting Options API");
|
|
3581
|
+
}
|
|
3582
|
+
return app;
|
|
3583
|
+
},
|
|
3584
|
+
component(name, component) {
|
|
3585
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3586
|
+
validateComponentName(name, context.config);
|
|
3587
|
+
}
|
|
3588
|
+
if (!component) {
|
|
3589
|
+
return context.components[name];
|
|
3590
|
+
}
|
|
3591
|
+
if (process.env.NODE_ENV !== "production" && context.components[name]) {
|
|
3592
|
+
warn(`Component "${name}" has already been registered in target app.`);
|
|
3593
|
+
}
|
|
3594
|
+
context.components[name] = component;
|
|
3595
|
+
return app;
|
|
3596
|
+
},
|
|
3597
|
+
directive(name, directive) {
|
|
3598
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3599
|
+
validateDirectiveName(name);
|
|
3600
|
+
}
|
|
3601
|
+
if (!directive) {
|
|
3602
|
+
return context.directives[name];
|
|
3603
|
+
}
|
|
3604
|
+
if (process.env.NODE_ENV !== "production" && context.directives[name]) {
|
|
3605
|
+
warn(`Directive "${name}" has already been registered in target app.`);
|
|
3606
|
+
}
|
|
3607
|
+
context.directives[name] = directive;
|
|
3608
|
+
return app;
|
|
3609
|
+
},
|
|
3610
|
+
mount(rootContainer, isHydrate, isSVG) {
|
|
3611
|
+
if (!isMounted) {
|
|
3612
|
+
if (process.env.NODE_ENV !== "production" && rootContainer.__vue_app__) {
|
|
3613
|
+
warn(
|
|
3614
|
+
`There is already an app instance mounted on the host container.
|
|
3615
|
+
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
3616
|
+
);
|
|
3617
|
+
}
|
|
3618
|
+
const vnode = createVNode(
|
|
3619
|
+
rootComponent,
|
|
3620
|
+
rootProps
|
|
3621
|
+
);
|
|
3622
|
+
vnode.appContext = context;
|
|
3623
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3624
|
+
context.reload = () => {
|
|
3625
|
+
render(cloneVNode(vnode), rootContainer, isSVG);
|
|
3626
|
+
};
|
|
3627
|
+
}
|
|
3628
|
+
if (isHydrate && hydrate) {
|
|
3629
|
+
hydrate(vnode, rootContainer);
|
|
3630
|
+
} else {
|
|
3631
|
+
render(vnode, rootContainer, isSVG);
|
|
3632
|
+
}
|
|
3633
|
+
isMounted = true;
|
|
3634
|
+
app._container = rootContainer;
|
|
3635
|
+
rootContainer.__vue_app__ = app;
|
|
3636
|
+
if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
|
|
3637
|
+
app._instance = vnode.component;
|
|
3638
|
+
devtoolsInitApp(app, version);
|
|
3639
|
+
}
|
|
3640
|
+
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
3641
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3642
|
+
warn(
|
|
3643
|
+
`App has already been mounted.
|
|
3644
|
+
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)\``
|
|
3645
|
+
);
|
|
3646
|
+
}
|
|
3647
|
+
},
|
|
3648
|
+
unmount() {
|
|
3649
|
+
if (isMounted) {
|
|
3650
|
+
render(null, app._container);
|
|
3651
|
+
if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
|
|
3652
|
+
app._instance = null;
|
|
3653
|
+
devtoolsUnmountApp(app);
|
|
3654
|
+
}
|
|
3655
|
+
delete app._container.__vue_app__;
|
|
3656
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3657
|
+
warn(`Cannot unmount an app that is not mounted.`);
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
provide(key, value) {
|
|
3661
|
+
if (process.env.NODE_ENV !== "production" && key in context.provides) {
|
|
3662
|
+
warn(
|
|
3663
|
+
`App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
|
3664
|
+
);
|
|
3665
|
+
}
|
|
3666
|
+
context.provides[key] = value;
|
|
3667
|
+
return app;
|
|
3668
|
+
},
|
|
3669
|
+
runWithContext(fn) {
|
|
3670
|
+
currentApp = app;
|
|
3671
|
+
try {
|
|
3672
|
+
return fn();
|
|
3673
|
+
} finally {
|
|
3674
|
+
currentApp = null;
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
return app;
|
|
3679
|
+
};
|
|
3680
|
+
}
|
|
3681
|
+
let currentApp = null;
|
|
3682
|
+
|
|
3683
|
+
function provide(key, value) {
|
|
3684
|
+
if (!currentInstance) {
|
|
3685
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3686
|
+
warn(`provide() can only be used inside setup().`);
|
|
3509
3687
|
}
|
|
3510
|
-
|
|
3688
|
+
} else {
|
|
3689
|
+
let provides = currentInstance.provides;
|
|
3690
|
+
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
3691
|
+
if (parentProvides === provides) {
|
|
3692
|
+
provides = currentInstance.provides = Object.create(parentProvides);
|
|
3693
|
+
}
|
|
3694
|
+
provides[key] = value;
|
|
3511
3695
|
}
|
|
3512
|
-
return raw;
|
|
3513
|
-
}
|
|
3514
|
-
function mergeAsArray(to, from) {
|
|
3515
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
3516
|
-
}
|
|
3517
|
-
function mergeObjectOptions(to, from) {
|
|
3518
|
-
return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
|
|
3519
3696
|
}
|
|
3520
|
-
function
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3697
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
3698
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
3699
|
+
if (instance || currentApp) {
|
|
3700
|
+
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
|
3701
|
+
if (provides && key in provides) {
|
|
3702
|
+
return provides[key];
|
|
3703
|
+
} else if (arguments.length > 1) {
|
|
3704
|
+
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
3705
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3706
|
+
warn(`injection "${String(key)}" not found.`);
|
|
3707
|
+
}
|
|
3708
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
3709
|
+
warn(`inject() can only be used inside setup() or functional components.`);
|
|
3528
3710
|
}
|
|
3529
|
-
return merged;
|
|
3530
3711
|
}
|
|
3531
3712
|
|
|
3532
3713
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
@@ -3844,7 +4025,7 @@ function validateProp(name, value, prop, isAbsent) {
|
|
|
3844
4025
|
warn('Missing required prop: "' + name + '"');
|
|
3845
4026
|
return;
|
|
3846
4027
|
}
|
|
3847
|
-
if (value == null && !
|
|
4028
|
+
if (value == null && !required) {
|
|
3848
4029
|
return;
|
|
3849
4030
|
}
|
|
3850
4031
|
if (type != null && type !== true && !skipCheck) {
|
|
@@ -4022,178 +4203,6 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4022
4203
|
}
|
|
4023
4204
|
};
|
|
4024
4205
|
|
|
4025
|
-
function createAppContext() {
|
|
4026
|
-
return {
|
|
4027
|
-
app: null,
|
|
4028
|
-
config: {
|
|
4029
|
-
isNativeTag: NO,
|
|
4030
|
-
performance: false,
|
|
4031
|
-
globalProperties: {},
|
|
4032
|
-
optionMergeStrategies: {},
|
|
4033
|
-
errorHandler: void 0,
|
|
4034
|
-
warnHandler: void 0,
|
|
4035
|
-
compilerOptions: {}
|
|
4036
|
-
},
|
|
4037
|
-
mixins: [],
|
|
4038
|
-
components: {},
|
|
4039
|
-
directives: {},
|
|
4040
|
-
provides: /* @__PURE__ */ Object.create(null),
|
|
4041
|
-
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
4042
|
-
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
4043
|
-
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
4044
|
-
};
|
|
4045
|
-
}
|
|
4046
|
-
let uid$1 = 0;
|
|
4047
|
-
function createAppAPI(render, hydrate) {
|
|
4048
|
-
return function createApp(rootComponent, rootProps = null) {
|
|
4049
|
-
if (!isFunction(rootComponent)) {
|
|
4050
|
-
rootComponent = extend({}, rootComponent);
|
|
4051
|
-
}
|
|
4052
|
-
if (rootProps != null && !isObject(rootProps)) {
|
|
4053
|
-
process.env.NODE_ENV !== "production" && warn(`root props passed to app.mount() must be an object.`);
|
|
4054
|
-
rootProps = null;
|
|
4055
|
-
}
|
|
4056
|
-
const context = createAppContext();
|
|
4057
|
-
const installedPlugins = /* @__PURE__ */ new Set();
|
|
4058
|
-
let isMounted = false;
|
|
4059
|
-
const app = context.app = {
|
|
4060
|
-
_uid: uid$1++,
|
|
4061
|
-
_component: rootComponent,
|
|
4062
|
-
_props: rootProps,
|
|
4063
|
-
_container: null,
|
|
4064
|
-
_context: context,
|
|
4065
|
-
_instance: null,
|
|
4066
|
-
version,
|
|
4067
|
-
get config() {
|
|
4068
|
-
return context.config;
|
|
4069
|
-
},
|
|
4070
|
-
set config(v) {
|
|
4071
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4072
|
-
warn(
|
|
4073
|
-
`app.config cannot be replaced. Modify individual options instead.`
|
|
4074
|
-
);
|
|
4075
|
-
}
|
|
4076
|
-
},
|
|
4077
|
-
use(plugin, ...options) {
|
|
4078
|
-
if (installedPlugins.has(plugin)) {
|
|
4079
|
-
process.env.NODE_ENV !== "production" && warn(`Plugin has already been applied to target app.`);
|
|
4080
|
-
} else if (plugin && isFunction(plugin.install)) {
|
|
4081
|
-
installedPlugins.add(plugin);
|
|
4082
|
-
plugin.install(app, ...options);
|
|
4083
|
-
} else if (isFunction(plugin)) {
|
|
4084
|
-
installedPlugins.add(plugin);
|
|
4085
|
-
plugin(app, ...options);
|
|
4086
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
4087
|
-
warn(
|
|
4088
|
-
`A plugin must either be a function or an object with an "install" function.`
|
|
4089
|
-
);
|
|
4090
|
-
}
|
|
4091
|
-
return app;
|
|
4092
|
-
},
|
|
4093
|
-
mixin(mixin) {
|
|
4094
|
-
if (__VUE_OPTIONS_API__) {
|
|
4095
|
-
if (!context.mixins.includes(mixin)) {
|
|
4096
|
-
context.mixins.push(mixin);
|
|
4097
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
4098
|
-
warn(
|
|
4099
|
-
"Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
|
4100
|
-
);
|
|
4101
|
-
}
|
|
4102
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
4103
|
-
warn("Mixins are only available in builds supporting Options API");
|
|
4104
|
-
}
|
|
4105
|
-
return app;
|
|
4106
|
-
},
|
|
4107
|
-
component(name, component) {
|
|
4108
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4109
|
-
validateComponentName(name, context.config);
|
|
4110
|
-
}
|
|
4111
|
-
if (!component) {
|
|
4112
|
-
return context.components[name];
|
|
4113
|
-
}
|
|
4114
|
-
if (process.env.NODE_ENV !== "production" && context.components[name]) {
|
|
4115
|
-
warn(`Component "${name}" has already been registered in target app.`);
|
|
4116
|
-
}
|
|
4117
|
-
context.components[name] = component;
|
|
4118
|
-
return app;
|
|
4119
|
-
},
|
|
4120
|
-
directive(name, directive) {
|
|
4121
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4122
|
-
validateDirectiveName(name);
|
|
4123
|
-
}
|
|
4124
|
-
if (!directive) {
|
|
4125
|
-
return context.directives[name];
|
|
4126
|
-
}
|
|
4127
|
-
if (process.env.NODE_ENV !== "production" && context.directives[name]) {
|
|
4128
|
-
warn(`Directive "${name}" has already been registered in target app.`);
|
|
4129
|
-
}
|
|
4130
|
-
context.directives[name] = directive;
|
|
4131
|
-
return app;
|
|
4132
|
-
},
|
|
4133
|
-
mount(rootContainer, isHydrate, isSVG) {
|
|
4134
|
-
if (!isMounted) {
|
|
4135
|
-
if (process.env.NODE_ENV !== "production" && rootContainer.__vue_app__) {
|
|
4136
|
-
warn(
|
|
4137
|
-
`There is already an app instance mounted on the host container.
|
|
4138
|
-
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
4139
|
-
);
|
|
4140
|
-
}
|
|
4141
|
-
const vnode = createVNode(
|
|
4142
|
-
rootComponent,
|
|
4143
|
-
rootProps
|
|
4144
|
-
);
|
|
4145
|
-
vnode.appContext = context;
|
|
4146
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4147
|
-
context.reload = () => {
|
|
4148
|
-
render(cloneVNode(vnode), rootContainer, isSVG);
|
|
4149
|
-
};
|
|
4150
|
-
}
|
|
4151
|
-
if (isHydrate && hydrate) {
|
|
4152
|
-
hydrate(vnode, rootContainer);
|
|
4153
|
-
} else {
|
|
4154
|
-
render(vnode, rootContainer, isSVG);
|
|
4155
|
-
}
|
|
4156
|
-
isMounted = true;
|
|
4157
|
-
app._container = rootContainer;
|
|
4158
|
-
rootContainer.__vue_app__ = app;
|
|
4159
|
-
if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
|
|
4160
|
-
app._instance = vnode.component;
|
|
4161
|
-
devtoolsInitApp(app, version);
|
|
4162
|
-
}
|
|
4163
|
-
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
4164
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
4165
|
-
warn(
|
|
4166
|
-
`App has already been mounted.
|
|
4167
|
-
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)\``
|
|
4168
|
-
);
|
|
4169
|
-
}
|
|
4170
|
-
},
|
|
4171
|
-
unmount() {
|
|
4172
|
-
if (isMounted) {
|
|
4173
|
-
render(null, app._container);
|
|
4174
|
-
if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
|
|
4175
|
-
app._instance = null;
|
|
4176
|
-
devtoolsUnmountApp(app);
|
|
4177
|
-
}
|
|
4178
|
-
delete app._container.__vue_app__;
|
|
4179
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
4180
|
-
warn(`Cannot unmount an app that is not mounted.`);
|
|
4181
|
-
}
|
|
4182
|
-
},
|
|
4183
|
-
provide(key, value) {
|
|
4184
|
-
if (process.env.NODE_ENV !== "production" && key in context.provides) {
|
|
4185
|
-
warn(
|
|
4186
|
-
`App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
|
4187
|
-
);
|
|
4188
|
-
}
|
|
4189
|
-
context.provides[key] = value;
|
|
4190
|
-
return app;
|
|
4191
|
-
}
|
|
4192
|
-
};
|
|
4193
|
-
return app;
|
|
4194
|
-
};
|
|
4195
|
-
}
|
|
4196
|
-
|
|
4197
4206
|
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4198
4207
|
if (isArray(rawRef)) {
|
|
4199
4208
|
rawRef.forEach(
|
|
@@ -7296,6 +7305,12 @@ function defineSlots() {
|
|
|
7296
7305
|
if (process.env.NODE_ENV !== "production") {
|
|
7297
7306
|
warnRuntimeUsage(`defineSlots`);
|
|
7298
7307
|
}
|
|
7308
|
+
return null;
|
|
7309
|
+
}
|
|
7310
|
+
function defineModel() {
|
|
7311
|
+
if (process.env.NODE_ENV !== "production") {
|
|
7312
|
+
warnRuntimeUsage("defineModel");
|
|
7313
|
+
}
|
|
7299
7314
|
}
|
|
7300
7315
|
function withDefaults(props, defaults) {
|
|
7301
7316
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -7309,6 +7324,40 @@ function useSlots() {
|
|
|
7309
7324
|
function useAttrs() {
|
|
7310
7325
|
return getContext().attrs;
|
|
7311
7326
|
}
|
|
7327
|
+
function useModel(props, name, options) {
|
|
7328
|
+
const i = getCurrentInstance();
|
|
7329
|
+
if (process.env.NODE_ENV !== "production" && !i) {
|
|
7330
|
+
warn(`useModel() called without active instance.`);
|
|
7331
|
+
return ref();
|
|
7332
|
+
}
|
|
7333
|
+
if (process.env.NODE_ENV !== "production" && !i.propsOptions[0][name]) {
|
|
7334
|
+
warn(`useModel() called with prop "${name}" which is not declared.`);
|
|
7335
|
+
return ref();
|
|
7336
|
+
}
|
|
7337
|
+
if (options && options.local) {
|
|
7338
|
+
const proxy = ref(props[name]);
|
|
7339
|
+
watch(
|
|
7340
|
+
() => props[name],
|
|
7341
|
+
(v) => proxy.value = v
|
|
7342
|
+
);
|
|
7343
|
+
watch(proxy, (value) => {
|
|
7344
|
+
if (value !== props[name]) {
|
|
7345
|
+
i.emit(`update:${name}`, value);
|
|
7346
|
+
}
|
|
7347
|
+
});
|
|
7348
|
+
return proxy;
|
|
7349
|
+
} else {
|
|
7350
|
+
return {
|
|
7351
|
+
__v_isRef: true,
|
|
7352
|
+
get value() {
|
|
7353
|
+
return props[name];
|
|
7354
|
+
},
|
|
7355
|
+
set value(value) {
|
|
7356
|
+
i.emit(`update:${name}`, value);
|
|
7357
|
+
}
|
|
7358
|
+
};
|
|
7359
|
+
}
|
|
7360
|
+
}
|
|
7312
7361
|
function getContext() {
|
|
7313
7362
|
const i = getCurrentInstance();
|
|
7314
7363
|
if (process.env.NODE_ENV !== "production" && !i) {
|
|
@@ -7316,11 +7365,14 @@ function getContext() {
|
|
|
7316
7365
|
}
|
|
7317
7366
|
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
7318
7367
|
}
|
|
7319
|
-
function
|
|
7320
|
-
|
|
7368
|
+
function normalizePropsOrEmits(props) {
|
|
7369
|
+
return isArray(props) ? props.reduce(
|
|
7321
7370
|
(normalized, p) => (normalized[p] = {}, normalized),
|
|
7322
7371
|
{}
|
|
7323
|
-
) :
|
|
7372
|
+
) : props;
|
|
7373
|
+
}
|
|
7374
|
+
function mergeDefaults(raw, defaults) {
|
|
7375
|
+
const props = normalizePropsOrEmits(raw);
|
|
7324
7376
|
for (const key in defaults) {
|
|
7325
7377
|
if (key.startsWith("__skip"))
|
|
7326
7378
|
continue;
|
|
@@ -7342,6 +7394,13 @@ function mergeDefaults(raw, defaults) {
|
|
|
7342
7394
|
}
|
|
7343
7395
|
return props;
|
|
7344
7396
|
}
|
|
7397
|
+
function mergeModels(a, b) {
|
|
7398
|
+
if (!a || !b)
|
|
7399
|
+
return a || b;
|
|
7400
|
+
if (isArray(a) && isArray(b))
|
|
7401
|
+
return a.concat(b);
|
|
7402
|
+
return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
|
7403
|
+
}
|
|
7345
7404
|
function createPropsRestProxy(props, excludedKeys) {
|
|
7346
7405
|
const ret = {};
|
|
7347
7406
|
for (const key in props) {
|
|
@@ -7611,7 +7670,7 @@ function isMemoSame(cached, memo) {
|
|
|
7611
7670
|
return true;
|
|
7612
7671
|
}
|
|
7613
7672
|
|
|
7614
|
-
const version = "3.3.0-alpha.
|
|
7673
|
+
const version = "3.3.0-alpha.9";
|
|
7615
7674
|
const _ssrUtils = {
|
|
7616
7675
|
createComponentInstance,
|
|
7617
7676
|
setupComponent,
|
|
@@ -7624,4 +7683,4 @@ const ssrUtils = _ssrUtils ;
|
|
|
7624
7683
|
const resolveFilter = null;
|
|
7625
7684
|
const compatUtils = null;
|
|
7626
7685
|
|
|
7627
|
-
export { BaseTransition, BaseTransitionPropsValidators, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineOptions, defineProps, defineSlots, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
|
|
7686
|
+
export { BaseTransition, BaseTransitionPropsValidators, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, getCurrentInstance, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, isMemoSame, isRuntimeOnly, isVNode, mergeDefaults, mergeModels, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useModel, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
|