@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.
package/dist/vue.cjs.js CHANGED
@@ -3609,33 +3609,41 @@ function setActiveBranch(suspense, branch) {
3609
3609
  }
3610
3610
  }
3611
3611
 
3612
- function provide(key, value) {
3613
- if (!currentInstance) {
3614
- {
3615
- warn(`provide() can only be used inside setup().`);
3616
- }
3617
- } else {
3618
- let provides = currentInstance.provides;
3619
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3620
- if (parentProvides === provides) {
3621
- provides = currentInstance.provides = Object.create(parentProvides);
3622
- }
3623
- provides[key] = value;
3624
- }
3625
- }
3626
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3627
- const instance = currentInstance || currentRenderingInstance;
3628
- if (instance) {
3629
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3630
- if (provides && key in provides) {
3631
- return provides[key];
3632
- } else if (arguments.length > 1) {
3633
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3612
+ const legacyDirectiveHookMap = {
3613
+ beforeMount: "bind",
3614
+ mounted: "inserted",
3615
+ updated: ["update", "componentUpdated"],
3616
+ unmounted: "unbind"
3617
+ };
3618
+ function mapCompatDirectiveHook(name, dir, instance) {
3619
+ const mappedName = legacyDirectiveHookMap[name];
3620
+ if (mappedName) {
3621
+ if (isArray(mappedName)) {
3622
+ const hook = [];
3623
+ mappedName.forEach((mapped) => {
3624
+ const mappedHook = dir[mapped];
3625
+ if (mappedHook) {
3626
+ softAssertCompatEnabled(
3627
+ "CUSTOM_DIR",
3628
+ instance,
3629
+ mapped,
3630
+ name
3631
+ );
3632
+ hook.push(mappedHook);
3633
+ }
3634
+ });
3635
+ return hook.length ? hook : void 0;
3634
3636
  } else {
3635
- warn(`injection "${String(key)}" not found.`);
3637
+ if (dir[mappedName]) {
3638
+ softAssertCompatEnabled(
3639
+ "CUSTOM_DIR",
3640
+ instance,
3641
+ mappedName,
3642
+ name
3643
+ );
3644
+ }
3645
+ return dir[mappedName];
3636
3646
  }
3637
- } else {
3638
- warn(`inject() can only be used inside setup() or functional components.`);
3639
3647
  }
3640
3648
  }
3641
3649
 
@@ -3895,6 +3903,68 @@ function traverse(value, seen) {
3895
3903
  return value;
3896
3904
  }
3897
3905
 
3906
+ function validateDirectiveName(name) {
3907
+ if (isBuiltInDirective(name)) {
3908
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3909
+ }
3910
+ }
3911
+ function withDirectives(vnode, directives) {
3912
+ const internalInstance = currentRenderingInstance;
3913
+ if (internalInstance === null) {
3914
+ warn(`withDirectives can only be used inside render functions.`);
3915
+ return vnode;
3916
+ }
3917
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3918
+ const bindings = vnode.dirs || (vnode.dirs = []);
3919
+ for (let i = 0; i < directives.length; i++) {
3920
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3921
+ if (dir) {
3922
+ if (isFunction(dir)) {
3923
+ dir = {
3924
+ mounted: dir,
3925
+ updated: dir
3926
+ };
3927
+ }
3928
+ if (dir.deep) {
3929
+ traverse(value);
3930
+ }
3931
+ bindings.push({
3932
+ dir,
3933
+ instance,
3934
+ value,
3935
+ oldValue: void 0,
3936
+ arg,
3937
+ modifiers
3938
+ });
3939
+ }
3940
+ }
3941
+ return vnode;
3942
+ }
3943
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3944
+ const bindings = vnode.dirs;
3945
+ const oldBindings = prevVNode && prevVNode.dirs;
3946
+ for (let i = 0; i < bindings.length; i++) {
3947
+ const binding = bindings[i];
3948
+ if (oldBindings) {
3949
+ binding.oldValue = oldBindings[i].value;
3950
+ }
3951
+ let hook = binding.dir[name];
3952
+ if (!hook) {
3953
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3954
+ }
3955
+ if (hook) {
3956
+ pauseTracking();
3957
+ callWithAsyncErrorHandling(hook, instance, 8, [
3958
+ vnode.el,
3959
+ binding,
3960
+ vnode,
3961
+ prevVNode
3962
+ ]);
3963
+ resetTracking();
3964
+ }
3965
+ }
3966
+ }
3967
+
3898
3968
  function useTransitionState() {
3899
3969
  const state = {
3900
3970
  isMounted: false,
@@ -4699,106 +4769,6 @@ function getCompatListeners(instance) {
4699
4769
  return listeners;
4700
4770
  }
4701
4771
 
4702
- const legacyDirectiveHookMap = {
4703
- beforeMount: "bind",
4704
- mounted: "inserted",
4705
- updated: ["update", "componentUpdated"],
4706
- unmounted: "unbind"
4707
- };
4708
- function mapCompatDirectiveHook(name, dir, instance) {
4709
- const mappedName = legacyDirectiveHookMap[name];
4710
- if (mappedName) {
4711
- if (isArray(mappedName)) {
4712
- const hook = [];
4713
- mappedName.forEach((mapped) => {
4714
- const mappedHook = dir[mapped];
4715
- if (mappedHook) {
4716
- softAssertCompatEnabled(
4717
- "CUSTOM_DIR",
4718
- instance,
4719
- mapped,
4720
- name
4721
- );
4722
- hook.push(mappedHook);
4723
- }
4724
- });
4725
- return hook.length ? hook : void 0;
4726
- } else {
4727
- if (dir[mappedName]) {
4728
- softAssertCompatEnabled(
4729
- "CUSTOM_DIR",
4730
- instance,
4731
- mappedName,
4732
- name
4733
- );
4734
- }
4735
- return dir[mappedName];
4736
- }
4737
- }
4738
- }
4739
-
4740
- function validateDirectiveName(name) {
4741
- if (isBuiltInDirective(name)) {
4742
- warn("Do not use built-in directive ids as custom directive id: " + name);
4743
- }
4744
- }
4745
- function withDirectives(vnode, directives) {
4746
- const internalInstance = currentRenderingInstance;
4747
- if (internalInstance === null) {
4748
- warn(`withDirectives can only be used inside render functions.`);
4749
- return vnode;
4750
- }
4751
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4752
- const bindings = vnode.dirs || (vnode.dirs = []);
4753
- for (let i = 0; i < directives.length; i++) {
4754
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4755
- if (dir) {
4756
- if (isFunction(dir)) {
4757
- dir = {
4758
- mounted: dir,
4759
- updated: dir
4760
- };
4761
- }
4762
- if (dir.deep) {
4763
- traverse(value);
4764
- }
4765
- bindings.push({
4766
- dir,
4767
- instance,
4768
- value,
4769
- oldValue: void 0,
4770
- arg,
4771
- modifiers
4772
- });
4773
- }
4774
- }
4775
- return vnode;
4776
- }
4777
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4778
- const bindings = vnode.dirs;
4779
- const oldBindings = prevVNode && prevVNode.dirs;
4780
- for (let i = 0; i < bindings.length; i++) {
4781
- const binding = bindings[i];
4782
- if (oldBindings) {
4783
- binding.oldValue = oldBindings[i].value;
4784
- }
4785
- let hook = binding.dir[name];
4786
- if (!hook) {
4787
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4788
- }
4789
- if (hook) {
4790
- pauseTracking();
4791
- callWithAsyncErrorHandling(hook, instance, 8, [
4792
- vnode.el,
4793
- binding,
4794
- vnode,
4795
- prevVNode
4796
- ]);
4797
- resetTracking();
4798
- }
4799
- }
4800
- }
4801
-
4802
4772
  const COMPONENTS = "components";
4803
4773
  const DIRECTIVES = "directives";
4804
4774
  const FILTERS = "filters";
@@ -6139,1179 +6109,1218 @@ function mergeWatchOptions(to, from) {
6139
6109
  return merged;
6140
6110
  }
6141
6111
 
6142
- function createPropsDefaultThis(instance, rawProps, propKey) {
6143
- return new Proxy(
6144
- {},
6145
- {
6146
- get(_, key) {
6147
- warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6148
- if (key === "$options") {
6149
- return resolveMergedOptions(instance);
6150
- }
6151
- if (key in rawProps) {
6152
- return rawProps[key];
6153
- }
6154
- const injections = instance.type.inject;
6155
- if (injections) {
6156
- if (isArray(injections)) {
6157
- if (injections.includes(key)) {
6158
- return inject(key);
6159
- }
6160
- } else if (key in injections) {
6161
- return inject(key);
6162
- }
6112
+ function installLegacyConfigWarnings(config) {
6113
+ const legacyConfigOptions = {
6114
+ silent: "CONFIG_SILENT",
6115
+ devtools: "CONFIG_DEVTOOLS",
6116
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6117
+ keyCodes: "CONFIG_KEY_CODES",
6118
+ productionTip: "CONFIG_PRODUCTION_TIP"
6119
+ };
6120
+ Object.keys(legacyConfigOptions).forEach((key) => {
6121
+ let val = config[key];
6122
+ Object.defineProperty(config, key, {
6123
+ enumerable: true,
6124
+ get() {
6125
+ return val;
6126
+ },
6127
+ set(newVal) {
6128
+ if (!isCopyingConfig) {
6129
+ warnDeprecation$1(legacyConfigOptions[key], null);
6163
6130
  }
6131
+ val = newVal;
6164
6132
  }
6165
- }
6166
- );
6133
+ });
6134
+ });
6167
6135
  }
6168
-
6169
- function shouldSkipAttr(key, instance) {
6170
- if (key === "is") {
6171
- return true;
6172
- }
6173
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6174
- return true;
6175
- }
6176
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6177
- return true;
6178
- }
6179
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6180
- return true;
6181
- }
6182
- return false;
6136
+ function installLegacyOptionMergeStrats(config) {
6137
+ config.optionMergeStrategies = new Proxy({}, {
6138
+ get(target, key) {
6139
+ if (key in target) {
6140
+ return target[key];
6141
+ }
6142
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6143
+ "CONFIG_OPTION_MERGE_STRATS",
6144
+ null
6145
+ )) {
6146
+ return internalOptionMergeStrats[key];
6147
+ }
6148
+ }
6149
+ });
6183
6150
  }
6184
6151
 
6185
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6186
- const props = {};
6187
- const attrs = {};
6188
- def(attrs, InternalObjectKey, 1);
6189
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6190
- setFullProps(instance, rawProps, props, attrs);
6191
- for (const key in instance.propsOptions[0]) {
6192
- if (!(key in props)) {
6193
- props[key] = void 0;
6152
+ let isCopyingConfig = false;
6153
+ let singletonApp;
6154
+ let singletonCtor;
6155
+ function createCompatVue$1(createApp, createSingletonApp) {
6156
+ singletonApp = createSingletonApp({});
6157
+ const Vue = singletonCtor = function Vue2(options = {}) {
6158
+ return createCompatApp(options, Vue2);
6159
+ };
6160
+ function createCompatApp(options = {}, Ctor) {
6161
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6162
+ const { data } = options;
6163
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6164
+ options.data = () => data;
6194
6165
  }
6195
- }
6196
- {
6197
- validateProps(rawProps || {}, props, instance);
6198
- }
6199
- if (isStateful) {
6200
- instance.props = isSSR ? props : shallowReactive(props);
6201
- } else {
6202
- if (!instance.type.props) {
6203
- instance.props = attrs;
6166
+ const app = createApp(options);
6167
+ if (Ctor !== Vue) {
6168
+ applySingletonPrototype(app, Ctor);
6169
+ }
6170
+ const vm = app._createRoot(options);
6171
+ if (options.el) {
6172
+ return vm.$mount(options.el);
6204
6173
  } else {
6205
- instance.props = props;
6174
+ return vm;
6206
6175
  }
6207
6176
  }
6208
- instance.attrs = attrs;
6209
- }
6210
- function isInHmrContext(instance) {
6211
- while (instance) {
6212
- if (instance.type.__hmrId)
6213
- return true;
6214
- instance = instance.parent;
6215
- }
6216
- }
6217
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6218
- const {
6219
- props,
6220
- attrs,
6221
- vnode: { patchFlag }
6222
- } = instance;
6223
- const rawCurrentProps = toRaw(props);
6224
- const [options] = instance.propsOptions;
6225
- let hasAttrsChanged = false;
6226
- if (
6227
- // always force full diff in dev
6228
- // - #1942 if hmr is enabled with sfc component
6229
- // - vite#872 non-sfc component used by sfc component
6230
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6231
- ) {
6232
- if (patchFlag & 8) {
6233
- const propsToUpdate = instance.vnode.dynamicProps;
6234
- for (let i = 0; i < propsToUpdate.length; i++) {
6235
- let key = propsToUpdate[i];
6236
- if (isEmitListener(instance.emitsOptions, key)) {
6237
- continue;
6238
- }
6239
- const value = rawProps[key];
6240
- if (options) {
6241
- if (hasOwn(attrs, key)) {
6242
- if (value !== attrs[key]) {
6243
- attrs[key] = value;
6244
- hasAttrsChanged = true;
6245
- }
6246
- } else {
6247
- const camelizedKey = camelize(key);
6248
- props[camelizedKey] = resolvePropValue(
6249
- options,
6250
- rawCurrentProps,
6251
- camelizedKey,
6252
- value,
6253
- instance,
6254
- false
6255
- /* isAbsent */
6256
- );
6257
- }
6258
- } else {
6259
- {
6260
- if (isOn(key) && key.endsWith("Native")) {
6261
- key = key.slice(0, -6);
6262
- } else if (shouldSkipAttr(key, instance)) {
6263
- continue;
6264
- }
6265
- }
6266
- if (value !== attrs[key]) {
6267
- attrs[key] = value;
6268
- hasAttrsChanged = true;
6269
- }
6270
- }
6271
- }
6177
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.9"}`;
6178
+ Vue.config = singletonApp.config;
6179
+ Vue.use = (p, ...options) => {
6180
+ if (p && isFunction(p.install)) {
6181
+ p.install(Vue, ...options);
6182
+ } else if (isFunction(p)) {
6183
+ p(Vue, ...options);
6272
6184
  }
6273
- } else {
6274
- if (setFullProps(instance, rawProps, props, attrs)) {
6275
- hasAttrsChanged = true;
6185
+ return Vue;
6186
+ };
6187
+ Vue.mixin = (m) => {
6188
+ singletonApp.mixin(m);
6189
+ return Vue;
6190
+ };
6191
+ Vue.component = (name, comp) => {
6192
+ if (comp) {
6193
+ singletonApp.component(name, comp);
6194
+ return Vue;
6195
+ } else {
6196
+ return singletonApp.component(name);
6276
6197
  }
6277
- let kebabKey;
6278
- for (const key in rawCurrentProps) {
6279
- if (!rawProps || // for camelCase
6280
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6281
- // and converted to camelCase (#955)
6282
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6283
- if (options) {
6284
- if (rawPrevProps && // for camelCase
6285
- (rawPrevProps[key] !== void 0 || // for kebab-case
6286
- rawPrevProps[kebabKey] !== void 0)) {
6287
- props[key] = resolvePropValue(
6288
- options,
6289
- rawCurrentProps,
6290
- key,
6291
- void 0,
6292
- instance,
6293
- true
6294
- /* isAbsent */
6295
- );
6296
- }
6297
- } else {
6298
- delete props[key];
6299
- }
6300
- }
6198
+ };
6199
+ Vue.directive = (name, dir) => {
6200
+ if (dir) {
6201
+ singletonApp.directive(name, dir);
6202
+ return Vue;
6203
+ } else {
6204
+ return singletonApp.directive(name);
6301
6205
  }
6302
- if (attrs !== rawCurrentProps) {
6303
- for (const key in attrs) {
6304
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6305
- delete attrs[key];
6306
- hasAttrsChanged = true;
6307
- }
6206
+ };
6207
+ Vue.options = { _base: Vue };
6208
+ let cid = 1;
6209
+ Vue.cid = cid;
6210
+ Vue.nextTick = nextTick;
6211
+ const extendCache = /* @__PURE__ */ new WeakMap();
6212
+ function extendCtor(extendOptions = {}) {
6213
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6214
+ if (isFunction(extendOptions)) {
6215
+ extendOptions = extendOptions.options;
6216
+ }
6217
+ if (extendCache.has(extendOptions)) {
6218
+ return extendCache.get(extendOptions);
6219
+ }
6220
+ const Super = this;
6221
+ function SubVue(inlineOptions) {
6222
+ if (!inlineOptions) {
6223
+ return createCompatApp(SubVue.options, SubVue);
6224
+ } else {
6225
+ return createCompatApp(
6226
+ mergeOptions(
6227
+ extend({}, SubVue.options),
6228
+ inlineOptions,
6229
+ internalOptionMergeStrats
6230
+ ),
6231
+ SubVue
6232
+ );
6308
6233
  }
6309
6234
  }
6235
+ SubVue.super = Super;
6236
+ SubVue.prototype = Object.create(Vue.prototype);
6237
+ SubVue.prototype.constructor = SubVue;
6238
+ const mergeBase = {};
6239
+ for (const key in Super.options) {
6240
+ const superValue = Super.options[key];
6241
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6242
+ }
6243
+ SubVue.options = mergeOptions(
6244
+ mergeBase,
6245
+ extendOptions,
6246
+ internalOptionMergeStrats
6247
+ );
6248
+ SubVue.options._base = SubVue;
6249
+ SubVue.extend = extendCtor.bind(SubVue);
6250
+ SubVue.mixin = Super.mixin;
6251
+ SubVue.use = Super.use;
6252
+ SubVue.cid = ++cid;
6253
+ extendCache.set(extendOptions, SubVue);
6254
+ return SubVue;
6310
6255
  }
6311
- if (hasAttrsChanged) {
6312
- trigger(instance, "set", "$attrs");
6313
- }
6314
- {
6315
- validateProps(rawProps || {}, props, instance);
6316
- }
6317
- }
6318
- function setFullProps(instance, rawProps, props, attrs) {
6319
- const [options, needCastKeys] = instance.propsOptions;
6320
- let hasAttrsChanged = false;
6321
- let rawCastValues;
6322
- if (rawProps) {
6323
- for (let key in rawProps) {
6324
- if (isReservedProp(key)) {
6325
- continue;
6326
- }
6327
- {
6328
- if (key.startsWith("onHook:")) {
6329
- softAssertCompatEnabled(
6330
- "INSTANCE_EVENT_HOOKS",
6331
- instance,
6332
- key.slice(2).toLowerCase()
6333
- );
6334
- }
6335
- if (key === "inline-template") {
6336
- continue;
6337
- }
6338
- }
6339
- const value = rawProps[key];
6340
- let camelKey;
6341
- if (options && hasOwn(options, camelKey = camelize(key))) {
6342
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6343
- props[camelKey] = value;
6344
- } else {
6345
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6346
- }
6347
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6348
- {
6349
- if (isOn(key) && key.endsWith("Native")) {
6350
- key = key.slice(0, -6);
6351
- } else if (shouldSkipAttr(key, instance)) {
6352
- continue;
6353
- }
6354
- }
6355
- if (!(key in attrs) || value !== attrs[key]) {
6356
- attrs[key] = value;
6357
- hasAttrsChanged = true;
6358
- }
6359
- }
6256
+ Vue.extend = extendCtor.bind(Vue);
6257
+ Vue.set = (target, key, value) => {
6258
+ assertCompatEnabled("GLOBAL_SET", null);
6259
+ target[key] = value;
6260
+ };
6261
+ Vue.delete = (target, key) => {
6262
+ assertCompatEnabled("GLOBAL_DELETE", null);
6263
+ delete target[key];
6264
+ };
6265
+ Vue.observable = (target) => {
6266
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6267
+ return reactive(target);
6268
+ };
6269
+ Vue.filter = (name, filter) => {
6270
+ if (filter) {
6271
+ singletonApp.filter(name, filter);
6272
+ return Vue;
6273
+ } else {
6274
+ return singletonApp.filter(name);
6360
6275
  }
6361
- }
6362
- if (needCastKeys) {
6363
- const rawCurrentProps = toRaw(props);
6364
- const castValues = rawCastValues || EMPTY_OBJ;
6365
- for (let i = 0; i < needCastKeys.length; i++) {
6366
- const key = needCastKeys[i];
6367
- props[key] = resolvePropValue(
6368
- options,
6369
- rawCurrentProps,
6370
- key,
6371
- castValues[key],
6372
- instance,
6373
- !hasOwn(castValues, key)
6374
- );
6276
+ };
6277
+ const util = {
6278
+ warn: warn ,
6279
+ extend,
6280
+ mergeOptions: (parent, child, vm) => mergeOptions(
6281
+ parent,
6282
+ child,
6283
+ vm ? void 0 : internalOptionMergeStrats
6284
+ ),
6285
+ defineReactive
6286
+ };
6287
+ Object.defineProperty(Vue, "util", {
6288
+ get() {
6289
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6290
+ return util;
6375
6291
  }
6292
+ });
6293
+ Vue.configureCompat = configureCompat;
6294
+ return Vue;
6295
+ }
6296
+ function installAppCompatProperties(app, context, render) {
6297
+ installFilterMethod(app, context);
6298
+ installLegacyOptionMergeStrats(app.config);
6299
+ if (!singletonApp) {
6300
+ return;
6376
6301
  }
6377
- return hasAttrsChanged;
6302
+ installCompatMount(app, context, render);
6303
+ installLegacyAPIs(app);
6304
+ applySingletonAppMutations(app);
6305
+ installLegacyConfigWarnings(app.config);
6378
6306
  }
6379
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6380
- const opt = options[key];
6381
- if (opt != null) {
6382
- const hasDefault = hasOwn(opt, "default");
6383
- if (hasDefault && value === void 0) {
6384
- const defaultValue = opt.default;
6385
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6386
- const { propsDefaults } = instance;
6387
- if (key in propsDefaults) {
6388
- value = propsDefaults[key];
6389
- } else {
6390
- setCurrentInstance(instance);
6391
- value = propsDefaults[key] = defaultValue.call(
6392
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6393
- props
6394
- );
6395
- unsetCurrentInstance();
6396
- }
6397
- } else {
6398
- value = defaultValue;
6399
- }
6307
+ function installFilterMethod(app, context) {
6308
+ context.filters = {};
6309
+ app.filter = (name, filter) => {
6310
+ assertCompatEnabled("FILTERS", null);
6311
+ if (!filter) {
6312
+ return context.filters[name];
6400
6313
  }
6401
- if (opt[0 /* shouldCast */]) {
6402
- if (isAbsent && !hasDefault) {
6403
- value = false;
6404
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6405
- value = true;
6406
- }
6314
+ if (context.filters[name]) {
6315
+ warn(`Filter "${name}" has already been registered.`);
6407
6316
  }
6408
- }
6409
- return value;
6317
+ context.filters[name] = filter;
6318
+ return app;
6319
+ };
6410
6320
  }
6411
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6412
- const cache = appContext.propsCache;
6413
- const cached = cache.get(comp);
6414
- if (cached) {
6415
- return cached;
6416
- }
6417
- const raw = comp.props;
6418
- const normalized = {};
6419
- const needCastKeys = [];
6420
- let hasExtends = false;
6421
- if (!isFunction(comp)) {
6422
- const extendProps = (raw2) => {
6423
- if (isFunction(raw2)) {
6424
- raw2 = raw2.options;
6321
+ function installLegacyAPIs(app) {
6322
+ Object.defineProperties(app, {
6323
+ // so that app.use() can work with legacy plugins that extend prototypes
6324
+ prototype: {
6325
+ get() {
6326
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6327
+ return app.config.globalProperties;
6328
+ }
6329
+ },
6330
+ nextTick: { value: nextTick },
6331
+ extend: { value: singletonCtor.extend },
6332
+ set: { value: singletonCtor.set },
6333
+ delete: { value: singletonCtor.delete },
6334
+ observable: { value: singletonCtor.observable },
6335
+ util: {
6336
+ get() {
6337
+ return singletonCtor.util;
6425
6338
  }
6426
- hasExtends = true;
6427
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6428
- extend(normalized, props);
6429
- if (keys)
6430
- needCastKeys.push(...keys);
6431
- };
6432
- if (!asMixin && appContext.mixins.length) {
6433
- appContext.mixins.forEach(extendProps);
6434
6339
  }
6435
- if (comp.extends) {
6436
- extendProps(comp.extends);
6340
+ });
6341
+ }
6342
+ function applySingletonAppMutations(app) {
6343
+ app._context.mixins = [...singletonApp._context.mixins];
6344
+ ["components", "directives", "filters"].forEach((key) => {
6345
+ app._context[key] = Object.create(singletonApp._context[key]);
6346
+ });
6347
+ isCopyingConfig = true;
6348
+ for (const key in singletonApp.config) {
6349
+ if (key === "isNativeTag")
6350
+ continue;
6351
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6352
+ continue;
6437
6353
  }
6438
- if (comp.mixins) {
6439
- comp.mixins.forEach(extendProps);
6354
+ const val = singletonApp.config[key];
6355
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6356
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6357
+ app.config.compilerOptions.isCustomElement = (tag) => {
6358
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6359
+ };
6440
6360
  }
6441
6361
  }
6442
- if (!raw && !hasExtends) {
6443
- if (isObject(comp)) {
6444
- cache.set(comp, EMPTY_ARR);
6445
- }
6446
- return EMPTY_ARR;
6362
+ isCopyingConfig = false;
6363
+ applySingletonPrototype(app, singletonCtor);
6364
+ }
6365
+ function applySingletonPrototype(app, Ctor) {
6366
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6367
+ if (enabled) {
6368
+ app.config.globalProperties = Object.create(Ctor.prototype);
6447
6369
  }
6448
- if (isArray(raw)) {
6449
- for (let i = 0; i < raw.length; i++) {
6450
- if (!isString(raw[i])) {
6451
- warn(`props must be strings when using array syntax.`, raw[i]);
6452
- }
6453
- const normalizedKey = camelize(raw[i]);
6454
- if (validatePropName(normalizedKey)) {
6455
- normalized[normalizedKey] = EMPTY_OBJ;
6456
- }
6457
- }
6458
- } else if (raw) {
6459
- if (!isObject(raw)) {
6460
- warn(`invalid props options`, raw);
6461
- }
6462
- for (const key in raw) {
6463
- const normalizedKey = camelize(key);
6464
- if (validatePropName(normalizedKey)) {
6465
- const opt = raw[key];
6466
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6467
- if (prop) {
6468
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6469
- const stringIndex = getTypeIndex(String, prop.type);
6470
- prop[0 /* shouldCast */] = booleanIndex > -1;
6471
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6472
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6473
- needCastKeys.push(normalizedKey);
6474
- }
6475
- }
6370
+ let hasPrototypeAugmentations = false;
6371
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6372
+ for (const key in descriptors) {
6373
+ if (key !== "constructor") {
6374
+ hasPrototypeAugmentations = true;
6375
+ if (enabled) {
6376
+ Object.defineProperty(
6377
+ app.config.globalProperties,
6378
+ key,
6379
+ descriptors[key]
6380
+ );
6476
6381
  }
6477
6382
  }
6478
6383
  }
6479
- const res = [normalized, needCastKeys];
6480
- if (isObject(comp)) {
6481
- cache.set(comp, res);
6482
- }
6483
- return res;
6384
+ if (hasPrototypeAugmentations) {
6385
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6386
+ }
6484
6387
  }
6485
- function validatePropName(key) {
6486
- if (key[0] !== "$") {
6487
- return true;
6388
+ function installCompatMount(app, context, render) {
6389
+ let isMounted = false;
6390
+ app._createRoot = (options) => {
6391
+ const component = app._component;
6392
+ const vnode = createVNode(component, options.propsData || null);
6393
+ vnode.appContext = context;
6394
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6395
+ const emptyRender = () => {
6396
+ };
6397
+ const instance = createComponentInstance(vnode, null, null);
6398
+ if (hasNoRender) {
6399
+ instance.render = emptyRender;
6400
+ }
6401
+ setupComponent(instance);
6402
+ vnode.component = instance;
6403
+ vnode.isCompatRoot = true;
6404
+ instance.ctx._compat_mount = (selectorOrEl) => {
6405
+ if (isMounted) {
6406
+ warn(`Root instance is already mounted.`);
6407
+ return;
6408
+ }
6409
+ let container;
6410
+ if (typeof selectorOrEl === "string") {
6411
+ const result = document.querySelector(selectorOrEl);
6412
+ if (!result) {
6413
+ warn(
6414
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6415
+ );
6416
+ return;
6417
+ }
6418
+ container = result;
6419
+ } else {
6420
+ container = selectorOrEl || document.createElement("div");
6421
+ }
6422
+ const isSVG = container instanceof SVGElement;
6423
+ {
6424
+ context.reload = () => {
6425
+ const cloned = cloneVNode(vnode);
6426
+ cloned.component = null;
6427
+ render(cloned, container, isSVG);
6428
+ };
6429
+ }
6430
+ if (hasNoRender && instance.render === emptyRender) {
6431
+ {
6432
+ for (let i = 0; i < container.attributes.length; i++) {
6433
+ const attr = container.attributes[i];
6434
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6435
+ warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6436
+ break;
6437
+ }
6438
+ }
6439
+ }
6440
+ instance.render = null;
6441
+ component.template = container.innerHTML;
6442
+ finishComponentSetup(
6443
+ instance,
6444
+ false,
6445
+ true
6446
+ /* skip options */
6447
+ );
6448
+ }
6449
+ container.innerHTML = "";
6450
+ render(vnode, container, isSVG);
6451
+ if (container instanceof Element) {
6452
+ container.removeAttribute("v-cloak");
6453
+ container.setAttribute("data-v-app", "");
6454
+ }
6455
+ isMounted = true;
6456
+ app._container = container;
6457
+ container.__vue_app__ = app;
6458
+ {
6459
+ devtoolsInitApp(app, version);
6460
+ }
6461
+ return instance.proxy;
6462
+ };
6463
+ instance.ctx._compat_destroy = () => {
6464
+ if (isMounted) {
6465
+ render(null, app._container);
6466
+ {
6467
+ devtoolsUnmountApp(app);
6468
+ }
6469
+ delete app._container.__vue_app__;
6470
+ } else {
6471
+ const { bum, scope, um } = instance;
6472
+ if (bum) {
6473
+ invokeArrayFns(bum);
6474
+ }
6475
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6476
+ instance.emit("hook:beforeDestroy");
6477
+ }
6478
+ if (scope) {
6479
+ scope.stop();
6480
+ }
6481
+ if (um) {
6482
+ invokeArrayFns(um);
6483
+ }
6484
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6485
+ instance.emit("hook:destroyed");
6486
+ }
6487
+ }
6488
+ };
6489
+ return instance.proxy;
6490
+ };
6491
+ }
6492
+ const methodsToPatch = [
6493
+ "push",
6494
+ "pop",
6495
+ "shift",
6496
+ "unshift",
6497
+ "splice",
6498
+ "sort",
6499
+ "reverse"
6500
+ ];
6501
+ const patched = /* @__PURE__ */ new WeakSet();
6502
+ function defineReactive(obj, key, val) {
6503
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6504
+ const reactiveVal = reactive(val);
6505
+ if (isArray(val)) {
6506
+ methodsToPatch.forEach((m) => {
6507
+ val[m] = (...args) => {
6508
+ Array.prototype[m].call(reactiveVal, ...args);
6509
+ };
6510
+ });
6511
+ } else {
6512
+ Object.keys(val).forEach((key2) => {
6513
+ try {
6514
+ defineReactiveSimple(val, key2, val[key2]);
6515
+ } catch (e) {
6516
+ }
6517
+ });
6518
+ }
6519
+ }
6520
+ const i = obj.$;
6521
+ if (i && obj === i.proxy) {
6522
+ defineReactiveSimple(i.ctx, key, val);
6523
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6524
+ } else if (isReactive(obj)) {
6525
+ obj[key] = val;
6488
6526
  } else {
6489
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6527
+ defineReactiveSimple(obj, key, val);
6490
6528
  }
6491
- return false;
6492
- }
6493
- function getType(ctor) {
6494
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6495
- return match ? match[2] : ctor === null ? "null" : "";
6496
6529
  }
6497
- function isSameType(a, b) {
6498
- return getType(a) === getType(b);
6530
+ function defineReactiveSimple(obj, key, val) {
6531
+ val = isObject(val) ? reactive(val) : val;
6532
+ Object.defineProperty(obj, key, {
6533
+ enumerable: true,
6534
+ configurable: true,
6535
+ get() {
6536
+ track(obj, "get", key);
6537
+ return val;
6538
+ },
6539
+ set(newVal) {
6540
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6541
+ trigger(obj, "set", key, newVal);
6542
+ }
6543
+ });
6499
6544
  }
6500
- function getTypeIndex(type, expectedTypes) {
6501
- if (isArray(expectedTypes)) {
6502
- return expectedTypes.findIndex((t) => isSameType(t, type));
6503
- } else if (isFunction(expectedTypes)) {
6504
- return isSameType(expectedTypes, type) ? 0 : -1;
6505
- }
6506
- return -1;
6545
+
6546
+ function createAppContext() {
6547
+ return {
6548
+ app: null,
6549
+ config: {
6550
+ isNativeTag: NO,
6551
+ performance: false,
6552
+ globalProperties: {},
6553
+ optionMergeStrategies: {},
6554
+ errorHandler: void 0,
6555
+ warnHandler: void 0,
6556
+ compilerOptions: {}
6557
+ },
6558
+ mixins: [],
6559
+ components: {},
6560
+ directives: {},
6561
+ provides: /* @__PURE__ */ Object.create(null),
6562
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6563
+ propsCache: /* @__PURE__ */ new WeakMap(),
6564
+ emitsCache: /* @__PURE__ */ new WeakMap()
6565
+ };
6507
6566
  }
6508
- function validateProps(rawProps, props, instance) {
6509
- const resolvedValues = toRaw(props);
6510
- const options = instance.propsOptions[0];
6511
- for (const key in options) {
6512
- let opt = options[key];
6513
- if (opt == null)
6514
- continue;
6515
- validateProp(
6516
- key,
6517
- resolvedValues[key],
6518
- opt,
6519
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6520
- );
6521
- }
6567
+ let uid$1 = 0;
6568
+ function createAppAPI(render, hydrate) {
6569
+ return function createApp(rootComponent, rootProps = null) {
6570
+ if (!isFunction(rootComponent)) {
6571
+ rootComponent = extend({}, rootComponent);
6572
+ }
6573
+ if (rootProps != null && !isObject(rootProps)) {
6574
+ warn(`root props passed to app.mount() must be an object.`);
6575
+ rootProps = null;
6576
+ }
6577
+ const context = createAppContext();
6578
+ const installedPlugins = /* @__PURE__ */ new Set();
6579
+ let isMounted = false;
6580
+ const app = context.app = {
6581
+ _uid: uid$1++,
6582
+ _component: rootComponent,
6583
+ _props: rootProps,
6584
+ _container: null,
6585
+ _context: context,
6586
+ _instance: null,
6587
+ version,
6588
+ get config() {
6589
+ return context.config;
6590
+ },
6591
+ set config(v) {
6592
+ {
6593
+ warn(
6594
+ `app.config cannot be replaced. Modify individual options instead.`
6595
+ );
6596
+ }
6597
+ },
6598
+ use(plugin, ...options) {
6599
+ if (installedPlugins.has(plugin)) {
6600
+ warn(`Plugin has already been applied to target app.`);
6601
+ } else if (plugin && isFunction(plugin.install)) {
6602
+ installedPlugins.add(plugin);
6603
+ plugin.install(app, ...options);
6604
+ } else if (isFunction(plugin)) {
6605
+ installedPlugins.add(plugin);
6606
+ plugin(app, ...options);
6607
+ } else {
6608
+ warn(
6609
+ `A plugin must either be a function or an object with an "install" function.`
6610
+ );
6611
+ }
6612
+ return app;
6613
+ },
6614
+ mixin(mixin) {
6615
+ {
6616
+ if (!context.mixins.includes(mixin)) {
6617
+ context.mixins.push(mixin);
6618
+ } else {
6619
+ warn(
6620
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6621
+ );
6622
+ }
6623
+ }
6624
+ return app;
6625
+ },
6626
+ component(name, component) {
6627
+ {
6628
+ validateComponentName(name, context.config);
6629
+ }
6630
+ if (!component) {
6631
+ return context.components[name];
6632
+ }
6633
+ if (context.components[name]) {
6634
+ warn(`Component "${name}" has already been registered in target app.`);
6635
+ }
6636
+ context.components[name] = component;
6637
+ return app;
6638
+ },
6639
+ directive(name, directive) {
6640
+ {
6641
+ validateDirectiveName(name);
6642
+ }
6643
+ if (!directive) {
6644
+ return context.directives[name];
6645
+ }
6646
+ if (context.directives[name]) {
6647
+ warn(`Directive "${name}" has already been registered in target app.`);
6648
+ }
6649
+ context.directives[name] = directive;
6650
+ return app;
6651
+ },
6652
+ mount(rootContainer, isHydrate, isSVG) {
6653
+ if (!isMounted) {
6654
+ if (rootContainer.__vue_app__) {
6655
+ warn(
6656
+ `There is already an app instance mounted on the host container.
6657
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6658
+ );
6659
+ }
6660
+ const vnode = createVNode(
6661
+ rootComponent,
6662
+ rootProps
6663
+ );
6664
+ vnode.appContext = context;
6665
+ {
6666
+ context.reload = () => {
6667
+ render(cloneVNode(vnode), rootContainer, isSVG);
6668
+ };
6669
+ }
6670
+ if (isHydrate && hydrate) {
6671
+ hydrate(vnode, rootContainer);
6672
+ } else {
6673
+ render(vnode, rootContainer, isSVG);
6674
+ }
6675
+ isMounted = true;
6676
+ app._container = rootContainer;
6677
+ rootContainer.__vue_app__ = app;
6678
+ {
6679
+ app._instance = vnode.component;
6680
+ devtoolsInitApp(app, version);
6681
+ }
6682
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6683
+ } else {
6684
+ warn(
6685
+ `App has already been mounted.
6686
+ 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)\``
6687
+ );
6688
+ }
6689
+ },
6690
+ unmount() {
6691
+ if (isMounted) {
6692
+ render(null, app._container);
6693
+ {
6694
+ app._instance = null;
6695
+ devtoolsUnmountApp(app);
6696
+ }
6697
+ delete app._container.__vue_app__;
6698
+ } else {
6699
+ warn(`Cannot unmount an app that is not mounted.`);
6700
+ }
6701
+ },
6702
+ provide(key, value) {
6703
+ if (key in context.provides) {
6704
+ warn(
6705
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6706
+ );
6707
+ }
6708
+ context.provides[key] = value;
6709
+ return app;
6710
+ },
6711
+ runWithContext(fn) {
6712
+ currentApp = app;
6713
+ try {
6714
+ return fn();
6715
+ } finally {
6716
+ currentApp = null;
6717
+ }
6718
+ }
6719
+ };
6720
+ {
6721
+ installAppCompatProperties(app, context, render);
6722
+ }
6723
+ return app;
6724
+ };
6522
6725
  }
6523
- function validateProp(name, value, prop, isAbsent) {
6524
- const { type, required, validator, skipCheck } = prop;
6525
- if (required && isAbsent) {
6526
- warn('Missing required prop: "' + name + '"');
6527
- return;
6528
- }
6529
- if (value == null && !prop.required) {
6530
- return;
6531
- }
6532
- if (type != null && type !== true && !skipCheck) {
6533
- let isValid = false;
6534
- const types = isArray(type) ? type : [type];
6535
- const expectedTypes = [];
6536
- for (let i = 0; i < types.length && !isValid; i++) {
6537
- const { valid, expectedType } = assertType(value, types[i]);
6538
- expectedTypes.push(expectedType || "");
6539
- isValid = valid;
6726
+ let currentApp = null;
6727
+
6728
+ function provide(key, value) {
6729
+ if (!currentInstance) {
6730
+ {
6731
+ warn(`provide() can only be used inside setup().`);
6540
6732
  }
6541
- if (!isValid) {
6542
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6543
- return;
6733
+ } else {
6734
+ let provides = currentInstance.provides;
6735
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6736
+ if (parentProvides === provides) {
6737
+ provides = currentInstance.provides = Object.create(parentProvides);
6544
6738
  }
6545
- }
6546
- if (validator && !validator(value)) {
6547
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6739
+ provides[key] = value;
6548
6740
  }
6549
6741
  }
6550
- const isSimpleType = /* @__PURE__ */ makeMap(
6551
- "String,Number,Boolean,Function,Symbol,BigInt"
6552
- );
6553
- function assertType(value, type) {
6554
- let valid;
6555
- const expectedType = getType(type);
6556
- if (isSimpleType(expectedType)) {
6557
- const t = typeof value;
6558
- valid = t === expectedType.toLowerCase();
6559
- if (!valid && t === "object") {
6560
- valid = value instanceof type;
6742
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6743
+ const instance = currentInstance || currentRenderingInstance;
6744
+ if (instance || currentApp) {
6745
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6746
+ if (provides && key in provides) {
6747
+ return provides[key];
6748
+ } else if (arguments.length > 1) {
6749
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6750
+ } else {
6751
+ warn(`injection "${String(key)}" not found.`);
6561
6752
  }
6562
- } else if (expectedType === "Object") {
6563
- valid = isObject(value);
6564
- } else if (expectedType === "Array") {
6565
- valid = isArray(value);
6566
- } else if (expectedType === "null") {
6567
- valid = value === null;
6568
6753
  } else {
6569
- valid = value instanceof type;
6754
+ warn(`inject() can only be used inside setup() or functional components.`);
6570
6755
  }
6571
- return {
6572
- valid,
6573
- expectedType
6574
- };
6575
6756
  }
6576
- function getInvalidTypeMessage(name, value, expectedTypes) {
6577
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6578
- const expectedType = expectedTypes[0];
6579
- const receivedType = toRawType(value);
6580
- const expectedValue = styleValue(value, expectedType);
6581
- const receivedValue = styleValue(value, receivedType);
6582
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6583
- message += ` with value ${expectedValue}`;
6757
+
6758
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6759
+ return new Proxy(
6760
+ {},
6761
+ {
6762
+ get(_, key) {
6763
+ warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6764
+ if (key === "$options") {
6765
+ return resolveMergedOptions(instance);
6766
+ }
6767
+ if (key in rawProps) {
6768
+ return rawProps[key];
6769
+ }
6770
+ const injections = instance.type.inject;
6771
+ if (injections) {
6772
+ if (isArray(injections)) {
6773
+ if (injections.includes(key)) {
6774
+ return inject(key);
6775
+ }
6776
+ } else if (key in injections) {
6777
+ return inject(key);
6778
+ }
6779
+ }
6780
+ }
6781
+ }
6782
+ );
6783
+ }
6784
+
6785
+ function shouldSkipAttr(key, instance) {
6786
+ if (key === "is") {
6787
+ return true;
6584
6788
  }
6585
- message += `, got ${receivedType} `;
6586
- if (isExplicable(receivedType)) {
6587
- message += `with value ${receivedValue}.`;
6789
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6790
+ return true;
6588
6791
  }
6589
- return message;
6590
- }
6591
- function styleValue(value, type) {
6592
- if (type === "String") {
6593
- return `"${value}"`;
6594
- } else if (type === "Number") {
6595
- return `${Number(value)}`;
6596
- } else {
6597
- return `${value}`;
6792
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6793
+ return true;
6598
6794
  }
6599
- }
6600
- function isExplicable(type) {
6601
- const explicitTypes = ["string", "number", "boolean"];
6602
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6603
- }
6604
- function isBoolean(...args) {
6605
- return args.some((elem) => elem.toLowerCase() === "boolean");
6795
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6796
+ return true;
6797
+ }
6798
+ return false;
6606
6799
  }
6607
6800
 
6608
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6609
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6610
- const normalizeSlot = (key, rawSlot, ctx) => {
6611
- if (rawSlot._n) {
6612
- return rawSlot;
6613
- }
6614
- const normalized = withCtx((...args) => {
6615
- if (currentInstance) {
6616
- warn(
6617
- `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.`
6618
- );
6619
- }
6620
- return normalizeSlotValue(rawSlot(...args));
6621
- }, ctx);
6622
- normalized._c = false;
6623
- return normalized;
6624
- };
6625
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6626
- const ctx = rawSlots._ctx;
6627
- for (const key in rawSlots) {
6628
- if (isInternalKey(key))
6629
- continue;
6630
- const value = rawSlots[key];
6631
- if (isFunction(value)) {
6632
- slots[key] = normalizeSlot(key, value, ctx);
6633
- } else if (value != null) {
6634
- if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6635
- warn(
6636
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6637
- );
6638
- }
6639
- const normalized = normalizeSlotValue(value);
6640
- slots[key] = () => normalized;
6801
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6802
+ const props = {};
6803
+ const attrs = {};
6804
+ def(attrs, InternalObjectKey, 1);
6805
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6806
+ setFullProps(instance, rawProps, props, attrs);
6807
+ for (const key in instance.propsOptions[0]) {
6808
+ if (!(key in props)) {
6809
+ props[key] = void 0;
6641
6810
  }
6642
6811
  }
6643
- };
6644
- const normalizeVNodeSlots = (instance, children) => {
6645
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6646
- warn(
6647
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6648
- );
6812
+ {
6813
+ validateProps(rawProps || {}, props, instance);
6649
6814
  }
6650
- const normalized = normalizeSlotValue(children);
6651
- instance.slots.default = () => normalized;
6652
- };
6653
- const initSlots = (instance, children) => {
6654
- if (instance.vnode.shapeFlag & 32) {
6655
- const type = children._;
6656
- if (type) {
6657
- instance.slots = toRaw(children);
6658
- def(children, "_", type);
6815
+ if (isStateful) {
6816
+ instance.props = isSSR ? props : shallowReactive(props);
6817
+ } else {
6818
+ if (!instance.type.props) {
6819
+ instance.props = attrs;
6659
6820
  } else {
6660
- normalizeObjectSlots(
6661
- children,
6662
- instance.slots = {},
6663
- instance
6664
- );
6821
+ instance.props = props;
6822
+ }
6823
+ }
6824
+ instance.attrs = attrs;
6825
+ }
6826
+ function isInHmrContext(instance) {
6827
+ while (instance) {
6828
+ if (instance.type.__hmrId)
6829
+ return true;
6830
+ instance = instance.parent;
6831
+ }
6832
+ }
6833
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6834
+ const {
6835
+ props,
6836
+ attrs,
6837
+ vnode: { patchFlag }
6838
+ } = instance;
6839
+ const rawCurrentProps = toRaw(props);
6840
+ const [options] = instance.propsOptions;
6841
+ let hasAttrsChanged = false;
6842
+ if (
6843
+ // always force full diff in dev
6844
+ // - #1942 if hmr is enabled with sfc component
6845
+ // - vite#872 non-sfc component used by sfc component
6846
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6847
+ ) {
6848
+ if (patchFlag & 8) {
6849
+ const propsToUpdate = instance.vnode.dynamicProps;
6850
+ for (let i = 0; i < propsToUpdate.length; i++) {
6851
+ let key = propsToUpdate[i];
6852
+ if (isEmitListener(instance.emitsOptions, key)) {
6853
+ continue;
6854
+ }
6855
+ const value = rawProps[key];
6856
+ if (options) {
6857
+ if (hasOwn(attrs, key)) {
6858
+ if (value !== attrs[key]) {
6859
+ attrs[key] = value;
6860
+ hasAttrsChanged = true;
6861
+ }
6862
+ } else {
6863
+ const camelizedKey = camelize(key);
6864
+ props[camelizedKey] = resolvePropValue(
6865
+ options,
6866
+ rawCurrentProps,
6867
+ camelizedKey,
6868
+ value,
6869
+ instance,
6870
+ false
6871
+ /* isAbsent */
6872
+ );
6873
+ }
6874
+ } else {
6875
+ {
6876
+ if (isOn(key) && key.endsWith("Native")) {
6877
+ key = key.slice(0, -6);
6878
+ } else if (shouldSkipAttr(key, instance)) {
6879
+ continue;
6880
+ }
6881
+ }
6882
+ if (value !== attrs[key]) {
6883
+ attrs[key] = value;
6884
+ hasAttrsChanged = true;
6885
+ }
6886
+ }
6887
+ }
6665
6888
  }
6666
6889
  } else {
6667
- instance.slots = {};
6668
- if (children) {
6669
- normalizeVNodeSlots(instance, children);
6890
+ if (setFullProps(instance, rawProps, props, attrs)) {
6891
+ hasAttrsChanged = true;
6670
6892
  }
6671
- }
6672
- def(instance.slots, InternalObjectKey, 1);
6673
- };
6674
- const updateSlots = (instance, children, optimized) => {
6675
- const { vnode, slots } = instance;
6676
- let needDeletionCheck = true;
6677
- let deletionComparisonTarget = EMPTY_OBJ;
6678
- if (vnode.shapeFlag & 32) {
6679
- const type = children._;
6680
- if (type) {
6681
- if (isHmrUpdating) {
6682
- extend(slots, children);
6683
- } else if (optimized && type === 1) {
6684
- needDeletionCheck = false;
6685
- } else {
6686
- extend(slots, children);
6687
- if (!optimized && type === 1) {
6688
- delete slots._;
6893
+ let kebabKey;
6894
+ for (const key in rawCurrentProps) {
6895
+ if (!rawProps || // for camelCase
6896
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6897
+ // and converted to camelCase (#955)
6898
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6899
+ if (options) {
6900
+ if (rawPrevProps && // for camelCase
6901
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6902
+ rawPrevProps[kebabKey] !== void 0)) {
6903
+ props[key] = resolvePropValue(
6904
+ options,
6905
+ rawCurrentProps,
6906
+ key,
6907
+ void 0,
6908
+ instance,
6909
+ true
6910
+ /* isAbsent */
6911
+ );
6912
+ }
6913
+ } else {
6914
+ delete props[key];
6689
6915
  }
6690
6916
  }
6691
- } else {
6692
- needDeletionCheck = !children.$stable;
6693
- normalizeObjectSlots(children, slots, instance);
6694
6917
  }
6695
- deletionComparisonTarget = children;
6696
- } else if (children) {
6697
- normalizeVNodeSlots(instance, children);
6698
- deletionComparisonTarget = { default: 1 };
6699
- }
6700
- if (needDeletionCheck) {
6701
- for (const key in slots) {
6702
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6703
- delete slots[key];
6918
+ if (attrs !== rawCurrentProps) {
6919
+ for (const key in attrs) {
6920
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6921
+ delete attrs[key];
6922
+ hasAttrsChanged = true;
6923
+ }
6704
6924
  }
6705
6925
  }
6706
6926
  }
6707
- };
6708
-
6709
- function installLegacyConfigWarnings(config) {
6710
- const legacyConfigOptions = {
6711
- silent: "CONFIG_SILENT",
6712
- devtools: "CONFIG_DEVTOOLS",
6713
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6714
- keyCodes: "CONFIG_KEY_CODES",
6715
- productionTip: "CONFIG_PRODUCTION_TIP"
6716
- };
6717
- Object.keys(legacyConfigOptions).forEach((key) => {
6718
- let val = config[key];
6719
- Object.defineProperty(config, key, {
6720
- enumerable: true,
6721
- get() {
6722
- return val;
6723
- },
6724
- set(newVal) {
6725
- if (!isCopyingConfig) {
6726
- warnDeprecation$1(legacyConfigOptions[key], null);
6727
- }
6728
- val = newVal;
6729
- }
6730
- });
6731
- });
6927
+ if (hasAttrsChanged) {
6928
+ trigger(instance, "set", "$attrs");
6929
+ }
6930
+ {
6931
+ validateProps(rawProps || {}, props, instance);
6932
+ }
6732
6933
  }
6733
- function installLegacyOptionMergeStrats(config) {
6734
- config.optionMergeStrategies = new Proxy({}, {
6735
- get(target, key) {
6736
- if (key in target) {
6737
- return target[key];
6934
+ function setFullProps(instance, rawProps, props, attrs) {
6935
+ const [options, needCastKeys] = instance.propsOptions;
6936
+ let hasAttrsChanged = false;
6937
+ let rawCastValues;
6938
+ if (rawProps) {
6939
+ for (let key in rawProps) {
6940
+ if (isReservedProp(key)) {
6941
+ continue;
6738
6942
  }
6739
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6740
- "CONFIG_OPTION_MERGE_STRATS",
6741
- null
6742
- )) {
6743
- return internalOptionMergeStrats[key];
6943
+ {
6944
+ if (key.startsWith("onHook:")) {
6945
+ softAssertCompatEnabled(
6946
+ "INSTANCE_EVENT_HOOKS",
6947
+ instance,
6948
+ key.slice(2).toLowerCase()
6949
+ );
6950
+ }
6951
+ if (key === "inline-template") {
6952
+ continue;
6953
+ }
6954
+ }
6955
+ const value = rawProps[key];
6956
+ let camelKey;
6957
+ if (options && hasOwn(options, camelKey = camelize(key))) {
6958
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6959
+ props[camelKey] = value;
6960
+ } else {
6961
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6962
+ }
6963
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
6964
+ {
6965
+ if (isOn(key) && key.endsWith("Native")) {
6966
+ key = key.slice(0, -6);
6967
+ } else if (shouldSkipAttr(key, instance)) {
6968
+ continue;
6969
+ }
6970
+ }
6971
+ if (!(key in attrs) || value !== attrs[key]) {
6972
+ attrs[key] = value;
6973
+ hasAttrsChanged = true;
6974
+ }
6744
6975
  }
6745
- }
6746
- });
6747
- }
6748
-
6749
- let isCopyingConfig = false;
6750
- let singletonApp;
6751
- let singletonCtor;
6752
- function createCompatVue$1(createApp, createSingletonApp) {
6753
- singletonApp = createSingletonApp({});
6754
- const Vue = singletonCtor = function Vue2(options = {}) {
6755
- return createCompatApp(options, Vue2);
6756
- };
6757
- function createCompatApp(options = {}, Ctor) {
6758
- assertCompatEnabled("GLOBAL_MOUNT", null);
6759
- const { data } = options;
6760
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6761
- options.data = () => data;
6762
- }
6763
- const app = createApp(options);
6764
- if (Ctor !== Vue) {
6765
- applySingletonPrototype(app, Ctor);
6766
- }
6767
- const vm = app._createRoot(options);
6768
- if (options.el) {
6769
- return vm.$mount(options.el);
6770
- } else {
6771
- return vm;
6772
6976
  }
6773
6977
  }
6774
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6775
- Vue.config = singletonApp.config;
6776
- Vue.use = (p, ...options) => {
6777
- if (p && isFunction(p.install)) {
6778
- p.install(Vue, ...options);
6779
- } else if (isFunction(p)) {
6780
- p(Vue, ...options);
6781
- }
6782
- return Vue;
6783
- };
6784
- Vue.mixin = (m) => {
6785
- singletonApp.mixin(m);
6786
- return Vue;
6787
- };
6788
- Vue.component = (name, comp) => {
6789
- if (comp) {
6790
- singletonApp.component(name, comp);
6791
- return Vue;
6792
- } else {
6793
- return singletonApp.component(name);
6794
- }
6795
- };
6796
- Vue.directive = (name, dir) => {
6797
- if (dir) {
6798
- singletonApp.directive(name, dir);
6799
- return Vue;
6800
- } else {
6801
- return singletonApp.directive(name);
6802
- }
6803
- };
6804
- Vue.options = { _base: Vue };
6805
- let cid = 1;
6806
- Vue.cid = cid;
6807
- Vue.nextTick = nextTick;
6808
- const extendCache = /* @__PURE__ */ new WeakMap();
6809
- function extendCtor(extendOptions = {}) {
6810
- assertCompatEnabled("GLOBAL_EXTEND", null);
6811
- if (isFunction(extendOptions)) {
6812
- extendOptions = extendOptions.options;
6813
- }
6814
- if (extendCache.has(extendOptions)) {
6815
- return extendCache.get(extendOptions);
6978
+ if (needCastKeys) {
6979
+ const rawCurrentProps = toRaw(props);
6980
+ const castValues = rawCastValues || EMPTY_OBJ;
6981
+ for (let i = 0; i < needCastKeys.length; i++) {
6982
+ const key = needCastKeys[i];
6983
+ props[key] = resolvePropValue(
6984
+ options,
6985
+ rawCurrentProps,
6986
+ key,
6987
+ castValues[key],
6988
+ instance,
6989
+ !hasOwn(castValues, key)
6990
+ );
6816
6991
  }
6817
- const Super = this;
6818
- function SubVue(inlineOptions) {
6819
- if (!inlineOptions) {
6820
- return createCompatApp(SubVue.options, SubVue);
6992
+ }
6993
+ return hasAttrsChanged;
6994
+ }
6995
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6996
+ const opt = options[key];
6997
+ if (opt != null) {
6998
+ const hasDefault = hasOwn(opt, "default");
6999
+ if (hasDefault && value === void 0) {
7000
+ const defaultValue = opt.default;
7001
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
7002
+ const { propsDefaults } = instance;
7003
+ if (key in propsDefaults) {
7004
+ value = propsDefaults[key];
7005
+ } else {
7006
+ setCurrentInstance(instance);
7007
+ value = propsDefaults[key] = defaultValue.call(
7008
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7009
+ props
7010
+ );
7011
+ unsetCurrentInstance();
7012
+ }
6821
7013
  } else {
6822
- return createCompatApp(
6823
- mergeOptions(
6824
- extend({}, SubVue.options),
6825
- inlineOptions,
6826
- internalOptionMergeStrats
6827
- ),
6828
- SubVue
6829
- );
7014
+ value = defaultValue;
6830
7015
  }
6831
7016
  }
6832
- SubVue.super = Super;
6833
- SubVue.prototype = Object.create(Vue.prototype);
6834
- SubVue.prototype.constructor = SubVue;
6835
- const mergeBase = {};
6836
- for (const key in Super.options) {
6837
- const superValue = Super.options[key];
6838
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
7017
+ if (opt[0 /* shouldCast */]) {
7018
+ if (isAbsent && !hasDefault) {
7019
+ value = false;
7020
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
7021
+ value = true;
7022
+ }
6839
7023
  }
6840
- SubVue.options = mergeOptions(
6841
- mergeBase,
6842
- extendOptions,
6843
- internalOptionMergeStrats
6844
- );
6845
- SubVue.options._base = SubVue;
6846
- SubVue.extend = extendCtor.bind(SubVue);
6847
- SubVue.mixin = Super.mixin;
6848
- SubVue.use = Super.use;
6849
- SubVue.cid = ++cid;
6850
- extendCache.set(extendOptions, SubVue);
6851
- return SubVue;
6852
7024
  }
6853
- Vue.extend = extendCtor.bind(Vue);
6854
- Vue.set = (target, key, value) => {
6855
- assertCompatEnabled("GLOBAL_SET", null);
6856
- target[key] = value;
6857
- };
6858
- Vue.delete = (target, key) => {
6859
- assertCompatEnabled("GLOBAL_DELETE", null);
6860
- delete target[key];
6861
- };
6862
- Vue.observable = (target) => {
6863
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6864
- return reactive(target);
6865
- };
6866
- Vue.filter = (name, filter) => {
6867
- if (filter) {
6868
- singletonApp.filter(name, filter);
6869
- return Vue;
6870
- } else {
6871
- return singletonApp.filter(name);
6872
- }
6873
- };
6874
- const util = {
6875
- warn: warn ,
6876
- extend,
6877
- mergeOptions: (parent, child, vm) => mergeOptions(
6878
- parent,
6879
- child,
6880
- vm ? void 0 : internalOptionMergeStrats
6881
- ),
6882
- defineReactive
6883
- };
6884
- Object.defineProperty(Vue, "util", {
6885
- get() {
6886
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6887
- return util;
6888
- }
6889
- });
6890
- Vue.configureCompat = configureCompat;
6891
- return Vue;
7025
+ return value;
6892
7026
  }
6893
- function installAppCompatProperties(app, context, render) {
6894
- installFilterMethod(app, context);
6895
- installLegacyOptionMergeStrats(app.config);
6896
- if (!singletonApp) {
6897
- return;
7027
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
7028
+ const cache = appContext.propsCache;
7029
+ const cached = cache.get(comp);
7030
+ if (cached) {
7031
+ return cached;
6898
7032
  }
6899
- installCompatMount(app, context, render);
6900
- installLegacyAPIs(app);
6901
- applySingletonAppMutations(app);
6902
- installLegacyConfigWarnings(app.config);
6903
- }
6904
- function installFilterMethod(app, context) {
6905
- context.filters = {};
6906
- app.filter = (name, filter) => {
6907
- assertCompatEnabled("FILTERS", null);
6908
- if (!filter) {
6909
- return context.filters[name];
7033
+ const raw = comp.props;
7034
+ const normalized = {};
7035
+ const needCastKeys = [];
7036
+ let hasExtends = false;
7037
+ if (!isFunction(comp)) {
7038
+ const extendProps = (raw2) => {
7039
+ if (isFunction(raw2)) {
7040
+ raw2 = raw2.options;
7041
+ }
7042
+ hasExtends = true;
7043
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
7044
+ extend(normalized, props);
7045
+ if (keys)
7046
+ needCastKeys.push(...keys);
7047
+ };
7048
+ if (!asMixin && appContext.mixins.length) {
7049
+ appContext.mixins.forEach(extendProps);
6910
7050
  }
6911
- if (context.filters[name]) {
6912
- warn(`Filter "${name}" has already been registered.`);
7051
+ if (comp.extends) {
7052
+ extendProps(comp.extends);
6913
7053
  }
6914
- context.filters[name] = filter;
6915
- return app;
6916
- };
6917
- }
6918
- function installLegacyAPIs(app) {
6919
- Object.defineProperties(app, {
6920
- // so that app.use() can work with legacy plugins that extend prototypes
6921
- prototype: {
6922
- get() {
6923
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6924
- return app.config.globalProperties;
7054
+ if (comp.mixins) {
7055
+ comp.mixins.forEach(extendProps);
7056
+ }
7057
+ }
7058
+ if (!raw && !hasExtends) {
7059
+ if (isObject(comp)) {
7060
+ cache.set(comp, EMPTY_ARR);
7061
+ }
7062
+ return EMPTY_ARR;
7063
+ }
7064
+ if (isArray(raw)) {
7065
+ for (let i = 0; i < raw.length; i++) {
7066
+ if (!isString(raw[i])) {
7067
+ warn(`props must be strings when using array syntax.`, raw[i]);
6925
7068
  }
6926
- },
6927
- nextTick: { value: nextTick },
6928
- extend: { value: singletonCtor.extend },
6929
- set: { value: singletonCtor.set },
6930
- delete: { value: singletonCtor.delete },
6931
- observable: { value: singletonCtor.observable },
6932
- util: {
6933
- get() {
6934
- return singletonCtor.util;
7069
+ const normalizedKey = camelize(raw[i]);
7070
+ if (validatePropName(normalizedKey)) {
7071
+ normalized[normalizedKey] = EMPTY_OBJ;
6935
7072
  }
6936
7073
  }
6937
- });
6938
- }
6939
- function applySingletonAppMutations(app) {
6940
- app._context.mixins = [...singletonApp._context.mixins];
6941
- ["components", "directives", "filters"].forEach((key) => {
6942
- app._context[key] = Object.create(singletonApp._context[key]);
6943
- });
6944
- isCopyingConfig = true;
6945
- for (const key in singletonApp.config) {
6946
- if (key === "isNativeTag")
6947
- continue;
6948
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6949
- continue;
7074
+ } else if (raw) {
7075
+ if (!isObject(raw)) {
7076
+ warn(`invalid props options`, raw);
6950
7077
  }
6951
- const val = singletonApp.config[key];
6952
- app.config[key] = isObject(val) ? Object.create(val) : val;
6953
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6954
- app.config.compilerOptions.isCustomElement = (tag) => {
6955
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6956
- };
7078
+ for (const key in raw) {
7079
+ const normalizedKey = camelize(key);
7080
+ if (validatePropName(normalizedKey)) {
7081
+ const opt = raw[key];
7082
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
7083
+ if (prop) {
7084
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
7085
+ const stringIndex = getTypeIndex(String, prop.type);
7086
+ prop[0 /* shouldCast */] = booleanIndex > -1;
7087
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
7088
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
7089
+ needCastKeys.push(normalizedKey);
7090
+ }
7091
+ }
7092
+ }
6957
7093
  }
6958
7094
  }
6959
- isCopyingConfig = false;
6960
- applySingletonPrototype(app, singletonCtor);
7095
+ const res = [normalized, needCastKeys];
7096
+ if (isObject(comp)) {
7097
+ cache.set(comp, res);
7098
+ }
7099
+ return res;
6961
7100
  }
6962
- function applySingletonPrototype(app, Ctor) {
6963
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6964
- if (enabled) {
6965
- app.config.globalProperties = Object.create(Ctor.prototype);
7101
+ function validatePropName(key) {
7102
+ if (key[0] !== "$") {
7103
+ return true;
7104
+ } else {
7105
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
6966
7106
  }
6967
- let hasPrototypeAugmentations = false;
6968
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6969
- for (const key in descriptors) {
6970
- if (key !== "constructor") {
6971
- hasPrototypeAugmentations = true;
6972
- if (enabled) {
6973
- Object.defineProperty(
6974
- app.config.globalProperties,
6975
- key,
6976
- descriptors[key]
6977
- );
6978
- }
7107
+ return false;
7108
+ }
7109
+ function getType(ctor) {
7110
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7111
+ return match ? match[2] : ctor === null ? "null" : "";
7112
+ }
7113
+ function isSameType(a, b) {
7114
+ return getType(a) === getType(b);
7115
+ }
7116
+ function getTypeIndex(type, expectedTypes) {
7117
+ if (isArray(expectedTypes)) {
7118
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7119
+ } else if (isFunction(expectedTypes)) {
7120
+ return isSameType(expectedTypes, type) ? 0 : -1;
7121
+ }
7122
+ return -1;
7123
+ }
7124
+ function validateProps(rawProps, props, instance) {
7125
+ const resolvedValues = toRaw(props);
7126
+ const options = instance.propsOptions[0];
7127
+ for (const key in options) {
7128
+ let opt = options[key];
7129
+ if (opt == null)
7130
+ continue;
7131
+ validateProp(
7132
+ key,
7133
+ resolvedValues[key],
7134
+ opt,
7135
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
7136
+ );
7137
+ }
7138
+ }
7139
+ function validateProp(name, value, prop, isAbsent) {
7140
+ const { type, required, validator, skipCheck } = prop;
7141
+ if (required && isAbsent) {
7142
+ warn('Missing required prop: "' + name + '"');
7143
+ return;
7144
+ }
7145
+ if (value == null && !required) {
7146
+ return;
7147
+ }
7148
+ if (type != null && type !== true && !skipCheck) {
7149
+ let isValid = false;
7150
+ const types = isArray(type) ? type : [type];
7151
+ const expectedTypes = [];
7152
+ for (let i = 0; i < types.length && !isValid; i++) {
7153
+ const { valid, expectedType } = assertType(value, types[i]);
7154
+ expectedTypes.push(expectedType || "");
7155
+ isValid = valid;
7156
+ }
7157
+ if (!isValid) {
7158
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7159
+ return;
6979
7160
  }
6980
7161
  }
6981
- if (hasPrototypeAugmentations) {
6982
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
7162
+ if (validator && !validator(value)) {
7163
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6983
7164
  }
6984
7165
  }
6985
- function installCompatMount(app, context, render) {
6986
- let isMounted = false;
6987
- app._createRoot = (options) => {
6988
- const component = app._component;
6989
- const vnode = createVNode(component, options.propsData || null);
6990
- vnode.appContext = context;
6991
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6992
- const emptyRender = () => {
6993
- };
6994
- const instance = createComponentInstance(vnode, null, null);
6995
- if (hasNoRender) {
6996
- instance.render = emptyRender;
7166
+ const isSimpleType = /* @__PURE__ */ makeMap(
7167
+ "String,Number,Boolean,Function,Symbol,BigInt"
7168
+ );
7169
+ function assertType(value, type) {
7170
+ let valid;
7171
+ const expectedType = getType(type);
7172
+ if (isSimpleType(expectedType)) {
7173
+ const t = typeof value;
7174
+ valid = t === expectedType.toLowerCase();
7175
+ if (!valid && t === "object") {
7176
+ valid = value instanceof type;
6997
7177
  }
6998
- setupComponent(instance);
6999
- vnode.component = instance;
7000
- vnode.isCompatRoot = true;
7001
- instance.ctx._compat_mount = (selectorOrEl) => {
7002
- if (isMounted) {
7003
- warn(`Root instance is already mounted.`);
7004
- return;
7005
- }
7006
- let container;
7007
- if (typeof selectorOrEl === "string") {
7008
- const result = document.querySelector(selectorOrEl);
7009
- if (!result) {
7010
- warn(
7011
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
7012
- );
7013
- return;
7014
- }
7015
- container = result;
7016
- } else {
7017
- container = selectorOrEl || document.createElement("div");
7018
- }
7019
- const isSVG = container instanceof SVGElement;
7020
- {
7021
- context.reload = () => {
7022
- const cloned = cloneVNode(vnode);
7023
- cloned.component = null;
7024
- render(cloned, container, isSVG);
7025
- };
7026
- }
7027
- if (hasNoRender && instance.render === emptyRender) {
7028
- {
7029
- for (let i = 0; i < container.attributes.length; i++) {
7030
- const attr = container.attributes[i];
7031
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
7032
- warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
7033
- break;
7034
- }
7035
- }
7036
- }
7037
- instance.render = null;
7038
- component.template = container.innerHTML;
7039
- finishComponentSetup(
7040
- instance,
7041
- false,
7042
- true
7043
- /* skip options */
7044
- );
7045
- }
7046
- container.innerHTML = "";
7047
- render(vnode, container, isSVG);
7048
- if (container instanceof Element) {
7049
- container.removeAttribute("v-cloak");
7050
- container.setAttribute("data-v-app", "");
7051
- }
7052
- isMounted = true;
7053
- app._container = container;
7054
- container.__vue_app__ = app;
7055
- {
7056
- devtoolsInitApp(app, version);
7057
- }
7058
- return instance.proxy;
7059
- };
7060
- instance.ctx._compat_destroy = () => {
7061
- if (isMounted) {
7062
- render(null, app._container);
7063
- {
7064
- devtoolsUnmountApp(app);
7065
- }
7066
- delete app._container.__vue_app__;
7067
- } else {
7068
- const { bum, scope, um } = instance;
7069
- if (bum) {
7070
- invokeArrayFns(bum);
7071
- }
7072
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7073
- instance.emit("hook:beforeDestroy");
7074
- }
7075
- if (scope) {
7076
- scope.stop();
7077
- }
7078
- if (um) {
7079
- invokeArrayFns(um);
7080
- }
7081
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7082
- instance.emit("hook:destroyed");
7083
- }
7084
- }
7085
- };
7086
- return instance.proxy;
7178
+ } else if (expectedType === "Object") {
7179
+ valid = isObject(value);
7180
+ } else if (expectedType === "Array") {
7181
+ valid = isArray(value);
7182
+ } else if (expectedType === "null") {
7183
+ valid = value === null;
7184
+ } else {
7185
+ valid = value instanceof type;
7186
+ }
7187
+ return {
7188
+ valid,
7189
+ expectedType
7087
7190
  };
7088
7191
  }
7089
- const methodsToPatch = [
7090
- "push",
7091
- "pop",
7092
- "shift",
7093
- "unshift",
7094
- "splice",
7095
- "sort",
7096
- "reverse"
7097
- ];
7098
- const patched = /* @__PURE__ */ new WeakSet();
7099
- function defineReactive(obj, key, val) {
7100
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
7101
- const reactiveVal = reactive(val);
7102
- if (isArray(val)) {
7103
- methodsToPatch.forEach((m) => {
7104
- val[m] = (...args) => {
7105
- Array.prototype[m].call(reactiveVal, ...args);
7106
- };
7107
- });
7108
- } else {
7109
- Object.keys(val).forEach((key2) => {
7110
- try {
7111
- defineReactiveSimple(val, key2, val[key2]);
7112
- } catch (e) {
7113
- }
7114
- });
7115
- }
7192
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7193
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7194
+ const expectedType = expectedTypes[0];
7195
+ const receivedType = toRawType(value);
7196
+ const expectedValue = styleValue(value, expectedType);
7197
+ const receivedValue = styleValue(value, receivedType);
7198
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7199
+ message += ` with value ${expectedValue}`;
7116
7200
  }
7117
- const i = obj.$;
7118
- if (i && obj === i.proxy) {
7119
- defineReactiveSimple(i.ctx, key, val);
7120
- i.accessCache = /* @__PURE__ */ Object.create(null);
7121
- } else if (isReactive(obj)) {
7122
- obj[key] = val;
7201
+ message += `, got ${receivedType} `;
7202
+ if (isExplicable(receivedType)) {
7203
+ message += `with value ${receivedValue}.`;
7204
+ }
7205
+ return message;
7206
+ }
7207
+ function styleValue(value, type) {
7208
+ if (type === "String") {
7209
+ return `"${value}"`;
7210
+ } else if (type === "Number") {
7211
+ return `${Number(value)}`;
7123
7212
  } else {
7124
- defineReactiveSimple(obj, key, val);
7213
+ return `${value}`;
7125
7214
  }
7126
7215
  }
7127
- function defineReactiveSimple(obj, key, val) {
7128
- val = isObject(val) ? reactive(val) : val;
7129
- Object.defineProperty(obj, key, {
7130
- enumerable: true,
7131
- configurable: true,
7132
- get() {
7133
- track(obj, "get", key);
7134
- return val;
7135
- },
7136
- set(newVal) {
7137
- val = isObject(newVal) ? reactive(newVal) : newVal;
7138
- trigger(obj, "set", key, newVal);
7216
+ function isExplicable(type) {
7217
+ const explicitTypes = ["string", "number", "boolean"];
7218
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7219
+ }
7220
+ function isBoolean(...args) {
7221
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7222
+ }
7223
+
7224
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7225
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7226
+ const normalizeSlot = (key, rawSlot, ctx) => {
7227
+ if (rawSlot._n) {
7228
+ return rawSlot;
7229
+ }
7230
+ const normalized = withCtx((...args) => {
7231
+ if (currentInstance) {
7232
+ warn(
7233
+ `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.`
7234
+ );
7235
+ }
7236
+ return normalizeSlotValue(rawSlot(...args));
7237
+ }, ctx);
7238
+ normalized._c = false;
7239
+ return normalized;
7240
+ };
7241
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7242
+ const ctx = rawSlots._ctx;
7243
+ for (const key in rawSlots) {
7244
+ if (isInternalKey(key))
7245
+ continue;
7246
+ const value = rawSlots[key];
7247
+ if (isFunction(value)) {
7248
+ slots[key] = normalizeSlot(key, value, ctx);
7249
+ } else if (value != null) {
7250
+ if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7251
+ warn(
7252
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7253
+ );
7254
+ }
7255
+ const normalized = normalizeSlotValue(value);
7256
+ slots[key] = () => normalized;
7139
7257
  }
7140
- });
7141
- }
7142
-
7143
- function createAppContext() {
7144
- return {
7145
- app: null,
7146
- config: {
7147
- isNativeTag: NO,
7148
- performance: false,
7149
- globalProperties: {},
7150
- optionMergeStrategies: {},
7151
- errorHandler: void 0,
7152
- warnHandler: void 0,
7153
- compilerOptions: {}
7154
- },
7155
- mixins: [],
7156
- components: {},
7157
- directives: {},
7158
- provides: /* @__PURE__ */ Object.create(null),
7159
- optionsCache: /* @__PURE__ */ new WeakMap(),
7160
- propsCache: /* @__PURE__ */ new WeakMap(),
7161
- emitsCache: /* @__PURE__ */ new WeakMap()
7162
- };
7163
- }
7164
- let uid$1 = 0;
7165
- function createAppAPI(render, hydrate) {
7166
- return function createApp(rootComponent, rootProps = null) {
7167
- if (!isFunction(rootComponent)) {
7168
- rootComponent = extend({}, rootComponent);
7258
+ }
7259
+ };
7260
+ const normalizeVNodeSlots = (instance, children) => {
7261
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7262
+ warn(
7263
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7264
+ );
7265
+ }
7266
+ const normalized = normalizeSlotValue(children);
7267
+ instance.slots.default = () => normalized;
7268
+ };
7269
+ const initSlots = (instance, children) => {
7270
+ if (instance.vnode.shapeFlag & 32) {
7271
+ const type = children._;
7272
+ if (type) {
7273
+ instance.slots = toRaw(children);
7274
+ def(children, "_", type);
7275
+ } else {
7276
+ normalizeObjectSlots(
7277
+ children,
7278
+ instance.slots = {},
7279
+ instance
7280
+ );
7169
7281
  }
7170
- if (rootProps != null && !isObject(rootProps)) {
7171
- warn(`root props passed to app.mount() must be an object.`);
7172
- rootProps = null;
7282
+ } else {
7283
+ instance.slots = {};
7284
+ if (children) {
7285
+ normalizeVNodeSlots(instance, children);
7173
7286
  }
7174
- const context = createAppContext();
7175
- const installedPlugins = /* @__PURE__ */ new Set();
7176
- let isMounted = false;
7177
- const app = context.app = {
7178
- _uid: uid$1++,
7179
- _component: rootComponent,
7180
- _props: rootProps,
7181
- _container: null,
7182
- _context: context,
7183
- _instance: null,
7184
- version,
7185
- get config() {
7186
- return context.config;
7187
- },
7188
- set config(v) {
7189
- {
7190
- warn(
7191
- `app.config cannot be replaced. Modify individual options instead.`
7192
- );
7193
- }
7194
- },
7195
- use(plugin, ...options) {
7196
- if (installedPlugins.has(plugin)) {
7197
- warn(`Plugin has already been applied to target app.`);
7198
- } else if (plugin && isFunction(plugin.install)) {
7199
- installedPlugins.add(plugin);
7200
- plugin.install(app, ...options);
7201
- } else if (isFunction(plugin)) {
7202
- installedPlugins.add(plugin);
7203
- plugin(app, ...options);
7204
- } else {
7205
- warn(
7206
- `A plugin must either be a function or an object with an "install" function.`
7207
- );
7208
- }
7209
- return app;
7210
- },
7211
- mixin(mixin) {
7212
- {
7213
- if (!context.mixins.includes(mixin)) {
7214
- context.mixins.push(mixin);
7215
- } else {
7216
- warn(
7217
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7218
- );
7219
- }
7220
- }
7221
- return app;
7222
- },
7223
- component(name, component) {
7224
- {
7225
- validateComponentName(name, context.config);
7226
- }
7227
- if (!component) {
7228
- return context.components[name];
7229
- }
7230
- if (context.components[name]) {
7231
- warn(`Component "${name}" has already been registered in target app.`);
7232
- }
7233
- context.components[name] = component;
7234
- return app;
7235
- },
7236
- directive(name, directive) {
7237
- {
7238
- validateDirectiveName(name);
7239
- }
7240
- if (!directive) {
7241
- return context.directives[name];
7242
- }
7243
- if (context.directives[name]) {
7244
- warn(`Directive "${name}" has already been registered in target app.`);
7245
- }
7246
- context.directives[name] = directive;
7247
- return app;
7248
- },
7249
- mount(rootContainer, isHydrate, isSVG) {
7250
- if (!isMounted) {
7251
- if (rootContainer.__vue_app__) {
7252
- warn(
7253
- `There is already an app instance mounted on the host container.
7254
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7255
- );
7256
- }
7257
- const vnode = createVNode(
7258
- rootComponent,
7259
- rootProps
7260
- );
7261
- vnode.appContext = context;
7262
- {
7263
- context.reload = () => {
7264
- render(cloneVNode(vnode), rootContainer, isSVG);
7265
- };
7266
- }
7267
- if (isHydrate && hydrate) {
7268
- hydrate(vnode, rootContainer);
7269
- } else {
7270
- render(vnode, rootContainer, isSVG);
7271
- }
7272
- isMounted = true;
7273
- app._container = rootContainer;
7274
- rootContainer.__vue_app__ = app;
7275
- {
7276
- app._instance = vnode.component;
7277
- devtoolsInitApp(app, version);
7278
- }
7279
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7280
- } else {
7281
- warn(
7282
- `App has already been mounted.
7283
- 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)\``
7284
- );
7285
- }
7286
- },
7287
- unmount() {
7288
- if (isMounted) {
7289
- render(null, app._container);
7290
- {
7291
- app._instance = null;
7292
- devtoolsUnmountApp(app);
7293
- }
7294
- delete app._container.__vue_app__;
7295
- } else {
7296
- warn(`Cannot unmount an app that is not mounted.`);
7297
- }
7298
- },
7299
- provide(key, value) {
7300
- if (key in context.provides) {
7301
- warn(
7302
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7303
- );
7287
+ }
7288
+ def(instance.slots, InternalObjectKey, 1);
7289
+ };
7290
+ const updateSlots = (instance, children, optimized) => {
7291
+ const { vnode, slots } = instance;
7292
+ let needDeletionCheck = true;
7293
+ let deletionComparisonTarget = EMPTY_OBJ;
7294
+ if (vnode.shapeFlag & 32) {
7295
+ const type = children._;
7296
+ if (type) {
7297
+ if (isHmrUpdating) {
7298
+ extend(slots, children);
7299
+ } else if (optimized && type === 1) {
7300
+ needDeletionCheck = false;
7301
+ } else {
7302
+ extend(slots, children);
7303
+ if (!optimized && type === 1) {
7304
+ delete slots._;
7304
7305
  }
7305
- context.provides[key] = value;
7306
- return app;
7307
7306
  }
7308
- };
7309
- {
7310
- installAppCompatProperties(app, context, render);
7307
+ } else {
7308
+ needDeletionCheck = !children.$stable;
7309
+ normalizeObjectSlots(children, slots, instance);
7311
7310
  }
7312
- return app;
7313
- };
7314
- }
7311
+ deletionComparisonTarget = children;
7312
+ } else if (children) {
7313
+ normalizeVNodeSlots(instance, children);
7314
+ deletionComparisonTarget = { default: 1 };
7315
+ }
7316
+ if (needDeletionCheck) {
7317
+ for (const key in slots) {
7318
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7319
+ delete slots[key];
7320
+ }
7321
+ }
7322
+ }
7323
+ };
7315
7324
 
7316
7325
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7317
7326
  if (isArray(rawRef)) {
@@ -10485,6 +10494,12 @@ function defineSlots() {
10485
10494
  {
10486
10495
  warnRuntimeUsage(`defineSlots`);
10487
10496
  }
10497
+ return null;
10498
+ }
10499
+ function defineModel() {
10500
+ {
10501
+ warnRuntimeUsage("defineModel");
10502
+ }
10488
10503
  }
10489
10504
  function withDefaults(props, defaults) {
10490
10505
  {
@@ -10498,6 +10513,40 @@ function useSlots() {
10498
10513
  function useAttrs() {
10499
10514
  return getContext().attrs;
10500
10515
  }
10516
+ function useModel(props, name, options) {
10517
+ const i = getCurrentInstance();
10518
+ if (!i) {
10519
+ warn(`useModel() called without active instance.`);
10520
+ return ref();
10521
+ }
10522
+ if (!i.propsOptions[0][name]) {
10523
+ warn(`useModel() called with prop "${name}" which is not declared.`);
10524
+ return ref();
10525
+ }
10526
+ if (options && options.local) {
10527
+ const proxy = ref(props[name]);
10528
+ watch(
10529
+ () => props[name],
10530
+ (v) => proxy.value = v
10531
+ );
10532
+ watch(proxy, (value) => {
10533
+ if (value !== props[name]) {
10534
+ i.emit(`update:${name}`, value);
10535
+ }
10536
+ });
10537
+ return proxy;
10538
+ } else {
10539
+ return {
10540
+ __v_isRef: true,
10541
+ get value() {
10542
+ return props[name];
10543
+ },
10544
+ set value(value) {
10545
+ i.emit(`update:${name}`, value);
10546
+ }
10547
+ };
10548
+ }
10549
+ }
10501
10550
  function getContext() {
10502
10551
  const i = getCurrentInstance();
10503
10552
  if (!i) {
@@ -10505,11 +10554,14 @@ function getContext() {
10505
10554
  }
10506
10555
  return i.setupContext || (i.setupContext = createSetupContext(i));
10507
10556
  }
10508
- function mergeDefaults(raw, defaults) {
10509
- const props = isArray(raw) ? raw.reduce(
10557
+ function normalizePropsOrEmits(props) {
10558
+ return isArray(props) ? props.reduce(
10510
10559
  (normalized, p) => (normalized[p] = {}, normalized),
10511
10560
  {}
10512
- ) : raw;
10561
+ ) : props;
10562
+ }
10563
+ function mergeDefaults(raw, defaults) {
10564
+ const props = normalizePropsOrEmits(raw);
10513
10565
  for (const key in defaults) {
10514
10566
  if (key.startsWith("__skip"))
10515
10567
  continue;
@@ -10531,6 +10583,13 @@ function mergeDefaults(raw, defaults) {
10531
10583
  }
10532
10584
  return props;
10533
10585
  }
10586
+ function mergeModels(a, b) {
10587
+ if (!a || !b)
10588
+ return a || b;
10589
+ if (isArray(a) && isArray(b))
10590
+ return a.concat(b);
10591
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
10592
+ }
10534
10593
  function createPropsRestProxy(props, excludedKeys) {
10535
10594
  const ret = {};
10536
10595
  for (const key in props) {
@@ -10796,7 +10855,7 @@ function isMemoSame(cached, memo) {
10796
10855
  return true;
10797
10856
  }
10798
10857
 
10799
- const version = "3.3.0-alpha.7";
10858
+ const version = "3.3.0-alpha.9";
10800
10859
  const _ssrUtils = {
10801
10860
  createComponentInstance,
10802
10861
  setupComponent,
@@ -12453,6 +12512,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12453
12512
  defineCustomElement: defineCustomElement,
12454
12513
  defineEmits: defineEmits,
12455
12514
  defineExpose: defineExpose,
12515
+ defineModel: defineModel,
12456
12516
  defineOptions: defineOptions,
12457
12517
  defineProps: defineProps,
12458
12518
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12480,6 +12540,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12480
12540
  isVNode: isVNode,
12481
12541
  markRaw: markRaw,
12482
12542
  mergeDefaults: mergeDefaults,
12543
+ mergeModels: mergeModels,
12483
12544
  mergeProps: mergeProps,
12484
12545
  nextTick: nextTick,
12485
12546
  normalizeClass: normalizeClass,
@@ -12538,6 +12599,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12538
12599
  useAttrs: useAttrs,
12539
12600
  useCssModule: useCssModule,
12540
12601
  useCssVars: useCssVars,
12602
+ useModel: useModel,
12541
12603
  useSSRContext: useSSRContext,
12542
12604
  useSlots: useSlots,
12543
12605
  useTransitionState: useTransitionState,
@@ -17458,7 +17520,7 @@ const transformText = (node, context) => {
17458
17520
  const seen$1 = /* @__PURE__ */ new WeakSet();
17459
17521
  const transformOnce = (node, context) => {
17460
17522
  if (node.type === 1 && findDir(node, "once", true)) {
17461
- if (seen$1.has(node) || context.inVOnce) {
17523
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
17462
17524
  return;
17463
17525
  }
17464
17526
  seen$1.add(node);