@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
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -1591,36 +1591,6 @@ function setActiveBranch(suspense, branch) {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
}
|
|
1593
1593
|
|
|
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
1594
|
function watchEffect(effect, options) {
|
|
1625
1595
|
return doWatch(effect, null, options);
|
|
1626
1596
|
}
|
|
@@ -1867,6 +1837,65 @@ function traverse(value, seen) {
|
|
|
1867
1837
|
return value;
|
|
1868
1838
|
}
|
|
1869
1839
|
|
|
1840
|
+
function validateDirectiveName(name) {
|
|
1841
|
+
if (shared.isBuiltInDirective(name)) {
|
|
1842
|
+
warn("Do not use built-in directive ids as custom directive id: " + name);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
function withDirectives(vnode, directives) {
|
|
1846
|
+
const internalInstance = currentRenderingInstance;
|
|
1847
|
+
if (internalInstance === null) {
|
|
1848
|
+
warn(`withDirectives can only be used inside render functions.`);
|
|
1849
|
+
return vnode;
|
|
1850
|
+
}
|
|
1851
|
+
const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
|
|
1852
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
1853
|
+
for (let i = 0; i < directives.length; i++) {
|
|
1854
|
+
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
1855
|
+
if (dir) {
|
|
1856
|
+
if (shared.isFunction(dir)) {
|
|
1857
|
+
dir = {
|
|
1858
|
+
mounted: dir,
|
|
1859
|
+
updated: dir
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
if (dir.deep) {
|
|
1863
|
+
traverse(value);
|
|
1864
|
+
}
|
|
1865
|
+
bindings.push({
|
|
1866
|
+
dir,
|
|
1867
|
+
instance,
|
|
1868
|
+
value,
|
|
1869
|
+
oldValue: void 0,
|
|
1870
|
+
arg,
|
|
1871
|
+
modifiers
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
return vnode;
|
|
1876
|
+
}
|
|
1877
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
1878
|
+
const bindings = vnode.dirs;
|
|
1879
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
1880
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
1881
|
+
const binding = bindings[i];
|
|
1882
|
+
if (oldBindings) {
|
|
1883
|
+
binding.oldValue = oldBindings[i].value;
|
|
1884
|
+
}
|
|
1885
|
+
let hook = binding.dir[name];
|
|
1886
|
+
if (hook) {
|
|
1887
|
+
reactivity.pauseTracking();
|
|
1888
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
1889
|
+
vnode.el,
|
|
1890
|
+
binding,
|
|
1891
|
+
vnode,
|
|
1892
|
+
prevVNode
|
|
1893
|
+
]);
|
|
1894
|
+
reactivity.resetTracking();
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1870
1899
|
function useTransitionState() {
|
|
1871
1900
|
const state = {
|
|
1872
1901
|
isMounted: false,
|
|
@@ -2630,65 +2659,6 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
2630
2659
|
injectHook("ec", hook, target);
|
|
2631
2660
|
}
|
|
2632
2661
|
|
|
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
2662
|
const COMPONENTS = "components";
|
|
2693
2663
|
const DIRECTIVES = "directives";
|
|
2694
2664
|
function resolveComponent(name, maybeSelfReference) {
|
|
@@ -3490,35 +3460,244 @@ function mergeDataFn(to, from) {
|
|
|
3490
3460
|
);
|
|
3491
3461
|
};
|
|
3492
3462
|
}
|
|
3493
|
-
function mergeInject(to, from) {
|
|
3494
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
3495
|
-
}
|
|
3496
|
-
function normalizeInject(raw) {
|
|
3497
|
-
if (shared.isArray(raw)) {
|
|
3498
|
-
const res = {};
|
|
3499
|
-
for (let i = 0; i < raw.length; i++) {
|
|
3500
|
-
res[raw[i]] = raw[i];
|
|
3463
|
+
function mergeInject(to, from) {
|
|
3464
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
3465
|
+
}
|
|
3466
|
+
function normalizeInject(raw) {
|
|
3467
|
+
if (shared.isArray(raw)) {
|
|
3468
|
+
const res = {};
|
|
3469
|
+
for (let i = 0; i < raw.length; i++) {
|
|
3470
|
+
res[raw[i]] = raw[i];
|
|
3471
|
+
}
|
|
3472
|
+
return res;
|
|
3473
|
+
}
|
|
3474
|
+
return raw;
|
|
3475
|
+
}
|
|
3476
|
+
function mergeAsArray(to, from) {
|
|
3477
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
3478
|
+
}
|
|
3479
|
+
function mergeObjectOptions(to, from) {
|
|
3480
|
+
return to ? shared.extend(shared.extend(/* @__PURE__ */ Object.create(null), to), from) : from;
|
|
3481
|
+
}
|
|
3482
|
+
function mergeWatchOptions(to, from) {
|
|
3483
|
+
if (!to)
|
|
3484
|
+
return from;
|
|
3485
|
+
if (!from)
|
|
3486
|
+
return to;
|
|
3487
|
+
const merged = shared.extend(/* @__PURE__ */ Object.create(null), to);
|
|
3488
|
+
for (const key in from) {
|
|
3489
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
3490
|
+
}
|
|
3491
|
+
return merged;
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
function createAppContext() {
|
|
3495
|
+
return {
|
|
3496
|
+
app: null,
|
|
3497
|
+
config: {
|
|
3498
|
+
isNativeTag: shared.NO,
|
|
3499
|
+
performance: false,
|
|
3500
|
+
globalProperties: {},
|
|
3501
|
+
optionMergeStrategies: {},
|
|
3502
|
+
errorHandler: void 0,
|
|
3503
|
+
warnHandler: void 0,
|
|
3504
|
+
compilerOptions: {}
|
|
3505
|
+
},
|
|
3506
|
+
mixins: [],
|
|
3507
|
+
components: {},
|
|
3508
|
+
directives: {},
|
|
3509
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
3510
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
3511
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
3512
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
3513
|
+
};
|
|
3514
|
+
}
|
|
3515
|
+
let uid$1 = 0;
|
|
3516
|
+
function createAppAPI(render, hydrate) {
|
|
3517
|
+
return function createApp(rootComponent, rootProps = null) {
|
|
3518
|
+
if (!shared.isFunction(rootComponent)) {
|
|
3519
|
+
rootComponent = shared.extend({}, rootComponent);
|
|
3520
|
+
}
|
|
3521
|
+
if (rootProps != null && !shared.isObject(rootProps)) {
|
|
3522
|
+
warn(`root props passed to app.mount() must be an object.`);
|
|
3523
|
+
rootProps = null;
|
|
3524
|
+
}
|
|
3525
|
+
const context = createAppContext();
|
|
3526
|
+
const installedPlugins = /* @__PURE__ */ new Set();
|
|
3527
|
+
let isMounted = false;
|
|
3528
|
+
const app = context.app = {
|
|
3529
|
+
_uid: uid$1++,
|
|
3530
|
+
_component: rootComponent,
|
|
3531
|
+
_props: rootProps,
|
|
3532
|
+
_container: null,
|
|
3533
|
+
_context: context,
|
|
3534
|
+
_instance: null,
|
|
3535
|
+
version,
|
|
3536
|
+
get config() {
|
|
3537
|
+
return context.config;
|
|
3538
|
+
},
|
|
3539
|
+
set config(v) {
|
|
3540
|
+
{
|
|
3541
|
+
warn(
|
|
3542
|
+
`app.config cannot be replaced. Modify individual options instead.`
|
|
3543
|
+
);
|
|
3544
|
+
}
|
|
3545
|
+
},
|
|
3546
|
+
use(plugin, ...options) {
|
|
3547
|
+
if (installedPlugins.has(plugin)) {
|
|
3548
|
+
warn(`Plugin has already been applied to target app.`);
|
|
3549
|
+
} else if (plugin && shared.isFunction(plugin.install)) {
|
|
3550
|
+
installedPlugins.add(plugin);
|
|
3551
|
+
plugin.install(app, ...options);
|
|
3552
|
+
} else if (shared.isFunction(plugin)) {
|
|
3553
|
+
installedPlugins.add(plugin);
|
|
3554
|
+
plugin(app, ...options);
|
|
3555
|
+
} else {
|
|
3556
|
+
warn(
|
|
3557
|
+
`A plugin must either be a function or an object with an "install" function.`
|
|
3558
|
+
);
|
|
3559
|
+
}
|
|
3560
|
+
return app;
|
|
3561
|
+
},
|
|
3562
|
+
mixin(mixin) {
|
|
3563
|
+
{
|
|
3564
|
+
if (!context.mixins.includes(mixin)) {
|
|
3565
|
+
context.mixins.push(mixin);
|
|
3566
|
+
} else {
|
|
3567
|
+
warn(
|
|
3568
|
+
"Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
|
|
3569
|
+
);
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
return app;
|
|
3573
|
+
},
|
|
3574
|
+
component(name, component) {
|
|
3575
|
+
{
|
|
3576
|
+
validateComponentName(name, context.config);
|
|
3577
|
+
}
|
|
3578
|
+
if (!component) {
|
|
3579
|
+
return context.components[name];
|
|
3580
|
+
}
|
|
3581
|
+
if (context.components[name]) {
|
|
3582
|
+
warn(`Component "${name}" has already been registered in target app.`);
|
|
3583
|
+
}
|
|
3584
|
+
context.components[name] = component;
|
|
3585
|
+
return app;
|
|
3586
|
+
},
|
|
3587
|
+
directive(name, directive) {
|
|
3588
|
+
{
|
|
3589
|
+
validateDirectiveName(name);
|
|
3590
|
+
}
|
|
3591
|
+
if (!directive) {
|
|
3592
|
+
return context.directives[name];
|
|
3593
|
+
}
|
|
3594
|
+
if (context.directives[name]) {
|
|
3595
|
+
warn(`Directive "${name}" has already been registered in target app.`);
|
|
3596
|
+
}
|
|
3597
|
+
context.directives[name] = directive;
|
|
3598
|
+
return app;
|
|
3599
|
+
},
|
|
3600
|
+
mount(rootContainer, isHydrate, isSVG) {
|
|
3601
|
+
if (!isMounted) {
|
|
3602
|
+
if (rootContainer.__vue_app__) {
|
|
3603
|
+
warn(
|
|
3604
|
+
`There is already an app instance mounted on the host container.
|
|
3605
|
+
If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
|
|
3606
|
+
);
|
|
3607
|
+
}
|
|
3608
|
+
const vnode = createVNode(
|
|
3609
|
+
rootComponent,
|
|
3610
|
+
rootProps
|
|
3611
|
+
);
|
|
3612
|
+
vnode.appContext = context;
|
|
3613
|
+
{
|
|
3614
|
+
context.reload = () => {
|
|
3615
|
+
render(cloneVNode(vnode), rootContainer, isSVG);
|
|
3616
|
+
};
|
|
3617
|
+
}
|
|
3618
|
+
if (isHydrate && hydrate) {
|
|
3619
|
+
hydrate(vnode, rootContainer);
|
|
3620
|
+
} else {
|
|
3621
|
+
render(vnode, rootContainer, isSVG);
|
|
3622
|
+
}
|
|
3623
|
+
isMounted = true;
|
|
3624
|
+
app._container = rootContainer;
|
|
3625
|
+
rootContainer.__vue_app__ = app;
|
|
3626
|
+
{
|
|
3627
|
+
app._instance = vnode.component;
|
|
3628
|
+
devtoolsInitApp(app, version);
|
|
3629
|
+
}
|
|
3630
|
+
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
3631
|
+
} else {
|
|
3632
|
+
warn(
|
|
3633
|
+
`App has already been mounted.
|
|
3634
|
+
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)\``
|
|
3635
|
+
);
|
|
3636
|
+
}
|
|
3637
|
+
},
|
|
3638
|
+
unmount() {
|
|
3639
|
+
if (isMounted) {
|
|
3640
|
+
render(null, app._container);
|
|
3641
|
+
{
|
|
3642
|
+
app._instance = null;
|
|
3643
|
+
devtoolsUnmountApp(app);
|
|
3644
|
+
}
|
|
3645
|
+
delete app._container.__vue_app__;
|
|
3646
|
+
} else {
|
|
3647
|
+
warn(`Cannot unmount an app that is not mounted.`);
|
|
3648
|
+
}
|
|
3649
|
+
},
|
|
3650
|
+
provide(key, value) {
|
|
3651
|
+
if (key in context.provides) {
|
|
3652
|
+
warn(
|
|
3653
|
+
`App already provides property with key "${String(key)}". It will be overwritten with the new value.`
|
|
3654
|
+
);
|
|
3655
|
+
}
|
|
3656
|
+
context.provides[key] = value;
|
|
3657
|
+
return app;
|
|
3658
|
+
},
|
|
3659
|
+
runWithContext(fn) {
|
|
3660
|
+
currentApp = app;
|
|
3661
|
+
try {
|
|
3662
|
+
return fn();
|
|
3663
|
+
} finally {
|
|
3664
|
+
currentApp = null;
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
};
|
|
3668
|
+
return app;
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3671
|
+
let currentApp = null;
|
|
3672
|
+
|
|
3673
|
+
function provide(key, value) {
|
|
3674
|
+
if (!currentInstance) {
|
|
3675
|
+
{
|
|
3676
|
+
warn(`provide() can only be used inside setup().`);
|
|
3501
3677
|
}
|
|
3502
|
-
|
|
3678
|
+
} else {
|
|
3679
|
+
let provides = currentInstance.provides;
|
|
3680
|
+
const parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
|
3681
|
+
if (parentProvides === provides) {
|
|
3682
|
+
provides = currentInstance.provides = Object.create(parentProvides);
|
|
3683
|
+
}
|
|
3684
|
+
provides[key] = value;
|
|
3503
3685
|
}
|
|
3504
|
-
return raw;
|
|
3505
|
-
}
|
|
3506
|
-
function mergeAsArray(to, from) {
|
|
3507
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
3508
|
-
}
|
|
3509
|
-
function mergeObjectOptions(to, from) {
|
|
3510
|
-
return to ? shared.extend(shared.extend(/* @__PURE__ */ Object.create(null), to), from) : from;
|
|
3511
3686
|
}
|
|
3512
|
-
function
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3687
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
3688
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
3689
|
+
if (instance || currentApp) {
|
|
3690
|
+
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
|
3691
|
+
if (provides && key in provides) {
|
|
3692
|
+
return provides[key];
|
|
3693
|
+
} else if (arguments.length > 1) {
|
|
3694
|
+
return treatDefaultAsFactory && shared.isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
3695
|
+
} else {
|
|
3696
|
+
warn(`injection "${String(key)}" not found.`);
|
|
3697
|
+
}
|
|
3698
|
+
} else {
|
|
3699
|
+
warn(`inject() can only be used inside setup() or functional components.`);
|
|
3520
3700
|
}
|
|
3521
|
-
return merged;
|
|
3522
3701
|
}
|
|
3523
3702
|
|
|
3524
3703
|
function initProps(instance, rawProps, isStateful, isSSR = false) {
|
|
@@ -3836,7 +4015,7 @@ function validateProp(name, value, prop, isAbsent) {
|
|
|
3836
4015
|
warn('Missing required prop: "' + name + '"');
|
|
3837
4016
|
return;
|
|
3838
4017
|
}
|
|
3839
|
-
if (value == null && !
|
|
4018
|
+
if (value == null && !required) {
|
|
3840
4019
|
return;
|
|
3841
4020
|
}
|
|
3842
4021
|
if (type != null && type !== true && !skipCheck) {
|
|
@@ -4014,176 +4193,6 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4014
4193
|
}
|
|
4015
4194
|
};
|
|
4016
4195
|
|
|
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;
|
|
4184
|
-
};
|
|
4185
|
-
}
|
|
4186
|
-
|
|
4187
4196
|
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
4188
4197
|
if (shared.isArray(rawRef)) {
|
|
4189
4198
|
rawRef.forEach(
|
|
@@ -7249,6 +7258,12 @@ function defineSlots() {
|
|
|
7249
7258
|
{
|
|
7250
7259
|
warnRuntimeUsage(`defineSlots`);
|
|
7251
7260
|
}
|
|
7261
|
+
return null;
|
|
7262
|
+
}
|
|
7263
|
+
function defineModel() {
|
|
7264
|
+
{
|
|
7265
|
+
warnRuntimeUsage("defineModel");
|
|
7266
|
+
}
|
|
7252
7267
|
}
|
|
7253
7268
|
function withDefaults(props, defaults) {
|
|
7254
7269
|
{
|
|
@@ -7262,6 +7277,40 @@ function useSlots() {
|
|
|
7262
7277
|
function useAttrs() {
|
|
7263
7278
|
return getContext().attrs;
|
|
7264
7279
|
}
|
|
7280
|
+
function useModel(props, name, options) {
|
|
7281
|
+
const i = getCurrentInstance();
|
|
7282
|
+
if (!i) {
|
|
7283
|
+
warn(`useModel() called without active instance.`);
|
|
7284
|
+
return reactivity.ref();
|
|
7285
|
+
}
|
|
7286
|
+
if (!i.propsOptions[0][name]) {
|
|
7287
|
+
warn(`useModel() called with prop "${name}" which is not declared.`);
|
|
7288
|
+
return reactivity.ref();
|
|
7289
|
+
}
|
|
7290
|
+
if (options && options.local) {
|
|
7291
|
+
const proxy = reactivity.ref(props[name]);
|
|
7292
|
+
watch(
|
|
7293
|
+
() => props[name],
|
|
7294
|
+
(v) => proxy.value = v
|
|
7295
|
+
);
|
|
7296
|
+
watch(proxy, (value) => {
|
|
7297
|
+
if (value !== props[name]) {
|
|
7298
|
+
i.emit(`update:${name}`, value);
|
|
7299
|
+
}
|
|
7300
|
+
});
|
|
7301
|
+
return proxy;
|
|
7302
|
+
} else {
|
|
7303
|
+
return {
|
|
7304
|
+
__v_isRef: true,
|
|
7305
|
+
get value() {
|
|
7306
|
+
return props[name];
|
|
7307
|
+
},
|
|
7308
|
+
set value(value) {
|
|
7309
|
+
i.emit(`update:${name}`, value);
|
|
7310
|
+
}
|
|
7311
|
+
};
|
|
7312
|
+
}
|
|
7313
|
+
}
|
|
7265
7314
|
function getContext() {
|
|
7266
7315
|
const i = getCurrentInstance();
|
|
7267
7316
|
if (!i) {
|
|
@@ -7269,11 +7318,14 @@ function getContext() {
|
|
|
7269
7318
|
}
|
|
7270
7319
|
return i.setupContext || (i.setupContext = createSetupContext(i));
|
|
7271
7320
|
}
|
|
7272
|
-
function
|
|
7273
|
-
|
|
7321
|
+
function normalizePropsOrEmits(props) {
|
|
7322
|
+
return shared.isArray(props) ? props.reduce(
|
|
7274
7323
|
(normalized, p) => (normalized[p] = {}, normalized),
|
|
7275
7324
|
{}
|
|
7276
|
-
) :
|
|
7325
|
+
) : props;
|
|
7326
|
+
}
|
|
7327
|
+
function mergeDefaults(raw, defaults) {
|
|
7328
|
+
const props = normalizePropsOrEmits(raw);
|
|
7277
7329
|
for (const key in defaults) {
|
|
7278
7330
|
if (key.startsWith("__skip"))
|
|
7279
7331
|
continue;
|
|
@@ -7295,6 +7347,13 @@ function mergeDefaults(raw, defaults) {
|
|
|
7295
7347
|
}
|
|
7296
7348
|
return props;
|
|
7297
7349
|
}
|
|
7350
|
+
function mergeModels(a, b) {
|
|
7351
|
+
if (!a || !b)
|
|
7352
|
+
return a || b;
|
|
7353
|
+
if (shared.isArray(a) && shared.isArray(b))
|
|
7354
|
+
return a.concat(b);
|
|
7355
|
+
return shared.extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
|
|
7356
|
+
}
|
|
7298
7357
|
function createPropsRestProxy(props, excludedKeys) {
|
|
7299
7358
|
const ret = {};
|
|
7300
7359
|
for (const key in props) {
|
|
@@ -7564,7 +7623,7 @@ function isMemoSame(cached, memo) {
|
|
|
7564
7623
|
return true;
|
|
7565
7624
|
}
|
|
7566
7625
|
|
|
7567
|
-
const version = "3.3.0-alpha.
|
|
7626
|
+
const version = "3.3.0-alpha.9";
|
|
7568
7627
|
const _ssrUtils = {
|
|
7569
7628
|
createComponentInstance,
|
|
7570
7629
|
setupComponent,
|
|
@@ -7641,6 +7700,7 @@ exports.defineAsyncComponent = defineAsyncComponent;
|
|
|
7641
7700
|
exports.defineComponent = defineComponent;
|
|
7642
7701
|
exports.defineEmits = defineEmits;
|
|
7643
7702
|
exports.defineExpose = defineExpose;
|
|
7703
|
+
exports.defineModel = defineModel;
|
|
7644
7704
|
exports.defineOptions = defineOptions;
|
|
7645
7705
|
exports.defineProps = defineProps;
|
|
7646
7706
|
exports.defineSlots = defineSlots;
|
|
@@ -7655,6 +7715,7 @@ exports.isMemoSame = isMemoSame;
|
|
|
7655
7715
|
exports.isRuntimeOnly = isRuntimeOnly;
|
|
7656
7716
|
exports.isVNode = isVNode;
|
|
7657
7717
|
exports.mergeDefaults = mergeDefaults;
|
|
7718
|
+
exports.mergeModels = mergeModels;
|
|
7658
7719
|
exports.mergeProps = mergeProps;
|
|
7659
7720
|
exports.nextTick = nextTick;
|
|
7660
7721
|
exports.onActivated = onActivated;
|
|
@@ -7690,6 +7751,7 @@ exports.ssrUtils = ssrUtils;
|
|
|
7690
7751
|
exports.toHandlers = toHandlers;
|
|
7691
7752
|
exports.transformVNodeArgs = transformVNodeArgs;
|
|
7692
7753
|
exports.useAttrs = useAttrs;
|
|
7754
|
+
exports.useModel = useModel;
|
|
7693
7755
|
exports.useSSRContext = useSSRContext;
|
|
7694
7756
|
exports.useSlots = useSlots;
|
|
7695
7757
|
exports.useTransitionState = useTransitionState;
|