@vue/compat 3.3.0-alpha.8 → 3.3.0-beta.1

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.
@@ -120,7 +120,7 @@ const slotFlagsText = {
120
120
  [3]: "FORWARDED"
121
121
  };
122
122
 
123
- const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
123
+ const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
124
124
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
125
125
 
126
126
  const range = 2;
@@ -1921,6 +1921,8 @@ function reload(id, newComp) {
1921
1921
  }
1922
1922
  hmrDirtyComponents.add(oldComp);
1923
1923
  }
1924
+ instance.appContext.propsCache.delete(instance.type);
1925
+ instance.appContext.emitsCache.delete(instance.type);
1924
1926
  instance.appContext.optionsCache.delete(instance.type);
1925
1927
  if (instance.ceReload) {
1926
1928
  hmrDirtyComponents.add(oldComp);
@@ -3236,7 +3238,8 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
3236
3238
  }
3237
3239
  }
3238
3240
  let hasWarned = false;
3239
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3241
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3242
+ var _a;
3240
3243
  if (!hasWarned) {
3241
3244
  hasWarned = true;
3242
3245
  console[console.info ? "info" : "log"](
@@ -3250,13 +3253,21 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3250
3253
  n: next,
3251
3254
  o: { parentNode, remove }
3252
3255
  } = rendererInternals;
3256
+ let parentSuspenseId;
3257
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3258
+ if (isSuspensible) {
3259
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3260
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
3261
+ parentSuspense.deps++;
3262
+ }
3263
+ }
3253
3264
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3254
3265
  {
3255
3266
  assertNumber(timeout, `Suspense timeout`);
3256
3267
  }
3257
3268
  const suspense = {
3258
3269
  vnode,
3259
- parent,
3270
+ parent: parentSuspense,
3260
3271
  parentComponent,
3261
3272
  isSVG,
3262
3273
  container,
@@ -3316,20 +3327,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3316
3327
  setActiveBranch(suspense, pendingBranch);
3317
3328
  suspense.pendingBranch = null;
3318
3329
  suspense.isInFallback = false;
3319
- let parent2 = suspense.parent;
3330
+ let parent = suspense.parent;
3320
3331
  let hasUnresolvedAncestor = false;
3321
- while (parent2) {
3322
- if (parent2.pendingBranch) {
3323
- parent2.effects.push(...effects);
3332
+ while (parent) {
3333
+ if (parent.pendingBranch) {
3334
+ parent.effects.push(...effects);
3324
3335
  hasUnresolvedAncestor = true;
3325
3336
  break;
3326
3337
  }
3327
- parent2 = parent2.parent;
3338
+ parent = parent.parent;
3328
3339
  }
3329
3340
  if (!hasUnresolvedAncestor) {
3330
3341
  queuePostFlushCb(effects);
3331
3342
  }
3332
3343
  suspense.effects = [];
3344
+ if (isSuspensible) {
3345
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3346
+ parentSuspense.deps--;
3347
+ if (parentSuspense.deps === 0) {
3348
+ parentSuspense.resolve();
3349
+ }
3350
+ }
3351
+ }
3333
3352
  triggerEvent(vnode2, "onResolve");
3334
3353
  },
3335
3354
  fallback(fallbackVNode) {
@@ -3429,13 +3448,13 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3429
3448
  }
3430
3449
  });
3431
3450
  },
3432
- unmount(parentSuspense, doRemove) {
3451
+ unmount(parentSuspense2, doRemove) {
3433
3452
  suspense.isUnmounted = true;
3434
3453
  if (suspense.activeBranch) {
3435
3454
  unmount(
3436
3455
  suspense.activeBranch,
3437
3456
  parentComponent,
3438
- parentSuspense,
3457
+ parentSuspense2,
3439
3458
  doRemove
3440
3459
  );
3441
3460
  }
@@ -3443,7 +3462,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3443
3462
  unmount(
3444
3463
  suspense.pendingBranch,
3445
3464
  parentComponent,
3446
- parentSuspense,
3465
+ parentSuspense2,
3447
3466
  doRemove
3448
3467
  );
3449
3468
  }
@@ -3536,33 +3555,41 @@ function setActiveBranch(suspense, branch) {
3536
3555
  }
3537
3556
  }
3538
3557
 
3539
- function provide(key, value) {
3540
- if (!currentInstance) {
3541
- {
3542
- warn(`provide() can only be used inside setup().`);
3543
- }
3544
- } else {
3545
- let provides = currentInstance.provides;
3546
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3547
- if (parentProvides === provides) {
3548
- provides = currentInstance.provides = Object.create(parentProvides);
3549
- }
3550
- provides[key] = value;
3551
- }
3552
- }
3553
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3554
- const instance = currentInstance || currentRenderingInstance;
3555
- if (instance) {
3556
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3557
- if (provides && key in provides) {
3558
- return provides[key];
3559
- } else if (arguments.length > 1) {
3560
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3558
+ const legacyDirectiveHookMap = {
3559
+ beforeMount: "bind",
3560
+ mounted: "inserted",
3561
+ updated: ["update", "componentUpdated"],
3562
+ unmounted: "unbind"
3563
+ };
3564
+ function mapCompatDirectiveHook(name, dir, instance) {
3565
+ const mappedName = legacyDirectiveHookMap[name];
3566
+ if (mappedName) {
3567
+ if (isArray(mappedName)) {
3568
+ const hook = [];
3569
+ mappedName.forEach((mapped) => {
3570
+ const mappedHook = dir[mapped];
3571
+ if (mappedHook) {
3572
+ softAssertCompatEnabled(
3573
+ "CUSTOM_DIR",
3574
+ instance,
3575
+ mapped,
3576
+ name
3577
+ );
3578
+ hook.push(mappedHook);
3579
+ }
3580
+ });
3581
+ return hook.length ? hook : void 0;
3561
3582
  } else {
3562
- warn(`injection "${String(key)}" not found.`);
3583
+ if (dir[mappedName]) {
3584
+ softAssertCompatEnabled(
3585
+ "CUSTOM_DIR",
3586
+ instance,
3587
+ mappedName,
3588
+ name
3589
+ );
3590
+ }
3591
+ return dir[mappedName];
3563
3592
  }
3564
- } else {
3565
- warn(`inject() can only be used inside setup() or functional components.`);
3566
3593
  }
3567
3594
  }
3568
3595
 
@@ -3801,6 +3828,68 @@ function traverse(value, seen) {
3801
3828
  return value;
3802
3829
  }
3803
3830
 
3831
+ function validateDirectiveName(name) {
3832
+ if (isBuiltInDirective(name)) {
3833
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3834
+ }
3835
+ }
3836
+ function withDirectives(vnode, directives) {
3837
+ const internalInstance = currentRenderingInstance;
3838
+ if (internalInstance === null) {
3839
+ warn(`withDirectives can only be used inside render functions.`);
3840
+ return vnode;
3841
+ }
3842
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3843
+ const bindings = vnode.dirs || (vnode.dirs = []);
3844
+ for (let i = 0; i < directives.length; i++) {
3845
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3846
+ if (dir) {
3847
+ if (isFunction(dir)) {
3848
+ dir = {
3849
+ mounted: dir,
3850
+ updated: dir
3851
+ };
3852
+ }
3853
+ if (dir.deep) {
3854
+ traverse(value);
3855
+ }
3856
+ bindings.push({
3857
+ dir,
3858
+ instance,
3859
+ value,
3860
+ oldValue: void 0,
3861
+ arg,
3862
+ modifiers
3863
+ });
3864
+ }
3865
+ }
3866
+ return vnode;
3867
+ }
3868
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3869
+ const bindings = vnode.dirs;
3870
+ const oldBindings = prevVNode && prevVNode.dirs;
3871
+ for (let i = 0; i < bindings.length; i++) {
3872
+ const binding = bindings[i];
3873
+ if (oldBindings) {
3874
+ binding.oldValue = oldBindings[i].value;
3875
+ }
3876
+ let hook = binding.dir[name];
3877
+ if (!hook) {
3878
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3879
+ }
3880
+ if (hook) {
3881
+ pauseTracking();
3882
+ callWithAsyncErrorHandling(hook, instance, 8, [
3883
+ vnode.el,
3884
+ binding,
3885
+ vnode,
3886
+ prevVNode
3887
+ ]);
3888
+ resetTracking();
3889
+ }
3890
+ }
3891
+ }
3892
+
3804
3893
  function useTransitionState() {
3805
3894
  const state = {
3806
3895
  isMounted: false,
@@ -4599,106 +4688,6 @@ function getCompatListeners(instance) {
4599
4688
  return listeners;
4600
4689
  }
4601
4690
 
4602
- const legacyDirectiveHookMap = {
4603
- beforeMount: "bind",
4604
- mounted: "inserted",
4605
- updated: ["update", "componentUpdated"],
4606
- unmounted: "unbind"
4607
- };
4608
- function mapCompatDirectiveHook(name, dir, instance) {
4609
- const mappedName = legacyDirectiveHookMap[name];
4610
- if (mappedName) {
4611
- if (isArray(mappedName)) {
4612
- const hook = [];
4613
- mappedName.forEach((mapped) => {
4614
- const mappedHook = dir[mapped];
4615
- if (mappedHook) {
4616
- softAssertCompatEnabled(
4617
- "CUSTOM_DIR",
4618
- instance,
4619
- mapped,
4620
- name
4621
- );
4622
- hook.push(mappedHook);
4623
- }
4624
- });
4625
- return hook.length ? hook : void 0;
4626
- } else {
4627
- if (dir[mappedName]) {
4628
- softAssertCompatEnabled(
4629
- "CUSTOM_DIR",
4630
- instance,
4631
- mappedName,
4632
- name
4633
- );
4634
- }
4635
- return dir[mappedName];
4636
- }
4637
- }
4638
- }
4639
-
4640
- function validateDirectiveName(name) {
4641
- if (isBuiltInDirective(name)) {
4642
- warn("Do not use built-in directive ids as custom directive id: " + name);
4643
- }
4644
- }
4645
- function withDirectives(vnode, directives) {
4646
- const internalInstance = currentRenderingInstance;
4647
- if (internalInstance === null) {
4648
- warn(`withDirectives can only be used inside render functions.`);
4649
- return vnode;
4650
- }
4651
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4652
- const bindings = vnode.dirs || (vnode.dirs = []);
4653
- for (let i = 0; i < directives.length; i++) {
4654
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4655
- if (dir) {
4656
- if (isFunction(dir)) {
4657
- dir = {
4658
- mounted: dir,
4659
- updated: dir
4660
- };
4661
- }
4662
- if (dir.deep) {
4663
- traverse(value);
4664
- }
4665
- bindings.push({
4666
- dir,
4667
- instance,
4668
- value,
4669
- oldValue: void 0,
4670
- arg,
4671
- modifiers
4672
- });
4673
- }
4674
- }
4675
- return vnode;
4676
- }
4677
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4678
- const bindings = vnode.dirs;
4679
- const oldBindings = prevVNode && prevVNode.dirs;
4680
- for (let i = 0; i < bindings.length; i++) {
4681
- const binding = bindings[i];
4682
- if (oldBindings) {
4683
- binding.oldValue = oldBindings[i].value;
4684
- }
4685
- let hook = binding.dir[name];
4686
- if (!hook) {
4687
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4688
- }
4689
- if (hook) {
4690
- pauseTracking();
4691
- callWithAsyncErrorHandling(hook, instance, 8, [
4692
- vnode.el,
4693
- binding,
4694
- vnode,
4695
- prevVNode
4696
- ]);
4697
- resetTracking();
4698
- }
4699
- }
4700
- }
4701
-
4702
4691
  const COMPONENTS = "components";
4703
4692
  const DIRECTIVES = "directives";
4704
4693
  const FILTERS = "filters";
@@ -5414,6 +5403,8 @@ const PublicInstanceProxyHandlers = {
5414
5403
  if (key === "$attrs") {
5415
5404
  track(instance, "get", key);
5416
5405
  markAttrsAccessed();
5406
+ } else if (key === "$slots") {
5407
+ track(instance, "get", key);
5417
5408
  }
5418
5409
  return publicGetter(instance);
5419
5410
  } else if (
@@ -5603,24 +5594,179 @@ function deepMergeData(to, from) {
5603
5594
  return to;
5604
5595
  }
5605
5596
 
5606
- function createDuplicateChecker() {
5607
- const cache = /* @__PURE__ */ Object.create(null);
5608
- return (type, key) => {
5609
- if (cache[key]) {
5610
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5611
- } else {
5612
- cache[key] = type;
5613
- }
5614
- };
5597
+ const warnRuntimeUsage = (method) => warn(
5598
+ `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
5599
+ );
5600
+ function defineProps() {
5601
+ {
5602
+ warnRuntimeUsage(`defineProps`);
5603
+ }
5604
+ return null;
5615
5605
  }
5616
- let shouldCacheAccess = true;
5617
- function applyOptions(instance) {
5618
- const options = resolveMergedOptions(instance);
5619
- const publicThis = instance.proxy;
5620
- const ctx = instance.ctx;
5621
- shouldCacheAccess = false;
5622
- if (options.beforeCreate) {
5623
- callHook$1(options.beforeCreate, instance, "bc");
5606
+ function defineEmits() {
5607
+ {
5608
+ warnRuntimeUsage(`defineEmits`);
5609
+ }
5610
+ return null;
5611
+ }
5612
+ function defineExpose(exposed) {
5613
+ {
5614
+ warnRuntimeUsage(`defineExpose`);
5615
+ }
5616
+ }
5617
+ function defineOptions(options) {
5618
+ {
5619
+ warnRuntimeUsage(`defineOptions`);
5620
+ }
5621
+ }
5622
+ function defineSlots() {
5623
+ {
5624
+ warnRuntimeUsage(`defineSlots`);
5625
+ }
5626
+ return null;
5627
+ }
5628
+ function defineModel() {
5629
+ {
5630
+ warnRuntimeUsage("defineModel");
5631
+ }
5632
+ }
5633
+ function withDefaults(props, defaults) {
5634
+ {
5635
+ warnRuntimeUsage(`withDefaults`);
5636
+ }
5637
+ return null;
5638
+ }
5639
+ function useSlots() {
5640
+ return getContext().slots;
5641
+ }
5642
+ function useAttrs() {
5643
+ return getContext().attrs;
5644
+ }
5645
+ function useModel(props, name, options) {
5646
+ const i = getCurrentInstance();
5647
+ if (!i) {
5648
+ warn(`useModel() called without active instance.`);
5649
+ return ref();
5650
+ }
5651
+ if (!i.propsOptions[0][name]) {
5652
+ warn(`useModel() called with prop "${name}" which is not declared.`);
5653
+ return ref();
5654
+ }
5655
+ if (options && options.local) {
5656
+ const proxy = ref(props[name]);
5657
+ watch(
5658
+ () => props[name],
5659
+ (v) => proxy.value = v
5660
+ );
5661
+ watch(proxy, (value) => {
5662
+ if (value !== props[name]) {
5663
+ i.emit(`update:${name}`, value);
5664
+ }
5665
+ });
5666
+ return proxy;
5667
+ } else {
5668
+ return {
5669
+ __v_isRef: true,
5670
+ get value() {
5671
+ return props[name];
5672
+ },
5673
+ set value(value) {
5674
+ i.emit(`update:${name}`, value);
5675
+ }
5676
+ };
5677
+ }
5678
+ }
5679
+ function getContext() {
5680
+ const i = getCurrentInstance();
5681
+ if (!i) {
5682
+ warn(`useContext() called without active instance.`);
5683
+ }
5684
+ return i.setupContext || (i.setupContext = createSetupContext(i));
5685
+ }
5686
+ function normalizePropsOrEmits(props) {
5687
+ return isArray(props) ? props.reduce(
5688
+ (normalized, p) => (normalized[p] = null, normalized),
5689
+ {}
5690
+ ) : props;
5691
+ }
5692
+ function mergeDefaults(raw, defaults) {
5693
+ const props = normalizePropsOrEmits(raw);
5694
+ for (const key in defaults) {
5695
+ if (key.startsWith("__skip"))
5696
+ continue;
5697
+ let opt = props[key];
5698
+ if (opt) {
5699
+ if (isArray(opt) || isFunction(opt)) {
5700
+ opt = props[key] = { type: opt, default: defaults[key] };
5701
+ } else {
5702
+ opt.default = defaults[key];
5703
+ }
5704
+ } else if (opt === null) {
5705
+ opt = props[key] = { default: defaults[key] };
5706
+ } else {
5707
+ warn(`props default key "${key}" has no corresponding declaration.`);
5708
+ }
5709
+ if (opt && defaults[`__skip_${key}`]) {
5710
+ opt.skipFactory = true;
5711
+ }
5712
+ }
5713
+ return props;
5714
+ }
5715
+ function mergeModels(a, b) {
5716
+ if (!a || !b)
5717
+ return a || b;
5718
+ if (isArray(a) && isArray(b))
5719
+ return a.concat(b);
5720
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5721
+ }
5722
+ function createPropsRestProxy(props, excludedKeys) {
5723
+ const ret = {};
5724
+ for (const key in props) {
5725
+ if (!excludedKeys.includes(key)) {
5726
+ Object.defineProperty(ret, key, {
5727
+ enumerable: true,
5728
+ get: () => props[key]
5729
+ });
5730
+ }
5731
+ }
5732
+ return ret;
5733
+ }
5734
+ function withAsyncContext(getAwaitable) {
5735
+ const ctx = getCurrentInstance();
5736
+ if (!ctx) {
5737
+ warn(
5738
+ `withAsyncContext called without active current instance. This is likely a bug.`
5739
+ );
5740
+ }
5741
+ let awaitable = getAwaitable();
5742
+ unsetCurrentInstance();
5743
+ if (isPromise(awaitable)) {
5744
+ awaitable = awaitable.catch((e) => {
5745
+ setCurrentInstance(ctx);
5746
+ throw e;
5747
+ });
5748
+ }
5749
+ return [awaitable, () => setCurrentInstance(ctx)];
5750
+ }
5751
+
5752
+ function createDuplicateChecker() {
5753
+ const cache = /* @__PURE__ */ Object.create(null);
5754
+ return (type, key) => {
5755
+ if (cache[key]) {
5756
+ warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5757
+ } else {
5758
+ cache[key] = type;
5759
+ }
5760
+ };
5761
+ }
5762
+ let shouldCacheAccess = true;
5763
+ function applyOptions(instance) {
5764
+ const options = resolveMergedOptions(instance);
5765
+ const publicThis = instance.proxy;
5766
+ const ctx = instance.ctx;
5767
+ shouldCacheAccess = false;
5768
+ if (options.beforeCreate) {
5769
+ callHook$1(options.beforeCreate, instance, "bc");
5624
5770
  }
5625
5771
  const {
5626
5772
  // state
@@ -5665,12 +5811,7 @@ function applyOptions(instance) {
5665
5811
  }
5666
5812
  }
5667
5813
  if (injectOptions) {
5668
- resolveInjections(
5669
- injectOptions,
5670
- ctx,
5671
- checkDuplicateProperties,
5672
- instance.appContext.config.unwrapInjectedRef
5673
- );
5814
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5674
5815
  }
5675
5816
  if (methods) {
5676
5817
  for (const key in methods) {
@@ -5821,7 +5962,7 @@ function applyOptions(instance) {
5821
5962
  instance.filters = filters;
5822
5963
  }
5823
5964
  }
5824
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
5965
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5825
5966
  if (isArray(injectOptions)) {
5826
5967
  injectOptions = normalizeInject(injectOptions);
5827
5968
  }
@@ -5843,21 +5984,12 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
5843
5984
  injected = inject(opt);
5844
5985
  }
5845
5986
  if (isRef(injected)) {
5846
- if (unwrapRef) {
5847
- Object.defineProperty(ctx, key, {
5848
- enumerable: true,
5849
- configurable: true,
5850
- get: () => injected.value,
5851
- set: (v) => injected.value = v
5852
- });
5853
- } else {
5854
- {
5855
- warn(
5856
- `injected property "${key}" is a ref and will be auto-unwrapped and no longer needs \`.value\` in the next minor release. To opt-in to the new behavior now, set \`app.config.unwrapInjectedRef = true\` (this config is temporary and will not be needed in the future.)`
5857
- );
5858
- }
5859
- ctx[key] = injected;
5860
- }
5987
+ Object.defineProperty(ctx, key, {
5988
+ enumerable: true,
5989
+ configurable: true,
5990
+ get: () => injected.value,
5991
+ set: (v) => injected.value = v
5992
+ });
5861
5993
  } else {
5862
5994
  ctx[key] = injected;
5863
5995
  }
@@ -5960,10 +6092,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
5960
6092
  }
5961
6093
  const internalOptionMergeStrats = {
5962
6094
  data: mergeDataFn,
5963
- props: mergeObjectOptions,
5964
- // TODO
5965
- emits: mergeObjectOptions,
5966
- // TODO
6095
+ props: mergeEmitsOrPropsOptions,
6096
+ emits: mergeEmitsOrPropsOptions,
5967
6097
  // objects
5968
6098
  methods: mergeObjectOptions,
5969
6099
  computed: mergeObjectOptions,
@@ -6025,7 +6155,21 @@ function mergeAsArray$1(to, from) {
6025
6155
  return to ? [...new Set([].concat(to, from))] : from;
6026
6156
  }
6027
6157
  function mergeObjectOptions(to, from) {
6028
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
6158
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
6159
+ }
6160
+ function mergeEmitsOrPropsOptions(to, from) {
6161
+ if (to) {
6162
+ if (isArray(to) && isArray(from)) {
6163
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
6164
+ }
6165
+ return extend(
6166
+ /* @__PURE__ */ Object.create(null),
6167
+ normalizePropsOrEmits(to),
6168
+ normalizePropsOrEmits(from != null ? from : {})
6169
+ );
6170
+ } else {
6171
+ return from;
6172
+ }
6029
6173
  }
6030
6174
  function mergeWatchOptions(to, from) {
6031
6175
  if (!to)
@@ -6039,1179 +6183,1234 @@ function mergeWatchOptions(to, from) {
6039
6183
  return merged;
6040
6184
  }
6041
6185
 
6042
- function createPropsDefaultThis(instance, rawProps, propKey) {
6043
- return new Proxy(
6044
- {},
6045
- {
6046
- get(_, key) {
6047
- warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6048
- if (key === "$options") {
6049
- return resolveMergedOptions(instance);
6050
- }
6051
- if (key in rawProps) {
6052
- return rawProps[key];
6053
- }
6054
- const injections = instance.type.inject;
6055
- if (injections) {
6056
- if (isArray(injections)) {
6057
- if (injections.includes(key)) {
6058
- return inject(key);
6059
- }
6060
- } else if (key in injections) {
6061
- return inject(key);
6062
- }
6186
+ function installLegacyConfigWarnings(config) {
6187
+ const legacyConfigOptions = {
6188
+ silent: "CONFIG_SILENT",
6189
+ devtools: "CONFIG_DEVTOOLS",
6190
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6191
+ keyCodes: "CONFIG_KEY_CODES",
6192
+ productionTip: "CONFIG_PRODUCTION_TIP"
6193
+ };
6194
+ Object.keys(legacyConfigOptions).forEach((key) => {
6195
+ let val = config[key];
6196
+ Object.defineProperty(config, key, {
6197
+ enumerable: true,
6198
+ get() {
6199
+ return val;
6200
+ },
6201
+ set(newVal) {
6202
+ if (!isCopyingConfig) {
6203
+ warnDeprecation$1(legacyConfigOptions[key], null);
6063
6204
  }
6205
+ val = newVal;
6064
6206
  }
6065
- }
6066
- );
6207
+ });
6208
+ });
6067
6209
  }
6068
-
6069
- function shouldSkipAttr(key, instance) {
6070
- if (key === "is") {
6071
- return true;
6072
- }
6073
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6074
- return true;
6075
- }
6076
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6077
- return true;
6078
- }
6079
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6080
- return true;
6081
- }
6082
- return false;
6210
+ function installLegacyOptionMergeStrats(config) {
6211
+ config.optionMergeStrategies = new Proxy({}, {
6212
+ get(target, key) {
6213
+ if (key in target) {
6214
+ return target[key];
6215
+ }
6216
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6217
+ "CONFIG_OPTION_MERGE_STRATS",
6218
+ null
6219
+ )) {
6220
+ return internalOptionMergeStrats[key];
6221
+ }
6222
+ }
6223
+ });
6083
6224
  }
6084
6225
 
6085
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6086
- const props = {};
6087
- const attrs = {};
6088
- def(attrs, InternalObjectKey, 1);
6089
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6090
- setFullProps(instance, rawProps, props, attrs);
6091
- for (const key in instance.propsOptions[0]) {
6092
- if (!(key in props)) {
6093
- props[key] = void 0;
6226
+ let isCopyingConfig = false;
6227
+ let singletonApp;
6228
+ let singletonCtor;
6229
+ function createCompatVue$1(createApp, createSingletonApp) {
6230
+ singletonApp = createSingletonApp({});
6231
+ const Vue = singletonCtor = function Vue2(options = {}) {
6232
+ return createCompatApp(options, Vue2);
6233
+ };
6234
+ function createCompatApp(options = {}, Ctor) {
6235
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6236
+ const { data } = options;
6237
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6238
+ options.data = () => data;
6239
+ }
6240
+ const app = createApp(options);
6241
+ if (Ctor !== Vue) {
6242
+ applySingletonPrototype(app, Ctor);
6243
+ }
6244
+ const vm = app._createRoot(options);
6245
+ if (options.el) {
6246
+ return vm.$mount(options.el);
6247
+ } else {
6248
+ return vm;
6094
6249
  }
6095
6250
  }
6096
- {
6097
- validateProps(rawProps || {}, props, instance);
6098
- }
6099
- if (isStateful) {
6100
- instance.props = isSSR ? props : shallowReactive(props);
6101
- } else {
6102
- if (!instance.type.props) {
6103
- instance.props = attrs;
6251
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
6252
+ Vue.config = singletonApp.config;
6253
+ Vue.use = (p, ...options) => {
6254
+ if (p && isFunction(p.install)) {
6255
+ p.install(Vue, ...options);
6256
+ } else if (isFunction(p)) {
6257
+ p(Vue, ...options);
6258
+ }
6259
+ return Vue;
6260
+ };
6261
+ Vue.mixin = (m) => {
6262
+ singletonApp.mixin(m);
6263
+ return Vue;
6264
+ };
6265
+ Vue.component = (name, comp) => {
6266
+ if (comp) {
6267
+ singletonApp.component(name, comp);
6268
+ return Vue;
6104
6269
  } else {
6105
- instance.props = props;
6270
+ return singletonApp.component(name);
6271
+ }
6272
+ };
6273
+ Vue.directive = (name, dir) => {
6274
+ if (dir) {
6275
+ singletonApp.directive(name, dir);
6276
+ return Vue;
6277
+ } else {
6278
+ return singletonApp.directive(name);
6279
+ }
6280
+ };
6281
+ Vue.options = { _base: Vue };
6282
+ let cid = 1;
6283
+ Vue.cid = cid;
6284
+ Vue.nextTick = nextTick;
6285
+ const extendCache = /* @__PURE__ */ new WeakMap();
6286
+ function extendCtor(extendOptions = {}) {
6287
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6288
+ if (isFunction(extendOptions)) {
6289
+ extendOptions = extendOptions.options;
6290
+ }
6291
+ if (extendCache.has(extendOptions)) {
6292
+ return extendCache.get(extendOptions);
6293
+ }
6294
+ const Super = this;
6295
+ function SubVue(inlineOptions) {
6296
+ if (!inlineOptions) {
6297
+ return createCompatApp(SubVue.options, SubVue);
6298
+ } else {
6299
+ return createCompatApp(
6300
+ mergeOptions(
6301
+ extend({}, SubVue.options),
6302
+ inlineOptions,
6303
+ internalOptionMergeStrats
6304
+ ),
6305
+ SubVue
6306
+ );
6307
+ }
6106
6308
  }
6309
+ SubVue.super = Super;
6310
+ SubVue.prototype = Object.create(Vue.prototype);
6311
+ SubVue.prototype.constructor = SubVue;
6312
+ const mergeBase = {};
6313
+ for (const key in Super.options) {
6314
+ const superValue = Super.options[key];
6315
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6316
+ }
6317
+ SubVue.options = mergeOptions(
6318
+ mergeBase,
6319
+ extendOptions,
6320
+ internalOptionMergeStrats
6321
+ );
6322
+ SubVue.options._base = SubVue;
6323
+ SubVue.extend = extendCtor.bind(SubVue);
6324
+ SubVue.mixin = Super.mixin;
6325
+ SubVue.use = Super.use;
6326
+ SubVue.cid = ++cid;
6327
+ extendCache.set(extendOptions, SubVue);
6328
+ return SubVue;
6107
6329
  }
6108
- instance.attrs = attrs;
6330
+ Vue.extend = extendCtor.bind(Vue);
6331
+ Vue.set = (target, key, value) => {
6332
+ assertCompatEnabled("GLOBAL_SET", null);
6333
+ target[key] = value;
6334
+ };
6335
+ Vue.delete = (target, key) => {
6336
+ assertCompatEnabled("GLOBAL_DELETE", null);
6337
+ delete target[key];
6338
+ };
6339
+ Vue.observable = (target) => {
6340
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6341
+ return reactive(target);
6342
+ };
6343
+ Vue.filter = (name, filter) => {
6344
+ if (filter) {
6345
+ singletonApp.filter(name, filter);
6346
+ return Vue;
6347
+ } else {
6348
+ return singletonApp.filter(name);
6349
+ }
6350
+ };
6351
+ const util = {
6352
+ warn: warn ,
6353
+ extend,
6354
+ mergeOptions: (parent, child, vm) => mergeOptions(
6355
+ parent,
6356
+ child,
6357
+ vm ? void 0 : internalOptionMergeStrats
6358
+ ),
6359
+ defineReactive
6360
+ };
6361
+ Object.defineProperty(Vue, "util", {
6362
+ get() {
6363
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6364
+ return util;
6365
+ }
6366
+ });
6367
+ Vue.configureCompat = configureCompat$1;
6368
+ return Vue;
6109
6369
  }
6110
- function isInHmrContext(instance) {
6111
- while (instance) {
6112
- if (instance.type.__hmrId)
6113
- return true;
6114
- instance = instance.parent;
6370
+ function installAppCompatProperties(app, context, render) {
6371
+ installFilterMethod(app, context);
6372
+ installLegacyOptionMergeStrats(app.config);
6373
+ if (!singletonApp) {
6374
+ return;
6115
6375
  }
6376
+ installCompatMount(app, context, render);
6377
+ installLegacyAPIs(app);
6378
+ applySingletonAppMutations(app);
6379
+ installLegacyConfigWarnings(app.config);
6116
6380
  }
6117
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6118
- const {
6119
- props,
6120
- attrs,
6121
- vnode: { patchFlag }
6122
- } = instance;
6123
- const rawCurrentProps = toRaw(props);
6124
- const [options] = instance.propsOptions;
6125
- let hasAttrsChanged = false;
6126
- if (
6127
- // always force full diff in dev
6128
- // - #1942 if hmr is enabled with sfc component
6129
- // - vite#872 non-sfc component used by sfc component
6130
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6131
- ) {
6132
- if (patchFlag & 8) {
6133
- const propsToUpdate = instance.vnode.dynamicProps;
6134
- for (let i = 0; i < propsToUpdate.length; i++) {
6135
- let key = propsToUpdate[i];
6136
- if (isEmitListener(instance.emitsOptions, key)) {
6137
- continue;
6138
- }
6139
- const value = rawProps[key];
6140
- if (options) {
6141
- if (hasOwn(attrs, key)) {
6142
- if (value !== attrs[key]) {
6143
- attrs[key] = value;
6144
- hasAttrsChanged = true;
6145
- }
6146
- } else {
6147
- const camelizedKey = camelize(key);
6148
- props[camelizedKey] = resolvePropValue(
6149
- options,
6150
- rawCurrentProps,
6151
- camelizedKey,
6152
- value,
6153
- instance,
6154
- false
6155
- /* isAbsent */
6156
- );
6157
- }
6158
- } else {
6159
- {
6160
- if (isOn(key) && key.endsWith("Native")) {
6161
- key = key.slice(0, -6);
6162
- } else if (shouldSkipAttr(key, instance)) {
6163
- continue;
6164
- }
6165
- }
6166
- if (value !== attrs[key]) {
6167
- attrs[key] = value;
6168
- hasAttrsChanged = true;
6169
- }
6170
- }
6171
- }
6381
+ function installFilterMethod(app, context) {
6382
+ context.filters = {};
6383
+ app.filter = (name, filter) => {
6384
+ assertCompatEnabled("FILTERS", null);
6385
+ if (!filter) {
6386
+ return context.filters[name];
6172
6387
  }
6173
- } else {
6174
- if (setFullProps(instance, rawProps, props, attrs)) {
6175
- hasAttrsChanged = true;
6388
+ if (context.filters[name]) {
6389
+ warn(`Filter "${name}" has already been registered.`);
6176
6390
  }
6177
- let kebabKey;
6178
- for (const key in rawCurrentProps) {
6179
- if (!rawProps || // for camelCase
6180
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6181
- // and converted to camelCase (#955)
6182
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6183
- if (options) {
6184
- if (rawPrevProps && // for camelCase
6185
- (rawPrevProps[key] !== void 0 || // for kebab-case
6186
- rawPrevProps[kebabKey] !== void 0)) {
6187
- props[key] = resolvePropValue(
6188
- options,
6189
- rawCurrentProps,
6190
- key,
6191
- void 0,
6192
- instance,
6193
- true
6194
- /* isAbsent */
6195
- );
6196
- }
6197
- } else {
6198
- delete props[key];
6199
- }
6391
+ context.filters[name] = filter;
6392
+ return app;
6393
+ };
6394
+ }
6395
+ function installLegacyAPIs(app) {
6396
+ Object.defineProperties(app, {
6397
+ // so that app.use() can work with legacy plugins that extend prototypes
6398
+ prototype: {
6399
+ get() {
6400
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6401
+ return app.config.globalProperties;
6200
6402
  }
6201
- }
6202
- if (attrs !== rawCurrentProps) {
6203
- for (const key in attrs) {
6204
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6205
- delete attrs[key];
6206
- hasAttrsChanged = true;
6207
- }
6403
+ },
6404
+ nextTick: { value: nextTick },
6405
+ extend: { value: singletonCtor.extend },
6406
+ set: { value: singletonCtor.set },
6407
+ delete: { value: singletonCtor.delete },
6408
+ observable: { value: singletonCtor.observable },
6409
+ util: {
6410
+ get() {
6411
+ return singletonCtor.util;
6208
6412
  }
6209
6413
  }
6414
+ });
6415
+ }
6416
+ function applySingletonAppMutations(app) {
6417
+ app._context.mixins = [...singletonApp._context.mixins];
6418
+ ["components", "directives", "filters"].forEach((key) => {
6419
+ app._context[key] = Object.create(singletonApp._context[key]);
6420
+ });
6421
+ isCopyingConfig = true;
6422
+ for (const key in singletonApp.config) {
6423
+ if (key === "isNativeTag")
6424
+ continue;
6425
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6426
+ continue;
6427
+ }
6428
+ const val = singletonApp.config[key];
6429
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6430
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6431
+ app.config.compilerOptions.isCustomElement = (tag) => {
6432
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6433
+ };
6434
+ }
6210
6435
  }
6211
- if (hasAttrsChanged) {
6212
- trigger(instance, "set", "$attrs");
6213
- }
6214
- {
6215
- validateProps(rawProps || {}, props, instance);
6436
+ isCopyingConfig = false;
6437
+ applySingletonPrototype(app, singletonCtor);
6438
+ }
6439
+ function applySingletonPrototype(app, Ctor) {
6440
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6441
+ if (enabled) {
6442
+ app.config.globalProperties = Object.create(Ctor.prototype);
6443
+ }
6444
+ let hasPrototypeAugmentations = false;
6445
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6446
+ for (const key in descriptors) {
6447
+ if (key !== "constructor") {
6448
+ hasPrototypeAugmentations = true;
6449
+ if (enabled) {
6450
+ Object.defineProperty(
6451
+ app.config.globalProperties,
6452
+ key,
6453
+ descriptors[key]
6454
+ );
6455
+ }
6456
+ }
6457
+ }
6458
+ if (hasPrototypeAugmentations) {
6459
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6216
6460
  }
6217
6461
  }
6218
- function setFullProps(instance, rawProps, props, attrs) {
6219
- const [options, needCastKeys] = instance.propsOptions;
6220
- let hasAttrsChanged = false;
6221
- let rawCastValues;
6222
- if (rawProps) {
6223
- for (let key in rawProps) {
6224
- if (isReservedProp(key)) {
6225
- continue;
6462
+ function installCompatMount(app, context, render) {
6463
+ let isMounted = false;
6464
+ app._createRoot = (options) => {
6465
+ const component = app._component;
6466
+ const vnode = createVNode(component, options.propsData || null);
6467
+ vnode.appContext = context;
6468
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6469
+ const emptyRender = () => {
6470
+ };
6471
+ const instance = createComponentInstance(vnode, null, null);
6472
+ if (hasNoRender) {
6473
+ instance.render = emptyRender;
6474
+ }
6475
+ setupComponent(instance);
6476
+ vnode.component = instance;
6477
+ vnode.isCompatRoot = true;
6478
+ instance.ctx._compat_mount = (selectorOrEl) => {
6479
+ if (isMounted) {
6480
+ warn(`Root instance is already mounted.`);
6481
+ return;
6226
6482
  }
6227
- {
6228
- if (key.startsWith("onHook:")) {
6229
- softAssertCompatEnabled(
6230
- "INSTANCE_EVENT_HOOKS",
6231
- instance,
6232
- key.slice(2).toLowerCase()
6483
+ let container;
6484
+ if (typeof selectorOrEl === "string") {
6485
+ const result = document.querySelector(selectorOrEl);
6486
+ if (!result) {
6487
+ warn(
6488
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6233
6489
  );
6490
+ return;
6234
6491
  }
6235
- if (key === "inline-template") {
6236
- continue;
6237
- }
6492
+ container = result;
6493
+ } else {
6494
+ container = selectorOrEl || document.createElement("div");
6238
6495
  }
6239
- const value = rawProps[key];
6240
- let camelKey;
6241
- if (options && hasOwn(options, camelKey = camelize(key))) {
6242
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6243
- props[camelKey] = value;
6244
- } else {
6245
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6246
- }
6247
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6496
+ const isSVG = container instanceof SVGElement;
6497
+ {
6498
+ context.reload = () => {
6499
+ const cloned = cloneVNode(vnode);
6500
+ cloned.component = null;
6501
+ render(cloned, container, isSVG);
6502
+ };
6503
+ }
6504
+ if (hasNoRender && instance.render === emptyRender) {
6248
6505
  {
6249
- if (isOn(key) && key.endsWith("Native")) {
6250
- key = key.slice(0, -6);
6251
- } else if (shouldSkipAttr(key, instance)) {
6252
- continue;
6506
+ for (let i = 0; i < container.attributes.length; i++) {
6507
+ const attr = container.attributes[i];
6508
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6509
+ warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6510
+ break;
6511
+ }
6253
6512
  }
6254
6513
  }
6255
- if (!(key in attrs) || value !== attrs[key]) {
6256
- attrs[key] = value;
6257
- hasAttrsChanged = true;
6258
- }
6514
+ instance.render = null;
6515
+ component.template = container.innerHTML;
6516
+ finishComponentSetup(
6517
+ instance,
6518
+ false,
6519
+ true
6520
+ /* skip options */
6521
+ );
6259
6522
  }
6260
- }
6261
- }
6262
- if (needCastKeys) {
6263
- const rawCurrentProps = toRaw(props);
6264
- const castValues = rawCastValues || EMPTY_OBJ;
6265
- for (let i = 0; i < needCastKeys.length; i++) {
6266
- const key = needCastKeys[i];
6267
- props[key] = resolvePropValue(
6268
- options,
6269
- rawCurrentProps,
6270
- key,
6271
- castValues[key],
6272
- instance,
6273
- !hasOwn(castValues, key)
6274
- );
6275
- }
6276
- }
6277
- return hasAttrsChanged;
6278
- }
6279
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6280
- const opt = options[key];
6281
- if (opt != null) {
6282
- const hasDefault = hasOwn(opt, "default");
6283
- if (hasDefault && value === void 0) {
6284
- const defaultValue = opt.default;
6285
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6286
- const { propsDefaults } = instance;
6287
- if (key in propsDefaults) {
6288
- value = propsDefaults[key];
6289
- } else {
6290
- setCurrentInstance(instance);
6291
- value = propsDefaults[key] = defaultValue.call(
6292
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6293
- props
6294
- );
6295
- unsetCurrentInstance();
6523
+ container.innerHTML = "";
6524
+ render(vnode, container, isSVG);
6525
+ if (container instanceof Element) {
6526
+ container.removeAttribute("v-cloak");
6527
+ container.setAttribute("data-v-app", "");
6528
+ }
6529
+ isMounted = true;
6530
+ app._container = container;
6531
+ container.__vue_app__ = app;
6532
+ {
6533
+ devtoolsInitApp(app, version);
6534
+ }
6535
+ return instance.proxy;
6536
+ };
6537
+ instance.ctx._compat_destroy = () => {
6538
+ if (isMounted) {
6539
+ render(null, app._container);
6540
+ {
6541
+ devtoolsUnmountApp(app);
6296
6542
  }
6543
+ delete app._container.__vue_app__;
6297
6544
  } else {
6298
- value = defaultValue;
6299
- }
6300
- }
6301
- if (opt[0 /* shouldCast */]) {
6302
- if (isAbsent && !hasDefault) {
6303
- value = false;
6304
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6305
- value = true;
6545
+ const { bum, scope, um } = instance;
6546
+ if (bum) {
6547
+ invokeArrayFns(bum);
6548
+ }
6549
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6550
+ instance.emit("hook:beforeDestroy");
6551
+ }
6552
+ if (scope) {
6553
+ scope.stop();
6554
+ }
6555
+ if (um) {
6556
+ invokeArrayFns(um);
6557
+ }
6558
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6559
+ instance.emit("hook:destroyed");
6560
+ }
6306
6561
  }
6562
+ };
6563
+ return instance.proxy;
6564
+ };
6565
+ }
6566
+ const methodsToPatch = [
6567
+ "push",
6568
+ "pop",
6569
+ "shift",
6570
+ "unshift",
6571
+ "splice",
6572
+ "sort",
6573
+ "reverse"
6574
+ ];
6575
+ const patched = /* @__PURE__ */ new WeakSet();
6576
+ function defineReactive(obj, key, val) {
6577
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6578
+ const reactiveVal = reactive(val);
6579
+ if (isArray(val)) {
6580
+ methodsToPatch.forEach((m) => {
6581
+ val[m] = (...args) => {
6582
+ Array.prototype[m].call(reactiveVal, ...args);
6583
+ };
6584
+ });
6585
+ } else {
6586
+ Object.keys(val).forEach((key2) => {
6587
+ try {
6588
+ defineReactiveSimple(val, key2, val[key2]);
6589
+ } catch (e) {
6590
+ }
6591
+ });
6307
6592
  }
6308
6593
  }
6309
- return value;
6594
+ const i = obj.$;
6595
+ if (i && obj === i.proxy) {
6596
+ defineReactiveSimple(i.ctx, key, val);
6597
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6598
+ } else if (isReactive(obj)) {
6599
+ obj[key] = val;
6600
+ } else {
6601
+ defineReactiveSimple(obj, key, val);
6602
+ }
6310
6603
  }
6311
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6312
- const cache = appContext.propsCache;
6313
- const cached = cache.get(comp);
6314
- if (cached) {
6315
- return cached;
6316
- }
6317
- const raw = comp.props;
6318
- const normalized = {};
6319
- const needCastKeys = [];
6320
- let hasExtends = false;
6321
- if (!isFunction(comp)) {
6322
- const extendProps = (raw2) => {
6323
- if (isFunction(raw2)) {
6324
- raw2 = raw2.options;
6325
- }
6326
- hasExtends = true;
6327
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6328
- extend(normalized, props);
6329
- if (keys)
6330
- needCastKeys.push(...keys);
6331
- };
6332
- if (!asMixin && appContext.mixins.length) {
6333
- appContext.mixins.forEach(extendProps);
6334
- }
6335
- if (comp.extends) {
6336
- extendProps(comp.extends);
6337
- }
6338
- if (comp.mixins) {
6339
- comp.mixins.forEach(extendProps);
6604
+ function defineReactiveSimple(obj, key, val) {
6605
+ val = isObject(val) ? reactive(val) : val;
6606
+ Object.defineProperty(obj, key, {
6607
+ enumerable: true,
6608
+ configurable: true,
6609
+ get() {
6610
+ track(obj, "get", key);
6611
+ return val;
6612
+ },
6613
+ set(newVal) {
6614
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6615
+ trigger(obj, "set", key, newVal);
6340
6616
  }
6341
- }
6342
- if (!raw && !hasExtends) {
6343
- if (isObject(comp)) {
6344
- cache.set(comp, EMPTY_ARR);
6617
+ });
6618
+ }
6619
+
6620
+ function createAppContext() {
6621
+ return {
6622
+ app: null,
6623
+ config: {
6624
+ isNativeTag: NO,
6625
+ performance: false,
6626
+ globalProperties: {},
6627
+ optionMergeStrategies: {},
6628
+ errorHandler: void 0,
6629
+ warnHandler: void 0,
6630
+ compilerOptions: {}
6631
+ },
6632
+ mixins: [],
6633
+ components: {},
6634
+ directives: {},
6635
+ provides: /* @__PURE__ */ Object.create(null),
6636
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6637
+ propsCache: /* @__PURE__ */ new WeakMap(),
6638
+ emitsCache: /* @__PURE__ */ new WeakMap()
6639
+ };
6640
+ }
6641
+ let uid$1 = 0;
6642
+ function createAppAPI(render, hydrate) {
6643
+ return function createApp(rootComponent, rootProps = null) {
6644
+ if (!isFunction(rootComponent)) {
6645
+ rootComponent = extend({}, rootComponent);
6345
6646
  }
6346
- return EMPTY_ARR;
6347
- }
6348
- if (isArray(raw)) {
6349
- for (let i = 0; i < raw.length; i++) {
6350
- if (!isString(raw[i])) {
6351
- warn(`props must be strings when using array syntax.`, raw[i]);
6352
- }
6353
- const normalizedKey = camelize(raw[i]);
6354
- if (validatePropName(normalizedKey)) {
6355
- normalized[normalizedKey] = EMPTY_OBJ;
6356
- }
6647
+ if (rootProps != null && !isObject(rootProps)) {
6648
+ warn(`root props passed to app.mount() must be an object.`);
6649
+ rootProps = null;
6357
6650
  }
6358
- } else if (raw) {
6359
- if (!isObject(raw)) {
6360
- warn(`invalid props options`, raw);
6651
+ const context = createAppContext();
6652
+ {
6653
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
6654
+ get() {
6655
+ return true;
6656
+ },
6657
+ set() {
6658
+ warn(
6659
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
6660
+ );
6661
+ }
6662
+ });
6361
6663
  }
6362
- for (const key in raw) {
6363
- const normalizedKey = camelize(key);
6364
- if (validatePropName(normalizedKey)) {
6365
- const opt = raw[key];
6366
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6367
- if (prop) {
6368
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6369
- const stringIndex = getTypeIndex(String, prop.type);
6370
- prop[0 /* shouldCast */] = booleanIndex > -1;
6371
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6372
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6373
- needCastKeys.push(normalizedKey);
6664
+ const installedPlugins = /* @__PURE__ */ new Set();
6665
+ let isMounted = false;
6666
+ const app = context.app = {
6667
+ _uid: uid$1++,
6668
+ _component: rootComponent,
6669
+ _props: rootProps,
6670
+ _container: null,
6671
+ _context: context,
6672
+ _instance: null,
6673
+ version,
6674
+ get config() {
6675
+ return context.config;
6676
+ },
6677
+ set config(v) {
6678
+ {
6679
+ warn(
6680
+ `app.config cannot be replaced. Modify individual options instead.`
6681
+ );
6682
+ }
6683
+ },
6684
+ use(plugin, ...options) {
6685
+ if (installedPlugins.has(plugin)) {
6686
+ warn(`Plugin has already been applied to target app.`);
6687
+ } else if (plugin && isFunction(plugin.install)) {
6688
+ installedPlugins.add(plugin);
6689
+ plugin.install(app, ...options);
6690
+ } else if (isFunction(plugin)) {
6691
+ installedPlugins.add(plugin);
6692
+ plugin(app, ...options);
6693
+ } else {
6694
+ warn(
6695
+ `A plugin must either be a function or an object with an "install" function.`
6696
+ );
6697
+ }
6698
+ return app;
6699
+ },
6700
+ mixin(mixin) {
6701
+ {
6702
+ if (!context.mixins.includes(mixin)) {
6703
+ context.mixins.push(mixin);
6704
+ } else {
6705
+ warn(
6706
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6707
+ );
6708
+ }
6709
+ }
6710
+ return app;
6711
+ },
6712
+ component(name, component) {
6713
+ {
6714
+ validateComponentName(name, context.config);
6715
+ }
6716
+ if (!component) {
6717
+ return context.components[name];
6718
+ }
6719
+ if (context.components[name]) {
6720
+ warn(`Component "${name}" has already been registered in target app.`);
6721
+ }
6722
+ context.components[name] = component;
6723
+ return app;
6724
+ },
6725
+ directive(name, directive) {
6726
+ {
6727
+ validateDirectiveName(name);
6728
+ }
6729
+ if (!directive) {
6730
+ return context.directives[name];
6731
+ }
6732
+ if (context.directives[name]) {
6733
+ warn(`Directive "${name}" has already been registered in target app.`);
6734
+ }
6735
+ context.directives[name] = directive;
6736
+ return app;
6737
+ },
6738
+ mount(rootContainer, isHydrate, isSVG) {
6739
+ if (!isMounted) {
6740
+ if (rootContainer.__vue_app__) {
6741
+ warn(
6742
+ `There is already an app instance mounted on the host container.
6743
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6744
+ );
6374
6745
  }
6746
+ const vnode = createVNode(
6747
+ rootComponent,
6748
+ rootProps
6749
+ );
6750
+ vnode.appContext = context;
6751
+ {
6752
+ context.reload = () => {
6753
+ render(cloneVNode(vnode), rootContainer, isSVG);
6754
+ };
6755
+ }
6756
+ if (isHydrate && hydrate) {
6757
+ hydrate(vnode, rootContainer);
6758
+ } else {
6759
+ render(vnode, rootContainer, isSVG);
6760
+ }
6761
+ isMounted = true;
6762
+ app._container = rootContainer;
6763
+ rootContainer.__vue_app__ = app;
6764
+ {
6765
+ app._instance = vnode.component;
6766
+ devtoolsInitApp(app, version);
6767
+ }
6768
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6769
+ } else {
6770
+ warn(
6771
+ `App has already been mounted.
6772
+ 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)\``
6773
+ );
6774
+ }
6775
+ },
6776
+ unmount() {
6777
+ if (isMounted) {
6778
+ render(null, app._container);
6779
+ {
6780
+ app._instance = null;
6781
+ devtoolsUnmountApp(app);
6782
+ }
6783
+ delete app._container.__vue_app__;
6784
+ } else {
6785
+ warn(`Cannot unmount an app that is not mounted.`);
6786
+ }
6787
+ },
6788
+ provide(key, value) {
6789
+ if (key in context.provides) {
6790
+ warn(
6791
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6792
+ );
6793
+ }
6794
+ context.provides[key] = value;
6795
+ return app;
6796
+ },
6797
+ runWithContext(fn) {
6798
+ currentApp = app;
6799
+ try {
6800
+ return fn();
6801
+ } finally {
6802
+ currentApp = null;
6375
6803
  }
6376
6804
  }
6805
+ };
6806
+ {
6807
+ installAppCompatProperties(app, context, render);
6377
6808
  }
6378
- }
6379
- const res = [normalized, needCastKeys];
6380
- if (isObject(comp)) {
6381
- cache.set(comp, res);
6382
- }
6383
- return res;
6809
+ return app;
6810
+ };
6384
6811
  }
6385
- function validatePropName(key) {
6386
- if (key[0] !== "$") {
6387
- return true;
6812
+ let currentApp = null;
6813
+
6814
+ function provide(key, value) {
6815
+ if (!currentInstance) {
6816
+ {
6817
+ warn(`provide() can only be used inside setup().`);
6818
+ }
6388
6819
  } else {
6389
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6820
+ let provides = currentInstance.provides;
6821
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6822
+ if (parentProvides === provides) {
6823
+ provides = currentInstance.provides = Object.create(parentProvides);
6824
+ }
6825
+ provides[key] = value;
6390
6826
  }
6391
- return false;
6392
6827
  }
6393
- function getType(ctor) {
6394
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6395
- return match ? match[2] : ctor === null ? "null" : "";
6396
- }
6397
- function isSameType(a, b) {
6398
- return getType(a) === getType(b);
6399
- }
6400
- function getTypeIndex(type, expectedTypes) {
6401
- if (isArray(expectedTypes)) {
6402
- return expectedTypes.findIndex((t) => isSameType(t, type));
6403
- } else if (isFunction(expectedTypes)) {
6404
- return isSameType(expectedTypes, type) ? 0 : -1;
6828
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6829
+ const instance = currentInstance || currentRenderingInstance;
6830
+ if (instance || currentApp) {
6831
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6832
+ if (provides && key in provides) {
6833
+ return provides[key];
6834
+ } else if (arguments.length > 1) {
6835
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6836
+ } else {
6837
+ warn(`injection "${String(key)}" not found.`);
6838
+ }
6839
+ } else {
6840
+ warn(`inject() can only be used inside setup() or functional components.`);
6405
6841
  }
6406
- return -1;
6407
6842
  }
6408
- function validateProps(rawProps, props, instance) {
6409
- const resolvedValues = toRaw(props);
6410
- const options = instance.propsOptions[0];
6411
- for (const key in options) {
6412
- let opt = options[key];
6413
- if (opt == null)
6414
- continue;
6415
- validateProp(
6416
- key,
6417
- resolvedValues[key],
6418
- opt,
6419
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6420
- );
6421
- }
6843
+ function hasInjectionContext() {
6844
+ return !!(currentInstance || currentRenderingInstance || currentApp);
6422
6845
  }
6423
- function validateProp(name, value, prop, isAbsent) {
6424
- const { type, required, validator, skipCheck } = prop;
6425
- if (required && isAbsent) {
6426
- warn('Missing required prop: "' + name + '"');
6427
- return;
6428
- }
6429
- if (value == null && !prop.required) {
6430
- return;
6431
- }
6432
- if (type != null && type !== true && !skipCheck) {
6433
- let isValid = false;
6434
- const types = isArray(type) ? type : [type];
6435
- const expectedTypes = [];
6436
- for (let i = 0; i < types.length && !isValid; i++) {
6437
- const { valid, expectedType } = assertType(value, types[i]);
6438
- expectedTypes.push(expectedType || "");
6439
- isValid = valid;
6440
- }
6441
- if (!isValid) {
6442
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6443
- return;
6846
+
6847
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6848
+ return new Proxy(
6849
+ {},
6850
+ {
6851
+ get(_, key) {
6852
+ warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6853
+ if (key === "$options") {
6854
+ return resolveMergedOptions(instance);
6855
+ }
6856
+ if (key in rawProps) {
6857
+ return rawProps[key];
6858
+ }
6859
+ const injections = instance.type.inject;
6860
+ if (injections) {
6861
+ if (isArray(injections)) {
6862
+ if (injections.includes(key)) {
6863
+ return inject(key);
6864
+ }
6865
+ } else if (key in injections) {
6866
+ return inject(key);
6867
+ }
6868
+ }
6869
+ }
6444
6870
  }
6445
- }
6446
- if (validator && !validator(value)) {
6447
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6448
- }
6871
+ );
6449
6872
  }
6450
- const isSimpleType = /* @__PURE__ */ makeMap(
6451
- "String,Number,Boolean,Function,Symbol,BigInt"
6452
- );
6453
- function assertType(value, type) {
6454
- let valid;
6455
- const expectedType = getType(type);
6456
- if (isSimpleType(expectedType)) {
6457
- const t = typeof value;
6458
- valid = t === expectedType.toLowerCase();
6459
- if (!valid && t === "object") {
6460
- valid = value instanceof type;
6461
- }
6462
- } else if (expectedType === "Object") {
6463
- valid = isObject(value);
6464
- } else if (expectedType === "Array") {
6465
- valid = isArray(value);
6466
- } else if (expectedType === "null") {
6467
- valid = value === null;
6468
- } else {
6469
- valid = value instanceof type;
6873
+
6874
+ function shouldSkipAttr(key, instance) {
6875
+ if (key === "is") {
6876
+ return true;
6470
6877
  }
6471
- return {
6472
- valid,
6473
- expectedType
6474
- };
6475
- }
6476
- function getInvalidTypeMessage(name, value, expectedTypes) {
6477
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6478
- const expectedType = expectedTypes[0];
6479
- const receivedType = toRawType(value);
6480
- const expectedValue = styleValue(value, expectedType);
6481
- const receivedValue = styleValue(value, receivedType);
6482
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6483
- message += ` with value ${expectedValue}`;
6878
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6879
+ return true;
6484
6880
  }
6485
- message += `, got ${receivedType} `;
6486
- if (isExplicable(receivedType)) {
6487
- message += `with value ${receivedValue}.`;
6881
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6882
+ return true;
6488
6883
  }
6489
- return message;
6490
- }
6491
- function styleValue(value, type) {
6492
- if (type === "String") {
6493
- return `"${value}"`;
6494
- } else if (type === "Number") {
6495
- return `${Number(value)}`;
6496
- } else {
6497
- return `${value}`;
6884
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6885
+ return true;
6498
6886
  }
6499
- }
6500
- function isExplicable(type) {
6501
- const explicitTypes = ["string", "number", "boolean"];
6502
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6503
- }
6504
- function isBoolean(...args) {
6505
- return args.some((elem) => elem.toLowerCase() === "boolean");
6887
+ return false;
6506
6888
  }
6507
6889
 
6508
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6509
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6510
- const normalizeSlot = (key, rawSlot, ctx) => {
6511
- if (rawSlot._n) {
6512
- return rawSlot;
6513
- }
6514
- const normalized = withCtx((...args) => {
6515
- if (currentInstance) {
6516
- warn(
6517
- `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.`
6518
- );
6519
- }
6520
- return normalizeSlotValue(rawSlot(...args));
6521
- }, ctx);
6522
- normalized._c = false;
6523
- return normalized;
6524
- };
6525
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6526
- const ctx = rawSlots._ctx;
6527
- for (const key in rawSlots) {
6528
- if (isInternalKey(key))
6529
- continue;
6530
- const value = rawSlots[key];
6531
- if (isFunction(value)) {
6532
- slots[key] = normalizeSlot(key, value, ctx);
6533
- } else if (value != null) {
6534
- if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6535
- warn(
6536
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6537
- );
6538
- }
6539
- const normalized = normalizeSlotValue(value);
6540
- slots[key] = () => normalized;
6890
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6891
+ const props = {};
6892
+ const attrs = {};
6893
+ def(attrs, InternalObjectKey, 1);
6894
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6895
+ setFullProps(instance, rawProps, props, attrs);
6896
+ for (const key in instance.propsOptions[0]) {
6897
+ if (!(key in props)) {
6898
+ props[key] = void 0;
6541
6899
  }
6542
6900
  }
6543
- };
6544
- const normalizeVNodeSlots = (instance, children) => {
6545
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6546
- warn(
6547
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6548
- );
6901
+ {
6902
+ validateProps(rawProps || {}, props, instance);
6549
6903
  }
6550
- const normalized = normalizeSlotValue(children);
6551
- instance.slots.default = () => normalized;
6552
- };
6553
- const initSlots = (instance, children) => {
6554
- if (instance.vnode.shapeFlag & 32) {
6555
- const type = children._;
6556
- if (type) {
6557
- instance.slots = toRaw(children);
6558
- def(children, "_", type);
6559
- } else {
6560
- normalizeObjectSlots(
6561
- children,
6562
- instance.slots = {},
6563
- instance
6564
- );
6565
- }
6904
+ if (isStateful) {
6905
+ instance.props = isSSR ? props : shallowReactive(props);
6566
6906
  } else {
6567
- instance.slots = {};
6568
- if (children) {
6569
- normalizeVNodeSlots(instance, children);
6907
+ if (!instance.type.props) {
6908
+ instance.props = attrs;
6909
+ } else {
6910
+ instance.props = props;
6570
6911
  }
6571
6912
  }
6572
- def(instance.slots, InternalObjectKey, 1);
6573
- };
6574
- const updateSlots = (instance, children, optimized) => {
6575
- const { vnode, slots } = instance;
6576
- let needDeletionCheck = true;
6577
- let deletionComparisonTarget = EMPTY_OBJ;
6578
- if (vnode.shapeFlag & 32) {
6579
- const type = children._;
6580
- if (type) {
6581
- if (isHmrUpdating) {
6582
- extend(slots, children);
6583
- } else if (optimized && type === 1) {
6584
- needDeletionCheck = false;
6585
- } else {
6586
- extend(slots, children);
6587
- if (!optimized && type === 1) {
6588
- delete slots._;
6913
+ instance.attrs = attrs;
6914
+ }
6915
+ function isInHmrContext(instance) {
6916
+ while (instance) {
6917
+ if (instance.type.__hmrId)
6918
+ return true;
6919
+ instance = instance.parent;
6920
+ }
6921
+ }
6922
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6923
+ const {
6924
+ props,
6925
+ attrs,
6926
+ vnode: { patchFlag }
6927
+ } = instance;
6928
+ const rawCurrentProps = toRaw(props);
6929
+ const [options] = instance.propsOptions;
6930
+ let hasAttrsChanged = false;
6931
+ if (
6932
+ // always force full diff in dev
6933
+ // - #1942 if hmr is enabled with sfc component
6934
+ // - vite#872 non-sfc component used by sfc component
6935
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6936
+ ) {
6937
+ if (patchFlag & 8) {
6938
+ const propsToUpdate = instance.vnode.dynamicProps;
6939
+ for (let i = 0; i < propsToUpdate.length; i++) {
6940
+ let key = propsToUpdate[i];
6941
+ if (isEmitListener(instance.emitsOptions, key)) {
6942
+ continue;
6943
+ }
6944
+ const value = rawProps[key];
6945
+ if (options) {
6946
+ if (hasOwn(attrs, key)) {
6947
+ if (value !== attrs[key]) {
6948
+ attrs[key] = value;
6949
+ hasAttrsChanged = true;
6950
+ }
6951
+ } else {
6952
+ const camelizedKey = camelize(key);
6953
+ props[camelizedKey] = resolvePropValue(
6954
+ options,
6955
+ rawCurrentProps,
6956
+ camelizedKey,
6957
+ value,
6958
+ instance,
6959
+ false
6960
+ /* isAbsent */
6961
+ );
6962
+ }
6963
+ } else {
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 (value !== attrs[key]) {
6972
+ attrs[key] = value;
6973
+ hasAttrsChanged = true;
6974
+ }
6589
6975
  }
6590
6976
  }
6591
- } else {
6592
- needDeletionCheck = !children.$stable;
6593
- normalizeObjectSlots(children, slots, instance);
6594
6977
  }
6595
- deletionComparisonTarget = children;
6596
- } else if (children) {
6597
- normalizeVNodeSlots(instance, children);
6598
- deletionComparisonTarget = { default: 1 };
6599
- }
6600
- if (needDeletionCheck) {
6601
- for (const key in slots) {
6602
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6603
- delete slots[key];
6978
+ } else {
6979
+ if (setFullProps(instance, rawProps, props, attrs)) {
6980
+ hasAttrsChanged = true;
6981
+ }
6982
+ let kebabKey;
6983
+ for (const key in rawCurrentProps) {
6984
+ if (!rawProps || // for camelCase
6985
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6986
+ // and converted to camelCase (#955)
6987
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6988
+ if (options) {
6989
+ if (rawPrevProps && // for camelCase
6990
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6991
+ rawPrevProps[kebabKey] !== void 0)) {
6992
+ props[key] = resolvePropValue(
6993
+ options,
6994
+ rawCurrentProps,
6995
+ key,
6996
+ void 0,
6997
+ instance,
6998
+ true
6999
+ /* isAbsent */
7000
+ );
7001
+ }
7002
+ } else {
7003
+ delete props[key];
7004
+ }
6604
7005
  }
6605
7006
  }
6606
- }
6607
- };
6608
-
6609
- function installLegacyConfigWarnings(config) {
6610
- const legacyConfigOptions = {
6611
- silent: "CONFIG_SILENT",
6612
- devtools: "CONFIG_DEVTOOLS",
6613
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6614
- keyCodes: "CONFIG_KEY_CODES",
6615
- productionTip: "CONFIG_PRODUCTION_TIP"
6616
- };
6617
- Object.keys(legacyConfigOptions).forEach((key) => {
6618
- let val = config[key];
6619
- Object.defineProperty(config, key, {
6620
- enumerable: true,
6621
- get() {
6622
- return val;
6623
- },
6624
- set(newVal) {
6625
- if (!isCopyingConfig) {
6626
- warnDeprecation$1(legacyConfigOptions[key], null);
7007
+ if (attrs !== rawCurrentProps) {
7008
+ for (const key in attrs) {
7009
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
7010
+ delete attrs[key];
7011
+ hasAttrsChanged = true;
6627
7012
  }
6628
- val = newVal;
6629
7013
  }
6630
- });
6631
- });
7014
+ }
7015
+ }
7016
+ if (hasAttrsChanged) {
7017
+ trigger(instance, "set", "$attrs");
7018
+ }
7019
+ {
7020
+ validateProps(rawProps || {}, props, instance);
7021
+ }
6632
7022
  }
6633
- function installLegacyOptionMergeStrats(config) {
6634
- config.optionMergeStrategies = new Proxy({}, {
6635
- get(target, key) {
6636
- if (key in target) {
6637
- return target[key];
7023
+ function setFullProps(instance, rawProps, props, attrs) {
7024
+ const [options, needCastKeys] = instance.propsOptions;
7025
+ let hasAttrsChanged = false;
7026
+ let rawCastValues;
7027
+ if (rawProps) {
7028
+ for (let key in rawProps) {
7029
+ if (isReservedProp(key)) {
7030
+ continue;
6638
7031
  }
6639
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6640
- "CONFIG_OPTION_MERGE_STRATS",
6641
- null
6642
- )) {
6643
- return internalOptionMergeStrats[key];
7032
+ {
7033
+ if (key.startsWith("onHook:")) {
7034
+ softAssertCompatEnabled(
7035
+ "INSTANCE_EVENT_HOOKS",
7036
+ instance,
7037
+ key.slice(2).toLowerCase()
7038
+ );
7039
+ }
7040
+ if (key === "inline-template") {
7041
+ continue;
7042
+ }
7043
+ }
7044
+ const value = rawProps[key];
7045
+ let camelKey;
7046
+ if (options && hasOwn(options, camelKey = camelize(key))) {
7047
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
7048
+ props[camelKey] = value;
7049
+ } else {
7050
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
7051
+ }
7052
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
7053
+ {
7054
+ if (isOn(key) && key.endsWith("Native")) {
7055
+ key = key.slice(0, -6);
7056
+ } else if (shouldSkipAttr(key, instance)) {
7057
+ continue;
7058
+ }
7059
+ }
7060
+ if (!(key in attrs) || value !== attrs[key]) {
7061
+ attrs[key] = value;
7062
+ hasAttrsChanged = true;
7063
+ }
6644
7064
  }
6645
7065
  }
6646
- });
7066
+ }
7067
+ if (needCastKeys) {
7068
+ const rawCurrentProps = toRaw(props);
7069
+ const castValues = rawCastValues || EMPTY_OBJ;
7070
+ for (let i = 0; i < needCastKeys.length; i++) {
7071
+ const key = needCastKeys[i];
7072
+ props[key] = resolvePropValue(
7073
+ options,
7074
+ rawCurrentProps,
7075
+ key,
7076
+ castValues[key],
7077
+ instance,
7078
+ !hasOwn(castValues, key)
7079
+ );
7080
+ }
7081
+ }
7082
+ return hasAttrsChanged;
6647
7083
  }
6648
-
6649
- let isCopyingConfig = false;
6650
- let singletonApp;
6651
- let singletonCtor;
6652
- function createCompatVue$1(createApp, createSingletonApp) {
6653
- singletonApp = createSingletonApp({});
6654
- const Vue = singletonCtor = function Vue2(options = {}) {
6655
- return createCompatApp(options, Vue2);
6656
- };
6657
- function createCompatApp(options = {}, Ctor) {
6658
- assertCompatEnabled("GLOBAL_MOUNT", null);
6659
- const { data } = options;
6660
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6661
- options.data = () => data;
7084
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7085
+ const opt = options[key];
7086
+ if (opt != null) {
7087
+ const hasDefault = hasOwn(opt, "default");
7088
+ if (hasDefault && value === void 0) {
7089
+ const defaultValue = opt.default;
7090
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
7091
+ const { propsDefaults } = instance;
7092
+ if (key in propsDefaults) {
7093
+ value = propsDefaults[key];
7094
+ } else {
7095
+ setCurrentInstance(instance);
7096
+ value = propsDefaults[key] = defaultValue.call(
7097
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7098
+ props
7099
+ );
7100
+ unsetCurrentInstance();
7101
+ }
7102
+ } else {
7103
+ value = defaultValue;
7104
+ }
6662
7105
  }
6663
- const app = createApp(options);
6664
- if (Ctor !== Vue) {
6665
- applySingletonPrototype(app, Ctor);
6666
- }
6667
- const vm = app._createRoot(options);
6668
- if (options.el) {
6669
- return vm.$mount(options.el);
6670
- } else {
6671
- return vm;
7106
+ if (opt[0 /* shouldCast */]) {
7107
+ if (isAbsent && !hasDefault) {
7108
+ value = false;
7109
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
7110
+ value = true;
7111
+ }
6672
7112
  }
6673
7113
  }
6674
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.8"}`;
6675
- Vue.config = singletonApp.config;
6676
- Vue.use = (p, ...options) => {
6677
- if (p && isFunction(p.install)) {
6678
- p.install(Vue, ...options);
6679
- } else if (isFunction(p)) {
6680
- p(Vue, ...options);
6681
- }
6682
- return Vue;
6683
- };
6684
- Vue.mixin = (m) => {
6685
- singletonApp.mixin(m);
6686
- return Vue;
6687
- };
6688
- Vue.component = (name, comp) => {
6689
- if (comp) {
6690
- singletonApp.component(name, comp);
6691
- return Vue;
6692
- } else {
6693
- return singletonApp.component(name);
7114
+ return value;
7115
+ }
7116
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
7117
+ const cache = appContext.propsCache;
7118
+ const cached = cache.get(comp);
7119
+ if (cached) {
7120
+ return cached;
7121
+ }
7122
+ const raw = comp.props;
7123
+ const normalized = {};
7124
+ const needCastKeys = [];
7125
+ let hasExtends = false;
7126
+ if (!isFunction(comp)) {
7127
+ const extendProps = (raw2) => {
7128
+ if (isFunction(raw2)) {
7129
+ raw2 = raw2.options;
7130
+ }
7131
+ hasExtends = true;
7132
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
7133
+ extend(normalized, props);
7134
+ if (keys)
7135
+ needCastKeys.push(...keys);
7136
+ };
7137
+ if (!asMixin && appContext.mixins.length) {
7138
+ appContext.mixins.forEach(extendProps);
6694
7139
  }
6695
- };
6696
- Vue.directive = (name, dir) => {
6697
- if (dir) {
6698
- singletonApp.directive(name, dir);
6699
- return Vue;
6700
- } else {
6701
- return singletonApp.directive(name);
7140
+ if (comp.extends) {
7141
+ extendProps(comp.extends);
6702
7142
  }
6703
- };
6704
- Vue.options = { _base: Vue };
6705
- let cid = 1;
6706
- Vue.cid = cid;
6707
- Vue.nextTick = nextTick;
6708
- const extendCache = /* @__PURE__ */ new WeakMap();
6709
- function extendCtor(extendOptions = {}) {
6710
- assertCompatEnabled("GLOBAL_EXTEND", null);
6711
- if (isFunction(extendOptions)) {
6712
- extendOptions = extendOptions.options;
7143
+ if (comp.mixins) {
7144
+ comp.mixins.forEach(extendProps);
6713
7145
  }
6714
- if (extendCache.has(extendOptions)) {
6715
- return extendCache.get(extendOptions);
7146
+ }
7147
+ if (!raw && !hasExtends) {
7148
+ if (isObject(comp)) {
7149
+ cache.set(comp, EMPTY_ARR);
6716
7150
  }
6717
- const Super = this;
6718
- function SubVue(inlineOptions) {
6719
- if (!inlineOptions) {
6720
- return createCompatApp(SubVue.options, SubVue);
6721
- } else {
6722
- return createCompatApp(
6723
- mergeOptions(
6724
- extend({}, SubVue.options),
6725
- inlineOptions,
6726
- internalOptionMergeStrats
6727
- ),
6728
- SubVue
6729
- );
7151
+ return EMPTY_ARR;
7152
+ }
7153
+ if (isArray(raw)) {
7154
+ for (let i = 0; i < raw.length; i++) {
7155
+ if (!isString(raw[i])) {
7156
+ warn(`props must be strings when using array syntax.`, raw[i]);
7157
+ }
7158
+ const normalizedKey = camelize(raw[i]);
7159
+ if (validatePropName(normalizedKey)) {
7160
+ normalized[normalizedKey] = EMPTY_OBJ;
6730
7161
  }
6731
7162
  }
6732
- SubVue.super = Super;
6733
- SubVue.prototype = Object.create(Vue.prototype);
6734
- SubVue.prototype.constructor = SubVue;
6735
- const mergeBase = {};
6736
- for (const key in Super.options) {
6737
- const superValue = Super.options[key];
6738
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
7163
+ } else if (raw) {
7164
+ if (!isObject(raw)) {
7165
+ warn(`invalid props options`, raw);
6739
7166
  }
6740
- SubVue.options = mergeOptions(
6741
- mergeBase,
6742
- extendOptions,
6743
- internalOptionMergeStrats
7167
+ for (const key in raw) {
7168
+ const normalizedKey = camelize(key);
7169
+ if (validatePropName(normalizedKey)) {
7170
+ const opt = raw[key];
7171
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
7172
+ if (prop) {
7173
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
7174
+ const stringIndex = getTypeIndex(String, prop.type);
7175
+ prop[0 /* shouldCast */] = booleanIndex > -1;
7176
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
7177
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
7178
+ needCastKeys.push(normalizedKey);
7179
+ }
7180
+ }
7181
+ }
7182
+ }
7183
+ }
7184
+ const res = [normalized, needCastKeys];
7185
+ if (isObject(comp)) {
7186
+ cache.set(comp, res);
7187
+ }
7188
+ return res;
7189
+ }
7190
+ function validatePropName(key) {
7191
+ if (key[0] !== "$") {
7192
+ return true;
7193
+ } else {
7194
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
7195
+ }
7196
+ return false;
7197
+ }
7198
+ function getType(ctor) {
7199
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7200
+ return match ? match[2] : ctor === null ? "null" : "";
7201
+ }
7202
+ function isSameType(a, b) {
7203
+ return getType(a) === getType(b);
7204
+ }
7205
+ function getTypeIndex(type, expectedTypes) {
7206
+ if (isArray(expectedTypes)) {
7207
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7208
+ } else if (isFunction(expectedTypes)) {
7209
+ return isSameType(expectedTypes, type) ? 0 : -1;
7210
+ }
7211
+ return -1;
7212
+ }
7213
+ function validateProps(rawProps, props, instance) {
7214
+ const resolvedValues = toRaw(props);
7215
+ const options = instance.propsOptions[0];
7216
+ for (const key in options) {
7217
+ let opt = options[key];
7218
+ if (opt == null)
7219
+ continue;
7220
+ validateProp(
7221
+ key,
7222
+ resolvedValues[key],
7223
+ opt,
7224
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6744
7225
  );
6745
- SubVue.options._base = SubVue;
6746
- SubVue.extend = extendCtor.bind(SubVue);
6747
- SubVue.mixin = Super.mixin;
6748
- SubVue.use = Super.use;
6749
- SubVue.cid = ++cid;
6750
- extendCache.set(extendOptions, SubVue);
6751
- return SubVue;
6752
7226
  }
6753
- Vue.extend = extendCtor.bind(Vue);
6754
- Vue.set = (target, key, value) => {
6755
- assertCompatEnabled("GLOBAL_SET", null);
6756
- target[key] = value;
6757
- };
6758
- Vue.delete = (target, key) => {
6759
- assertCompatEnabled("GLOBAL_DELETE", null);
6760
- delete target[key];
6761
- };
6762
- Vue.observable = (target) => {
6763
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6764
- return reactive(target);
6765
- };
6766
- Vue.filter = (name, filter) => {
6767
- if (filter) {
6768
- singletonApp.filter(name, filter);
6769
- return Vue;
6770
- } else {
6771
- return singletonApp.filter(name);
6772
- }
6773
- };
6774
- const util = {
6775
- warn: warn ,
6776
- extend,
6777
- mergeOptions: (parent, child, vm) => mergeOptions(
6778
- parent,
6779
- child,
6780
- vm ? void 0 : internalOptionMergeStrats
6781
- ),
6782
- defineReactive
6783
- };
6784
- Object.defineProperty(Vue, "util", {
6785
- get() {
6786
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6787
- return util;
6788
- }
6789
- });
6790
- Vue.configureCompat = configureCompat$1;
6791
- return Vue;
6792
7227
  }
6793
- function installAppCompatProperties(app, context, render) {
6794
- installFilterMethod(app, context);
6795
- installLegacyOptionMergeStrats(app.config);
6796
- if (!singletonApp) {
7228
+ function validateProp(name, value, prop, isAbsent) {
7229
+ const { type, required, validator, skipCheck } = prop;
7230
+ if (required && isAbsent) {
7231
+ warn('Missing required prop: "' + name + '"');
6797
7232
  return;
6798
7233
  }
6799
- installCompatMount(app, context, render);
6800
- installLegacyAPIs(app);
6801
- applySingletonAppMutations(app);
6802
- installLegacyConfigWarnings(app.config);
6803
- }
6804
- function installFilterMethod(app, context) {
6805
- context.filters = {};
6806
- app.filter = (name, filter) => {
6807
- assertCompatEnabled("FILTERS", null);
6808
- if (!filter) {
6809
- return context.filters[name];
7234
+ if (value == null && !required) {
7235
+ return;
7236
+ }
7237
+ if (type != null && type !== true && !skipCheck) {
7238
+ let isValid = false;
7239
+ const types = isArray(type) ? type : [type];
7240
+ const expectedTypes = [];
7241
+ for (let i = 0; i < types.length && !isValid; i++) {
7242
+ const { valid, expectedType } = assertType(value, types[i]);
7243
+ expectedTypes.push(expectedType || "");
7244
+ isValid = valid;
6810
7245
  }
6811
- if (context.filters[name]) {
6812
- warn(`Filter "${name}" has already been registered.`);
7246
+ if (!isValid) {
7247
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7248
+ return;
6813
7249
  }
6814
- context.filters[name] = filter;
6815
- return app;
6816
- };
7250
+ }
7251
+ if (validator && !validator(value)) {
7252
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
7253
+ }
6817
7254
  }
6818
- function installLegacyAPIs(app) {
6819
- Object.defineProperties(app, {
6820
- // so that app.use() can work with legacy plugins that extend prototypes
6821
- prototype: {
6822
- get() {
6823
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6824
- return app.config.globalProperties;
6825
- }
6826
- },
6827
- nextTick: { value: nextTick },
6828
- extend: { value: singletonCtor.extend },
6829
- set: { value: singletonCtor.set },
6830
- delete: { value: singletonCtor.delete },
6831
- observable: { value: singletonCtor.observable },
6832
- util: {
6833
- get() {
6834
- return singletonCtor.util;
6835
- }
6836
- }
6837
- });
6838
- }
6839
- function applySingletonAppMutations(app) {
6840
- app._context.mixins = [...singletonApp._context.mixins];
6841
- ["components", "directives", "filters"].forEach((key) => {
6842
- app._context[key] = Object.create(singletonApp._context[key]);
6843
- });
6844
- isCopyingConfig = true;
6845
- for (const key in singletonApp.config) {
6846
- if (key === "isNativeTag")
6847
- continue;
6848
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6849
- continue;
6850
- }
6851
- const val = singletonApp.config[key];
6852
- app.config[key] = isObject(val) ? Object.create(val) : val;
6853
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6854
- app.config.compilerOptions.isCustomElement = (tag) => {
6855
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6856
- };
6857
- }
6858
- }
6859
- isCopyingConfig = false;
6860
- applySingletonPrototype(app, singletonCtor);
6861
- }
6862
- function applySingletonPrototype(app, Ctor) {
6863
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6864
- if (enabled) {
6865
- app.config.globalProperties = Object.create(Ctor.prototype);
6866
- }
6867
- let hasPrototypeAugmentations = false;
6868
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6869
- for (const key in descriptors) {
6870
- if (key !== "constructor") {
6871
- hasPrototypeAugmentations = true;
6872
- if (enabled) {
6873
- Object.defineProperty(
6874
- app.config.globalProperties,
6875
- key,
6876
- descriptors[key]
6877
- );
6878
- }
6879
- }
6880
- }
6881
- if (hasPrototypeAugmentations) {
6882
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6883
- }
6884
- }
6885
- function installCompatMount(app, context, render) {
6886
- let isMounted = false;
6887
- app._createRoot = (options) => {
6888
- const component = app._component;
6889
- const vnode = createVNode(component, options.propsData || null);
6890
- vnode.appContext = context;
6891
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6892
- const emptyRender = () => {
6893
- };
6894
- const instance = createComponentInstance(vnode, null, null);
6895
- if (hasNoRender) {
6896
- instance.render = emptyRender;
6897
- }
6898
- setupComponent(instance);
6899
- vnode.component = instance;
6900
- vnode.isCompatRoot = true;
6901
- instance.ctx._compat_mount = (selectorOrEl) => {
6902
- if (isMounted) {
6903
- warn(`Root instance is already mounted.`);
6904
- return;
6905
- }
6906
- let container;
6907
- if (typeof selectorOrEl === "string") {
6908
- const result = document.querySelector(selectorOrEl);
6909
- if (!result) {
6910
- warn(
6911
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6912
- );
6913
- return;
6914
- }
6915
- container = result;
6916
- } else {
6917
- container = selectorOrEl || document.createElement("div");
6918
- }
6919
- const isSVG = container instanceof SVGElement;
6920
- {
6921
- context.reload = () => {
6922
- const cloned = cloneVNode(vnode);
6923
- cloned.component = null;
6924
- render(cloned, container, isSVG);
6925
- };
6926
- }
6927
- if (hasNoRender && instance.render === emptyRender) {
6928
- {
6929
- for (let i = 0; i < container.attributes.length; i++) {
6930
- const attr = container.attributes[i];
6931
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6932
- warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6933
- break;
6934
- }
6935
- }
6936
- }
6937
- instance.render = null;
6938
- component.template = container.innerHTML;
6939
- finishComponentSetup(
6940
- instance,
6941
- false,
6942
- true
6943
- /* skip options */
6944
- );
6945
- }
6946
- container.innerHTML = "";
6947
- render(vnode, container, isSVG);
6948
- if (container instanceof Element) {
6949
- container.removeAttribute("v-cloak");
6950
- container.setAttribute("data-v-app", "");
6951
- }
6952
- isMounted = true;
6953
- app._container = container;
6954
- container.__vue_app__ = app;
6955
- {
6956
- devtoolsInitApp(app, version);
6957
- }
6958
- return instance.proxy;
6959
- };
6960
- instance.ctx._compat_destroy = () => {
6961
- if (isMounted) {
6962
- render(null, app._container);
6963
- {
6964
- devtoolsUnmountApp(app);
6965
- }
6966
- delete app._container.__vue_app__;
6967
- } else {
6968
- const { bum, scope, um } = instance;
6969
- if (bum) {
6970
- invokeArrayFns(bum);
6971
- }
6972
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6973
- instance.emit("hook:beforeDestroy");
6974
- }
6975
- if (scope) {
6976
- scope.stop();
6977
- }
6978
- if (um) {
6979
- invokeArrayFns(um);
6980
- }
6981
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6982
- instance.emit("hook:destroyed");
6983
- }
6984
- }
6985
- };
6986
- return instance.proxy;
6987
- };
6988
- }
6989
- const methodsToPatch = [
6990
- "push",
6991
- "pop",
6992
- "shift",
6993
- "unshift",
6994
- "splice",
6995
- "sort",
6996
- "reverse"
6997
- ];
6998
- const patched = /* @__PURE__ */ new WeakSet();
6999
- function defineReactive(obj, key, val) {
7000
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
7001
- const reactiveVal = reactive(val);
7002
- if (isArray(val)) {
7003
- methodsToPatch.forEach((m) => {
7004
- val[m] = (...args) => {
7005
- Array.prototype[m].call(reactiveVal, ...args);
7006
- };
7007
- });
7008
- } else {
7009
- Object.keys(val).forEach((key2) => {
7010
- try {
7011
- defineReactiveSimple(val, key2, val[key2]);
7012
- } catch (e) {
7013
- }
7014
- });
7255
+ const isSimpleType = /* @__PURE__ */ makeMap(
7256
+ "String,Number,Boolean,Function,Symbol,BigInt"
7257
+ );
7258
+ function assertType(value, type) {
7259
+ let valid;
7260
+ const expectedType = getType(type);
7261
+ if (isSimpleType(expectedType)) {
7262
+ const t = typeof value;
7263
+ valid = t === expectedType.toLowerCase();
7264
+ if (!valid && t === "object") {
7265
+ valid = value instanceof type;
7015
7266
  }
7016
- }
7017
- const i = obj.$;
7018
- if (i && obj === i.proxy) {
7019
- defineReactiveSimple(i.ctx, key, val);
7020
- i.accessCache = /* @__PURE__ */ Object.create(null);
7021
- } else if (isReactive(obj)) {
7022
- obj[key] = val;
7267
+ } else if (expectedType === "Object") {
7268
+ valid = isObject(value);
7269
+ } else if (expectedType === "Array") {
7270
+ valid = isArray(value);
7271
+ } else if (expectedType === "null") {
7272
+ valid = value === null;
7023
7273
  } else {
7024
- defineReactiveSimple(obj, key, val);
7274
+ valid = value instanceof type;
7025
7275
  }
7026
- }
7027
- function defineReactiveSimple(obj, key, val) {
7028
- val = isObject(val) ? reactive(val) : val;
7029
- Object.defineProperty(obj, key, {
7030
- enumerable: true,
7031
- configurable: true,
7032
- get() {
7033
- track(obj, "get", key);
7034
- return val;
7035
- },
7036
- set(newVal) {
7037
- val = isObject(newVal) ? reactive(newVal) : newVal;
7038
- trigger(obj, "set", key, newVal);
7039
- }
7040
- });
7041
- }
7042
-
7043
- function createAppContext() {
7044
7276
  return {
7045
- app: null,
7046
- config: {
7047
- isNativeTag: NO,
7048
- performance: false,
7049
- globalProperties: {},
7050
- optionMergeStrategies: {},
7051
- errorHandler: void 0,
7052
- warnHandler: void 0,
7053
- compilerOptions: {}
7054
- },
7055
- mixins: [],
7056
- components: {},
7057
- directives: {},
7058
- provides: /* @__PURE__ */ Object.create(null),
7059
- optionsCache: /* @__PURE__ */ new WeakMap(),
7060
- propsCache: /* @__PURE__ */ new WeakMap(),
7061
- emitsCache: /* @__PURE__ */ new WeakMap()
7277
+ valid,
7278
+ expectedType
7062
7279
  };
7063
7280
  }
7064
- let uid$1 = 0;
7065
- function createAppAPI(render, hydrate) {
7066
- return function createApp(rootComponent, rootProps = null) {
7067
- if (!isFunction(rootComponent)) {
7068
- rootComponent = extend({}, rootComponent);
7069
- }
7070
- if (rootProps != null && !isObject(rootProps)) {
7071
- warn(`root props passed to app.mount() must be an object.`);
7072
- rootProps = null;
7073
- }
7074
- const context = createAppContext();
7075
- const installedPlugins = /* @__PURE__ */ new Set();
7076
- let isMounted = false;
7077
- const app = context.app = {
7078
- _uid: uid$1++,
7079
- _component: rootComponent,
7080
- _props: rootProps,
7081
- _container: null,
7082
- _context: context,
7083
- _instance: null,
7084
- version,
7085
- get config() {
7086
- return context.config;
7087
- },
7088
- set config(v) {
7089
- {
7090
- warn(
7091
- `app.config cannot be replaced. Modify individual options instead.`
7092
- );
7093
- }
7094
- },
7095
- use(plugin, ...options) {
7096
- if (installedPlugins.has(plugin)) {
7097
- warn(`Plugin has already been applied to target app.`);
7098
- } else if (plugin && isFunction(plugin.install)) {
7099
- installedPlugins.add(plugin);
7100
- plugin.install(app, ...options);
7101
- } else if (isFunction(plugin)) {
7102
- installedPlugins.add(plugin);
7103
- plugin(app, ...options);
7104
- } else {
7105
- warn(
7106
- `A plugin must either be a function or an object with an "install" function.`
7107
- );
7108
- }
7109
- return app;
7110
- },
7111
- mixin(mixin) {
7112
- {
7113
- if (!context.mixins.includes(mixin)) {
7114
- context.mixins.push(mixin);
7115
- } else {
7116
- warn(
7117
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7118
- );
7119
- }
7120
- }
7121
- return app;
7122
- },
7123
- component(name, component) {
7124
- {
7125
- validateComponentName(name, context.config);
7126
- }
7127
- if (!component) {
7128
- return context.components[name];
7129
- }
7130
- if (context.components[name]) {
7131
- warn(`Component "${name}" has already been registered in target app.`);
7132
- }
7133
- context.components[name] = component;
7134
- return app;
7135
- },
7136
- directive(name, directive) {
7137
- {
7138
- validateDirectiveName(name);
7139
- }
7140
- if (!directive) {
7141
- return context.directives[name];
7142
- }
7143
- if (context.directives[name]) {
7144
- warn(`Directive "${name}" has already been registered in target app.`);
7145
- }
7146
- context.directives[name] = directive;
7147
- return app;
7148
- },
7149
- mount(rootContainer, isHydrate, isSVG) {
7150
- if (!isMounted) {
7151
- if (rootContainer.__vue_app__) {
7152
- warn(
7153
- `There is already an app instance mounted on the host container.
7154
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7155
- );
7156
- }
7157
- const vnode = createVNode(
7158
- rootComponent,
7159
- rootProps
7160
- );
7161
- vnode.appContext = context;
7162
- {
7163
- context.reload = () => {
7164
- render(cloneVNode(vnode), rootContainer, isSVG);
7165
- };
7166
- }
7167
- if (isHydrate && hydrate) {
7168
- hydrate(vnode, rootContainer);
7169
- } else {
7170
- render(vnode, rootContainer, isSVG);
7171
- }
7172
- isMounted = true;
7173
- app._container = rootContainer;
7174
- rootContainer.__vue_app__ = app;
7175
- {
7176
- app._instance = vnode.component;
7177
- devtoolsInitApp(app, version);
7178
- }
7179
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7180
- } else {
7181
- warn(
7182
- `App has already been mounted.
7183
- 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)\``
7184
- );
7185
- }
7186
- },
7187
- unmount() {
7188
- if (isMounted) {
7189
- render(null, app._container);
7190
- {
7191
- app._instance = null;
7192
- devtoolsUnmountApp(app);
7193
- }
7194
- delete app._container.__vue_app__;
7195
- } else {
7196
- warn(`Cannot unmount an app that is not mounted.`);
7197
- }
7198
- },
7199
- provide(key, value) {
7200
- if (key in context.provides) {
7201
- warn(
7202
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7203
- );
7281
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7282
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7283
+ const expectedType = expectedTypes[0];
7284
+ const receivedType = toRawType(value);
7285
+ const expectedValue = styleValue(value, expectedType);
7286
+ const receivedValue = styleValue(value, receivedType);
7287
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7288
+ message += ` with value ${expectedValue}`;
7289
+ }
7290
+ message += `, got ${receivedType} `;
7291
+ if (isExplicable(receivedType)) {
7292
+ message += `with value ${receivedValue}.`;
7293
+ }
7294
+ return message;
7295
+ }
7296
+ function styleValue(value, type) {
7297
+ if (type === "String") {
7298
+ return `"${value}"`;
7299
+ } else if (type === "Number") {
7300
+ return `${Number(value)}`;
7301
+ } else {
7302
+ return `${value}`;
7303
+ }
7304
+ }
7305
+ function isExplicable(type) {
7306
+ const explicitTypes = ["string", "number", "boolean"];
7307
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7308
+ }
7309
+ function isBoolean(...args) {
7310
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7311
+ }
7312
+
7313
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7314
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7315
+ const normalizeSlot = (key, rawSlot, ctx) => {
7316
+ if (rawSlot._n) {
7317
+ return rawSlot;
7318
+ }
7319
+ const normalized = withCtx((...args) => {
7320
+ if (currentInstance) {
7321
+ warn(
7322
+ `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.`
7323
+ );
7324
+ }
7325
+ return normalizeSlotValue(rawSlot(...args));
7326
+ }, ctx);
7327
+ normalized._c = false;
7328
+ return normalized;
7329
+ };
7330
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7331
+ const ctx = rawSlots._ctx;
7332
+ for (const key in rawSlots) {
7333
+ if (isInternalKey(key))
7334
+ continue;
7335
+ const value = rawSlots[key];
7336
+ if (isFunction(value)) {
7337
+ slots[key] = normalizeSlot(key, value, ctx);
7338
+ } else if (value != null) {
7339
+ if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7340
+ warn(
7341
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7342
+ );
7343
+ }
7344
+ const normalized = normalizeSlotValue(value);
7345
+ slots[key] = () => normalized;
7346
+ }
7347
+ }
7348
+ };
7349
+ const normalizeVNodeSlots = (instance, children) => {
7350
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7351
+ warn(
7352
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7353
+ );
7354
+ }
7355
+ const normalized = normalizeSlotValue(children);
7356
+ instance.slots.default = () => normalized;
7357
+ };
7358
+ const initSlots = (instance, children) => {
7359
+ if (instance.vnode.shapeFlag & 32) {
7360
+ const type = children._;
7361
+ if (type) {
7362
+ instance.slots = toRaw(children);
7363
+ def(children, "_", type);
7364
+ } else {
7365
+ normalizeObjectSlots(
7366
+ children,
7367
+ instance.slots = {},
7368
+ instance
7369
+ );
7370
+ }
7371
+ } else {
7372
+ instance.slots = {};
7373
+ if (children) {
7374
+ normalizeVNodeSlots(instance, children);
7375
+ }
7376
+ }
7377
+ def(instance.slots, InternalObjectKey, 1);
7378
+ };
7379
+ const updateSlots = (instance, children, optimized) => {
7380
+ const { vnode, slots } = instance;
7381
+ let needDeletionCheck = true;
7382
+ let deletionComparisonTarget = EMPTY_OBJ;
7383
+ if (vnode.shapeFlag & 32) {
7384
+ const type = children._;
7385
+ if (type) {
7386
+ if (isHmrUpdating) {
7387
+ extend(slots, children);
7388
+ trigger(instance, "set", "$slots");
7389
+ } else if (optimized && type === 1) {
7390
+ needDeletionCheck = false;
7391
+ } else {
7392
+ extend(slots, children);
7393
+ if (!optimized && type === 1) {
7394
+ delete slots._;
7204
7395
  }
7205
- context.provides[key] = value;
7206
- return app;
7207
7396
  }
7208
- };
7209
- {
7210
- installAppCompatProperties(app, context, render);
7397
+ } else {
7398
+ needDeletionCheck = !children.$stable;
7399
+ normalizeObjectSlots(children, slots, instance);
7211
7400
  }
7212
- return app;
7213
- };
7214
- }
7401
+ deletionComparisonTarget = children;
7402
+ } else if (children) {
7403
+ normalizeVNodeSlots(instance, children);
7404
+ deletionComparisonTarget = { default: 1 };
7405
+ }
7406
+ if (needDeletionCheck) {
7407
+ for (const key in slots) {
7408
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7409
+ delete slots[key];
7410
+ }
7411
+ }
7412
+ }
7413
+ };
7215
7414
 
7216
7415
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7217
7416
  if (isArray(rawRef)) {
@@ -8115,7 +8314,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8115
8314
  areChildrenSVG,
8116
8315
  slotScopeIds
8117
8316
  );
8118
- if (parentComponent && parentComponent.type.__hmrId) {
8317
+ {
8119
8318
  traverseStaticChildren(n1, n2);
8120
8319
  }
8121
8320
  } else if (!optimized) {
@@ -8311,21 +8510,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8311
8510
  isSVG,
8312
8511
  slotScopeIds
8313
8512
  );
8314
- if (parentComponent && parentComponent.type.__hmrId) {
8513
+ {
8315
8514
  traverseStaticChildren(n1, n2);
8316
- } else if (
8317
- // #2080 if the stable fragment has a key, it's a <template v-for> that may
8318
- // get moved around. Make sure all root level vnodes inherit el.
8319
- // #2134 or if it's a component root, it may also get moved around
8320
- // as the component is being moved.
8321
- n2.key != null || parentComponent && n2 === parentComponent.subTree
8322
- ) {
8323
- traverseStaticChildren(
8324
- n1,
8325
- n2,
8326
- true
8327
- /* shallow */
8328
- );
8329
8515
  }
8330
8516
  } else {
8331
8517
  patchChildren(
@@ -9994,6 +10180,8 @@ function createComponentInstance(vnode, parent, suspense) {
9994
10180
  refs: EMPTY_OBJ,
9995
10181
  setupState: EMPTY_OBJ,
9996
10182
  setupContext: null,
10183
+ attrsProxy: null,
10184
+ slotsProxy: null,
9997
10185
  // suspense related
9998
10186
  suspense,
9999
10187
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -10233,8 +10421,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10233
10421
  }
10234
10422
  }
10235
10423
  }
10236
- function createAttrsProxy(instance) {
10237
- return new Proxy(
10424
+ function getAttrsProxy(instance) {
10425
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10238
10426
  instance.attrs,
10239
10427
  {
10240
10428
  get(target, key) {
@@ -10251,7 +10439,23 @@ function createAttrsProxy(instance) {
10251
10439
  return false;
10252
10440
  }
10253
10441
  }
10254
- );
10442
+ ));
10443
+ }
10444
+ function getSlotsProxy(instance) {
10445
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
10446
+ get(target, key) {
10447
+ track(instance, "get", "$slots");
10448
+ return target[key];
10449
+ },
10450
+ set() {
10451
+ warn(`setupContext.slots is readonly.`);
10452
+ return false;
10453
+ },
10454
+ deleteProperty() {
10455
+ warn(`setupContext.slots is readonly.`);
10456
+ return false;
10457
+ }
10458
+ }));
10255
10459
  }
10256
10460
  function createSetupContext(instance) {
10257
10461
  const expose = (exposed) => {
@@ -10277,14 +10481,13 @@ function createSetupContext(instance) {
10277
10481
  }
10278
10482
  instance.exposed = exposed || {};
10279
10483
  };
10280
- let attrs;
10281
10484
  {
10282
10485
  return Object.freeze({
10283
10486
  get attrs() {
10284
- return attrs || (attrs = createAttrsProxy(instance));
10487
+ return getAttrsProxy(instance);
10285
10488
  },
10286
10489
  get slots() {
10287
- return shallowReadonly(instance.slots);
10490
+ return getSlotsProxy(instance);
10288
10491
  },
10289
10492
  get emit() {
10290
10493
  return (event, ...args) => instance.emit(event, ...args);
@@ -10344,111 +10547,6 @@ const computed = (getterOrOptions, debugOptions) => {
10344
10547
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10345
10548
  };
10346
10549
 
10347
- const warnRuntimeUsage = (method) => warn(
10348
- `${method}() is a compiler-hint helper that is only usable inside <script setup> of a single file component. Its arguments should be compiled away and passing it at runtime has no effect.`
10349
- );
10350
- function defineProps() {
10351
- {
10352
- warnRuntimeUsage(`defineProps`);
10353
- }
10354
- return null;
10355
- }
10356
- function defineEmits() {
10357
- {
10358
- warnRuntimeUsage(`defineEmits`);
10359
- }
10360
- return null;
10361
- }
10362
- function defineExpose(exposed) {
10363
- {
10364
- warnRuntimeUsage(`defineExpose`);
10365
- }
10366
- }
10367
- function defineOptions(options) {
10368
- {
10369
- warnRuntimeUsage(`defineOptions`);
10370
- }
10371
- }
10372
- function defineSlots() {
10373
- {
10374
- warnRuntimeUsage(`defineSlots`);
10375
- }
10376
- }
10377
- function withDefaults(props, defaults) {
10378
- {
10379
- warnRuntimeUsage(`withDefaults`);
10380
- }
10381
- return null;
10382
- }
10383
- function useSlots() {
10384
- return getContext().slots;
10385
- }
10386
- function useAttrs() {
10387
- return getContext().attrs;
10388
- }
10389
- function getContext() {
10390
- const i = getCurrentInstance();
10391
- if (!i) {
10392
- warn(`useContext() called without active instance.`);
10393
- }
10394
- return i.setupContext || (i.setupContext = createSetupContext(i));
10395
- }
10396
- function mergeDefaults(raw, defaults) {
10397
- const props = isArray(raw) ? raw.reduce(
10398
- (normalized, p) => (normalized[p] = {}, normalized),
10399
- {}
10400
- ) : raw;
10401
- for (const key in defaults) {
10402
- if (key.startsWith("__skip"))
10403
- continue;
10404
- let opt = props[key];
10405
- if (opt) {
10406
- if (isArray(opt) || isFunction(opt)) {
10407
- opt = props[key] = { type: opt, default: defaults[key] };
10408
- } else {
10409
- opt.default = defaults[key];
10410
- }
10411
- } else if (opt === null) {
10412
- opt = props[key] = { default: defaults[key] };
10413
- } else {
10414
- warn(`props default key "${key}" has no corresponding declaration.`);
10415
- }
10416
- if (opt && defaults[`__skip_${key}`]) {
10417
- opt.skipFactory = true;
10418
- }
10419
- }
10420
- return props;
10421
- }
10422
- function createPropsRestProxy(props, excludedKeys) {
10423
- const ret = {};
10424
- for (const key in props) {
10425
- if (!excludedKeys.includes(key)) {
10426
- Object.defineProperty(ret, key, {
10427
- enumerable: true,
10428
- get: () => props[key]
10429
- });
10430
- }
10431
- }
10432
- return ret;
10433
- }
10434
- function withAsyncContext(getAwaitable) {
10435
- const ctx = getCurrentInstance();
10436
- if (!ctx) {
10437
- warn(
10438
- `withAsyncContext called without active current instance. This is likely a bug.`
10439
- );
10440
- }
10441
- let awaitable = getAwaitable();
10442
- unsetCurrentInstance();
10443
- if (isPromise(awaitable)) {
10444
- awaitable = awaitable.catch((e) => {
10445
- setCurrentInstance(ctx);
10446
- throw e;
10447
- });
10448
- }
10449
- return [awaitable, () => setCurrentInstance(ctx)];
10450
- }
10451
-
10452
10550
  function h(type, propsOrChildren, children) {
10453
10551
  const l = arguments.length;
10454
10552
  if (l === 2) {
@@ -10684,7 +10782,7 @@ function isMemoSame(cached, memo) {
10684
10782
  return true;
10685
10783
  }
10686
10784
 
10687
- const version = "3.3.0-alpha.8";
10785
+ const version = "3.3.0-beta.1";
10688
10786
  const ssrUtils = null;
10689
10787
  const resolveFilter = resolveFilter$1 ;
10690
10788
  const _compatUtils = {
@@ -12340,6 +12438,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12340
12438
  defineCustomElement: defineCustomElement,
12341
12439
  defineEmits: defineEmits,
12342
12440
  defineExpose: defineExpose,
12441
+ defineModel: defineModel,
12343
12442
  defineOptions: defineOptions,
12344
12443
  defineProps: defineProps,
12345
12444
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12353,6 +12452,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12353
12452
  guardReactiveProps: guardReactiveProps,
12354
12453
  h: h,
12355
12454
  handleError: handleError,
12455
+ hasInjectionContext: hasInjectionContext,
12356
12456
  hydrate: hydrate,
12357
12457
  initCustomFormatter: initCustomFormatter,
12358
12458
  initDirectivesForSSR: initDirectivesForSSR,
@@ -12367,6 +12467,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12367
12467
  isVNode: isVNode,
12368
12468
  markRaw: markRaw,
12369
12469
  mergeDefaults: mergeDefaults,
12470
+ mergeModels: mergeModels,
12370
12471
  mergeProps: mergeProps,
12371
12472
  nextTick: nextTick,
12372
12473
  normalizeClass: normalizeClass,
@@ -12425,6 +12526,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12425
12526
  useAttrs: useAttrs,
12426
12527
  useCssModule: useCssModule,
12427
12528
  useCssVars: useCssVars,
12529
+ useModel: useModel,
12428
12530
  useSSRContext: useSSRContext,
12429
12531
  useSlots: useSlots,
12430
12532
  useTransitionState: useTransitionState,
@@ -12552,8 +12654,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12552
12654
  [48]: `ES module mode is not supported in this build of compiler.`,
12553
12655
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12554
12656
  [50]: `"scopeId" option is only supported in module mode.`,
12657
+ // deprecations
12658
+ [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
12659
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12555
12660
  // just to fulfill types
12556
- [51]: ``
12661
+ [53]: ``
12557
12662
  };
12558
12663
 
12559
12664
  const FRAGMENT = Symbol(`Fragment` );
@@ -15919,6 +16024,11 @@ function resolveComponentType(node, context, ssr = false) {
15919
16024
  }
15920
16025
  const isDir = !isExplicitDynamic && findDir(node, "is");
15921
16026
  if (isDir && isDir.exp) {
16027
+ {
16028
+ context.onWarn(
16029
+ createCompilerError(52, isDir.loc)
16030
+ );
16031
+ }
15922
16032
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15923
16033
  isDir.exp
15924
16034
  ]);
@@ -16424,6 +16534,11 @@ const transformOn$1 = (dir, node, context, augmentor) => {
16424
16534
  if (arg.type === 4) {
16425
16535
  if (arg.isStatic) {
16426
16536
  let rawName = arg.content;
16537
+ if (rawName.startsWith("vnode")) {
16538
+ context.onWarn(
16539
+ createCompilerError(51, arg.loc)
16540
+ );
16541
+ }
16427
16542
  if (rawName.startsWith("vue:")) {
16428
16543
  rawName = `vnode-${rawName.slice(4)}`;
16429
16544
  }
@@ -16620,7 +16735,7 @@ const transformText = (node, context) => {
16620
16735
  const seen$1 = /* @__PURE__ */ new WeakSet();
16621
16736
  const transformOnce = (node, context) => {
16622
16737
  if (node.type === 1 && findDir(node, "once", true)) {
16623
- if (seen$1.has(node) || context.inVOnce) {
16738
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
16624
16739
  return;
16625
16740
  }
16626
16741
  seen$1.add(node);
@@ -17071,29 +17186,29 @@ function createDOMCompilerError(code, loc) {
17071
17186
  );
17072
17187
  }
17073
17188
  const DOMErrorMessages = {
17074
- [51]: `v-html is missing expression.`,
17075
- [52]: `v-html will override element children.`,
17076
- [53]: `v-text is missing expression.`,
17077
- [54]: `v-text will override element children.`,
17078
- [55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17079
- [56]: `v-model argument is not supported on plain elements.`,
17080
- [57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17081
- [58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17082
- [59]: `v-show is missing expression.`,
17083
- [60]: `<Transition> expects exactly one child element or component.`,
17084
- [61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17189
+ [53]: `v-html is missing expression.`,
17190
+ [54]: `v-html will override element children.`,
17191
+ [55]: `v-text is missing expression.`,
17192
+ [56]: `v-text will override element children.`,
17193
+ [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17194
+ [58]: `v-model argument is not supported on plain elements.`,
17195
+ [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17196
+ [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17197
+ [61]: `v-show is missing expression.`,
17198
+ [62]: `<Transition> expects exactly one child element or component.`,
17199
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17085
17200
  };
17086
17201
 
17087
17202
  const transformVHtml = (dir, node, context) => {
17088
17203
  const { exp, loc } = dir;
17089
17204
  if (!exp) {
17090
17205
  context.onError(
17091
- createDOMCompilerError(51, loc)
17206
+ createDOMCompilerError(53, loc)
17092
17207
  );
17093
17208
  }
17094
17209
  if (node.children.length) {
17095
17210
  context.onError(
17096
- createDOMCompilerError(52, loc)
17211
+ createDOMCompilerError(54, loc)
17097
17212
  );
17098
17213
  node.children.length = 0;
17099
17214
  }
@@ -17111,12 +17226,12 @@ const transformVText = (dir, node, context) => {
17111
17226
  const { exp, loc } = dir;
17112
17227
  if (!exp) {
17113
17228
  context.onError(
17114
- createDOMCompilerError(53, loc)
17229
+ createDOMCompilerError(55, loc)
17115
17230
  );
17116
17231
  }
17117
17232
  if (node.children.length) {
17118
17233
  context.onError(
17119
- createDOMCompilerError(54, loc)
17234
+ createDOMCompilerError(56, loc)
17120
17235
  );
17121
17236
  node.children.length = 0;
17122
17237
  }
@@ -17142,7 +17257,7 @@ const transformModel = (dir, node, context) => {
17142
17257
  if (dir.arg) {
17143
17258
  context.onError(
17144
17259
  createDOMCompilerError(
17145
- 56,
17260
+ 58,
17146
17261
  dir.arg.loc
17147
17262
  )
17148
17263
  );
@@ -17152,7 +17267,7 @@ const transformModel = (dir, node, context) => {
17152
17267
  if (value) {
17153
17268
  context.onError(
17154
17269
  createDOMCompilerError(
17155
- 58,
17270
+ 60,
17156
17271
  value.loc
17157
17272
  )
17158
17273
  );
@@ -17180,7 +17295,7 @@ const transformModel = (dir, node, context) => {
17180
17295
  isInvalidType = true;
17181
17296
  context.onError(
17182
17297
  createDOMCompilerError(
17183
- 57,
17298
+ 59,
17184
17299
  dir.loc
17185
17300
  )
17186
17301
  );
@@ -17206,7 +17321,7 @@ const transformModel = (dir, node, context) => {
17206
17321
  } else {
17207
17322
  context.onError(
17208
17323
  createDOMCompilerError(
17209
- 55,
17324
+ 57,
17210
17325
  dir.loc
17211
17326
  )
17212
17327
  );
@@ -17318,7 +17433,7 @@ const transformShow = (dir, node, context) => {
17318
17433
  const { exp, loc } = dir;
17319
17434
  if (!exp) {
17320
17435
  context.onError(
17321
- createDOMCompilerError(59, loc)
17436
+ createDOMCompilerError(61, loc)
17322
17437
  );
17323
17438
  }
17324
17439
  return {
@@ -17338,7 +17453,7 @@ const transformTransition = (node, context) => {
17338
17453
  if (hasMultipleChildren(node)) {
17339
17454
  context.onError(
17340
17455
  createDOMCompilerError(
17341
- 60,
17456
+ 62,
17342
17457
  {
17343
17458
  start: node.children[0].loc.start,
17344
17459
  end: node.children[node.children.length - 1].loc.end,
@@ -17375,7 +17490,7 @@ function hasMultipleChildren(node) {
17375
17490
  const ignoreSideEffectTags = (node, context) => {
17376
17491
  if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
17377
17492
  context.onError(
17378
- createDOMCompilerError(61, node.loc)
17493
+ createDOMCompilerError(63, node.loc)
17379
17494
  );
17380
17495
  context.removeNode();
17381
17496
  }
@@ -17475,4 +17590,4 @@ var Vue$1 = Vue;
17475
17590
 
17476
17591
  const { configureCompat } = Vue$1;
17477
17592
 
17478
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
17593
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };