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