@vue/compat 3.3.0-alpha.7 → 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.
@@ -3471,33 +3471,41 @@ function setActiveBranch(suspense, branch) {
3471
3471
  }
3472
3472
  }
3473
3473
 
3474
- function provide(key, value) {
3475
- if (!currentInstance) {
3476
- {
3477
- warn(`provide() can only be used inside setup().`);
3478
- }
3479
- } else {
3480
- let provides = currentInstance.provides;
3481
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3482
- if (parentProvides === provides) {
3483
- provides = currentInstance.provides = Object.create(parentProvides);
3484
- }
3485
- provides[key] = value;
3486
- }
3487
- }
3488
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3489
- const instance = currentInstance || currentRenderingInstance;
3490
- if (instance) {
3491
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3492
- if (provides && key in provides) {
3493
- return provides[key];
3494
- } else if (arguments.length > 1) {
3495
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3474
+ const legacyDirectiveHookMap = {
3475
+ beforeMount: "bind",
3476
+ mounted: "inserted",
3477
+ updated: ["update", "componentUpdated"],
3478
+ unmounted: "unbind"
3479
+ };
3480
+ function mapCompatDirectiveHook(name, dir, instance) {
3481
+ const mappedName = legacyDirectiveHookMap[name];
3482
+ if (mappedName) {
3483
+ if (isArray(mappedName)) {
3484
+ const hook = [];
3485
+ mappedName.forEach((mapped) => {
3486
+ const mappedHook = dir[mapped];
3487
+ if (mappedHook) {
3488
+ softAssertCompatEnabled(
3489
+ "CUSTOM_DIR",
3490
+ instance,
3491
+ mapped,
3492
+ name
3493
+ );
3494
+ hook.push(mappedHook);
3495
+ }
3496
+ });
3497
+ return hook.length ? hook : void 0;
3496
3498
  } else {
3497
- warn(`injection "${String(key)}" not found.`);
3499
+ if (dir[mappedName]) {
3500
+ softAssertCompatEnabled(
3501
+ "CUSTOM_DIR",
3502
+ instance,
3503
+ mappedName,
3504
+ name
3505
+ );
3506
+ }
3507
+ return dir[mappedName];
3498
3508
  }
3499
- } else {
3500
- warn(`inject() can only be used inside setup() or functional components.`);
3501
3509
  }
3502
3510
  }
3503
3511
 
@@ -3736,6 +3744,68 @@ function traverse(value, seen) {
3736
3744
  return value;
3737
3745
  }
3738
3746
 
3747
+ function validateDirectiveName(name) {
3748
+ if (isBuiltInDirective(name)) {
3749
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3750
+ }
3751
+ }
3752
+ function withDirectives(vnode, directives) {
3753
+ const internalInstance = currentRenderingInstance;
3754
+ if (internalInstance === null) {
3755
+ warn(`withDirectives can only be used inside render functions.`);
3756
+ return vnode;
3757
+ }
3758
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3759
+ const bindings = vnode.dirs || (vnode.dirs = []);
3760
+ for (let i = 0; i < directives.length; i++) {
3761
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3762
+ if (dir) {
3763
+ if (isFunction(dir)) {
3764
+ dir = {
3765
+ mounted: dir,
3766
+ updated: dir
3767
+ };
3768
+ }
3769
+ if (dir.deep) {
3770
+ traverse(value);
3771
+ }
3772
+ bindings.push({
3773
+ dir,
3774
+ instance,
3775
+ value,
3776
+ oldValue: void 0,
3777
+ arg,
3778
+ modifiers
3779
+ });
3780
+ }
3781
+ }
3782
+ return vnode;
3783
+ }
3784
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3785
+ const bindings = vnode.dirs;
3786
+ const oldBindings = prevVNode && prevVNode.dirs;
3787
+ for (let i = 0; i < bindings.length; i++) {
3788
+ const binding = bindings[i];
3789
+ if (oldBindings) {
3790
+ binding.oldValue = oldBindings[i].value;
3791
+ }
3792
+ let hook = binding.dir[name];
3793
+ if (!hook) {
3794
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3795
+ }
3796
+ if (hook) {
3797
+ pauseTracking();
3798
+ callWithAsyncErrorHandling(hook, instance, 8, [
3799
+ vnode.el,
3800
+ binding,
3801
+ vnode,
3802
+ prevVNode
3803
+ ]);
3804
+ resetTracking();
3805
+ }
3806
+ }
3807
+ }
3808
+
3739
3809
  function useTransitionState() {
3740
3810
  const state = {
3741
3811
  isMounted: false,
@@ -4534,106 +4604,6 @@ function getCompatListeners(instance) {
4534
4604
  return listeners;
4535
4605
  }
4536
4606
 
4537
- const legacyDirectiveHookMap = {
4538
- beforeMount: "bind",
4539
- mounted: "inserted",
4540
- updated: ["update", "componentUpdated"],
4541
- unmounted: "unbind"
4542
- };
4543
- function mapCompatDirectiveHook(name, dir, instance) {
4544
- const mappedName = legacyDirectiveHookMap[name];
4545
- if (mappedName) {
4546
- if (isArray(mappedName)) {
4547
- const hook = [];
4548
- mappedName.forEach((mapped) => {
4549
- const mappedHook = dir[mapped];
4550
- if (mappedHook) {
4551
- softAssertCompatEnabled(
4552
- "CUSTOM_DIR",
4553
- instance,
4554
- mapped,
4555
- name
4556
- );
4557
- hook.push(mappedHook);
4558
- }
4559
- });
4560
- return hook.length ? hook : void 0;
4561
- } else {
4562
- if (dir[mappedName]) {
4563
- softAssertCompatEnabled(
4564
- "CUSTOM_DIR",
4565
- instance,
4566
- mappedName,
4567
- name
4568
- );
4569
- }
4570
- return dir[mappedName];
4571
- }
4572
- }
4573
- }
4574
-
4575
- function validateDirectiveName(name) {
4576
- if (isBuiltInDirective(name)) {
4577
- warn("Do not use built-in directive ids as custom directive id: " + name);
4578
- }
4579
- }
4580
- function withDirectives(vnode, directives) {
4581
- const internalInstance = currentRenderingInstance;
4582
- if (internalInstance === null) {
4583
- warn(`withDirectives can only be used inside render functions.`);
4584
- return vnode;
4585
- }
4586
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4587
- const bindings = vnode.dirs || (vnode.dirs = []);
4588
- for (let i = 0; i < directives.length; i++) {
4589
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4590
- if (dir) {
4591
- if (isFunction(dir)) {
4592
- dir = {
4593
- mounted: dir,
4594
- updated: dir
4595
- };
4596
- }
4597
- if (dir.deep) {
4598
- traverse(value);
4599
- }
4600
- bindings.push({
4601
- dir,
4602
- instance,
4603
- value,
4604
- oldValue: void 0,
4605
- arg,
4606
- modifiers
4607
- });
4608
- }
4609
- }
4610
- return vnode;
4611
- }
4612
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4613
- const bindings = vnode.dirs;
4614
- const oldBindings = prevVNode && prevVNode.dirs;
4615
- for (let i = 0; i < bindings.length; i++) {
4616
- const binding = bindings[i];
4617
- if (oldBindings) {
4618
- binding.oldValue = oldBindings[i].value;
4619
- }
4620
- let hook = binding.dir[name];
4621
- if (!hook) {
4622
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4623
- }
4624
- if (hook) {
4625
- pauseTracking();
4626
- callWithAsyncErrorHandling(hook, instance, 8, [
4627
- vnode.el,
4628
- binding,
4629
- vnode,
4630
- prevVNode
4631
- ]);
4632
- resetTracking();
4633
- }
4634
- }
4635
- }
4636
-
4637
4607
  const COMPONENTS = "components";
4638
4608
  const DIRECTIVES = "directives";
4639
4609
  const FILTERS = "filters";
@@ -5974,1179 +5944,1218 @@ function mergeWatchOptions(to, from) {
5974
5944
  return merged;
5975
5945
  }
5976
5946
 
5977
- function createPropsDefaultThis(instance, rawProps, propKey) {
5978
- return new Proxy(
5979
- {},
5980
- {
5981
- get(_, key) {
5982
- warnDeprecation("PROPS_DEFAULT_THIS", null, propKey);
5983
- if (key === "$options") {
5984
- return resolveMergedOptions(instance);
5985
- }
5986
- if (key in rawProps) {
5987
- return rawProps[key];
5988
- }
5989
- const injections = instance.type.inject;
5990
- if (injections) {
5991
- if (isArray(injections)) {
5992
- if (injections.includes(key)) {
5993
- return inject(key);
5994
- }
5995
- } else if (key in injections) {
5996
- return inject(key);
5997
- }
5947
+ function installLegacyConfigWarnings(config) {
5948
+ const legacyConfigOptions = {
5949
+ silent: "CONFIG_SILENT",
5950
+ devtools: "CONFIG_DEVTOOLS",
5951
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
5952
+ keyCodes: "CONFIG_KEY_CODES",
5953
+ productionTip: "CONFIG_PRODUCTION_TIP"
5954
+ };
5955
+ Object.keys(legacyConfigOptions).forEach((key) => {
5956
+ let val = config[key];
5957
+ Object.defineProperty(config, key, {
5958
+ enumerable: true,
5959
+ get() {
5960
+ return val;
5961
+ },
5962
+ set(newVal) {
5963
+ if (!isCopyingConfig) {
5964
+ warnDeprecation(legacyConfigOptions[key], null);
5998
5965
  }
5966
+ val = newVal;
5999
5967
  }
6000
- }
6001
- );
5968
+ });
5969
+ });
6002
5970
  }
6003
-
6004
- function shouldSkipAttr(key, instance) {
6005
- if (key === "is") {
6006
- return true;
6007
- }
6008
- if ((key === "class" || key === "style") && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6009
- return true;
6010
- }
6011
- if (isOn(key) && isCompatEnabled("INSTANCE_LISTENERS", instance)) {
6012
- return true;
6013
- }
6014
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6015
- return true;
6016
- }
6017
- return false;
5971
+ function installLegacyOptionMergeStrats(config) {
5972
+ config.optionMergeStrategies = new Proxy({}, {
5973
+ get(target, key) {
5974
+ if (key in target) {
5975
+ return target[key];
5976
+ }
5977
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
5978
+ "CONFIG_OPTION_MERGE_STRATS",
5979
+ null
5980
+ )) {
5981
+ return internalOptionMergeStrats[key];
5982
+ }
5983
+ }
5984
+ });
6018
5985
  }
6019
5986
 
6020
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6021
- const props = {};
6022
- const attrs = {};
6023
- def(attrs, InternalObjectKey, 1);
6024
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6025
- setFullProps(instance, rawProps, props, attrs);
6026
- for (const key in instance.propsOptions[0]) {
6027
- if (!(key in props)) {
6028
- props[key] = void 0;
5987
+ let isCopyingConfig = false;
5988
+ let singletonApp;
5989
+ let singletonCtor;
5990
+ function createCompatVue$1(createApp, createSingletonApp) {
5991
+ singletonApp = createSingletonApp({});
5992
+ const Vue = singletonCtor = function Vue2(options = {}) {
5993
+ return createCompatApp(options, Vue2);
5994
+ };
5995
+ function createCompatApp(options = {}, Ctor) {
5996
+ assertCompatEnabled("GLOBAL_MOUNT", null);
5997
+ const { data } = options;
5998
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
5999
+ options.data = () => data;
6029
6000
  }
6030
- }
6031
- {
6032
- validateProps(rawProps || {}, props, instance);
6033
- }
6034
- if (isStateful) {
6035
- instance.props = isSSR ? props : shallowReactive(props);
6036
- } else {
6037
- if (!instance.type.props) {
6038
- instance.props = attrs;
6001
+ const app = createApp(options);
6002
+ if (Ctor !== Vue) {
6003
+ applySingletonPrototype(app, Ctor);
6004
+ }
6005
+ const vm = app._createRoot(options);
6006
+ if (options.el) {
6007
+ return vm.$mount(options.el);
6039
6008
  } else {
6040
- instance.props = props;
6009
+ return vm;
6041
6010
  }
6042
6011
  }
6043
- instance.attrs = attrs;
6044
- }
6045
- function isInHmrContext(instance) {
6046
- while (instance) {
6047
- if (instance.type.__hmrId)
6048
- return true;
6049
- instance = instance.parent;
6050
- }
6051
- }
6052
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6053
- const {
6054
- props,
6055
- attrs,
6056
- vnode: { patchFlag }
6057
- } = instance;
6058
- const rawCurrentProps = toRaw(props);
6059
- const [options] = instance.propsOptions;
6060
- let hasAttrsChanged = false;
6061
- if (
6062
- // always force full diff in dev
6063
- // - #1942 if hmr is enabled with sfc component
6064
- // - vite#872 non-sfc component used by sfc component
6065
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6066
- ) {
6067
- if (patchFlag & 8) {
6068
- const propsToUpdate = instance.vnode.dynamicProps;
6069
- for (let i = 0; i < propsToUpdate.length; i++) {
6070
- let key = propsToUpdate[i];
6071
- if (isEmitListener(instance.emitsOptions, key)) {
6072
- continue;
6073
- }
6074
- const value = rawProps[key];
6075
- if (options) {
6076
- if (hasOwn(attrs, key)) {
6077
- if (value !== attrs[key]) {
6078
- attrs[key] = value;
6079
- hasAttrsChanged = true;
6080
- }
6081
- } else {
6082
- const camelizedKey = camelize(key);
6083
- props[camelizedKey] = resolvePropValue(
6084
- options,
6085
- rawCurrentProps,
6086
- camelizedKey,
6087
- value,
6088
- instance,
6089
- false
6090
- /* isAbsent */
6091
- );
6092
- }
6093
- } else {
6094
- {
6095
- if (isOn(key) && key.endsWith("Native")) {
6096
- key = key.slice(0, -6);
6097
- } else if (shouldSkipAttr(key, instance)) {
6098
- continue;
6099
- }
6100
- }
6101
- if (value !== attrs[key]) {
6102
- attrs[key] = value;
6103
- hasAttrsChanged = true;
6104
- }
6105
- }
6106
- }
6012
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.9"}`;
6013
+ Vue.config = singletonApp.config;
6014
+ Vue.use = (p, ...options) => {
6015
+ if (p && isFunction(p.install)) {
6016
+ p.install(Vue, ...options);
6017
+ } else if (isFunction(p)) {
6018
+ p(Vue, ...options);
6107
6019
  }
6108
- } else {
6109
- if (setFullProps(instance, rawProps, props, attrs)) {
6110
- hasAttrsChanged = true;
6020
+ return Vue;
6021
+ };
6022
+ Vue.mixin = (m) => {
6023
+ singletonApp.mixin(m);
6024
+ return Vue;
6025
+ };
6026
+ Vue.component = (name, comp) => {
6027
+ if (comp) {
6028
+ singletonApp.component(name, comp);
6029
+ return Vue;
6030
+ } else {
6031
+ return singletonApp.component(name);
6111
6032
  }
6112
- let kebabKey;
6113
- for (const key in rawCurrentProps) {
6114
- if (!rawProps || // for camelCase
6115
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6116
- // and converted to camelCase (#955)
6117
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6118
- if (options) {
6119
- if (rawPrevProps && // for camelCase
6120
- (rawPrevProps[key] !== void 0 || // for kebab-case
6121
- rawPrevProps[kebabKey] !== void 0)) {
6122
- props[key] = resolvePropValue(
6123
- options,
6124
- rawCurrentProps,
6125
- key,
6126
- void 0,
6127
- instance,
6128
- true
6129
- /* isAbsent */
6130
- );
6131
- }
6132
- } else {
6133
- delete props[key];
6134
- }
6135
- }
6033
+ };
6034
+ Vue.directive = (name, dir) => {
6035
+ if (dir) {
6036
+ singletonApp.directive(name, dir);
6037
+ return Vue;
6038
+ } else {
6039
+ return singletonApp.directive(name);
6136
6040
  }
6137
- if (attrs !== rawCurrentProps) {
6138
- for (const key in attrs) {
6139
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6140
- delete attrs[key];
6141
- hasAttrsChanged = true;
6142
- }
6041
+ };
6042
+ Vue.options = { _base: Vue };
6043
+ let cid = 1;
6044
+ Vue.cid = cid;
6045
+ Vue.nextTick = nextTick;
6046
+ const extendCache = /* @__PURE__ */ new WeakMap();
6047
+ function extendCtor(extendOptions = {}) {
6048
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6049
+ if (isFunction(extendOptions)) {
6050
+ extendOptions = extendOptions.options;
6051
+ }
6052
+ if (extendCache.has(extendOptions)) {
6053
+ return extendCache.get(extendOptions);
6054
+ }
6055
+ const Super = this;
6056
+ function SubVue(inlineOptions) {
6057
+ if (!inlineOptions) {
6058
+ return createCompatApp(SubVue.options, SubVue);
6059
+ } else {
6060
+ return createCompatApp(
6061
+ mergeOptions(
6062
+ extend({}, SubVue.options),
6063
+ inlineOptions,
6064
+ internalOptionMergeStrats
6065
+ ),
6066
+ SubVue
6067
+ );
6143
6068
  }
6144
6069
  }
6070
+ SubVue.super = Super;
6071
+ SubVue.prototype = Object.create(Vue.prototype);
6072
+ SubVue.prototype.constructor = SubVue;
6073
+ const mergeBase = {};
6074
+ for (const key in Super.options) {
6075
+ const superValue = Super.options[key];
6076
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6077
+ }
6078
+ SubVue.options = mergeOptions(
6079
+ mergeBase,
6080
+ extendOptions,
6081
+ internalOptionMergeStrats
6082
+ );
6083
+ SubVue.options._base = SubVue;
6084
+ SubVue.extend = extendCtor.bind(SubVue);
6085
+ SubVue.mixin = Super.mixin;
6086
+ SubVue.use = Super.use;
6087
+ SubVue.cid = ++cid;
6088
+ extendCache.set(extendOptions, SubVue);
6089
+ return SubVue;
6145
6090
  }
6146
- if (hasAttrsChanged) {
6147
- trigger(instance, "set", "$attrs");
6148
- }
6149
- {
6150
- validateProps(rawProps || {}, props, instance);
6151
- }
6152
- }
6153
- function setFullProps(instance, rawProps, props, attrs) {
6154
- const [options, needCastKeys] = instance.propsOptions;
6155
- let hasAttrsChanged = false;
6156
- let rawCastValues;
6157
- if (rawProps) {
6158
- for (let key in rawProps) {
6159
- if (isReservedProp(key)) {
6160
- continue;
6161
- }
6162
- {
6163
- if (key.startsWith("onHook:")) {
6164
- softAssertCompatEnabled(
6165
- "INSTANCE_EVENT_HOOKS",
6166
- instance,
6167
- key.slice(2).toLowerCase()
6168
- );
6169
- }
6170
- if (key === "inline-template") {
6171
- continue;
6172
- }
6173
- }
6174
- const value = rawProps[key];
6175
- let camelKey;
6176
- if (options && hasOwn(options, camelKey = camelize(key))) {
6177
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6178
- props[camelKey] = value;
6179
- } else {
6180
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6181
- }
6182
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6183
- {
6184
- if (isOn(key) && key.endsWith("Native")) {
6185
- key = key.slice(0, -6);
6186
- } else if (shouldSkipAttr(key, instance)) {
6187
- continue;
6188
- }
6189
- }
6190
- if (!(key in attrs) || value !== attrs[key]) {
6191
- attrs[key] = value;
6192
- hasAttrsChanged = true;
6193
- }
6194
- }
6091
+ Vue.extend = extendCtor.bind(Vue);
6092
+ Vue.set = (target, key, value) => {
6093
+ assertCompatEnabled("GLOBAL_SET", null);
6094
+ target[key] = value;
6095
+ };
6096
+ Vue.delete = (target, key) => {
6097
+ assertCompatEnabled("GLOBAL_DELETE", null);
6098
+ delete target[key];
6099
+ };
6100
+ Vue.observable = (target) => {
6101
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6102
+ return reactive(target);
6103
+ };
6104
+ Vue.filter = (name, filter) => {
6105
+ if (filter) {
6106
+ singletonApp.filter(name, filter);
6107
+ return Vue;
6108
+ } else {
6109
+ return singletonApp.filter(name);
6195
6110
  }
6196
- }
6197
- if (needCastKeys) {
6198
- const rawCurrentProps = toRaw(props);
6199
- const castValues = rawCastValues || EMPTY_OBJ;
6200
- for (let i = 0; i < needCastKeys.length; i++) {
6201
- const key = needCastKeys[i];
6202
- props[key] = resolvePropValue(
6203
- options,
6204
- rawCurrentProps,
6205
- key,
6206
- castValues[key],
6207
- instance,
6208
- !hasOwn(castValues, key)
6209
- );
6111
+ };
6112
+ const util = {
6113
+ warn: warn ,
6114
+ extend,
6115
+ mergeOptions: (parent, child, vm) => mergeOptions(
6116
+ parent,
6117
+ child,
6118
+ vm ? void 0 : internalOptionMergeStrats
6119
+ ),
6120
+ defineReactive
6121
+ };
6122
+ Object.defineProperty(Vue, "util", {
6123
+ get() {
6124
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6125
+ return util;
6210
6126
  }
6127
+ });
6128
+ Vue.configureCompat = configureCompat$1;
6129
+ return Vue;
6130
+ }
6131
+ function installAppCompatProperties(app, context, render) {
6132
+ installFilterMethod(app, context);
6133
+ installLegacyOptionMergeStrats(app.config);
6134
+ if (!singletonApp) {
6135
+ return;
6211
6136
  }
6212
- return hasAttrsChanged;
6137
+ installCompatMount(app, context, render);
6138
+ installLegacyAPIs(app);
6139
+ applySingletonAppMutations(app);
6140
+ installLegacyConfigWarnings(app.config);
6213
6141
  }
6214
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6215
- const opt = options[key];
6216
- if (opt != null) {
6217
- const hasDefault = hasOwn(opt, "default");
6218
- if (hasDefault && value === void 0) {
6219
- const defaultValue = opt.default;
6220
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6221
- const { propsDefaults } = instance;
6222
- if (key in propsDefaults) {
6223
- value = propsDefaults[key];
6224
- } else {
6225
- setCurrentInstance(instance);
6226
- value = propsDefaults[key] = defaultValue.call(
6227
- isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6228
- props
6229
- );
6230
- unsetCurrentInstance();
6231
- }
6232
- } else {
6233
- value = defaultValue;
6234
- }
6142
+ function installFilterMethod(app, context) {
6143
+ context.filters = {};
6144
+ app.filter = (name, filter) => {
6145
+ assertCompatEnabled("FILTERS", null);
6146
+ if (!filter) {
6147
+ return context.filters[name];
6235
6148
  }
6236
- if (opt[0 /* shouldCast */]) {
6237
- if (isAbsent && !hasDefault) {
6238
- value = false;
6239
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6240
- value = true;
6241
- }
6149
+ if (context.filters[name]) {
6150
+ warn(`Filter "${name}" has already been registered.`);
6242
6151
  }
6243
- }
6244
- return value;
6152
+ context.filters[name] = filter;
6153
+ return app;
6154
+ };
6245
6155
  }
6246
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6247
- const cache = appContext.propsCache;
6248
- const cached = cache.get(comp);
6249
- if (cached) {
6250
- return cached;
6251
- }
6252
- const raw = comp.props;
6253
- const normalized = {};
6254
- const needCastKeys = [];
6255
- let hasExtends = false;
6256
- if (!isFunction(comp)) {
6257
- const extendProps = (raw2) => {
6258
- if (isFunction(raw2)) {
6259
- raw2 = raw2.options;
6156
+ function installLegacyAPIs(app) {
6157
+ Object.defineProperties(app, {
6158
+ // so that app.use() can work with legacy plugins that extend prototypes
6159
+ prototype: {
6160
+ get() {
6161
+ warnDeprecation("GLOBAL_PROTOTYPE", null);
6162
+ return app.config.globalProperties;
6163
+ }
6164
+ },
6165
+ nextTick: { value: nextTick },
6166
+ extend: { value: singletonCtor.extend },
6167
+ set: { value: singletonCtor.set },
6168
+ delete: { value: singletonCtor.delete },
6169
+ observable: { value: singletonCtor.observable },
6170
+ util: {
6171
+ get() {
6172
+ return singletonCtor.util;
6260
6173
  }
6261
- hasExtends = true;
6262
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6263
- extend(normalized, props);
6264
- if (keys)
6265
- needCastKeys.push(...keys);
6266
- };
6267
- if (!asMixin && appContext.mixins.length) {
6268
- appContext.mixins.forEach(extendProps);
6269
6174
  }
6270
- if (comp.extends) {
6271
- extendProps(comp.extends);
6175
+ });
6176
+ }
6177
+ function applySingletonAppMutations(app) {
6178
+ app._context.mixins = [...singletonApp._context.mixins];
6179
+ ["components", "directives", "filters"].forEach((key) => {
6180
+ app._context[key] = Object.create(singletonApp._context[key]);
6181
+ });
6182
+ isCopyingConfig = true;
6183
+ for (const key in singletonApp.config) {
6184
+ if (key === "isNativeTag")
6185
+ continue;
6186
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6187
+ continue;
6272
6188
  }
6273
- if (comp.mixins) {
6274
- comp.mixins.forEach(extendProps);
6189
+ const val = singletonApp.config[key];
6190
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6191
+ if (key === "ignoredElements" && isCompatEnabled("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6192
+ app.config.compilerOptions.isCustomElement = (tag) => {
6193
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6194
+ };
6275
6195
  }
6276
6196
  }
6277
- if (!raw && !hasExtends) {
6278
- if (isObject(comp)) {
6279
- cache.set(comp, EMPTY_ARR);
6280
- }
6281
- return EMPTY_ARR;
6197
+ isCopyingConfig = false;
6198
+ applySingletonPrototype(app, singletonCtor);
6199
+ }
6200
+ function applySingletonPrototype(app, Ctor) {
6201
+ const enabled = isCompatEnabled("GLOBAL_PROTOTYPE", null);
6202
+ if (enabled) {
6203
+ app.config.globalProperties = Object.create(Ctor.prototype);
6282
6204
  }
6283
- if (isArray(raw)) {
6284
- for (let i = 0; i < raw.length; i++) {
6285
- if (!isString(raw[i])) {
6286
- warn(`props must be strings when using array syntax.`, raw[i]);
6287
- }
6288
- const normalizedKey = camelize(raw[i]);
6289
- if (validatePropName(normalizedKey)) {
6290
- normalized[normalizedKey] = EMPTY_OBJ;
6291
- }
6292
- }
6293
- } else if (raw) {
6294
- if (!isObject(raw)) {
6295
- warn(`invalid props options`, raw);
6296
- }
6297
- for (const key in raw) {
6298
- const normalizedKey = camelize(key);
6299
- if (validatePropName(normalizedKey)) {
6300
- const opt = raw[key];
6301
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6302
- if (prop) {
6303
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6304
- const stringIndex = getTypeIndex(String, prop.type);
6305
- prop[0 /* shouldCast */] = booleanIndex > -1;
6306
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6307
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6308
- needCastKeys.push(normalizedKey);
6309
- }
6310
- }
6205
+ let hasPrototypeAugmentations = false;
6206
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6207
+ for (const key in descriptors) {
6208
+ if (key !== "constructor") {
6209
+ hasPrototypeAugmentations = true;
6210
+ if (enabled) {
6211
+ Object.defineProperty(
6212
+ app.config.globalProperties,
6213
+ key,
6214
+ descriptors[key]
6215
+ );
6311
6216
  }
6312
6217
  }
6313
6218
  }
6314
- const res = [normalized, needCastKeys];
6315
- if (isObject(comp)) {
6316
- cache.set(comp, res);
6317
- }
6318
- return res;
6219
+ if (hasPrototypeAugmentations) {
6220
+ warnDeprecation("GLOBAL_PROTOTYPE", null);
6221
+ }
6319
6222
  }
6320
- function validatePropName(key) {
6321
- if (key[0] !== "$") {
6322
- return true;
6223
+ function installCompatMount(app, context, render) {
6224
+ let isMounted = false;
6225
+ app._createRoot = (options) => {
6226
+ const component = app._component;
6227
+ const vnode = createVNode(component, options.propsData || null);
6228
+ vnode.appContext = context;
6229
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6230
+ const emptyRender = () => {
6231
+ };
6232
+ const instance = createComponentInstance(vnode, null, null);
6233
+ if (hasNoRender) {
6234
+ instance.render = emptyRender;
6235
+ }
6236
+ setupComponent(instance);
6237
+ vnode.component = instance;
6238
+ vnode.isCompatRoot = true;
6239
+ instance.ctx._compat_mount = (selectorOrEl) => {
6240
+ if (isMounted) {
6241
+ warn(`Root instance is already mounted.`);
6242
+ return;
6243
+ }
6244
+ let container;
6245
+ if (typeof selectorOrEl === "string") {
6246
+ const result = document.querySelector(selectorOrEl);
6247
+ if (!result) {
6248
+ warn(
6249
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6250
+ );
6251
+ return;
6252
+ }
6253
+ container = result;
6254
+ } else {
6255
+ container = selectorOrEl || document.createElement("div");
6256
+ }
6257
+ const isSVG = container instanceof SVGElement;
6258
+ {
6259
+ context.reload = () => {
6260
+ const cloned = cloneVNode(vnode);
6261
+ cloned.component = null;
6262
+ render(cloned, container, isSVG);
6263
+ };
6264
+ }
6265
+ if (hasNoRender && instance.render === emptyRender) {
6266
+ {
6267
+ for (let i = 0; i < container.attributes.length; i++) {
6268
+ const attr = container.attributes[i];
6269
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6270
+ warnDeprecation("GLOBAL_MOUNT_CONTAINER", null);
6271
+ break;
6272
+ }
6273
+ }
6274
+ }
6275
+ instance.render = null;
6276
+ component.template = container.innerHTML;
6277
+ finishComponentSetup(
6278
+ instance,
6279
+ false,
6280
+ true
6281
+ /* skip options */
6282
+ );
6283
+ }
6284
+ container.innerHTML = "";
6285
+ render(vnode, container, isSVG);
6286
+ if (container instanceof Element) {
6287
+ container.removeAttribute("v-cloak");
6288
+ container.setAttribute("data-v-app", "");
6289
+ }
6290
+ isMounted = true;
6291
+ app._container = container;
6292
+ container.__vue_app__ = app;
6293
+ {
6294
+ devtoolsInitApp(app, version);
6295
+ }
6296
+ return instance.proxy;
6297
+ };
6298
+ instance.ctx._compat_destroy = () => {
6299
+ if (isMounted) {
6300
+ render(null, app._container);
6301
+ {
6302
+ devtoolsUnmountApp(app);
6303
+ }
6304
+ delete app._container.__vue_app__;
6305
+ } else {
6306
+ const { bum, scope, um } = instance;
6307
+ if (bum) {
6308
+ invokeArrayFns(bum);
6309
+ }
6310
+ if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6311
+ instance.emit("hook:beforeDestroy");
6312
+ }
6313
+ if (scope) {
6314
+ scope.stop();
6315
+ }
6316
+ if (um) {
6317
+ invokeArrayFns(um);
6318
+ }
6319
+ if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6320
+ instance.emit("hook:destroyed");
6321
+ }
6322
+ }
6323
+ };
6324
+ return instance.proxy;
6325
+ };
6326
+ }
6327
+ const methodsToPatch = [
6328
+ "push",
6329
+ "pop",
6330
+ "shift",
6331
+ "unshift",
6332
+ "splice",
6333
+ "sort",
6334
+ "reverse"
6335
+ ];
6336
+ const patched = /* @__PURE__ */ new WeakSet();
6337
+ function defineReactive(obj, key, val) {
6338
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6339
+ const reactiveVal = reactive(val);
6340
+ if (isArray(val)) {
6341
+ methodsToPatch.forEach((m) => {
6342
+ val[m] = (...args) => {
6343
+ Array.prototype[m].call(reactiveVal, ...args);
6344
+ };
6345
+ });
6346
+ } else {
6347
+ Object.keys(val).forEach((key2) => {
6348
+ try {
6349
+ defineReactiveSimple(val, key2, val[key2]);
6350
+ } catch (e) {
6351
+ }
6352
+ });
6353
+ }
6354
+ }
6355
+ const i = obj.$;
6356
+ if (i && obj === i.proxy) {
6357
+ defineReactiveSimple(i.ctx, key, val);
6358
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6359
+ } else if (isReactive(obj)) {
6360
+ obj[key] = val;
6323
6361
  } else {
6324
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6362
+ defineReactiveSimple(obj, key, val);
6325
6363
  }
6326
- return false;
6327
- }
6328
- function getType(ctor) {
6329
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6330
- return match ? match[2] : ctor === null ? "null" : "";
6331
6364
  }
6332
- function isSameType(a, b) {
6333
- return getType(a) === getType(b);
6365
+ function defineReactiveSimple(obj, key, val) {
6366
+ val = isObject(val) ? reactive(val) : val;
6367
+ Object.defineProperty(obj, key, {
6368
+ enumerable: true,
6369
+ configurable: true,
6370
+ get() {
6371
+ track(obj, "get", key);
6372
+ return val;
6373
+ },
6374
+ set(newVal) {
6375
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6376
+ trigger(obj, "set", key, newVal);
6377
+ }
6378
+ });
6334
6379
  }
6335
- function getTypeIndex(type, expectedTypes) {
6336
- if (isArray(expectedTypes)) {
6337
- return expectedTypes.findIndex((t) => isSameType(t, type));
6338
- } else if (isFunction(expectedTypes)) {
6339
- return isSameType(expectedTypes, type) ? 0 : -1;
6340
- }
6341
- return -1;
6380
+
6381
+ function createAppContext() {
6382
+ return {
6383
+ app: null,
6384
+ config: {
6385
+ isNativeTag: NO,
6386
+ performance: false,
6387
+ globalProperties: {},
6388
+ optionMergeStrategies: {},
6389
+ errorHandler: void 0,
6390
+ warnHandler: void 0,
6391
+ compilerOptions: {}
6392
+ },
6393
+ mixins: [],
6394
+ components: {},
6395
+ directives: {},
6396
+ provides: /* @__PURE__ */ Object.create(null),
6397
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6398
+ propsCache: /* @__PURE__ */ new WeakMap(),
6399
+ emitsCache: /* @__PURE__ */ new WeakMap()
6400
+ };
6342
6401
  }
6343
- function validateProps(rawProps, props, instance) {
6344
- const resolvedValues = toRaw(props);
6345
- const options = instance.propsOptions[0];
6346
- for (const key in options) {
6347
- let opt = options[key];
6348
- if (opt == null)
6349
- continue;
6350
- validateProp(
6351
- key,
6352
- resolvedValues[key],
6353
- opt,
6354
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6355
- );
6356
- }
6402
+ let uid$1 = 0;
6403
+ function createAppAPI(render, hydrate) {
6404
+ return function createApp(rootComponent, rootProps = null) {
6405
+ if (!isFunction(rootComponent)) {
6406
+ rootComponent = extend({}, rootComponent);
6407
+ }
6408
+ if (rootProps != null && !isObject(rootProps)) {
6409
+ warn(`root props passed to app.mount() must be an object.`);
6410
+ rootProps = null;
6411
+ }
6412
+ const context = createAppContext();
6413
+ const installedPlugins = /* @__PURE__ */ new Set();
6414
+ let isMounted = false;
6415
+ const app = context.app = {
6416
+ _uid: uid$1++,
6417
+ _component: rootComponent,
6418
+ _props: rootProps,
6419
+ _container: null,
6420
+ _context: context,
6421
+ _instance: null,
6422
+ version,
6423
+ get config() {
6424
+ return context.config;
6425
+ },
6426
+ set config(v) {
6427
+ {
6428
+ warn(
6429
+ `app.config cannot be replaced. Modify individual options instead.`
6430
+ );
6431
+ }
6432
+ },
6433
+ use(plugin, ...options) {
6434
+ if (installedPlugins.has(plugin)) {
6435
+ warn(`Plugin has already been applied to target app.`);
6436
+ } else if (plugin && isFunction(plugin.install)) {
6437
+ installedPlugins.add(plugin);
6438
+ plugin.install(app, ...options);
6439
+ } else if (isFunction(plugin)) {
6440
+ installedPlugins.add(plugin);
6441
+ plugin(app, ...options);
6442
+ } else {
6443
+ warn(
6444
+ `A plugin must either be a function or an object with an "install" function.`
6445
+ );
6446
+ }
6447
+ return app;
6448
+ },
6449
+ mixin(mixin) {
6450
+ {
6451
+ if (!context.mixins.includes(mixin)) {
6452
+ context.mixins.push(mixin);
6453
+ } else {
6454
+ warn(
6455
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6456
+ );
6457
+ }
6458
+ }
6459
+ return app;
6460
+ },
6461
+ component(name, component) {
6462
+ {
6463
+ validateComponentName(name, context.config);
6464
+ }
6465
+ if (!component) {
6466
+ return context.components[name];
6467
+ }
6468
+ if (context.components[name]) {
6469
+ warn(`Component "${name}" has already been registered in target app.`);
6470
+ }
6471
+ context.components[name] = component;
6472
+ return app;
6473
+ },
6474
+ directive(name, directive) {
6475
+ {
6476
+ validateDirectiveName(name);
6477
+ }
6478
+ if (!directive) {
6479
+ return context.directives[name];
6480
+ }
6481
+ if (context.directives[name]) {
6482
+ warn(`Directive "${name}" has already been registered in target app.`);
6483
+ }
6484
+ context.directives[name] = directive;
6485
+ return app;
6486
+ },
6487
+ mount(rootContainer, isHydrate, isSVG) {
6488
+ if (!isMounted) {
6489
+ if (rootContainer.__vue_app__) {
6490
+ warn(
6491
+ `There is already an app instance mounted on the host container.
6492
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6493
+ );
6494
+ }
6495
+ const vnode = createVNode(
6496
+ rootComponent,
6497
+ rootProps
6498
+ );
6499
+ vnode.appContext = context;
6500
+ {
6501
+ context.reload = () => {
6502
+ render(cloneVNode(vnode), rootContainer, isSVG);
6503
+ };
6504
+ }
6505
+ if (isHydrate && hydrate) {
6506
+ hydrate(vnode, rootContainer);
6507
+ } else {
6508
+ render(vnode, rootContainer, isSVG);
6509
+ }
6510
+ isMounted = true;
6511
+ app._container = rootContainer;
6512
+ rootContainer.__vue_app__ = app;
6513
+ {
6514
+ app._instance = vnode.component;
6515
+ devtoolsInitApp(app, version);
6516
+ }
6517
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6518
+ } else {
6519
+ warn(
6520
+ `App has already been mounted.
6521
+ 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)\``
6522
+ );
6523
+ }
6524
+ },
6525
+ unmount() {
6526
+ if (isMounted) {
6527
+ render(null, app._container);
6528
+ {
6529
+ app._instance = null;
6530
+ devtoolsUnmountApp(app);
6531
+ }
6532
+ delete app._container.__vue_app__;
6533
+ } else {
6534
+ warn(`Cannot unmount an app that is not mounted.`);
6535
+ }
6536
+ },
6537
+ provide(key, value) {
6538
+ if (key in context.provides) {
6539
+ warn(
6540
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6541
+ );
6542
+ }
6543
+ context.provides[key] = value;
6544
+ return app;
6545
+ },
6546
+ runWithContext(fn) {
6547
+ currentApp = app;
6548
+ try {
6549
+ return fn();
6550
+ } finally {
6551
+ currentApp = null;
6552
+ }
6553
+ }
6554
+ };
6555
+ {
6556
+ installAppCompatProperties(app, context, render);
6557
+ }
6558
+ return app;
6559
+ };
6357
6560
  }
6358
- function validateProp(name, value, prop, isAbsent) {
6359
- const { type, required, validator, skipCheck } = prop;
6360
- if (required && isAbsent) {
6361
- warn('Missing required prop: "' + name + '"');
6362
- return;
6363
- }
6364
- if (value == null && !prop.required) {
6365
- return;
6366
- }
6367
- if (type != null && type !== true && !skipCheck) {
6368
- let isValid = false;
6369
- const types = isArray(type) ? type : [type];
6370
- const expectedTypes = [];
6371
- for (let i = 0; i < types.length && !isValid; i++) {
6372
- const { valid, expectedType } = assertType(value, types[i]);
6373
- expectedTypes.push(expectedType || "");
6374
- isValid = valid;
6561
+ let currentApp = null;
6562
+
6563
+ function provide(key, value) {
6564
+ if (!currentInstance) {
6565
+ {
6566
+ warn(`provide() can only be used inside setup().`);
6375
6567
  }
6376
- if (!isValid) {
6377
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6378
- return;
6568
+ } else {
6569
+ let provides = currentInstance.provides;
6570
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6571
+ if (parentProvides === provides) {
6572
+ provides = currentInstance.provides = Object.create(parentProvides);
6379
6573
  }
6380
- }
6381
- if (validator && !validator(value)) {
6382
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6574
+ provides[key] = value;
6383
6575
  }
6384
6576
  }
6385
- const isSimpleType = /* @__PURE__ */ makeMap(
6386
- "String,Number,Boolean,Function,Symbol,BigInt"
6387
- );
6388
- function assertType(value, type) {
6389
- let valid;
6390
- const expectedType = getType(type);
6391
- if (isSimpleType(expectedType)) {
6392
- const t = typeof value;
6393
- valid = t === expectedType.toLowerCase();
6394
- if (!valid && t === "object") {
6395
- valid = value instanceof type;
6577
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6578
+ const instance = currentInstance || currentRenderingInstance;
6579
+ if (instance || currentApp) {
6580
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6581
+ if (provides && key in provides) {
6582
+ return provides[key];
6583
+ } else if (arguments.length > 1) {
6584
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6585
+ } else {
6586
+ warn(`injection "${String(key)}" not found.`);
6396
6587
  }
6397
- } else if (expectedType === "Object") {
6398
- valid = isObject(value);
6399
- } else if (expectedType === "Array") {
6400
- valid = isArray(value);
6401
- } else if (expectedType === "null") {
6402
- valid = value === null;
6403
6588
  } else {
6404
- valid = value instanceof type;
6589
+ warn(`inject() can only be used inside setup() or functional components.`);
6405
6590
  }
6406
- return {
6407
- valid,
6408
- expectedType
6409
- };
6410
6591
  }
6411
- function getInvalidTypeMessage(name, value, expectedTypes) {
6412
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6413
- const expectedType = expectedTypes[0];
6414
- const receivedType = toRawType(value);
6415
- const expectedValue = styleValue(value, expectedType);
6416
- const receivedValue = styleValue(value, receivedType);
6417
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6418
- message += ` with value ${expectedValue}`;
6592
+
6593
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6594
+ return new Proxy(
6595
+ {},
6596
+ {
6597
+ get(_, key) {
6598
+ warnDeprecation("PROPS_DEFAULT_THIS", null, propKey);
6599
+ if (key === "$options") {
6600
+ return resolveMergedOptions(instance);
6601
+ }
6602
+ if (key in rawProps) {
6603
+ return rawProps[key];
6604
+ }
6605
+ const injections = instance.type.inject;
6606
+ if (injections) {
6607
+ if (isArray(injections)) {
6608
+ if (injections.includes(key)) {
6609
+ return inject(key);
6610
+ }
6611
+ } else if (key in injections) {
6612
+ return inject(key);
6613
+ }
6614
+ }
6615
+ }
6616
+ }
6617
+ );
6618
+ }
6619
+
6620
+ function shouldSkipAttr(key, instance) {
6621
+ if (key === "is") {
6622
+ return true;
6419
6623
  }
6420
- message += `, got ${receivedType} `;
6421
- if (isExplicable(receivedType)) {
6422
- message += `with value ${receivedValue}.`;
6624
+ if ((key === "class" || key === "style") && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6625
+ return true;
6423
6626
  }
6424
- return message;
6425
- }
6426
- function styleValue(value, type) {
6427
- if (type === "String") {
6428
- return `"${value}"`;
6429
- } else if (type === "Number") {
6430
- return `${Number(value)}`;
6431
- } else {
6432
- return `${value}`;
6627
+ if (isOn(key) && isCompatEnabled("INSTANCE_LISTENERS", instance)) {
6628
+ return true;
6433
6629
  }
6434
- }
6435
- function isExplicable(type) {
6436
- const explicitTypes = ["string", "number", "boolean"];
6437
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6438
- }
6439
- function isBoolean(...args) {
6440
- return args.some((elem) => elem.toLowerCase() === "boolean");
6630
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6631
+ return true;
6632
+ }
6633
+ return false;
6441
6634
  }
6442
6635
 
6443
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6444
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6445
- const normalizeSlot = (key, rawSlot, ctx) => {
6446
- if (rawSlot._n) {
6447
- return rawSlot;
6448
- }
6449
- const normalized = withCtx((...args) => {
6450
- if (currentInstance) {
6451
- warn(
6452
- `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.`
6453
- );
6454
- }
6455
- return normalizeSlotValue(rawSlot(...args));
6456
- }, ctx);
6457
- normalized._c = false;
6458
- return normalized;
6459
- };
6460
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6461
- const ctx = rawSlots._ctx;
6462
- for (const key in rawSlots) {
6463
- if (isInternalKey(key))
6464
- continue;
6465
- const value = rawSlots[key];
6466
- if (isFunction(value)) {
6467
- slots[key] = normalizeSlot(key, value, ctx);
6468
- } else if (value != null) {
6469
- if (!isCompatEnabled("RENDER_FUNCTION", instance)) {
6470
- warn(
6471
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6472
- );
6473
- }
6474
- const normalized = normalizeSlotValue(value);
6475
- slots[key] = () => normalized;
6636
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6637
+ const props = {};
6638
+ const attrs = {};
6639
+ def(attrs, InternalObjectKey, 1);
6640
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6641
+ setFullProps(instance, rawProps, props, attrs);
6642
+ for (const key in instance.propsOptions[0]) {
6643
+ if (!(key in props)) {
6644
+ props[key] = void 0;
6476
6645
  }
6477
6646
  }
6478
- };
6479
- const normalizeVNodeSlots = (instance, children) => {
6480
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled("RENDER_FUNCTION", instance)) {
6481
- warn(
6482
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6483
- );
6647
+ {
6648
+ validateProps(rawProps || {}, props, instance);
6484
6649
  }
6485
- const normalized = normalizeSlotValue(children);
6486
- instance.slots.default = () => normalized;
6487
- };
6488
- const initSlots = (instance, children) => {
6489
- if (instance.vnode.shapeFlag & 32) {
6490
- const type = children._;
6491
- if (type) {
6492
- instance.slots = toRaw(children);
6493
- def(children, "_", type);
6650
+ if (isStateful) {
6651
+ instance.props = isSSR ? props : shallowReactive(props);
6652
+ } else {
6653
+ if (!instance.type.props) {
6654
+ instance.props = attrs;
6494
6655
  } else {
6495
- normalizeObjectSlots(
6496
- children,
6497
- instance.slots = {},
6498
- instance
6499
- );
6656
+ instance.props = props;
6657
+ }
6658
+ }
6659
+ instance.attrs = attrs;
6660
+ }
6661
+ function isInHmrContext(instance) {
6662
+ while (instance) {
6663
+ if (instance.type.__hmrId)
6664
+ return true;
6665
+ instance = instance.parent;
6666
+ }
6667
+ }
6668
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6669
+ const {
6670
+ props,
6671
+ attrs,
6672
+ vnode: { patchFlag }
6673
+ } = instance;
6674
+ const rawCurrentProps = toRaw(props);
6675
+ const [options] = instance.propsOptions;
6676
+ let hasAttrsChanged = false;
6677
+ if (
6678
+ // always force full diff in dev
6679
+ // - #1942 if hmr is enabled with sfc component
6680
+ // - vite#872 non-sfc component used by sfc component
6681
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6682
+ ) {
6683
+ if (patchFlag & 8) {
6684
+ const propsToUpdate = instance.vnode.dynamicProps;
6685
+ for (let i = 0; i < propsToUpdate.length; i++) {
6686
+ let key = propsToUpdate[i];
6687
+ if (isEmitListener(instance.emitsOptions, key)) {
6688
+ continue;
6689
+ }
6690
+ const value = rawProps[key];
6691
+ if (options) {
6692
+ if (hasOwn(attrs, key)) {
6693
+ if (value !== attrs[key]) {
6694
+ attrs[key] = value;
6695
+ hasAttrsChanged = true;
6696
+ }
6697
+ } else {
6698
+ const camelizedKey = camelize(key);
6699
+ props[camelizedKey] = resolvePropValue(
6700
+ options,
6701
+ rawCurrentProps,
6702
+ camelizedKey,
6703
+ value,
6704
+ instance,
6705
+ false
6706
+ /* isAbsent */
6707
+ );
6708
+ }
6709
+ } else {
6710
+ {
6711
+ if (isOn(key) && key.endsWith("Native")) {
6712
+ key = key.slice(0, -6);
6713
+ } else if (shouldSkipAttr(key, instance)) {
6714
+ continue;
6715
+ }
6716
+ }
6717
+ if (value !== attrs[key]) {
6718
+ attrs[key] = value;
6719
+ hasAttrsChanged = true;
6720
+ }
6721
+ }
6722
+ }
6500
6723
  }
6501
6724
  } else {
6502
- instance.slots = {};
6503
- if (children) {
6504
- normalizeVNodeSlots(instance, children);
6725
+ if (setFullProps(instance, rawProps, props, attrs)) {
6726
+ hasAttrsChanged = true;
6505
6727
  }
6506
- }
6507
- def(instance.slots, InternalObjectKey, 1);
6508
- };
6509
- const updateSlots = (instance, children, optimized) => {
6510
- const { vnode, slots } = instance;
6511
- let needDeletionCheck = true;
6512
- let deletionComparisonTarget = EMPTY_OBJ;
6513
- if (vnode.shapeFlag & 32) {
6514
- const type = children._;
6515
- if (type) {
6516
- if (isHmrUpdating) {
6517
- extend(slots, children);
6518
- } else if (optimized && type === 1) {
6519
- needDeletionCheck = false;
6520
- } else {
6521
- extend(slots, children);
6522
- if (!optimized && type === 1) {
6523
- delete slots._;
6728
+ let kebabKey;
6729
+ for (const key in rawCurrentProps) {
6730
+ if (!rawProps || // for camelCase
6731
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6732
+ // and converted to camelCase (#955)
6733
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6734
+ if (options) {
6735
+ if (rawPrevProps && // for camelCase
6736
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6737
+ rawPrevProps[kebabKey] !== void 0)) {
6738
+ props[key] = resolvePropValue(
6739
+ options,
6740
+ rawCurrentProps,
6741
+ key,
6742
+ void 0,
6743
+ instance,
6744
+ true
6745
+ /* isAbsent */
6746
+ );
6747
+ }
6748
+ } else {
6749
+ delete props[key];
6524
6750
  }
6525
6751
  }
6526
- } else {
6527
- needDeletionCheck = !children.$stable;
6528
- normalizeObjectSlots(children, slots, instance);
6529
6752
  }
6530
- deletionComparisonTarget = children;
6531
- } else if (children) {
6532
- normalizeVNodeSlots(instance, children);
6533
- deletionComparisonTarget = { default: 1 };
6534
- }
6535
- if (needDeletionCheck) {
6536
- for (const key in slots) {
6537
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6538
- delete slots[key];
6753
+ if (attrs !== rawCurrentProps) {
6754
+ for (const key in attrs) {
6755
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6756
+ delete attrs[key];
6757
+ hasAttrsChanged = true;
6758
+ }
6539
6759
  }
6540
6760
  }
6541
6761
  }
6542
- };
6543
-
6544
- function installLegacyConfigWarnings(config) {
6545
- const legacyConfigOptions = {
6546
- silent: "CONFIG_SILENT",
6547
- devtools: "CONFIG_DEVTOOLS",
6548
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6549
- keyCodes: "CONFIG_KEY_CODES",
6550
- productionTip: "CONFIG_PRODUCTION_TIP"
6551
- };
6552
- Object.keys(legacyConfigOptions).forEach((key) => {
6553
- let val = config[key];
6554
- Object.defineProperty(config, key, {
6555
- enumerable: true,
6556
- get() {
6557
- return val;
6558
- },
6559
- set(newVal) {
6560
- if (!isCopyingConfig) {
6561
- warnDeprecation(legacyConfigOptions[key], null);
6562
- }
6563
- val = newVal;
6564
- }
6565
- });
6566
- });
6762
+ if (hasAttrsChanged) {
6763
+ trigger(instance, "set", "$attrs");
6764
+ }
6765
+ {
6766
+ validateProps(rawProps || {}, props, instance);
6767
+ }
6567
6768
  }
6568
- function installLegacyOptionMergeStrats(config) {
6569
- config.optionMergeStrategies = new Proxy({}, {
6570
- get(target, key) {
6571
- if (key in target) {
6572
- return target[key];
6769
+ function setFullProps(instance, rawProps, props, attrs) {
6770
+ const [options, needCastKeys] = instance.propsOptions;
6771
+ let hasAttrsChanged = false;
6772
+ let rawCastValues;
6773
+ if (rawProps) {
6774
+ for (let key in rawProps) {
6775
+ if (isReservedProp(key)) {
6776
+ continue;
6573
6777
  }
6574
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6575
- "CONFIG_OPTION_MERGE_STRATS",
6576
- null
6577
- )) {
6578
- return internalOptionMergeStrats[key];
6778
+ {
6779
+ if (key.startsWith("onHook:")) {
6780
+ softAssertCompatEnabled(
6781
+ "INSTANCE_EVENT_HOOKS",
6782
+ instance,
6783
+ key.slice(2).toLowerCase()
6784
+ );
6785
+ }
6786
+ if (key === "inline-template") {
6787
+ continue;
6788
+ }
6789
+ }
6790
+ const value = rawProps[key];
6791
+ let camelKey;
6792
+ if (options && hasOwn(options, camelKey = camelize(key))) {
6793
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6794
+ props[camelKey] = value;
6795
+ } else {
6796
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6797
+ }
6798
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
6799
+ {
6800
+ if (isOn(key) && key.endsWith("Native")) {
6801
+ key = key.slice(0, -6);
6802
+ } else if (shouldSkipAttr(key, instance)) {
6803
+ continue;
6804
+ }
6805
+ }
6806
+ if (!(key in attrs) || value !== attrs[key]) {
6807
+ attrs[key] = value;
6808
+ hasAttrsChanged = true;
6809
+ }
6579
6810
  }
6580
- }
6581
- });
6582
- }
6583
-
6584
- let isCopyingConfig = false;
6585
- let singletonApp;
6586
- let singletonCtor;
6587
- function createCompatVue$1(createApp, createSingletonApp) {
6588
- singletonApp = createSingletonApp({});
6589
- const Vue = singletonCtor = function Vue2(options = {}) {
6590
- return createCompatApp(options, Vue2);
6591
- };
6592
- function createCompatApp(options = {}, Ctor) {
6593
- assertCompatEnabled("GLOBAL_MOUNT", null);
6594
- const { data } = options;
6595
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6596
- options.data = () => data;
6597
- }
6598
- const app = createApp(options);
6599
- if (Ctor !== Vue) {
6600
- applySingletonPrototype(app, Ctor);
6601
- }
6602
- const vm = app._createRoot(options);
6603
- if (options.el) {
6604
- return vm.$mount(options.el);
6605
- } else {
6606
- return vm;
6607
6811
  }
6608
6812
  }
6609
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6610
- Vue.config = singletonApp.config;
6611
- Vue.use = (p, ...options) => {
6612
- if (p && isFunction(p.install)) {
6613
- p.install(Vue, ...options);
6614
- } else if (isFunction(p)) {
6615
- p(Vue, ...options);
6616
- }
6617
- return Vue;
6618
- };
6619
- Vue.mixin = (m) => {
6620
- singletonApp.mixin(m);
6621
- return Vue;
6622
- };
6623
- Vue.component = (name, comp) => {
6624
- if (comp) {
6625
- singletonApp.component(name, comp);
6626
- return Vue;
6627
- } else {
6628
- return singletonApp.component(name);
6629
- }
6630
- };
6631
- Vue.directive = (name, dir) => {
6632
- if (dir) {
6633
- singletonApp.directive(name, dir);
6634
- return Vue;
6635
- } else {
6636
- return singletonApp.directive(name);
6637
- }
6638
- };
6639
- Vue.options = { _base: Vue };
6640
- let cid = 1;
6641
- Vue.cid = cid;
6642
- Vue.nextTick = nextTick;
6643
- const extendCache = /* @__PURE__ */ new WeakMap();
6644
- function extendCtor(extendOptions = {}) {
6645
- assertCompatEnabled("GLOBAL_EXTEND", null);
6646
- if (isFunction(extendOptions)) {
6647
- extendOptions = extendOptions.options;
6648
- }
6649
- if (extendCache.has(extendOptions)) {
6650
- return extendCache.get(extendOptions);
6813
+ if (needCastKeys) {
6814
+ const rawCurrentProps = toRaw(props);
6815
+ const castValues = rawCastValues || EMPTY_OBJ;
6816
+ for (let i = 0; i < needCastKeys.length; i++) {
6817
+ const key = needCastKeys[i];
6818
+ props[key] = resolvePropValue(
6819
+ options,
6820
+ rawCurrentProps,
6821
+ key,
6822
+ castValues[key],
6823
+ instance,
6824
+ !hasOwn(castValues, key)
6825
+ );
6651
6826
  }
6652
- const Super = this;
6653
- function SubVue(inlineOptions) {
6654
- if (!inlineOptions) {
6655
- return createCompatApp(SubVue.options, SubVue);
6827
+ }
6828
+ return hasAttrsChanged;
6829
+ }
6830
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6831
+ const opt = options[key];
6832
+ if (opt != null) {
6833
+ const hasDefault = hasOwn(opt, "default");
6834
+ if (hasDefault && value === void 0) {
6835
+ const defaultValue = opt.default;
6836
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6837
+ const { propsDefaults } = instance;
6838
+ if (key in propsDefaults) {
6839
+ value = propsDefaults[key];
6840
+ } else {
6841
+ setCurrentInstance(instance);
6842
+ value = propsDefaults[key] = defaultValue.call(
6843
+ isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6844
+ props
6845
+ );
6846
+ unsetCurrentInstance();
6847
+ }
6656
6848
  } else {
6657
- return createCompatApp(
6658
- mergeOptions(
6659
- extend({}, SubVue.options),
6660
- inlineOptions,
6661
- internalOptionMergeStrats
6662
- ),
6663
- SubVue
6664
- );
6849
+ value = defaultValue;
6665
6850
  }
6666
6851
  }
6667
- SubVue.super = Super;
6668
- SubVue.prototype = Object.create(Vue.prototype);
6669
- SubVue.prototype.constructor = SubVue;
6670
- const mergeBase = {};
6671
- for (const key in Super.options) {
6672
- const superValue = Super.options[key];
6673
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6852
+ if (opt[0 /* shouldCast */]) {
6853
+ if (isAbsent && !hasDefault) {
6854
+ value = false;
6855
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6856
+ value = true;
6857
+ }
6674
6858
  }
6675
- SubVue.options = mergeOptions(
6676
- mergeBase,
6677
- extendOptions,
6678
- internalOptionMergeStrats
6679
- );
6680
- SubVue.options._base = SubVue;
6681
- SubVue.extend = extendCtor.bind(SubVue);
6682
- SubVue.mixin = Super.mixin;
6683
- SubVue.use = Super.use;
6684
- SubVue.cid = ++cid;
6685
- extendCache.set(extendOptions, SubVue);
6686
- return SubVue;
6687
6859
  }
6688
- Vue.extend = extendCtor.bind(Vue);
6689
- Vue.set = (target, key, value) => {
6690
- assertCompatEnabled("GLOBAL_SET", null);
6691
- target[key] = value;
6692
- };
6693
- Vue.delete = (target, key) => {
6694
- assertCompatEnabled("GLOBAL_DELETE", null);
6695
- delete target[key];
6696
- };
6697
- Vue.observable = (target) => {
6698
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6699
- return reactive(target);
6700
- };
6701
- Vue.filter = (name, filter) => {
6702
- if (filter) {
6703
- singletonApp.filter(name, filter);
6704
- return Vue;
6705
- } else {
6706
- return singletonApp.filter(name);
6707
- }
6708
- };
6709
- const util = {
6710
- warn: warn ,
6711
- extend,
6712
- mergeOptions: (parent, child, vm) => mergeOptions(
6713
- parent,
6714
- child,
6715
- vm ? void 0 : internalOptionMergeStrats
6716
- ),
6717
- defineReactive
6718
- };
6719
- Object.defineProperty(Vue, "util", {
6720
- get() {
6721
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6722
- return util;
6723
- }
6724
- });
6725
- Vue.configureCompat = configureCompat$1;
6726
- return Vue;
6860
+ return value;
6727
6861
  }
6728
- function installAppCompatProperties(app, context, render) {
6729
- installFilterMethod(app, context);
6730
- installLegacyOptionMergeStrats(app.config);
6731
- if (!singletonApp) {
6732
- return;
6862
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
6863
+ const cache = appContext.propsCache;
6864
+ const cached = cache.get(comp);
6865
+ if (cached) {
6866
+ return cached;
6733
6867
  }
6734
- installCompatMount(app, context, render);
6735
- installLegacyAPIs(app);
6736
- applySingletonAppMutations(app);
6737
- installLegacyConfigWarnings(app.config);
6738
- }
6739
- function installFilterMethod(app, context) {
6740
- context.filters = {};
6741
- app.filter = (name, filter) => {
6742
- assertCompatEnabled("FILTERS", null);
6743
- if (!filter) {
6744
- return context.filters[name];
6868
+ const raw = comp.props;
6869
+ const normalized = {};
6870
+ const needCastKeys = [];
6871
+ let hasExtends = false;
6872
+ if (!isFunction(comp)) {
6873
+ const extendProps = (raw2) => {
6874
+ if (isFunction(raw2)) {
6875
+ raw2 = raw2.options;
6876
+ }
6877
+ hasExtends = true;
6878
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6879
+ extend(normalized, props);
6880
+ if (keys)
6881
+ needCastKeys.push(...keys);
6882
+ };
6883
+ if (!asMixin && appContext.mixins.length) {
6884
+ appContext.mixins.forEach(extendProps);
6745
6885
  }
6746
- if (context.filters[name]) {
6747
- warn(`Filter "${name}" has already been registered.`);
6886
+ if (comp.extends) {
6887
+ extendProps(comp.extends);
6748
6888
  }
6749
- context.filters[name] = filter;
6750
- return app;
6751
- };
6752
- }
6753
- function installLegacyAPIs(app) {
6754
- Object.defineProperties(app, {
6755
- // so that app.use() can work with legacy plugins that extend prototypes
6756
- prototype: {
6757
- get() {
6758
- warnDeprecation("GLOBAL_PROTOTYPE", null);
6759
- return app.config.globalProperties;
6889
+ if (comp.mixins) {
6890
+ comp.mixins.forEach(extendProps);
6891
+ }
6892
+ }
6893
+ if (!raw && !hasExtends) {
6894
+ if (isObject(comp)) {
6895
+ cache.set(comp, EMPTY_ARR);
6896
+ }
6897
+ return EMPTY_ARR;
6898
+ }
6899
+ if (isArray(raw)) {
6900
+ for (let i = 0; i < raw.length; i++) {
6901
+ if (!isString(raw[i])) {
6902
+ warn(`props must be strings when using array syntax.`, raw[i]);
6760
6903
  }
6761
- },
6762
- nextTick: { value: nextTick },
6763
- extend: { value: singletonCtor.extend },
6764
- set: { value: singletonCtor.set },
6765
- delete: { value: singletonCtor.delete },
6766
- observable: { value: singletonCtor.observable },
6767
- util: {
6768
- get() {
6769
- return singletonCtor.util;
6904
+ const normalizedKey = camelize(raw[i]);
6905
+ if (validatePropName(normalizedKey)) {
6906
+ normalized[normalizedKey] = EMPTY_OBJ;
6770
6907
  }
6771
6908
  }
6772
- });
6773
- }
6774
- function applySingletonAppMutations(app) {
6775
- app._context.mixins = [...singletonApp._context.mixins];
6776
- ["components", "directives", "filters"].forEach((key) => {
6777
- app._context[key] = Object.create(singletonApp._context[key]);
6778
- });
6779
- isCopyingConfig = true;
6780
- for (const key in singletonApp.config) {
6781
- if (key === "isNativeTag")
6782
- continue;
6783
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6784
- continue;
6909
+ } else if (raw) {
6910
+ if (!isObject(raw)) {
6911
+ warn(`invalid props options`, raw);
6785
6912
  }
6786
- const val = singletonApp.config[key];
6787
- app.config[key] = isObject(val) ? Object.create(val) : val;
6788
- if (key === "ignoredElements" && isCompatEnabled("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6789
- app.config.compilerOptions.isCustomElement = (tag) => {
6790
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6791
- };
6913
+ for (const key in raw) {
6914
+ const normalizedKey = camelize(key);
6915
+ if (validatePropName(normalizedKey)) {
6916
+ const opt = raw[key];
6917
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6918
+ if (prop) {
6919
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
6920
+ const stringIndex = getTypeIndex(String, prop.type);
6921
+ prop[0 /* shouldCast */] = booleanIndex > -1;
6922
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6923
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
6924
+ needCastKeys.push(normalizedKey);
6925
+ }
6926
+ }
6927
+ }
6792
6928
  }
6793
6929
  }
6794
- isCopyingConfig = false;
6795
- applySingletonPrototype(app, singletonCtor);
6930
+ const res = [normalized, needCastKeys];
6931
+ if (isObject(comp)) {
6932
+ cache.set(comp, res);
6933
+ }
6934
+ return res;
6796
6935
  }
6797
- function applySingletonPrototype(app, Ctor) {
6798
- const enabled = isCompatEnabled("GLOBAL_PROTOTYPE", null);
6799
- if (enabled) {
6800
- app.config.globalProperties = Object.create(Ctor.prototype);
6936
+ function validatePropName(key) {
6937
+ if (key[0] !== "$") {
6938
+ return true;
6939
+ } else {
6940
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
6801
6941
  }
6802
- let hasPrototypeAugmentations = false;
6803
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6804
- for (const key in descriptors) {
6805
- if (key !== "constructor") {
6806
- hasPrototypeAugmentations = true;
6807
- if (enabled) {
6808
- Object.defineProperty(
6809
- app.config.globalProperties,
6810
- key,
6811
- descriptors[key]
6812
- );
6813
- }
6942
+ return false;
6943
+ }
6944
+ function getType(ctor) {
6945
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6946
+ return match ? match[2] : ctor === null ? "null" : "";
6947
+ }
6948
+ function isSameType(a, b) {
6949
+ return getType(a) === getType(b);
6950
+ }
6951
+ function getTypeIndex(type, expectedTypes) {
6952
+ if (isArray(expectedTypes)) {
6953
+ return expectedTypes.findIndex((t) => isSameType(t, type));
6954
+ } else if (isFunction(expectedTypes)) {
6955
+ return isSameType(expectedTypes, type) ? 0 : -1;
6956
+ }
6957
+ return -1;
6958
+ }
6959
+ function validateProps(rawProps, props, instance) {
6960
+ const resolvedValues = toRaw(props);
6961
+ const options = instance.propsOptions[0];
6962
+ for (const key in options) {
6963
+ let opt = options[key];
6964
+ if (opt == null)
6965
+ continue;
6966
+ validateProp(
6967
+ key,
6968
+ resolvedValues[key],
6969
+ opt,
6970
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6971
+ );
6972
+ }
6973
+ }
6974
+ function validateProp(name, value, prop, isAbsent) {
6975
+ const { type, required, validator, skipCheck } = prop;
6976
+ if (required && isAbsent) {
6977
+ warn('Missing required prop: "' + name + '"');
6978
+ return;
6979
+ }
6980
+ if (value == null && !required) {
6981
+ return;
6982
+ }
6983
+ if (type != null && type !== true && !skipCheck) {
6984
+ let isValid = false;
6985
+ const types = isArray(type) ? type : [type];
6986
+ const expectedTypes = [];
6987
+ for (let i = 0; i < types.length && !isValid; i++) {
6988
+ const { valid, expectedType } = assertType(value, types[i]);
6989
+ expectedTypes.push(expectedType || "");
6990
+ isValid = valid;
6991
+ }
6992
+ if (!isValid) {
6993
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
6994
+ return;
6814
6995
  }
6815
6996
  }
6816
- if (hasPrototypeAugmentations) {
6817
- warnDeprecation("GLOBAL_PROTOTYPE", null);
6997
+ if (validator && !validator(value)) {
6998
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6818
6999
  }
6819
7000
  }
6820
- function installCompatMount(app, context, render) {
6821
- let isMounted = false;
6822
- app._createRoot = (options) => {
6823
- const component = app._component;
6824
- const vnode = createVNode(component, options.propsData || null);
6825
- vnode.appContext = context;
6826
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6827
- const emptyRender = () => {
6828
- };
6829
- const instance = createComponentInstance(vnode, null, null);
6830
- if (hasNoRender) {
6831
- instance.render = emptyRender;
7001
+ const isSimpleType = /* @__PURE__ */ makeMap(
7002
+ "String,Number,Boolean,Function,Symbol,BigInt"
7003
+ );
7004
+ function assertType(value, type) {
7005
+ let valid;
7006
+ const expectedType = getType(type);
7007
+ if (isSimpleType(expectedType)) {
7008
+ const t = typeof value;
7009
+ valid = t === expectedType.toLowerCase();
7010
+ if (!valid && t === "object") {
7011
+ valid = value instanceof type;
6832
7012
  }
6833
- setupComponent(instance);
6834
- vnode.component = instance;
6835
- vnode.isCompatRoot = true;
6836
- instance.ctx._compat_mount = (selectorOrEl) => {
6837
- if (isMounted) {
6838
- warn(`Root instance is already mounted.`);
6839
- return;
6840
- }
6841
- let container;
6842
- if (typeof selectorOrEl === "string") {
6843
- const result = document.querySelector(selectorOrEl);
6844
- if (!result) {
6845
- warn(
6846
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6847
- );
6848
- return;
6849
- }
6850
- container = result;
6851
- } else {
6852
- container = selectorOrEl || document.createElement("div");
6853
- }
6854
- const isSVG = container instanceof SVGElement;
6855
- {
6856
- context.reload = () => {
6857
- const cloned = cloneVNode(vnode);
6858
- cloned.component = null;
6859
- render(cloned, container, isSVG);
6860
- };
6861
- }
6862
- if (hasNoRender && instance.render === emptyRender) {
6863
- {
6864
- for (let i = 0; i < container.attributes.length; i++) {
6865
- const attr = container.attributes[i];
6866
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6867
- warnDeprecation("GLOBAL_MOUNT_CONTAINER", null);
6868
- break;
6869
- }
6870
- }
6871
- }
6872
- instance.render = null;
6873
- component.template = container.innerHTML;
6874
- finishComponentSetup(
6875
- instance,
6876
- false,
6877
- true
6878
- /* skip options */
6879
- );
6880
- }
6881
- container.innerHTML = "";
6882
- render(vnode, container, isSVG);
6883
- if (container instanceof Element) {
6884
- container.removeAttribute("v-cloak");
6885
- container.setAttribute("data-v-app", "");
6886
- }
6887
- isMounted = true;
6888
- app._container = container;
6889
- container.__vue_app__ = app;
6890
- {
6891
- devtoolsInitApp(app, version);
6892
- }
6893
- return instance.proxy;
6894
- };
6895
- instance.ctx._compat_destroy = () => {
6896
- if (isMounted) {
6897
- render(null, app._container);
6898
- {
6899
- devtoolsUnmountApp(app);
6900
- }
6901
- delete app._container.__vue_app__;
6902
- } else {
6903
- const { bum, scope, um } = instance;
6904
- if (bum) {
6905
- invokeArrayFns(bum);
6906
- }
6907
- if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6908
- instance.emit("hook:beforeDestroy");
6909
- }
6910
- if (scope) {
6911
- scope.stop();
6912
- }
6913
- if (um) {
6914
- invokeArrayFns(um);
6915
- }
6916
- if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6917
- instance.emit("hook:destroyed");
6918
- }
6919
- }
6920
- };
6921
- return instance.proxy;
7013
+ } else if (expectedType === "Object") {
7014
+ valid = isObject(value);
7015
+ } else if (expectedType === "Array") {
7016
+ valid = isArray(value);
7017
+ } else if (expectedType === "null") {
7018
+ valid = value === null;
7019
+ } else {
7020
+ valid = value instanceof type;
7021
+ }
7022
+ return {
7023
+ valid,
7024
+ expectedType
6922
7025
  };
6923
7026
  }
6924
- const methodsToPatch = [
6925
- "push",
6926
- "pop",
6927
- "shift",
6928
- "unshift",
6929
- "splice",
6930
- "sort",
6931
- "reverse"
6932
- ];
6933
- const patched = /* @__PURE__ */ new WeakSet();
6934
- function defineReactive(obj, key, val) {
6935
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6936
- const reactiveVal = reactive(val);
6937
- if (isArray(val)) {
6938
- methodsToPatch.forEach((m) => {
6939
- val[m] = (...args) => {
6940
- Array.prototype[m].call(reactiveVal, ...args);
6941
- };
6942
- });
6943
- } else {
6944
- Object.keys(val).forEach((key2) => {
6945
- try {
6946
- defineReactiveSimple(val, key2, val[key2]);
6947
- } catch (e) {
6948
- }
6949
- });
6950
- }
7027
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7028
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7029
+ const expectedType = expectedTypes[0];
7030
+ const receivedType = toRawType(value);
7031
+ const expectedValue = styleValue(value, expectedType);
7032
+ const receivedValue = styleValue(value, receivedType);
7033
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7034
+ message += ` with value ${expectedValue}`;
6951
7035
  }
6952
- const i = obj.$;
6953
- if (i && obj === i.proxy) {
6954
- defineReactiveSimple(i.ctx, key, val);
6955
- i.accessCache = /* @__PURE__ */ Object.create(null);
6956
- } else if (isReactive(obj)) {
6957
- obj[key] = val;
7036
+ message += `, got ${receivedType} `;
7037
+ if (isExplicable(receivedType)) {
7038
+ message += `with value ${receivedValue}.`;
7039
+ }
7040
+ return message;
7041
+ }
7042
+ function styleValue(value, type) {
7043
+ if (type === "String") {
7044
+ return `"${value}"`;
7045
+ } else if (type === "Number") {
7046
+ return `${Number(value)}`;
6958
7047
  } else {
6959
- defineReactiveSimple(obj, key, val);
7048
+ return `${value}`;
6960
7049
  }
6961
7050
  }
6962
- function defineReactiveSimple(obj, key, val) {
6963
- val = isObject(val) ? reactive(val) : val;
6964
- Object.defineProperty(obj, key, {
6965
- enumerable: true,
6966
- configurable: true,
6967
- get() {
6968
- track(obj, "get", key);
6969
- return val;
6970
- },
6971
- set(newVal) {
6972
- val = isObject(newVal) ? reactive(newVal) : newVal;
6973
- trigger(obj, "set", key, newVal);
7051
+ function isExplicable(type) {
7052
+ const explicitTypes = ["string", "number", "boolean"];
7053
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7054
+ }
7055
+ function isBoolean(...args) {
7056
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7057
+ }
7058
+
7059
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7060
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7061
+ const normalizeSlot = (key, rawSlot, ctx) => {
7062
+ if (rawSlot._n) {
7063
+ return rawSlot;
7064
+ }
7065
+ const normalized = withCtx((...args) => {
7066
+ if (currentInstance) {
7067
+ warn(
7068
+ `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.`
7069
+ );
7070
+ }
7071
+ return normalizeSlotValue(rawSlot(...args));
7072
+ }, ctx);
7073
+ normalized._c = false;
7074
+ return normalized;
7075
+ };
7076
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7077
+ const ctx = rawSlots._ctx;
7078
+ for (const key in rawSlots) {
7079
+ if (isInternalKey(key))
7080
+ continue;
7081
+ const value = rawSlots[key];
7082
+ if (isFunction(value)) {
7083
+ slots[key] = normalizeSlot(key, value, ctx);
7084
+ } else if (value != null) {
7085
+ if (!isCompatEnabled("RENDER_FUNCTION", instance)) {
7086
+ warn(
7087
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7088
+ );
7089
+ }
7090
+ const normalized = normalizeSlotValue(value);
7091
+ slots[key] = () => normalized;
6974
7092
  }
6975
- });
6976
- }
6977
-
6978
- function createAppContext() {
6979
- return {
6980
- app: null,
6981
- config: {
6982
- isNativeTag: NO,
6983
- performance: false,
6984
- globalProperties: {},
6985
- optionMergeStrategies: {},
6986
- errorHandler: void 0,
6987
- warnHandler: void 0,
6988
- compilerOptions: {}
6989
- },
6990
- mixins: [],
6991
- components: {},
6992
- directives: {},
6993
- provides: /* @__PURE__ */ Object.create(null),
6994
- optionsCache: /* @__PURE__ */ new WeakMap(),
6995
- propsCache: /* @__PURE__ */ new WeakMap(),
6996
- emitsCache: /* @__PURE__ */ new WeakMap()
6997
- };
6998
- }
6999
- let uid$1 = 0;
7000
- function createAppAPI(render, hydrate) {
7001
- return function createApp(rootComponent, rootProps = null) {
7002
- if (!isFunction(rootComponent)) {
7003
- rootComponent = extend({}, rootComponent);
7093
+ }
7094
+ };
7095
+ const normalizeVNodeSlots = (instance, children) => {
7096
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled("RENDER_FUNCTION", instance)) {
7097
+ warn(
7098
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7099
+ );
7100
+ }
7101
+ const normalized = normalizeSlotValue(children);
7102
+ instance.slots.default = () => normalized;
7103
+ };
7104
+ const initSlots = (instance, children) => {
7105
+ if (instance.vnode.shapeFlag & 32) {
7106
+ const type = children._;
7107
+ if (type) {
7108
+ instance.slots = toRaw(children);
7109
+ def(children, "_", type);
7110
+ } else {
7111
+ normalizeObjectSlots(
7112
+ children,
7113
+ instance.slots = {},
7114
+ instance
7115
+ );
7004
7116
  }
7005
- if (rootProps != null && !isObject(rootProps)) {
7006
- warn(`root props passed to app.mount() must be an object.`);
7007
- rootProps = null;
7117
+ } else {
7118
+ instance.slots = {};
7119
+ if (children) {
7120
+ normalizeVNodeSlots(instance, children);
7008
7121
  }
7009
- const context = createAppContext();
7010
- const installedPlugins = /* @__PURE__ */ new Set();
7011
- let isMounted = false;
7012
- const app = context.app = {
7013
- _uid: uid$1++,
7014
- _component: rootComponent,
7015
- _props: rootProps,
7016
- _container: null,
7017
- _context: context,
7018
- _instance: null,
7019
- version,
7020
- get config() {
7021
- return context.config;
7022
- },
7023
- set config(v) {
7024
- {
7025
- warn(
7026
- `app.config cannot be replaced. Modify individual options instead.`
7027
- );
7028
- }
7029
- },
7030
- use(plugin, ...options) {
7031
- if (installedPlugins.has(plugin)) {
7032
- warn(`Plugin has already been applied to target app.`);
7033
- } else if (plugin && isFunction(plugin.install)) {
7034
- installedPlugins.add(plugin);
7035
- plugin.install(app, ...options);
7036
- } else if (isFunction(plugin)) {
7037
- installedPlugins.add(plugin);
7038
- plugin(app, ...options);
7039
- } else {
7040
- warn(
7041
- `A plugin must either be a function or an object with an "install" function.`
7042
- );
7043
- }
7044
- return app;
7045
- },
7046
- mixin(mixin) {
7047
- {
7048
- if (!context.mixins.includes(mixin)) {
7049
- context.mixins.push(mixin);
7050
- } else {
7051
- warn(
7052
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7053
- );
7054
- }
7055
- }
7056
- return app;
7057
- },
7058
- component(name, component) {
7059
- {
7060
- validateComponentName(name, context.config);
7061
- }
7062
- if (!component) {
7063
- return context.components[name];
7064
- }
7065
- if (context.components[name]) {
7066
- warn(`Component "${name}" has already been registered in target app.`);
7067
- }
7068
- context.components[name] = component;
7069
- return app;
7070
- },
7071
- directive(name, directive) {
7072
- {
7073
- validateDirectiveName(name);
7074
- }
7075
- if (!directive) {
7076
- return context.directives[name];
7077
- }
7078
- if (context.directives[name]) {
7079
- warn(`Directive "${name}" has already been registered in target app.`);
7080
- }
7081
- context.directives[name] = directive;
7082
- return app;
7083
- },
7084
- mount(rootContainer, isHydrate, isSVG) {
7085
- if (!isMounted) {
7086
- if (rootContainer.__vue_app__) {
7087
- warn(
7088
- `There is already an app instance mounted on the host container.
7089
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7090
- );
7091
- }
7092
- const vnode = createVNode(
7093
- rootComponent,
7094
- rootProps
7095
- );
7096
- vnode.appContext = context;
7097
- {
7098
- context.reload = () => {
7099
- render(cloneVNode(vnode), rootContainer, isSVG);
7100
- };
7101
- }
7102
- if (isHydrate && hydrate) {
7103
- hydrate(vnode, rootContainer);
7104
- } else {
7105
- render(vnode, rootContainer, isSVG);
7106
- }
7107
- isMounted = true;
7108
- app._container = rootContainer;
7109
- rootContainer.__vue_app__ = app;
7110
- {
7111
- app._instance = vnode.component;
7112
- devtoolsInitApp(app, version);
7113
- }
7114
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7115
- } else {
7116
- warn(
7117
- `App has already been mounted.
7118
- 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)\``
7119
- );
7120
- }
7121
- },
7122
- unmount() {
7123
- if (isMounted) {
7124
- render(null, app._container);
7125
- {
7126
- app._instance = null;
7127
- devtoolsUnmountApp(app);
7128
- }
7129
- delete app._container.__vue_app__;
7130
- } else {
7131
- warn(`Cannot unmount an app that is not mounted.`);
7132
- }
7133
- },
7134
- provide(key, value) {
7135
- if (key in context.provides) {
7136
- warn(
7137
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7138
- );
7122
+ }
7123
+ def(instance.slots, InternalObjectKey, 1);
7124
+ };
7125
+ const updateSlots = (instance, children, optimized) => {
7126
+ const { vnode, slots } = instance;
7127
+ let needDeletionCheck = true;
7128
+ let deletionComparisonTarget = EMPTY_OBJ;
7129
+ if (vnode.shapeFlag & 32) {
7130
+ const type = children._;
7131
+ if (type) {
7132
+ if (isHmrUpdating) {
7133
+ extend(slots, children);
7134
+ } else if (optimized && type === 1) {
7135
+ needDeletionCheck = false;
7136
+ } else {
7137
+ extend(slots, children);
7138
+ if (!optimized && type === 1) {
7139
+ delete slots._;
7139
7140
  }
7140
- context.provides[key] = value;
7141
- return app;
7142
7141
  }
7143
- };
7144
- {
7145
- installAppCompatProperties(app, context, render);
7142
+ } else {
7143
+ needDeletionCheck = !children.$stable;
7144
+ normalizeObjectSlots(children, slots, instance);
7146
7145
  }
7147
- return app;
7148
- };
7149
- }
7146
+ deletionComparisonTarget = children;
7147
+ } else if (children) {
7148
+ normalizeVNodeSlots(instance, children);
7149
+ deletionComparisonTarget = { default: 1 };
7150
+ }
7151
+ if (needDeletionCheck) {
7152
+ for (const key in slots) {
7153
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7154
+ delete slots[key];
7155
+ }
7156
+ }
7157
+ }
7158
+ };
7150
7159
 
7151
7160
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7152
7161
  if (isArray(rawRef)) {
@@ -10308,6 +10317,12 @@ function defineSlots() {
10308
10317
  {
10309
10318
  warnRuntimeUsage(`defineSlots`);
10310
10319
  }
10320
+ return null;
10321
+ }
10322
+ function defineModel() {
10323
+ {
10324
+ warnRuntimeUsage("defineModel");
10325
+ }
10311
10326
  }
10312
10327
  function withDefaults(props, defaults) {
10313
10328
  {
@@ -10321,6 +10336,40 @@ function useSlots() {
10321
10336
  function useAttrs() {
10322
10337
  return getContext().attrs;
10323
10338
  }
10339
+ function useModel(props, name, options) {
10340
+ const i = getCurrentInstance();
10341
+ if (!i) {
10342
+ warn(`useModel() called without active instance.`);
10343
+ return ref();
10344
+ }
10345
+ if (!i.propsOptions[0][name]) {
10346
+ warn(`useModel() called with prop "${name}" which is not declared.`);
10347
+ return ref();
10348
+ }
10349
+ if (options && options.local) {
10350
+ const proxy = ref(props[name]);
10351
+ watch(
10352
+ () => props[name],
10353
+ (v) => proxy.value = v
10354
+ );
10355
+ watch(proxy, (value) => {
10356
+ if (value !== props[name]) {
10357
+ i.emit(`update:${name}`, value);
10358
+ }
10359
+ });
10360
+ return proxy;
10361
+ } else {
10362
+ return {
10363
+ __v_isRef: true,
10364
+ get value() {
10365
+ return props[name];
10366
+ },
10367
+ set value(value) {
10368
+ i.emit(`update:${name}`, value);
10369
+ }
10370
+ };
10371
+ }
10372
+ }
10324
10373
  function getContext() {
10325
10374
  const i = getCurrentInstance();
10326
10375
  if (!i) {
@@ -10328,11 +10377,14 @@ function getContext() {
10328
10377
  }
10329
10378
  return i.setupContext || (i.setupContext = createSetupContext(i));
10330
10379
  }
10331
- function mergeDefaults(raw, defaults) {
10332
- const props = isArray(raw) ? raw.reduce(
10380
+ function normalizePropsOrEmits(props) {
10381
+ return isArray(props) ? props.reduce(
10333
10382
  (normalized, p) => (normalized[p] = {}, normalized),
10334
10383
  {}
10335
- ) : raw;
10384
+ ) : props;
10385
+ }
10386
+ function mergeDefaults(raw, defaults) {
10387
+ const props = normalizePropsOrEmits(raw);
10336
10388
  for (const key in defaults) {
10337
10389
  if (key.startsWith("__skip"))
10338
10390
  continue;
@@ -10354,6 +10406,13 @@ function mergeDefaults(raw, defaults) {
10354
10406
  }
10355
10407
  return props;
10356
10408
  }
10409
+ function mergeModels(a, b) {
10410
+ if (!a || !b)
10411
+ return a || b;
10412
+ if (isArray(a) && isArray(b))
10413
+ return a.concat(b);
10414
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
10415
+ }
10357
10416
  function createPropsRestProxy(props, excludedKeys) {
10358
10417
  const ret = {};
10359
10418
  for (const key in props) {
@@ -10619,7 +10678,7 @@ function isMemoSame(cached, memo) {
10619
10678
  return true;
10620
10679
  }
10621
10680
 
10622
- const version = "3.3.0-alpha.7";
10681
+ const version = "3.3.0-alpha.9";
10623
10682
  const ssrUtils = null;
10624
10683
  const resolveFilter = resolveFilter$1 ;
10625
10684
  const _compatUtils = {
@@ -12275,6 +12334,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12275
12334
  defineCustomElement: defineCustomElement,
12276
12335
  defineEmits: defineEmits,
12277
12336
  defineExpose: defineExpose,
12337
+ defineModel: defineModel,
12278
12338
  defineOptions: defineOptions,
12279
12339
  defineProps: defineProps,
12280
12340
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12302,6 +12362,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12302
12362
  isVNode: isVNode,
12303
12363
  markRaw: markRaw,
12304
12364
  mergeDefaults: mergeDefaults,
12365
+ mergeModels: mergeModels,
12305
12366
  mergeProps: mergeProps,
12306
12367
  nextTick: nextTick,
12307
12368
  normalizeClass: normalizeClass,
@@ -12360,6 +12421,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12360
12421
  useAttrs: useAttrs,
12361
12422
  useCssModule: useCssModule,
12362
12423
  useCssVars: useCssVars,
12424
+ useModel: useModel,
12363
12425
  useSSRContext: useSSRContext,
12364
12426
  useSlots: useSlots,
12365
12427
  useTransitionState: useTransitionState,
@@ -12430,4 +12492,4 @@ var Vue$1 = Vue;
12430
12492
 
12431
12493
  const { configureCompat } = Vue$1;
12432
12494
 
12433
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12495
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };