@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.
@@ -3539,33 +3539,41 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3539
3539
  }
3540
3540
  }
3541
3541
 
3542
- function provide(key, value) {
3543
- if (!currentInstance) {
3544
- {
3545
- warn(`provide() can only be used inside setup().`);
3546
- }
3547
- } else {
3548
- let provides = currentInstance.provides;
3549
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3550
- if (parentProvides === provides) {
3551
- provides = currentInstance.provides = Object.create(parentProvides);
3552
- }
3553
- provides[key] = value;
3554
- }
3555
- }
3556
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3557
- const instance = currentInstance || currentRenderingInstance;
3558
- if (instance) {
3559
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3560
- if (provides && key in provides) {
3561
- return provides[key];
3562
- } else if (arguments.length > 1) {
3563
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3542
+ const legacyDirectiveHookMap = {
3543
+ beforeMount: "bind",
3544
+ mounted: "inserted",
3545
+ updated: ["update", "componentUpdated"],
3546
+ unmounted: "unbind"
3547
+ };
3548
+ function mapCompatDirectiveHook(name, dir, instance) {
3549
+ const mappedName = legacyDirectiveHookMap[name];
3550
+ if (mappedName) {
3551
+ if (isArray(mappedName)) {
3552
+ const hook = [];
3553
+ mappedName.forEach((mapped) => {
3554
+ const mappedHook = dir[mapped];
3555
+ if (mappedHook) {
3556
+ softAssertCompatEnabled(
3557
+ "CUSTOM_DIR",
3558
+ instance,
3559
+ mapped,
3560
+ name
3561
+ );
3562
+ hook.push(mappedHook);
3563
+ }
3564
+ });
3565
+ return hook.length ? hook : void 0;
3564
3566
  } else {
3565
- warn(`injection "${String(key)}" not found.`);
3567
+ if (dir[mappedName]) {
3568
+ softAssertCompatEnabled(
3569
+ "CUSTOM_DIR",
3570
+ instance,
3571
+ mappedName,
3572
+ name
3573
+ );
3574
+ }
3575
+ return dir[mappedName];
3566
3576
  }
3567
- } else {
3568
- warn(`inject() can only be used inside setup() or functional components.`);
3569
3577
  }
3570
3578
  }
3571
3579
 
@@ -3804,6 +3812,68 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3804
3812
  return value;
3805
3813
  }
3806
3814
 
3815
+ function validateDirectiveName(name) {
3816
+ if (isBuiltInDirective(name)) {
3817
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3818
+ }
3819
+ }
3820
+ function withDirectives(vnode, directives) {
3821
+ const internalInstance = currentRenderingInstance;
3822
+ if (internalInstance === null) {
3823
+ warn(`withDirectives can only be used inside render functions.`);
3824
+ return vnode;
3825
+ }
3826
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3827
+ const bindings = vnode.dirs || (vnode.dirs = []);
3828
+ for (let i = 0; i < directives.length; i++) {
3829
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3830
+ if (dir) {
3831
+ if (isFunction(dir)) {
3832
+ dir = {
3833
+ mounted: dir,
3834
+ updated: dir
3835
+ };
3836
+ }
3837
+ if (dir.deep) {
3838
+ traverse(value);
3839
+ }
3840
+ bindings.push({
3841
+ dir,
3842
+ instance,
3843
+ value,
3844
+ oldValue: void 0,
3845
+ arg,
3846
+ modifiers
3847
+ });
3848
+ }
3849
+ }
3850
+ return vnode;
3851
+ }
3852
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3853
+ const bindings = vnode.dirs;
3854
+ const oldBindings = prevVNode && prevVNode.dirs;
3855
+ for (let i = 0; i < bindings.length; i++) {
3856
+ const binding = bindings[i];
3857
+ if (oldBindings) {
3858
+ binding.oldValue = oldBindings[i].value;
3859
+ }
3860
+ let hook = binding.dir[name];
3861
+ if (!hook) {
3862
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3863
+ }
3864
+ if (hook) {
3865
+ pauseTracking();
3866
+ callWithAsyncErrorHandling(hook, instance, 8, [
3867
+ vnode.el,
3868
+ binding,
3869
+ vnode,
3870
+ prevVNode
3871
+ ]);
3872
+ resetTracking();
3873
+ }
3874
+ }
3875
+ }
3876
+
3807
3877
  function useTransitionState() {
3808
3878
  const state = {
3809
3879
  isMounted: false,
@@ -4602,106 +4672,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4602
4672
  return listeners;
4603
4673
  }
4604
4674
 
4605
- const legacyDirectiveHookMap = {
4606
- beforeMount: "bind",
4607
- mounted: "inserted",
4608
- updated: ["update", "componentUpdated"],
4609
- unmounted: "unbind"
4610
- };
4611
- function mapCompatDirectiveHook(name, dir, instance) {
4612
- const mappedName = legacyDirectiveHookMap[name];
4613
- if (mappedName) {
4614
- if (isArray(mappedName)) {
4615
- const hook = [];
4616
- mappedName.forEach((mapped) => {
4617
- const mappedHook = dir[mapped];
4618
- if (mappedHook) {
4619
- softAssertCompatEnabled(
4620
- "CUSTOM_DIR",
4621
- instance,
4622
- mapped,
4623
- name
4624
- );
4625
- hook.push(mappedHook);
4626
- }
4627
- });
4628
- return hook.length ? hook : void 0;
4629
- } else {
4630
- if (dir[mappedName]) {
4631
- softAssertCompatEnabled(
4632
- "CUSTOM_DIR",
4633
- instance,
4634
- mappedName,
4635
- name
4636
- );
4637
- }
4638
- return dir[mappedName];
4639
- }
4640
- }
4641
- }
4642
-
4643
- function validateDirectiveName(name) {
4644
- if (isBuiltInDirective(name)) {
4645
- warn("Do not use built-in directive ids as custom directive id: " + name);
4646
- }
4647
- }
4648
- function withDirectives(vnode, directives) {
4649
- const internalInstance = currentRenderingInstance;
4650
- if (internalInstance === null) {
4651
- warn(`withDirectives can only be used inside render functions.`);
4652
- return vnode;
4653
- }
4654
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4655
- const bindings = vnode.dirs || (vnode.dirs = []);
4656
- for (let i = 0; i < directives.length; i++) {
4657
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4658
- if (dir) {
4659
- if (isFunction(dir)) {
4660
- dir = {
4661
- mounted: dir,
4662
- updated: dir
4663
- };
4664
- }
4665
- if (dir.deep) {
4666
- traverse(value);
4667
- }
4668
- bindings.push({
4669
- dir,
4670
- instance,
4671
- value,
4672
- oldValue: void 0,
4673
- arg,
4674
- modifiers
4675
- });
4676
- }
4677
- }
4678
- return vnode;
4679
- }
4680
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4681
- const bindings = vnode.dirs;
4682
- const oldBindings = prevVNode && prevVNode.dirs;
4683
- for (let i = 0; i < bindings.length; i++) {
4684
- const binding = bindings[i];
4685
- if (oldBindings) {
4686
- binding.oldValue = oldBindings[i].value;
4687
- }
4688
- let hook = binding.dir[name];
4689
- if (!hook) {
4690
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4691
- }
4692
- if (hook) {
4693
- pauseTracking();
4694
- callWithAsyncErrorHandling(hook, instance, 8, [
4695
- vnode.el,
4696
- binding,
4697
- vnode,
4698
- prevVNode
4699
- ]);
4700
- resetTracking();
4701
- }
4702
- }
4703
- }
4704
-
4705
4675
  const COMPONENTS = "components";
4706
4676
  const DIRECTIVES = "directives";
4707
4677
  const FILTERS = "filters";
@@ -6042,1179 +6012,1218 @@ If this is a native custom element, make sure to exclude it from component resol
6042
6012
  return merged;
6043
6013
  }
6044
6014
 
6045
- function createPropsDefaultThis(instance, rawProps, propKey) {
6046
- return new Proxy(
6047
- {},
6048
- {
6049
- get(_, key) {
6050
- warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6051
- if (key === "$options") {
6052
- return resolveMergedOptions(instance);
6053
- }
6054
- if (key in rawProps) {
6055
- return rawProps[key];
6056
- }
6057
- const injections = instance.type.inject;
6058
- if (injections) {
6059
- if (isArray(injections)) {
6060
- if (injections.includes(key)) {
6061
- return inject(key);
6062
- }
6063
- } else if (key in injections) {
6064
- return inject(key);
6065
- }
6015
+ function installLegacyConfigWarnings(config) {
6016
+ const legacyConfigOptions = {
6017
+ silent: "CONFIG_SILENT",
6018
+ devtools: "CONFIG_DEVTOOLS",
6019
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6020
+ keyCodes: "CONFIG_KEY_CODES",
6021
+ productionTip: "CONFIG_PRODUCTION_TIP"
6022
+ };
6023
+ Object.keys(legacyConfigOptions).forEach((key) => {
6024
+ let val = config[key];
6025
+ Object.defineProperty(config, key, {
6026
+ enumerable: true,
6027
+ get() {
6028
+ return val;
6029
+ },
6030
+ set(newVal) {
6031
+ if (!isCopyingConfig) {
6032
+ warnDeprecation$1(legacyConfigOptions[key], null);
6066
6033
  }
6034
+ val = newVal;
6067
6035
  }
6068
- }
6069
- );
6036
+ });
6037
+ });
6070
6038
  }
6071
-
6072
- function shouldSkipAttr(key, instance) {
6073
- if (key === "is") {
6074
- return true;
6075
- }
6076
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6077
- return true;
6078
- }
6079
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6080
- return true;
6081
- }
6082
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6083
- return true;
6084
- }
6085
- return false;
6039
+ function installLegacyOptionMergeStrats(config) {
6040
+ config.optionMergeStrategies = new Proxy({}, {
6041
+ get(target, key) {
6042
+ if (key in target) {
6043
+ return target[key];
6044
+ }
6045
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6046
+ "CONFIG_OPTION_MERGE_STRATS",
6047
+ null
6048
+ )) {
6049
+ return internalOptionMergeStrats[key];
6050
+ }
6051
+ }
6052
+ });
6086
6053
  }
6087
6054
 
6088
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6089
- const props = {};
6090
- const attrs = {};
6091
- def(attrs, InternalObjectKey, 1);
6092
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6093
- setFullProps(instance, rawProps, props, attrs);
6094
- for (const key in instance.propsOptions[0]) {
6095
- if (!(key in props)) {
6096
- props[key] = void 0;
6055
+ let isCopyingConfig = false;
6056
+ let singletonApp;
6057
+ let singletonCtor;
6058
+ function createCompatVue$1(createApp, createSingletonApp) {
6059
+ singletonApp = createSingletonApp({});
6060
+ const Vue = singletonCtor = function Vue2(options = {}) {
6061
+ return createCompatApp(options, Vue2);
6062
+ };
6063
+ function createCompatApp(options = {}, Ctor) {
6064
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6065
+ const { data } = options;
6066
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6067
+ options.data = () => data;
6097
6068
  }
6098
- }
6099
- {
6100
- validateProps(rawProps || {}, props, instance);
6101
- }
6102
- if (isStateful) {
6103
- instance.props = isSSR ? props : shallowReactive(props);
6104
- } else {
6105
- if (!instance.type.props) {
6106
- instance.props = attrs;
6069
+ const app = createApp(options);
6070
+ if (Ctor !== Vue) {
6071
+ applySingletonPrototype(app, Ctor);
6072
+ }
6073
+ const vm = app._createRoot(options);
6074
+ if (options.el) {
6075
+ return vm.$mount(options.el);
6107
6076
  } else {
6108
- instance.props = props;
6077
+ return vm;
6109
6078
  }
6110
6079
  }
6111
- instance.attrs = attrs;
6112
- }
6113
- function isInHmrContext(instance) {
6114
- while (instance) {
6115
- if (instance.type.__hmrId)
6116
- return true;
6117
- instance = instance.parent;
6118
- }
6119
- }
6120
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6121
- const {
6122
- props,
6123
- attrs,
6124
- vnode: { patchFlag }
6125
- } = instance;
6126
- const rawCurrentProps = toRaw(props);
6127
- const [options] = instance.propsOptions;
6128
- let hasAttrsChanged = false;
6129
- if (
6130
- // always force full diff in dev
6131
- // - #1942 if hmr is enabled with sfc component
6132
- // - vite#872 non-sfc component used by sfc component
6133
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6134
- ) {
6135
- if (patchFlag & 8) {
6136
- const propsToUpdate = instance.vnode.dynamicProps;
6137
- for (let i = 0; i < propsToUpdate.length; i++) {
6138
- let key = propsToUpdate[i];
6139
- if (isEmitListener(instance.emitsOptions, key)) {
6140
- continue;
6141
- }
6142
- const value = rawProps[key];
6143
- if (options) {
6144
- if (hasOwn(attrs, key)) {
6145
- if (value !== attrs[key]) {
6146
- attrs[key] = value;
6147
- hasAttrsChanged = true;
6148
- }
6149
- } else {
6150
- const camelizedKey = camelize(key);
6151
- props[camelizedKey] = resolvePropValue(
6152
- options,
6153
- rawCurrentProps,
6154
- camelizedKey,
6155
- value,
6156
- instance,
6157
- false
6158
- /* isAbsent */
6159
- );
6160
- }
6161
- } else {
6162
- {
6163
- if (isOn(key) && key.endsWith("Native")) {
6164
- key = key.slice(0, -6);
6165
- } else if (shouldSkipAttr(key, instance)) {
6166
- continue;
6167
- }
6168
- }
6169
- if (value !== attrs[key]) {
6170
- attrs[key] = value;
6171
- hasAttrsChanged = true;
6172
- }
6173
- }
6174
- }
6080
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.9"}`;
6081
+ Vue.config = singletonApp.config;
6082
+ Vue.use = (p, ...options) => {
6083
+ if (p && isFunction(p.install)) {
6084
+ p.install(Vue, ...options);
6085
+ } else if (isFunction(p)) {
6086
+ p(Vue, ...options);
6175
6087
  }
6176
- } else {
6177
- if (setFullProps(instance, rawProps, props, attrs)) {
6178
- hasAttrsChanged = true;
6088
+ return Vue;
6089
+ };
6090
+ Vue.mixin = (m) => {
6091
+ singletonApp.mixin(m);
6092
+ return Vue;
6093
+ };
6094
+ Vue.component = (name, comp) => {
6095
+ if (comp) {
6096
+ singletonApp.component(name, comp);
6097
+ return Vue;
6098
+ } else {
6099
+ return singletonApp.component(name);
6179
6100
  }
6180
- let kebabKey;
6181
- for (const key in rawCurrentProps) {
6182
- if (!rawProps || // for camelCase
6183
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6184
- // and converted to camelCase (#955)
6185
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6186
- if (options) {
6187
- if (rawPrevProps && // for camelCase
6188
- (rawPrevProps[key] !== void 0 || // for kebab-case
6189
- rawPrevProps[kebabKey] !== void 0)) {
6190
- props[key] = resolvePropValue(
6191
- options,
6192
- rawCurrentProps,
6193
- key,
6194
- void 0,
6195
- instance,
6196
- true
6197
- /* isAbsent */
6198
- );
6199
- }
6200
- } else {
6201
- delete props[key];
6202
- }
6203
- }
6101
+ };
6102
+ Vue.directive = (name, dir) => {
6103
+ if (dir) {
6104
+ singletonApp.directive(name, dir);
6105
+ return Vue;
6106
+ } else {
6107
+ return singletonApp.directive(name);
6204
6108
  }
6205
- if (attrs !== rawCurrentProps) {
6206
- for (const key in attrs) {
6207
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6208
- delete attrs[key];
6209
- hasAttrsChanged = true;
6210
- }
6109
+ };
6110
+ Vue.options = { _base: Vue };
6111
+ let cid = 1;
6112
+ Vue.cid = cid;
6113
+ Vue.nextTick = nextTick;
6114
+ const extendCache = /* @__PURE__ */ new WeakMap();
6115
+ function extendCtor(extendOptions = {}) {
6116
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6117
+ if (isFunction(extendOptions)) {
6118
+ extendOptions = extendOptions.options;
6119
+ }
6120
+ if (extendCache.has(extendOptions)) {
6121
+ return extendCache.get(extendOptions);
6122
+ }
6123
+ const Super = this;
6124
+ function SubVue(inlineOptions) {
6125
+ if (!inlineOptions) {
6126
+ return createCompatApp(SubVue.options, SubVue);
6127
+ } else {
6128
+ return createCompatApp(
6129
+ mergeOptions(
6130
+ extend({}, SubVue.options),
6131
+ inlineOptions,
6132
+ internalOptionMergeStrats
6133
+ ),
6134
+ SubVue
6135
+ );
6211
6136
  }
6212
6137
  }
6138
+ SubVue.super = Super;
6139
+ SubVue.prototype = Object.create(Vue.prototype);
6140
+ SubVue.prototype.constructor = SubVue;
6141
+ const mergeBase = {};
6142
+ for (const key in Super.options) {
6143
+ const superValue = Super.options[key];
6144
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6145
+ }
6146
+ SubVue.options = mergeOptions(
6147
+ mergeBase,
6148
+ extendOptions,
6149
+ internalOptionMergeStrats
6150
+ );
6151
+ SubVue.options._base = SubVue;
6152
+ SubVue.extend = extendCtor.bind(SubVue);
6153
+ SubVue.mixin = Super.mixin;
6154
+ SubVue.use = Super.use;
6155
+ SubVue.cid = ++cid;
6156
+ extendCache.set(extendOptions, SubVue);
6157
+ return SubVue;
6213
6158
  }
6214
- if (hasAttrsChanged) {
6215
- trigger(instance, "set", "$attrs");
6216
- }
6217
- {
6218
- validateProps(rawProps || {}, props, instance);
6219
- }
6220
- }
6221
- function setFullProps(instance, rawProps, props, attrs) {
6222
- const [options, needCastKeys] = instance.propsOptions;
6223
- let hasAttrsChanged = false;
6224
- let rawCastValues;
6225
- if (rawProps) {
6226
- for (let key in rawProps) {
6227
- if (isReservedProp(key)) {
6228
- continue;
6229
- }
6230
- {
6231
- if (key.startsWith("onHook:")) {
6232
- softAssertCompatEnabled(
6233
- "INSTANCE_EVENT_HOOKS",
6234
- instance,
6235
- key.slice(2).toLowerCase()
6236
- );
6237
- }
6238
- if (key === "inline-template") {
6239
- continue;
6240
- }
6241
- }
6242
- const value = rawProps[key];
6243
- let camelKey;
6244
- if (options && hasOwn(options, camelKey = camelize(key))) {
6245
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6246
- props[camelKey] = value;
6247
- } else {
6248
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6249
- }
6250
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6251
- {
6252
- if (isOn(key) && key.endsWith("Native")) {
6253
- key = key.slice(0, -6);
6254
- } else if (shouldSkipAttr(key, instance)) {
6255
- continue;
6256
- }
6257
- }
6258
- if (!(key in attrs) || value !== attrs[key]) {
6259
- attrs[key] = value;
6260
- hasAttrsChanged = true;
6261
- }
6262
- }
6159
+ Vue.extend = extendCtor.bind(Vue);
6160
+ Vue.set = (target, key, value) => {
6161
+ assertCompatEnabled("GLOBAL_SET", null);
6162
+ target[key] = value;
6163
+ };
6164
+ Vue.delete = (target, key) => {
6165
+ assertCompatEnabled("GLOBAL_DELETE", null);
6166
+ delete target[key];
6167
+ };
6168
+ Vue.observable = (target) => {
6169
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6170
+ return reactive(target);
6171
+ };
6172
+ Vue.filter = (name, filter) => {
6173
+ if (filter) {
6174
+ singletonApp.filter(name, filter);
6175
+ return Vue;
6176
+ } else {
6177
+ return singletonApp.filter(name);
6263
6178
  }
6264
- }
6265
- if (needCastKeys) {
6266
- const rawCurrentProps = toRaw(props);
6267
- const castValues = rawCastValues || EMPTY_OBJ;
6268
- for (let i = 0; i < needCastKeys.length; i++) {
6269
- const key = needCastKeys[i];
6270
- props[key] = resolvePropValue(
6271
- options,
6272
- rawCurrentProps,
6273
- key,
6274
- castValues[key],
6275
- instance,
6276
- !hasOwn(castValues, key)
6277
- );
6179
+ };
6180
+ const util = {
6181
+ warn: warn ,
6182
+ extend,
6183
+ mergeOptions: (parent, child, vm) => mergeOptions(
6184
+ parent,
6185
+ child,
6186
+ vm ? void 0 : internalOptionMergeStrats
6187
+ ),
6188
+ defineReactive
6189
+ };
6190
+ Object.defineProperty(Vue, "util", {
6191
+ get() {
6192
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6193
+ return util;
6278
6194
  }
6195
+ });
6196
+ Vue.configureCompat = configureCompat;
6197
+ return Vue;
6198
+ }
6199
+ function installAppCompatProperties(app, context, render) {
6200
+ installFilterMethod(app, context);
6201
+ installLegacyOptionMergeStrats(app.config);
6202
+ if (!singletonApp) {
6203
+ return;
6279
6204
  }
6280
- return hasAttrsChanged;
6205
+ installCompatMount(app, context, render);
6206
+ installLegacyAPIs(app);
6207
+ applySingletonAppMutations(app);
6208
+ installLegacyConfigWarnings(app.config);
6281
6209
  }
6282
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6283
- const opt = options[key];
6284
- if (opt != null) {
6285
- const hasDefault = hasOwn(opt, "default");
6286
- if (hasDefault && value === void 0) {
6287
- const defaultValue = opt.default;
6288
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6289
- const { propsDefaults } = instance;
6290
- if (key in propsDefaults) {
6291
- value = propsDefaults[key];
6292
- } else {
6293
- setCurrentInstance(instance);
6294
- value = propsDefaults[key] = defaultValue.call(
6295
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6296
- props
6297
- );
6298
- unsetCurrentInstance();
6299
- }
6300
- } else {
6301
- value = defaultValue;
6302
- }
6210
+ function installFilterMethod(app, context) {
6211
+ context.filters = {};
6212
+ app.filter = (name, filter) => {
6213
+ assertCompatEnabled("FILTERS", null);
6214
+ if (!filter) {
6215
+ return context.filters[name];
6303
6216
  }
6304
- if (opt[0 /* shouldCast */]) {
6305
- if (isAbsent && !hasDefault) {
6306
- value = false;
6307
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6308
- value = true;
6309
- }
6217
+ if (context.filters[name]) {
6218
+ warn(`Filter "${name}" has already been registered.`);
6310
6219
  }
6311
- }
6312
- return value;
6220
+ context.filters[name] = filter;
6221
+ return app;
6222
+ };
6313
6223
  }
6314
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6315
- const cache = appContext.propsCache;
6316
- const cached = cache.get(comp);
6317
- if (cached) {
6318
- return cached;
6319
- }
6320
- const raw = comp.props;
6321
- const normalized = {};
6322
- const needCastKeys = [];
6323
- let hasExtends = false;
6324
- if (!isFunction(comp)) {
6325
- const extendProps = (raw2) => {
6326
- if (isFunction(raw2)) {
6327
- raw2 = raw2.options;
6224
+ function installLegacyAPIs(app) {
6225
+ Object.defineProperties(app, {
6226
+ // so that app.use() can work with legacy plugins that extend prototypes
6227
+ prototype: {
6228
+ get() {
6229
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6230
+ return app.config.globalProperties;
6231
+ }
6232
+ },
6233
+ nextTick: { value: nextTick },
6234
+ extend: { value: singletonCtor.extend },
6235
+ set: { value: singletonCtor.set },
6236
+ delete: { value: singletonCtor.delete },
6237
+ observable: { value: singletonCtor.observable },
6238
+ util: {
6239
+ get() {
6240
+ return singletonCtor.util;
6328
6241
  }
6329
- hasExtends = true;
6330
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6331
- extend(normalized, props);
6332
- if (keys)
6333
- needCastKeys.push(...keys);
6334
- };
6335
- if (!asMixin && appContext.mixins.length) {
6336
- appContext.mixins.forEach(extendProps);
6337
6242
  }
6338
- if (comp.extends) {
6339
- extendProps(comp.extends);
6243
+ });
6244
+ }
6245
+ function applySingletonAppMutations(app) {
6246
+ app._context.mixins = [...singletonApp._context.mixins];
6247
+ ["components", "directives", "filters"].forEach((key) => {
6248
+ app._context[key] = Object.create(singletonApp._context[key]);
6249
+ });
6250
+ isCopyingConfig = true;
6251
+ for (const key in singletonApp.config) {
6252
+ if (key === "isNativeTag")
6253
+ continue;
6254
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6255
+ continue;
6340
6256
  }
6341
- if (comp.mixins) {
6342
- comp.mixins.forEach(extendProps);
6257
+ const val = singletonApp.config[key];
6258
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6259
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6260
+ app.config.compilerOptions.isCustomElement = (tag) => {
6261
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6262
+ };
6343
6263
  }
6344
6264
  }
6345
- if (!raw && !hasExtends) {
6346
- if (isObject(comp)) {
6347
- cache.set(comp, EMPTY_ARR);
6348
- }
6349
- return EMPTY_ARR;
6265
+ isCopyingConfig = false;
6266
+ applySingletonPrototype(app, singletonCtor);
6267
+ }
6268
+ function applySingletonPrototype(app, Ctor) {
6269
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6270
+ if (enabled) {
6271
+ app.config.globalProperties = Object.create(Ctor.prototype);
6350
6272
  }
6351
- if (isArray(raw)) {
6352
- for (let i = 0; i < raw.length; i++) {
6353
- if (!isString(raw[i])) {
6354
- warn(`props must be strings when using array syntax.`, raw[i]);
6355
- }
6356
- const normalizedKey = camelize(raw[i]);
6357
- if (validatePropName(normalizedKey)) {
6358
- normalized[normalizedKey] = EMPTY_OBJ;
6359
- }
6360
- }
6361
- } else if (raw) {
6362
- if (!isObject(raw)) {
6363
- warn(`invalid props options`, raw);
6364
- }
6365
- for (const key in raw) {
6366
- const normalizedKey = camelize(key);
6367
- if (validatePropName(normalizedKey)) {
6368
- const opt = raw[key];
6369
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6370
- if (prop) {
6371
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6372
- const stringIndex = getTypeIndex(String, prop.type);
6373
- prop[0 /* shouldCast */] = booleanIndex > -1;
6374
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6375
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6376
- needCastKeys.push(normalizedKey);
6377
- }
6378
- }
6273
+ let hasPrototypeAugmentations = false;
6274
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6275
+ for (const key in descriptors) {
6276
+ if (key !== "constructor") {
6277
+ hasPrototypeAugmentations = true;
6278
+ if (enabled) {
6279
+ Object.defineProperty(
6280
+ app.config.globalProperties,
6281
+ key,
6282
+ descriptors[key]
6283
+ );
6379
6284
  }
6380
6285
  }
6381
6286
  }
6382
- const res = [normalized, needCastKeys];
6383
- if (isObject(comp)) {
6384
- cache.set(comp, res);
6385
- }
6386
- return res;
6287
+ if (hasPrototypeAugmentations) {
6288
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6289
+ }
6387
6290
  }
6388
- function validatePropName(key) {
6389
- if (key[0] !== "$") {
6390
- return true;
6291
+ function installCompatMount(app, context, render) {
6292
+ let isMounted = false;
6293
+ app._createRoot = (options) => {
6294
+ const component = app._component;
6295
+ const vnode = createVNode(component, options.propsData || null);
6296
+ vnode.appContext = context;
6297
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6298
+ const emptyRender = () => {
6299
+ };
6300
+ const instance = createComponentInstance(vnode, null, null);
6301
+ if (hasNoRender) {
6302
+ instance.render = emptyRender;
6303
+ }
6304
+ setupComponent(instance);
6305
+ vnode.component = instance;
6306
+ vnode.isCompatRoot = true;
6307
+ instance.ctx._compat_mount = (selectorOrEl) => {
6308
+ if (isMounted) {
6309
+ warn(`Root instance is already mounted.`);
6310
+ return;
6311
+ }
6312
+ let container;
6313
+ if (typeof selectorOrEl === "string") {
6314
+ const result = document.querySelector(selectorOrEl);
6315
+ if (!result) {
6316
+ warn(
6317
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6318
+ );
6319
+ return;
6320
+ }
6321
+ container = result;
6322
+ } else {
6323
+ container = selectorOrEl || document.createElement("div");
6324
+ }
6325
+ const isSVG = container instanceof SVGElement;
6326
+ {
6327
+ context.reload = () => {
6328
+ const cloned = cloneVNode(vnode);
6329
+ cloned.component = null;
6330
+ render(cloned, container, isSVG);
6331
+ };
6332
+ }
6333
+ if (hasNoRender && instance.render === emptyRender) {
6334
+ {
6335
+ for (let i = 0; i < container.attributes.length; i++) {
6336
+ const attr = container.attributes[i];
6337
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6338
+ warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6339
+ break;
6340
+ }
6341
+ }
6342
+ }
6343
+ instance.render = null;
6344
+ component.template = container.innerHTML;
6345
+ finishComponentSetup(
6346
+ instance,
6347
+ false,
6348
+ true
6349
+ /* skip options */
6350
+ );
6351
+ }
6352
+ container.innerHTML = "";
6353
+ render(vnode, container, isSVG);
6354
+ if (container instanceof Element) {
6355
+ container.removeAttribute("v-cloak");
6356
+ container.setAttribute("data-v-app", "");
6357
+ }
6358
+ isMounted = true;
6359
+ app._container = container;
6360
+ container.__vue_app__ = app;
6361
+ {
6362
+ devtoolsInitApp(app, version);
6363
+ }
6364
+ return instance.proxy;
6365
+ };
6366
+ instance.ctx._compat_destroy = () => {
6367
+ if (isMounted) {
6368
+ render(null, app._container);
6369
+ {
6370
+ devtoolsUnmountApp(app);
6371
+ }
6372
+ delete app._container.__vue_app__;
6373
+ } else {
6374
+ const { bum, scope, um } = instance;
6375
+ if (bum) {
6376
+ invokeArrayFns(bum);
6377
+ }
6378
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6379
+ instance.emit("hook:beforeDestroy");
6380
+ }
6381
+ if (scope) {
6382
+ scope.stop();
6383
+ }
6384
+ if (um) {
6385
+ invokeArrayFns(um);
6386
+ }
6387
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6388
+ instance.emit("hook:destroyed");
6389
+ }
6390
+ }
6391
+ };
6392
+ return instance.proxy;
6393
+ };
6394
+ }
6395
+ const methodsToPatch = [
6396
+ "push",
6397
+ "pop",
6398
+ "shift",
6399
+ "unshift",
6400
+ "splice",
6401
+ "sort",
6402
+ "reverse"
6403
+ ];
6404
+ const patched = /* @__PURE__ */ new WeakSet();
6405
+ function defineReactive(obj, key, val) {
6406
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6407
+ const reactiveVal = reactive(val);
6408
+ if (isArray(val)) {
6409
+ methodsToPatch.forEach((m) => {
6410
+ val[m] = (...args) => {
6411
+ Array.prototype[m].call(reactiveVal, ...args);
6412
+ };
6413
+ });
6414
+ } else {
6415
+ Object.keys(val).forEach((key2) => {
6416
+ try {
6417
+ defineReactiveSimple(val, key2, val[key2]);
6418
+ } catch (e) {
6419
+ }
6420
+ });
6421
+ }
6422
+ }
6423
+ const i = obj.$;
6424
+ if (i && obj === i.proxy) {
6425
+ defineReactiveSimple(i.ctx, key, val);
6426
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6427
+ } else if (isReactive(obj)) {
6428
+ obj[key] = val;
6391
6429
  } else {
6392
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6430
+ defineReactiveSimple(obj, key, val);
6393
6431
  }
6394
- return false;
6395
- }
6396
- function getType(ctor) {
6397
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6398
- return match ? match[2] : ctor === null ? "null" : "";
6399
6432
  }
6400
- function isSameType(a, b) {
6401
- return getType(a) === getType(b);
6433
+ function defineReactiveSimple(obj, key, val) {
6434
+ val = isObject(val) ? reactive(val) : val;
6435
+ Object.defineProperty(obj, key, {
6436
+ enumerable: true,
6437
+ configurable: true,
6438
+ get() {
6439
+ track(obj, "get", key);
6440
+ return val;
6441
+ },
6442
+ set(newVal) {
6443
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6444
+ trigger(obj, "set", key, newVal);
6445
+ }
6446
+ });
6402
6447
  }
6403
- function getTypeIndex(type, expectedTypes) {
6404
- if (isArray(expectedTypes)) {
6405
- return expectedTypes.findIndex((t) => isSameType(t, type));
6406
- } else if (isFunction(expectedTypes)) {
6407
- return isSameType(expectedTypes, type) ? 0 : -1;
6408
- }
6409
- return -1;
6448
+
6449
+ function createAppContext() {
6450
+ return {
6451
+ app: null,
6452
+ config: {
6453
+ isNativeTag: NO,
6454
+ performance: false,
6455
+ globalProperties: {},
6456
+ optionMergeStrategies: {},
6457
+ errorHandler: void 0,
6458
+ warnHandler: void 0,
6459
+ compilerOptions: {}
6460
+ },
6461
+ mixins: [],
6462
+ components: {},
6463
+ directives: {},
6464
+ provides: /* @__PURE__ */ Object.create(null),
6465
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6466
+ propsCache: /* @__PURE__ */ new WeakMap(),
6467
+ emitsCache: /* @__PURE__ */ new WeakMap()
6468
+ };
6410
6469
  }
6411
- function validateProps(rawProps, props, instance) {
6412
- const resolvedValues = toRaw(props);
6413
- const options = instance.propsOptions[0];
6414
- for (const key in options) {
6415
- let opt = options[key];
6416
- if (opt == null)
6417
- continue;
6418
- validateProp(
6419
- key,
6420
- resolvedValues[key],
6421
- opt,
6422
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6423
- );
6424
- }
6470
+ let uid$1 = 0;
6471
+ function createAppAPI(render, hydrate) {
6472
+ return function createApp(rootComponent, rootProps = null) {
6473
+ if (!isFunction(rootComponent)) {
6474
+ rootComponent = extend({}, rootComponent);
6475
+ }
6476
+ if (rootProps != null && !isObject(rootProps)) {
6477
+ warn(`root props passed to app.mount() must be an object.`);
6478
+ rootProps = null;
6479
+ }
6480
+ const context = createAppContext();
6481
+ const installedPlugins = /* @__PURE__ */ new Set();
6482
+ let isMounted = false;
6483
+ const app = context.app = {
6484
+ _uid: uid$1++,
6485
+ _component: rootComponent,
6486
+ _props: rootProps,
6487
+ _container: null,
6488
+ _context: context,
6489
+ _instance: null,
6490
+ version,
6491
+ get config() {
6492
+ return context.config;
6493
+ },
6494
+ set config(v) {
6495
+ {
6496
+ warn(
6497
+ `app.config cannot be replaced. Modify individual options instead.`
6498
+ );
6499
+ }
6500
+ },
6501
+ use(plugin, ...options) {
6502
+ if (installedPlugins.has(plugin)) {
6503
+ warn(`Plugin has already been applied to target app.`);
6504
+ } else if (plugin && isFunction(plugin.install)) {
6505
+ installedPlugins.add(plugin);
6506
+ plugin.install(app, ...options);
6507
+ } else if (isFunction(plugin)) {
6508
+ installedPlugins.add(plugin);
6509
+ plugin(app, ...options);
6510
+ } else {
6511
+ warn(
6512
+ `A plugin must either be a function or an object with an "install" function.`
6513
+ );
6514
+ }
6515
+ return app;
6516
+ },
6517
+ mixin(mixin) {
6518
+ {
6519
+ if (!context.mixins.includes(mixin)) {
6520
+ context.mixins.push(mixin);
6521
+ } else {
6522
+ warn(
6523
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6524
+ );
6525
+ }
6526
+ }
6527
+ return app;
6528
+ },
6529
+ component(name, component) {
6530
+ {
6531
+ validateComponentName(name, context.config);
6532
+ }
6533
+ if (!component) {
6534
+ return context.components[name];
6535
+ }
6536
+ if (context.components[name]) {
6537
+ warn(`Component "${name}" has already been registered in target app.`);
6538
+ }
6539
+ context.components[name] = component;
6540
+ return app;
6541
+ },
6542
+ directive(name, directive) {
6543
+ {
6544
+ validateDirectiveName(name);
6545
+ }
6546
+ if (!directive) {
6547
+ return context.directives[name];
6548
+ }
6549
+ if (context.directives[name]) {
6550
+ warn(`Directive "${name}" has already been registered in target app.`);
6551
+ }
6552
+ context.directives[name] = directive;
6553
+ return app;
6554
+ },
6555
+ mount(rootContainer, isHydrate, isSVG) {
6556
+ if (!isMounted) {
6557
+ if (rootContainer.__vue_app__) {
6558
+ warn(
6559
+ `There is already an app instance mounted on the host container.
6560
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6561
+ );
6562
+ }
6563
+ const vnode = createVNode(
6564
+ rootComponent,
6565
+ rootProps
6566
+ );
6567
+ vnode.appContext = context;
6568
+ {
6569
+ context.reload = () => {
6570
+ render(cloneVNode(vnode), rootContainer, isSVG);
6571
+ };
6572
+ }
6573
+ if (isHydrate && hydrate) {
6574
+ hydrate(vnode, rootContainer);
6575
+ } else {
6576
+ render(vnode, rootContainer, isSVG);
6577
+ }
6578
+ isMounted = true;
6579
+ app._container = rootContainer;
6580
+ rootContainer.__vue_app__ = app;
6581
+ {
6582
+ app._instance = vnode.component;
6583
+ devtoolsInitApp(app, version);
6584
+ }
6585
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6586
+ } else {
6587
+ warn(
6588
+ `App has already been mounted.
6589
+ 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)\``
6590
+ );
6591
+ }
6592
+ },
6593
+ unmount() {
6594
+ if (isMounted) {
6595
+ render(null, app._container);
6596
+ {
6597
+ app._instance = null;
6598
+ devtoolsUnmountApp(app);
6599
+ }
6600
+ delete app._container.__vue_app__;
6601
+ } else {
6602
+ warn(`Cannot unmount an app that is not mounted.`);
6603
+ }
6604
+ },
6605
+ provide(key, value) {
6606
+ if (key in context.provides) {
6607
+ warn(
6608
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6609
+ );
6610
+ }
6611
+ context.provides[key] = value;
6612
+ return app;
6613
+ },
6614
+ runWithContext(fn) {
6615
+ currentApp = app;
6616
+ try {
6617
+ return fn();
6618
+ } finally {
6619
+ currentApp = null;
6620
+ }
6621
+ }
6622
+ };
6623
+ {
6624
+ installAppCompatProperties(app, context, render);
6625
+ }
6626
+ return app;
6627
+ };
6425
6628
  }
6426
- function validateProp(name, value, prop, isAbsent) {
6427
- const { type, required, validator, skipCheck } = prop;
6428
- if (required && isAbsent) {
6429
- warn('Missing required prop: "' + name + '"');
6430
- return;
6431
- }
6432
- if (value == null && !prop.required) {
6433
- return;
6434
- }
6435
- if (type != null && type !== true && !skipCheck) {
6436
- let isValid = false;
6437
- const types = isArray(type) ? type : [type];
6438
- const expectedTypes = [];
6439
- for (let i = 0; i < types.length && !isValid; i++) {
6440
- const { valid, expectedType } = assertType(value, types[i]);
6441
- expectedTypes.push(expectedType || "");
6442
- isValid = valid;
6629
+ let currentApp = null;
6630
+
6631
+ function provide(key, value) {
6632
+ if (!currentInstance) {
6633
+ {
6634
+ warn(`provide() can only be used inside setup().`);
6443
6635
  }
6444
- if (!isValid) {
6445
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6446
- return;
6636
+ } else {
6637
+ let provides = currentInstance.provides;
6638
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6639
+ if (parentProvides === provides) {
6640
+ provides = currentInstance.provides = Object.create(parentProvides);
6447
6641
  }
6448
- }
6449
- if (validator && !validator(value)) {
6450
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6642
+ provides[key] = value;
6451
6643
  }
6452
6644
  }
6453
- const isSimpleType = /* @__PURE__ */ makeMap(
6454
- "String,Number,Boolean,Function,Symbol,BigInt"
6455
- );
6456
- function assertType(value, type) {
6457
- let valid;
6458
- const expectedType = getType(type);
6459
- if (isSimpleType(expectedType)) {
6460
- const t = typeof value;
6461
- valid = t === expectedType.toLowerCase();
6462
- if (!valid && t === "object") {
6463
- valid = value instanceof type;
6645
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6646
+ const instance = currentInstance || currentRenderingInstance;
6647
+ if (instance || currentApp) {
6648
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6649
+ if (provides && key in provides) {
6650
+ return provides[key];
6651
+ } else if (arguments.length > 1) {
6652
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6653
+ } else {
6654
+ warn(`injection "${String(key)}" not found.`);
6464
6655
  }
6465
- } else if (expectedType === "Object") {
6466
- valid = isObject(value);
6467
- } else if (expectedType === "Array") {
6468
- valid = isArray(value);
6469
- } else if (expectedType === "null") {
6470
- valid = value === null;
6471
6656
  } else {
6472
- valid = value instanceof type;
6657
+ warn(`inject() can only be used inside setup() or functional components.`);
6473
6658
  }
6474
- return {
6475
- valid,
6476
- expectedType
6477
- };
6478
6659
  }
6479
- function getInvalidTypeMessage(name, value, expectedTypes) {
6480
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6481
- const expectedType = expectedTypes[0];
6482
- const receivedType = toRawType(value);
6483
- const expectedValue = styleValue(value, expectedType);
6484
- const receivedValue = styleValue(value, receivedType);
6485
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6486
- message += ` with value ${expectedValue}`;
6660
+
6661
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6662
+ return new Proxy(
6663
+ {},
6664
+ {
6665
+ get(_, key) {
6666
+ warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6667
+ if (key === "$options") {
6668
+ return resolveMergedOptions(instance);
6669
+ }
6670
+ if (key in rawProps) {
6671
+ return rawProps[key];
6672
+ }
6673
+ const injections = instance.type.inject;
6674
+ if (injections) {
6675
+ if (isArray(injections)) {
6676
+ if (injections.includes(key)) {
6677
+ return inject(key);
6678
+ }
6679
+ } else if (key in injections) {
6680
+ return inject(key);
6681
+ }
6682
+ }
6683
+ }
6684
+ }
6685
+ );
6686
+ }
6687
+
6688
+ function shouldSkipAttr(key, instance) {
6689
+ if (key === "is") {
6690
+ return true;
6487
6691
  }
6488
- message += `, got ${receivedType} `;
6489
- if (isExplicable(receivedType)) {
6490
- message += `with value ${receivedValue}.`;
6692
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6693
+ return true;
6491
6694
  }
6492
- return message;
6493
- }
6494
- function styleValue(value, type) {
6495
- if (type === "String") {
6496
- return `"${value}"`;
6497
- } else if (type === "Number") {
6498
- return `${Number(value)}`;
6499
- } else {
6500
- return `${value}`;
6695
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6696
+ return true;
6501
6697
  }
6502
- }
6503
- function isExplicable(type) {
6504
- const explicitTypes = ["string", "number", "boolean"];
6505
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6506
- }
6507
- function isBoolean(...args) {
6508
- return args.some((elem) => elem.toLowerCase() === "boolean");
6698
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6699
+ return true;
6700
+ }
6701
+ return false;
6509
6702
  }
6510
6703
 
6511
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6512
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6513
- const normalizeSlot = (key, rawSlot, ctx) => {
6514
- if (rawSlot._n) {
6515
- return rawSlot;
6516
- }
6517
- const normalized = withCtx((...args) => {
6518
- if (currentInstance) {
6519
- warn(
6520
- `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.`
6521
- );
6522
- }
6523
- return normalizeSlotValue(rawSlot(...args));
6524
- }, ctx);
6525
- normalized._c = false;
6526
- return normalized;
6527
- };
6528
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6529
- const ctx = rawSlots._ctx;
6530
- for (const key in rawSlots) {
6531
- if (isInternalKey(key))
6532
- continue;
6533
- const value = rawSlots[key];
6534
- if (isFunction(value)) {
6535
- slots[key] = normalizeSlot(key, value, ctx);
6536
- } else if (value != null) {
6537
- if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6538
- warn(
6539
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6540
- );
6541
- }
6542
- const normalized = normalizeSlotValue(value);
6543
- slots[key] = () => normalized;
6704
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6705
+ const props = {};
6706
+ const attrs = {};
6707
+ def(attrs, InternalObjectKey, 1);
6708
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6709
+ setFullProps(instance, rawProps, props, attrs);
6710
+ for (const key in instance.propsOptions[0]) {
6711
+ if (!(key in props)) {
6712
+ props[key] = void 0;
6544
6713
  }
6545
6714
  }
6546
- };
6547
- const normalizeVNodeSlots = (instance, children) => {
6548
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6549
- warn(
6550
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6551
- );
6715
+ {
6716
+ validateProps(rawProps || {}, props, instance);
6552
6717
  }
6553
- const normalized = normalizeSlotValue(children);
6554
- instance.slots.default = () => normalized;
6555
- };
6556
- const initSlots = (instance, children) => {
6557
- if (instance.vnode.shapeFlag & 32) {
6558
- const type = children._;
6559
- if (type) {
6560
- instance.slots = toRaw(children);
6561
- def(children, "_", type);
6718
+ if (isStateful) {
6719
+ instance.props = isSSR ? props : shallowReactive(props);
6720
+ } else {
6721
+ if (!instance.type.props) {
6722
+ instance.props = attrs;
6562
6723
  } else {
6563
- normalizeObjectSlots(
6564
- children,
6565
- instance.slots = {},
6566
- instance
6567
- );
6724
+ instance.props = props;
6725
+ }
6726
+ }
6727
+ instance.attrs = attrs;
6728
+ }
6729
+ function isInHmrContext(instance) {
6730
+ while (instance) {
6731
+ if (instance.type.__hmrId)
6732
+ return true;
6733
+ instance = instance.parent;
6734
+ }
6735
+ }
6736
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6737
+ const {
6738
+ props,
6739
+ attrs,
6740
+ vnode: { patchFlag }
6741
+ } = instance;
6742
+ const rawCurrentProps = toRaw(props);
6743
+ const [options] = instance.propsOptions;
6744
+ let hasAttrsChanged = false;
6745
+ if (
6746
+ // always force full diff in dev
6747
+ // - #1942 if hmr is enabled with sfc component
6748
+ // - vite#872 non-sfc component used by sfc component
6749
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6750
+ ) {
6751
+ if (patchFlag & 8) {
6752
+ const propsToUpdate = instance.vnode.dynamicProps;
6753
+ for (let i = 0; i < propsToUpdate.length; i++) {
6754
+ let key = propsToUpdate[i];
6755
+ if (isEmitListener(instance.emitsOptions, key)) {
6756
+ continue;
6757
+ }
6758
+ const value = rawProps[key];
6759
+ if (options) {
6760
+ if (hasOwn(attrs, key)) {
6761
+ if (value !== attrs[key]) {
6762
+ attrs[key] = value;
6763
+ hasAttrsChanged = true;
6764
+ }
6765
+ } else {
6766
+ const camelizedKey = camelize(key);
6767
+ props[camelizedKey] = resolvePropValue(
6768
+ options,
6769
+ rawCurrentProps,
6770
+ camelizedKey,
6771
+ value,
6772
+ instance,
6773
+ false
6774
+ /* isAbsent */
6775
+ );
6776
+ }
6777
+ } else {
6778
+ {
6779
+ if (isOn(key) && key.endsWith("Native")) {
6780
+ key = key.slice(0, -6);
6781
+ } else if (shouldSkipAttr(key, instance)) {
6782
+ continue;
6783
+ }
6784
+ }
6785
+ if (value !== attrs[key]) {
6786
+ attrs[key] = value;
6787
+ hasAttrsChanged = true;
6788
+ }
6789
+ }
6790
+ }
6568
6791
  }
6569
6792
  } else {
6570
- instance.slots = {};
6571
- if (children) {
6572
- normalizeVNodeSlots(instance, children);
6793
+ if (setFullProps(instance, rawProps, props, attrs)) {
6794
+ hasAttrsChanged = true;
6573
6795
  }
6574
- }
6575
- def(instance.slots, InternalObjectKey, 1);
6576
- };
6577
- const updateSlots = (instance, children, optimized) => {
6578
- const { vnode, slots } = instance;
6579
- let needDeletionCheck = true;
6580
- let deletionComparisonTarget = EMPTY_OBJ;
6581
- if (vnode.shapeFlag & 32) {
6582
- const type = children._;
6583
- if (type) {
6584
- if (isHmrUpdating) {
6585
- extend(slots, children);
6586
- } else if (optimized && type === 1) {
6587
- needDeletionCheck = false;
6588
- } else {
6589
- extend(slots, children);
6590
- if (!optimized && type === 1) {
6591
- delete slots._;
6796
+ let kebabKey;
6797
+ for (const key in rawCurrentProps) {
6798
+ if (!rawProps || // for camelCase
6799
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6800
+ // and converted to camelCase (#955)
6801
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6802
+ if (options) {
6803
+ if (rawPrevProps && // for camelCase
6804
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6805
+ rawPrevProps[kebabKey] !== void 0)) {
6806
+ props[key] = resolvePropValue(
6807
+ options,
6808
+ rawCurrentProps,
6809
+ key,
6810
+ void 0,
6811
+ instance,
6812
+ true
6813
+ /* isAbsent */
6814
+ );
6815
+ }
6816
+ } else {
6817
+ delete props[key];
6592
6818
  }
6593
6819
  }
6594
- } else {
6595
- needDeletionCheck = !children.$stable;
6596
- normalizeObjectSlots(children, slots, instance);
6597
6820
  }
6598
- deletionComparisonTarget = children;
6599
- } else if (children) {
6600
- normalizeVNodeSlots(instance, children);
6601
- deletionComparisonTarget = { default: 1 };
6602
- }
6603
- if (needDeletionCheck) {
6604
- for (const key in slots) {
6605
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6606
- delete slots[key];
6821
+ if (attrs !== rawCurrentProps) {
6822
+ for (const key in attrs) {
6823
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6824
+ delete attrs[key];
6825
+ hasAttrsChanged = true;
6826
+ }
6607
6827
  }
6608
6828
  }
6609
6829
  }
6610
- };
6611
-
6612
- function installLegacyConfigWarnings(config) {
6613
- const legacyConfigOptions = {
6614
- silent: "CONFIG_SILENT",
6615
- devtools: "CONFIG_DEVTOOLS",
6616
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6617
- keyCodes: "CONFIG_KEY_CODES",
6618
- productionTip: "CONFIG_PRODUCTION_TIP"
6619
- };
6620
- Object.keys(legacyConfigOptions).forEach((key) => {
6621
- let val = config[key];
6622
- Object.defineProperty(config, key, {
6623
- enumerable: true,
6624
- get() {
6625
- return val;
6626
- },
6627
- set(newVal) {
6628
- if (!isCopyingConfig) {
6629
- warnDeprecation$1(legacyConfigOptions[key], null);
6630
- }
6631
- val = newVal;
6632
- }
6633
- });
6634
- });
6830
+ if (hasAttrsChanged) {
6831
+ trigger(instance, "set", "$attrs");
6832
+ }
6833
+ {
6834
+ validateProps(rawProps || {}, props, instance);
6835
+ }
6635
6836
  }
6636
- function installLegacyOptionMergeStrats(config) {
6637
- config.optionMergeStrategies = new Proxy({}, {
6638
- get(target, key) {
6639
- if (key in target) {
6640
- return target[key];
6837
+ function setFullProps(instance, rawProps, props, attrs) {
6838
+ const [options, needCastKeys] = instance.propsOptions;
6839
+ let hasAttrsChanged = false;
6840
+ let rawCastValues;
6841
+ if (rawProps) {
6842
+ for (let key in rawProps) {
6843
+ if (isReservedProp(key)) {
6844
+ continue;
6641
6845
  }
6642
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6643
- "CONFIG_OPTION_MERGE_STRATS",
6644
- null
6645
- )) {
6646
- return internalOptionMergeStrats[key];
6846
+ {
6847
+ if (key.startsWith("onHook:")) {
6848
+ softAssertCompatEnabled(
6849
+ "INSTANCE_EVENT_HOOKS",
6850
+ instance,
6851
+ key.slice(2).toLowerCase()
6852
+ );
6853
+ }
6854
+ if (key === "inline-template") {
6855
+ continue;
6856
+ }
6857
+ }
6858
+ const value = rawProps[key];
6859
+ let camelKey;
6860
+ if (options && hasOwn(options, camelKey = camelize(key))) {
6861
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6862
+ props[camelKey] = value;
6863
+ } else {
6864
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6865
+ }
6866
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
6867
+ {
6868
+ if (isOn(key) && key.endsWith("Native")) {
6869
+ key = key.slice(0, -6);
6870
+ } else if (shouldSkipAttr(key, instance)) {
6871
+ continue;
6872
+ }
6873
+ }
6874
+ if (!(key in attrs) || value !== attrs[key]) {
6875
+ attrs[key] = value;
6876
+ hasAttrsChanged = true;
6877
+ }
6647
6878
  }
6648
- }
6649
- });
6650
- }
6651
-
6652
- let isCopyingConfig = false;
6653
- let singletonApp;
6654
- let singletonCtor;
6655
- function createCompatVue$1(createApp, createSingletonApp) {
6656
- singletonApp = createSingletonApp({});
6657
- const Vue = singletonCtor = function Vue2(options = {}) {
6658
- return createCompatApp(options, Vue2);
6659
- };
6660
- function createCompatApp(options = {}, Ctor) {
6661
- assertCompatEnabled("GLOBAL_MOUNT", null);
6662
- const { data } = options;
6663
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6664
- options.data = () => data;
6665
- }
6666
- const app = createApp(options);
6667
- if (Ctor !== Vue) {
6668
- applySingletonPrototype(app, Ctor);
6669
- }
6670
- const vm = app._createRoot(options);
6671
- if (options.el) {
6672
- return vm.$mount(options.el);
6673
- } else {
6674
- return vm;
6675
6879
  }
6676
6880
  }
6677
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6678
- Vue.config = singletonApp.config;
6679
- Vue.use = (p, ...options) => {
6680
- if (p && isFunction(p.install)) {
6681
- p.install(Vue, ...options);
6682
- } else if (isFunction(p)) {
6683
- p(Vue, ...options);
6684
- }
6685
- return Vue;
6686
- };
6687
- Vue.mixin = (m) => {
6688
- singletonApp.mixin(m);
6689
- return Vue;
6690
- };
6691
- Vue.component = (name, comp) => {
6692
- if (comp) {
6693
- singletonApp.component(name, comp);
6694
- return Vue;
6695
- } else {
6696
- return singletonApp.component(name);
6697
- }
6698
- };
6699
- Vue.directive = (name, dir) => {
6700
- if (dir) {
6701
- singletonApp.directive(name, dir);
6702
- return Vue;
6703
- } else {
6704
- return singletonApp.directive(name);
6705
- }
6706
- };
6707
- Vue.options = { _base: Vue };
6708
- let cid = 1;
6709
- Vue.cid = cid;
6710
- Vue.nextTick = nextTick;
6711
- const extendCache = /* @__PURE__ */ new WeakMap();
6712
- function extendCtor(extendOptions = {}) {
6713
- assertCompatEnabled("GLOBAL_EXTEND", null);
6714
- if (isFunction(extendOptions)) {
6715
- extendOptions = extendOptions.options;
6716
- }
6717
- if (extendCache.has(extendOptions)) {
6718
- return extendCache.get(extendOptions);
6881
+ if (needCastKeys) {
6882
+ const rawCurrentProps = toRaw(props);
6883
+ const castValues = rawCastValues || EMPTY_OBJ;
6884
+ for (let i = 0; i < needCastKeys.length; i++) {
6885
+ const key = needCastKeys[i];
6886
+ props[key] = resolvePropValue(
6887
+ options,
6888
+ rawCurrentProps,
6889
+ key,
6890
+ castValues[key],
6891
+ instance,
6892
+ !hasOwn(castValues, key)
6893
+ );
6719
6894
  }
6720
- const Super = this;
6721
- function SubVue(inlineOptions) {
6722
- if (!inlineOptions) {
6723
- return createCompatApp(SubVue.options, SubVue);
6895
+ }
6896
+ return hasAttrsChanged;
6897
+ }
6898
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6899
+ const opt = options[key];
6900
+ if (opt != null) {
6901
+ const hasDefault = hasOwn(opt, "default");
6902
+ if (hasDefault && value === void 0) {
6903
+ const defaultValue = opt.default;
6904
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6905
+ const { propsDefaults } = instance;
6906
+ if (key in propsDefaults) {
6907
+ value = propsDefaults[key];
6908
+ } else {
6909
+ setCurrentInstance(instance);
6910
+ value = propsDefaults[key] = defaultValue.call(
6911
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6912
+ props
6913
+ );
6914
+ unsetCurrentInstance();
6915
+ }
6724
6916
  } else {
6725
- return createCompatApp(
6726
- mergeOptions(
6727
- extend({}, SubVue.options),
6728
- inlineOptions,
6729
- internalOptionMergeStrats
6730
- ),
6731
- SubVue
6732
- );
6917
+ value = defaultValue;
6733
6918
  }
6734
6919
  }
6735
- SubVue.super = Super;
6736
- SubVue.prototype = Object.create(Vue.prototype);
6737
- SubVue.prototype.constructor = SubVue;
6738
- const mergeBase = {};
6739
- for (const key in Super.options) {
6740
- const superValue = Super.options[key];
6741
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6920
+ if (opt[0 /* shouldCast */]) {
6921
+ if (isAbsent && !hasDefault) {
6922
+ value = false;
6923
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6924
+ value = true;
6925
+ }
6742
6926
  }
6743
- SubVue.options = mergeOptions(
6744
- mergeBase,
6745
- extendOptions,
6746
- internalOptionMergeStrats
6747
- );
6748
- SubVue.options._base = SubVue;
6749
- SubVue.extend = extendCtor.bind(SubVue);
6750
- SubVue.mixin = Super.mixin;
6751
- SubVue.use = Super.use;
6752
- SubVue.cid = ++cid;
6753
- extendCache.set(extendOptions, SubVue);
6754
- return SubVue;
6755
6927
  }
6756
- Vue.extend = extendCtor.bind(Vue);
6757
- Vue.set = (target, key, value) => {
6758
- assertCompatEnabled("GLOBAL_SET", null);
6759
- target[key] = value;
6760
- };
6761
- Vue.delete = (target, key) => {
6762
- assertCompatEnabled("GLOBAL_DELETE", null);
6763
- delete target[key];
6764
- };
6765
- Vue.observable = (target) => {
6766
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6767
- return reactive(target);
6768
- };
6769
- Vue.filter = (name, filter) => {
6770
- if (filter) {
6771
- singletonApp.filter(name, filter);
6772
- return Vue;
6773
- } else {
6774
- return singletonApp.filter(name);
6775
- }
6776
- };
6777
- const util = {
6778
- warn: warn ,
6779
- extend,
6780
- mergeOptions: (parent, child, vm) => mergeOptions(
6781
- parent,
6782
- child,
6783
- vm ? void 0 : internalOptionMergeStrats
6784
- ),
6785
- defineReactive
6786
- };
6787
- Object.defineProperty(Vue, "util", {
6788
- get() {
6789
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6790
- return util;
6791
- }
6792
- });
6793
- Vue.configureCompat = configureCompat;
6794
- return Vue;
6928
+ return value;
6795
6929
  }
6796
- function installAppCompatProperties(app, context, render) {
6797
- installFilterMethod(app, context);
6798
- installLegacyOptionMergeStrats(app.config);
6799
- if (!singletonApp) {
6800
- return;
6930
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
6931
+ const cache = appContext.propsCache;
6932
+ const cached = cache.get(comp);
6933
+ if (cached) {
6934
+ return cached;
6801
6935
  }
6802
- installCompatMount(app, context, render);
6803
- installLegacyAPIs(app);
6804
- applySingletonAppMutations(app);
6805
- installLegacyConfigWarnings(app.config);
6806
- }
6807
- function installFilterMethod(app, context) {
6808
- context.filters = {};
6809
- app.filter = (name, filter) => {
6810
- assertCompatEnabled("FILTERS", null);
6811
- if (!filter) {
6812
- return context.filters[name];
6936
+ const raw = comp.props;
6937
+ const normalized = {};
6938
+ const needCastKeys = [];
6939
+ let hasExtends = false;
6940
+ if (!isFunction(comp)) {
6941
+ const extendProps = (raw2) => {
6942
+ if (isFunction(raw2)) {
6943
+ raw2 = raw2.options;
6944
+ }
6945
+ hasExtends = true;
6946
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6947
+ extend(normalized, props);
6948
+ if (keys)
6949
+ needCastKeys.push(...keys);
6950
+ };
6951
+ if (!asMixin && appContext.mixins.length) {
6952
+ appContext.mixins.forEach(extendProps);
6813
6953
  }
6814
- if (context.filters[name]) {
6815
- warn(`Filter "${name}" has already been registered.`);
6954
+ if (comp.extends) {
6955
+ extendProps(comp.extends);
6816
6956
  }
6817
- context.filters[name] = filter;
6818
- return app;
6819
- };
6820
- }
6821
- function installLegacyAPIs(app) {
6822
- Object.defineProperties(app, {
6823
- // so that app.use() can work with legacy plugins that extend prototypes
6824
- prototype: {
6825
- get() {
6826
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6827
- return app.config.globalProperties;
6957
+ if (comp.mixins) {
6958
+ comp.mixins.forEach(extendProps);
6959
+ }
6960
+ }
6961
+ if (!raw && !hasExtends) {
6962
+ if (isObject(comp)) {
6963
+ cache.set(comp, EMPTY_ARR);
6964
+ }
6965
+ return EMPTY_ARR;
6966
+ }
6967
+ if (isArray(raw)) {
6968
+ for (let i = 0; i < raw.length; i++) {
6969
+ if (!isString(raw[i])) {
6970
+ warn(`props must be strings when using array syntax.`, raw[i]);
6828
6971
  }
6829
- },
6830
- nextTick: { value: nextTick },
6831
- extend: { value: singletonCtor.extend },
6832
- set: { value: singletonCtor.set },
6833
- delete: { value: singletonCtor.delete },
6834
- observable: { value: singletonCtor.observable },
6835
- util: {
6836
- get() {
6837
- return singletonCtor.util;
6972
+ const normalizedKey = camelize(raw[i]);
6973
+ if (validatePropName(normalizedKey)) {
6974
+ normalized[normalizedKey] = EMPTY_OBJ;
6838
6975
  }
6839
6976
  }
6840
- });
6841
- }
6842
- function applySingletonAppMutations(app) {
6843
- app._context.mixins = [...singletonApp._context.mixins];
6844
- ["components", "directives", "filters"].forEach((key) => {
6845
- app._context[key] = Object.create(singletonApp._context[key]);
6846
- });
6847
- isCopyingConfig = true;
6848
- for (const key in singletonApp.config) {
6849
- if (key === "isNativeTag")
6850
- continue;
6851
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6852
- continue;
6977
+ } else if (raw) {
6978
+ if (!isObject(raw)) {
6979
+ warn(`invalid props options`, raw);
6853
6980
  }
6854
- const val = singletonApp.config[key];
6855
- app.config[key] = isObject(val) ? Object.create(val) : val;
6856
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6857
- app.config.compilerOptions.isCustomElement = (tag) => {
6858
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6859
- };
6981
+ for (const key in raw) {
6982
+ const normalizedKey = camelize(key);
6983
+ if (validatePropName(normalizedKey)) {
6984
+ const opt = raw[key];
6985
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6986
+ if (prop) {
6987
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
6988
+ const stringIndex = getTypeIndex(String, prop.type);
6989
+ prop[0 /* shouldCast */] = booleanIndex > -1;
6990
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6991
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
6992
+ needCastKeys.push(normalizedKey);
6993
+ }
6994
+ }
6995
+ }
6860
6996
  }
6861
6997
  }
6862
- isCopyingConfig = false;
6863
- applySingletonPrototype(app, singletonCtor);
6998
+ const res = [normalized, needCastKeys];
6999
+ if (isObject(comp)) {
7000
+ cache.set(comp, res);
7001
+ }
7002
+ return res;
6864
7003
  }
6865
- function applySingletonPrototype(app, Ctor) {
6866
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6867
- if (enabled) {
6868
- app.config.globalProperties = Object.create(Ctor.prototype);
7004
+ function validatePropName(key) {
7005
+ if (key[0] !== "$") {
7006
+ return true;
7007
+ } else {
7008
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
6869
7009
  }
6870
- let hasPrototypeAugmentations = false;
6871
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6872
- for (const key in descriptors) {
6873
- if (key !== "constructor") {
6874
- hasPrototypeAugmentations = true;
6875
- if (enabled) {
6876
- Object.defineProperty(
6877
- app.config.globalProperties,
6878
- key,
6879
- descriptors[key]
6880
- );
6881
- }
7010
+ return false;
7011
+ }
7012
+ function getType(ctor) {
7013
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7014
+ return match ? match[2] : ctor === null ? "null" : "";
7015
+ }
7016
+ function isSameType(a, b) {
7017
+ return getType(a) === getType(b);
7018
+ }
7019
+ function getTypeIndex(type, expectedTypes) {
7020
+ if (isArray(expectedTypes)) {
7021
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7022
+ } else if (isFunction(expectedTypes)) {
7023
+ return isSameType(expectedTypes, type) ? 0 : -1;
7024
+ }
7025
+ return -1;
7026
+ }
7027
+ function validateProps(rawProps, props, instance) {
7028
+ const resolvedValues = toRaw(props);
7029
+ const options = instance.propsOptions[0];
7030
+ for (const key in options) {
7031
+ let opt = options[key];
7032
+ if (opt == null)
7033
+ continue;
7034
+ validateProp(
7035
+ key,
7036
+ resolvedValues[key],
7037
+ opt,
7038
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
7039
+ );
7040
+ }
7041
+ }
7042
+ function validateProp(name, value, prop, isAbsent) {
7043
+ const { type, required, validator, skipCheck } = prop;
7044
+ if (required && isAbsent) {
7045
+ warn('Missing required prop: "' + name + '"');
7046
+ return;
7047
+ }
7048
+ if (value == null && !required) {
7049
+ return;
7050
+ }
7051
+ if (type != null && type !== true && !skipCheck) {
7052
+ let isValid = false;
7053
+ const types = isArray(type) ? type : [type];
7054
+ const expectedTypes = [];
7055
+ for (let i = 0; i < types.length && !isValid; i++) {
7056
+ const { valid, expectedType } = assertType(value, types[i]);
7057
+ expectedTypes.push(expectedType || "");
7058
+ isValid = valid;
7059
+ }
7060
+ if (!isValid) {
7061
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7062
+ return;
6882
7063
  }
6883
7064
  }
6884
- if (hasPrototypeAugmentations) {
6885
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
7065
+ if (validator && !validator(value)) {
7066
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6886
7067
  }
6887
7068
  }
6888
- function installCompatMount(app, context, render) {
6889
- let isMounted = false;
6890
- app._createRoot = (options) => {
6891
- const component = app._component;
6892
- const vnode = createVNode(component, options.propsData || null);
6893
- vnode.appContext = context;
6894
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6895
- const emptyRender = () => {
6896
- };
6897
- const instance = createComponentInstance(vnode, null, null);
6898
- if (hasNoRender) {
6899
- instance.render = emptyRender;
7069
+ const isSimpleType = /* @__PURE__ */ makeMap(
7070
+ "String,Number,Boolean,Function,Symbol,BigInt"
7071
+ );
7072
+ function assertType(value, type) {
7073
+ let valid;
7074
+ const expectedType = getType(type);
7075
+ if (isSimpleType(expectedType)) {
7076
+ const t = typeof value;
7077
+ valid = t === expectedType.toLowerCase();
7078
+ if (!valid && t === "object") {
7079
+ valid = value instanceof type;
6900
7080
  }
6901
- setupComponent(instance);
6902
- vnode.component = instance;
6903
- vnode.isCompatRoot = true;
6904
- instance.ctx._compat_mount = (selectorOrEl) => {
6905
- if (isMounted) {
6906
- warn(`Root instance is already mounted.`);
6907
- return;
6908
- }
6909
- let container;
6910
- if (typeof selectorOrEl === "string") {
6911
- const result = document.querySelector(selectorOrEl);
6912
- if (!result) {
6913
- warn(
6914
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6915
- );
6916
- return;
6917
- }
6918
- container = result;
6919
- } else {
6920
- container = selectorOrEl || document.createElement("div");
6921
- }
6922
- const isSVG = container instanceof SVGElement;
6923
- {
6924
- context.reload = () => {
6925
- const cloned = cloneVNode(vnode);
6926
- cloned.component = null;
6927
- render(cloned, container, isSVG);
6928
- };
6929
- }
6930
- if (hasNoRender && instance.render === emptyRender) {
6931
- {
6932
- for (let i = 0; i < container.attributes.length; i++) {
6933
- const attr = container.attributes[i];
6934
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6935
- warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6936
- break;
6937
- }
6938
- }
6939
- }
6940
- instance.render = null;
6941
- component.template = container.innerHTML;
6942
- finishComponentSetup(
6943
- instance,
6944
- false,
6945
- true
6946
- /* skip options */
6947
- );
6948
- }
6949
- container.innerHTML = "";
6950
- render(vnode, container, isSVG);
6951
- if (container instanceof Element) {
6952
- container.removeAttribute("v-cloak");
6953
- container.setAttribute("data-v-app", "");
6954
- }
6955
- isMounted = true;
6956
- app._container = container;
6957
- container.__vue_app__ = app;
6958
- {
6959
- devtoolsInitApp(app, version);
6960
- }
6961
- return instance.proxy;
6962
- };
6963
- instance.ctx._compat_destroy = () => {
6964
- if (isMounted) {
6965
- render(null, app._container);
6966
- {
6967
- devtoolsUnmountApp(app);
6968
- }
6969
- delete app._container.__vue_app__;
6970
- } else {
6971
- const { bum, scope, um } = instance;
6972
- if (bum) {
6973
- invokeArrayFns(bum);
6974
- }
6975
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6976
- instance.emit("hook:beforeDestroy");
6977
- }
6978
- if (scope) {
6979
- scope.stop();
6980
- }
6981
- if (um) {
6982
- invokeArrayFns(um);
6983
- }
6984
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6985
- instance.emit("hook:destroyed");
6986
- }
6987
- }
6988
- };
6989
- return instance.proxy;
7081
+ } else if (expectedType === "Object") {
7082
+ valid = isObject(value);
7083
+ } else if (expectedType === "Array") {
7084
+ valid = isArray(value);
7085
+ } else if (expectedType === "null") {
7086
+ valid = value === null;
7087
+ } else {
7088
+ valid = value instanceof type;
7089
+ }
7090
+ return {
7091
+ valid,
7092
+ expectedType
6990
7093
  };
6991
7094
  }
6992
- const methodsToPatch = [
6993
- "push",
6994
- "pop",
6995
- "shift",
6996
- "unshift",
6997
- "splice",
6998
- "sort",
6999
- "reverse"
7000
- ];
7001
- const patched = /* @__PURE__ */ new WeakSet();
7002
- function defineReactive(obj, key, val) {
7003
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
7004
- const reactiveVal = reactive(val);
7005
- if (isArray(val)) {
7006
- methodsToPatch.forEach((m) => {
7007
- val[m] = (...args) => {
7008
- Array.prototype[m].call(reactiveVal, ...args);
7009
- };
7010
- });
7011
- } else {
7012
- Object.keys(val).forEach((key2) => {
7013
- try {
7014
- defineReactiveSimple(val, key2, val[key2]);
7015
- } catch (e) {
7016
- }
7017
- });
7018
- }
7095
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7096
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7097
+ const expectedType = expectedTypes[0];
7098
+ const receivedType = toRawType(value);
7099
+ const expectedValue = styleValue(value, expectedType);
7100
+ const receivedValue = styleValue(value, receivedType);
7101
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7102
+ message += ` with value ${expectedValue}`;
7019
7103
  }
7020
- const i = obj.$;
7021
- if (i && obj === i.proxy) {
7022
- defineReactiveSimple(i.ctx, key, val);
7023
- i.accessCache = /* @__PURE__ */ Object.create(null);
7024
- } else if (isReactive(obj)) {
7025
- obj[key] = val;
7104
+ message += `, got ${receivedType} `;
7105
+ if (isExplicable(receivedType)) {
7106
+ message += `with value ${receivedValue}.`;
7107
+ }
7108
+ return message;
7109
+ }
7110
+ function styleValue(value, type) {
7111
+ if (type === "String") {
7112
+ return `"${value}"`;
7113
+ } else if (type === "Number") {
7114
+ return `${Number(value)}`;
7026
7115
  } else {
7027
- defineReactiveSimple(obj, key, val);
7116
+ return `${value}`;
7028
7117
  }
7029
7118
  }
7030
- function defineReactiveSimple(obj, key, val) {
7031
- val = isObject(val) ? reactive(val) : val;
7032
- Object.defineProperty(obj, key, {
7033
- enumerable: true,
7034
- configurable: true,
7035
- get() {
7036
- track(obj, "get", key);
7037
- return val;
7038
- },
7039
- set(newVal) {
7040
- val = isObject(newVal) ? reactive(newVal) : newVal;
7041
- trigger(obj, "set", key, newVal);
7119
+ function isExplicable(type) {
7120
+ const explicitTypes = ["string", "number", "boolean"];
7121
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7122
+ }
7123
+ function isBoolean(...args) {
7124
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7125
+ }
7126
+
7127
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7128
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7129
+ const normalizeSlot = (key, rawSlot, ctx) => {
7130
+ if (rawSlot._n) {
7131
+ return rawSlot;
7132
+ }
7133
+ const normalized = withCtx((...args) => {
7134
+ if (currentInstance) {
7135
+ warn(
7136
+ `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.`
7137
+ );
7138
+ }
7139
+ return normalizeSlotValue(rawSlot(...args));
7140
+ }, ctx);
7141
+ normalized._c = false;
7142
+ return normalized;
7143
+ };
7144
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7145
+ const ctx = rawSlots._ctx;
7146
+ for (const key in rawSlots) {
7147
+ if (isInternalKey(key))
7148
+ continue;
7149
+ const value = rawSlots[key];
7150
+ if (isFunction(value)) {
7151
+ slots[key] = normalizeSlot(key, value, ctx);
7152
+ } else if (value != null) {
7153
+ if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7154
+ warn(
7155
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7156
+ );
7157
+ }
7158
+ const normalized = normalizeSlotValue(value);
7159
+ slots[key] = () => normalized;
7042
7160
  }
7043
- });
7044
- }
7045
-
7046
- function createAppContext() {
7047
- return {
7048
- app: null,
7049
- config: {
7050
- isNativeTag: NO,
7051
- performance: false,
7052
- globalProperties: {},
7053
- optionMergeStrategies: {},
7054
- errorHandler: void 0,
7055
- warnHandler: void 0,
7056
- compilerOptions: {}
7057
- },
7058
- mixins: [],
7059
- components: {},
7060
- directives: {},
7061
- provides: /* @__PURE__ */ Object.create(null),
7062
- optionsCache: /* @__PURE__ */ new WeakMap(),
7063
- propsCache: /* @__PURE__ */ new WeakMap(),
7064
- emitsCache: /* @__PURE__ */ new WeakMap()
7065
- };
7066
- }
7067
- let uid$1 = 0;
7068
- function createAppAPI(render, hydrate) {
7069
- return function createApp(rootComponent, rootProps = null) {
7070
- if (!isFunction(rootComponent)) {
7071
- rootComponent = extend({}, rootComponent);
7161
+ }
7162
+ };
7163
+ const normalizeVNodeSlots = (instance, children) => {
7164
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7165
+ warn(
7166
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7167
+ );
7168
+ }
7169
+ const normalized = normalizeSlotValue(children);
7170
+ instance.slots.default = () => normalized;
7171
+ };
7172
+ const initSlots = (instance, children) => {
7173
+ if (instance.vnode.shapeFlag & 32) {
7174
+ const type = children._;
7175
+ if (type) {
7176
+ instance.slots = toRaw(children);
7177
+ def(children, "_", type);
7178
+ } else {
7179
+ normalizeObjectSlots(
7180
+ children,
7181
+ instance.slots = {},
7182
+ instance
7183
+ );
7072
7184
  }
7073
- if (rootProps != null && !isObject(rootProps)) {
7074
- warn(`root props passed to app.mount() must be an object.`);
7075
- rootProps = null;
7185
+ } else {
7186
+ instance.slots = {};
7187
+ if (children) {
7188
+ normalizeVNodeSlots(instance, children);
7076
7189
  }
7077
- const context = createAppContext();
7078
- const installedPlugins = /* @__PURE__ */ new Set();
7079
- let isMounted = false;
7080
- const app = context.app = {
7081
- _uid: uid$1++,
7082
- _component: rootComponent,
7083
- _props: rootProps,
7084
- _container: null,
7085
- _context: context,
7086
- _instance: null,
7087
- version,
7088
- get config() {
7089
- return context.config;
7090
- },
7091
- set config(v) {
7092
- {
7093
- warn(
7094
- `app.config cannot be replaced. Modify individual options instead.`
7095
- );
7096
- }
7097
- },
7098
- use(plugin, ...options) {
7099
- if (installedPlugins.has(plugin)) {
7100
- warn(`Plugin has already been applied to target app.`);
7101
- } else if (plugin && isFunction(plugin.install)) {
7102
- installedPlugins.add(plugin);
7103
- plugin.install(app, ...options);
7104
- } else if (isFunction(plugin)) {
7105
- installedPlugins.add(plugin);
7106
- plugin(app, ...options);
7107
- } else {
7108
- warn(
7109
- `A plugin must either be a function or an object with an "install" function.`
7110
- );
7111
- }
7112
- return app;
7113
- },
7114
- mixin(mixin) {
7115
- {
7116
- if (!context.mixins.includes(mixin)) {
7117
- context.mixins.push(mixin);
7118
- } else {
7119
- warn(
7120
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7121
- );
7122
- }
7123
- }
7124
- return app;
7125
- },
7126
- component(name, component) {
7127
- {
7128
- validateComponentName(name, context.config);
7129
- }
7130
- if (!component) {
7131
- return context.components[name];
7132
- }
7133
- if (context.components[name]) {
7134
- warn(`Component "${name}" has already been registered in target app.`);
7135
- }
7136
- context.components[name] = component;
7137
- return app;
7138
- },
7139
- directive(name, directive) {
7140
- {
7141
- validateDirectiveName(name);
7142
- }
7143
- if (!directive) {
7144
- return context.directives[name];
7145
- }
7146
- if (context.directives[name]) {
7147
- warn(`Directive "${name}" has already been registered in target app.`);
7148
- }
7149
- context.directives[name] = directive;
7150
- return app;
7151
- },
7152
- mount(rootContainer, isHydrate, isSVG) {
7153
- if (!isMounted) {
7154
- if (rootContainer.__vue_app__) {
7155
- warn(
7156
- `There is already an app instance mounted on the host container.
7157
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7158
- );
7159
- }
7160
- const vnode = createVNode(
7161
- rootComponent,
7162
- rootProps
7163
- );
7164
- vnode.appContext = context;
7165
- {
7166
- context.reload = () => {
7167
- render(cloneVNode(vnode), rootContainer, isSVG);
7168
- };
7169
- }
7170
- if (isHydrate && hydrate) {
7171
- hydrate(vnode, rootContainer);
7172
- } else {
7173
- render(vnode, rootContainer, isSVG);
7174
- }
7175
- isMounted = true;
7176
- app._container = rootContainer;
7177
- rootContainer.__vue_app__ = app;
7178
- {
7179
- app._instance = vnode.component;
7180
- devtoolsInitApp(app, version);
7181
- }
7182
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7183
- } else {
7184
- warn(
7185
- `App has already been mounted.
7186
- 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)\``
7187
- );
7188
- }
7189
- },
7190
- unmount() {
7191
- if (isMounted) {
7192
- render(null, app._container);
7193
- {
7194
- app._instance = null;
7195
- devtoolsUnmountApp(app);
7196
- }
7197
- delete app._container.__vue_app__;
7198
- } else {
7199
- warn(`Cannot unmount an app that is not mounted.`);
7200
- }
7201
- },
7202
- provide(key, value) {
7203
- if (key in context.provides) {
7204
- warn(
7205
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7206
- );
7190
+ }
7191
+ def(instance.slots, InternalObjectKey, 1);
7192
+ };
7193
+ const updateSlots = (instance, children, optimized) => {
7194
+ const { vnode, slots } = instance;
7195
+ let needDeletionCheck = true;
7196
+ let deletionComparisonTarget = EMPTY_OBJ;
7197
+ if (vnode.shapeFlag & 32) {
7198
+ const type = children._;
7199
+ if (type) {
7200
+ if (isHmrUpdating) {
7201
+ extend(slots, children);
7202
+ } else if (optimized && type === 1) {
7203
+ needDeletionCheck = false;
7204
+ } else {
7205
+ extend(slots, children);
7206
+ if (!optimized && type === 1) {
7207
+ delete slots._;
7207
7208
  }
7208
- context.provides[key] = value;
7209
- return app;
7210
7209
  }
7211
- };
7212
- {
7213
- installAppCompatProperties(app, context, render);
7210
+ } else {
7211
+ needDeletionCheck = !children.$stable;
7212
+ normalizeObjectSlots(children, slots, instance);
7214
7213
  }
7215
- return app;
7216
- };
7217
- }
7214
+ deletionComparisonTarget = children;
7215
+ } else if (children) {
7216
+ normalizeVNodeSlots(instance, children);
7217
+ deletionComparisonTarget = { default: 1 };
7218
+ }
7219
+ if (needDeletionCheck) {
7220
+ for (const key in slots) {
7221
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7222
+ delete slots[key];
7223
+ }
7224
+ }
7225
+ }
7226
+ };
7218
7227
 
7219
7228
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7220
7229
  if (isArray(rawRef)) {
@@ -10376,6 +10385,12 @@ Component that was made reactive: `,
10376
10385
  {
10377
10386
  warnRuntimeUsage(`defineSlots`);
10378
10387
  }
10388
+ return null;
10389
+ }
10390
+ function defineModel() {
10391
+ {
10392
+ warnRuntimeUsage("defineModel");
10393
+ }
10379
10394
  }
10380
10395
  function withDefaults(props, defaults) {
10381
10396
  {
@@ -10389,6 +10404,40 @@ Component that was made reactive: `,
10389
10404
  function useAttrs() {
10390
10405
  return getContext().attrs;
10391
10406
  }
10407
+ function useModel(props, name, options) {
10408
+ const i = getCurrentInstance();
10409
+ if (!i) {
10410
+ warn(`useModel() called without active instance.`);
10411
+ return ref();
10412
+ }
10413
+ if (!i.propsOptions[0][name]) {
10414
+ warn(`useModel() called with prop "${name}" which is not declared.`);
10415
+ return ref();
10416
+ }
10417
+ if (options && options.local) {
10418
+ const proxy = ref(props[name]);
10419
+ watch(
10420
+ () => props[name],
10421
+ (v) => proxy.value = v
10422
+ );
10423
+ watch(proxy, (value) => {
10424
+ if (value !== props[name]) {
10425
+ i.emit(`update:${name}`, value);
10426
+ }
10427
+ });
10428
+ return proxy;
10429
+ } else {
10430
+ return {
10431
+ __v_isRef: true,
10432
+ get value() {
10433
+ return props[name];
10434
+ },
10435
+ set value(value) {
10436
+ i.emit(`update:${name}`, value);
10437
+ }
10438
+ };
10439
+ }
10440
+ }
10392
10441
  function getContext() {
10393
10442
  const i = getCurrentInstance();
10394
10443
  if (!i) {
@@ -10396,11 +10445,14 @@ Component that was made reactive: `,
10396
10445
  }
10397
10446
  return i.setupContext || (i.setupContext = createSetupContext(i));
10398
10447
  }
10399
- function mergeDefaults(raw, defaults) {
10400
- const props = isArray(raw) ? raw.reduce(
10448
+ function normalizePropsOrEmits(props) {
10449
+ return isArray(props) ? props.reduce(
10401
10450
  (normalized, p) => (normalized[p] = {}, normalized),
10402
10451
  {}
10403
- ) : raw;
10452
+ ) : props;
10453
+ }
10454
+ function mergeDefaults(raw, defaults) {
10455
+ const props = normalizePropsOrEmits(raw);
10404
10456
  for (const key in defaults) {
10405
10457
  if (key.startsWith("__skip"))
10406
10458
  continue;
@@ -10422,6 +10474,13 @@ Component that was made reactive: `,
10422
10474
  }
10423
10475
  return props;
10424
10476
  }
10477
+ function mergeModels(a, b) {
10478
+ if (!a || !b)
10479
+ return a || b;
10480
+ if (isArray(a) && isArray(b))
10481
+ return a.concat(b);
10482
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
10483
+ }
10425
10484
  function createPropsRestProxy(props, excludedKeys) {
10426
10485
  const ret = {};
10427
10486
  for (const key in props) {
@@ -10681,7 +10740,7 @@ Component that was made reactive: `,
10681
10740
  return true;
10682
10741
  }
10683
10742
 
10684
- const version = "3.3.0-alpha.7";
10743
+ const version = "3.3.0-alpha.9";
10685
10744
  const ssrUtils = null;
10686
10745
  const resolveFilter = resolveFilter$1 ;
10687
10746
  const _compatUtils = {
@@ -12325,6 +12384,7 @@ Component that was made reactive: `,
12325
12384
  defineCustomElement: defineCustomElement,
12326
12385
  defineEmits: defineEmits,
12327
12386
  defineExpose: defineExpose,
12387
+ defineModel: defineModel,
12328
12388
  defineOptions: defineOptions,
12329
12389
  defineProps: defineProps,
12330
12390
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12352,6 +12412,7 @@ Component that was made reactive: `,
12352
12412
  isVNode: isVNode,
12353
12413
  markRaw: markRaw,
12354
12414
  mergeDefaults: mergeDefaults,
12415
+ mergeModels: mergeModels,
12355
12416
  mergeProps: mergeProps,
12356
12417
  nextTick: nextTick,
12357
12418
  normalizeClass: normalizeClass,
@@ -12410,6 +12471,7 @@ Component that was made reactive: `,
12410
12471
  useAttrs: useAttrs,
12411
12472
  useCssModule: useCssModule,
12412
12473
  useCssVars: useCssVars,
12474
+ useModel: useModel,
12413
12475
  useSSRContext: useSSRContext,
12414
12476
  useSlots: useSlots,
12415
12477
  useTransitionState: useTransitionState,
@@ -16605,7 +16667,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16605
16667
  const seen$1 = /* @__PURE__ */ new WeakSet();
16606
16668
  const transformOnce = (node, context) => {
16607
16669
  if (node.type === 1 && findDir(node, "once", true)) {
16608
- if (seen$1.has(node) || context.inVOnce) {
16670
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
16609
16671
  return;
16610
16672
  }
16611
16673
  seen$1.add(node);