@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.
@@ -123,7 +123,7 @@ var Vue = (function () {
123
123
  [3]: "FORWARDED"
124
124
  };
125
125
 
126
- 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";
126
+ 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";
127
127
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
128
128
 
129
129
  const range = 2;
@@ -1924,6 +1924,8 @@ var Vue = (function () {
1924
1924
  }
1925
1925
  hmrDirtyComponents.add(oldComp);
1926
1926
  }
1927
+ instance.appContext.propsCache.delete(instance.type);
1928
+ instance.appContext.emitsCache.delete(instance.type);
1927
1929
  instance.appContext.optionsCache.delete(instance.type);
1928
1930
  if (instance.ceReload) {
1929
1931
  hmrDirtyComponents.add(oldComp);
@@ -3239,7 +3241,8 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3239
3241
  }
3240
3242
  }
3241
3243
  let hasWarned = false;
3242
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3244
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3245
+ var _a;
3243
3246
  if (!hasWarned) {
3244
3247
  hasWarned = true;
3245
3248
  console[console.info ? "info" : "log"](
@@ -3253,13 +3256,21 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3253
3256
  n: next,
3254
3257
  o: { parentNode, remove }
3255
3258
  } = rendererInternals;
3259
+ let parentSuspenseId;
3260
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3261
+ if (isSuspensible) {
3262
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3263
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
3264
+ parentSuspense.deps++;
3265
+ }
3266
+ }
3256
3267
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3257
3268
  {
3258
3269
  assertNumber(timeout, `Suspense timeout`);
3259
3270
  }
3260
3271
  const suspense = {
3261
3272
  vnode,
3262
- parent,
3273
+ parent: parentSuspense,
3263
3274
  parentComponent,
3264
3275
  isSVG,
3265
3276
  container,
@@ -3319,20 +3330,28 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3319
3330
  setActiveBranch(suspense, pendingBranch);
3320
3331
  suspense.pendingBranch = null;
3321
3332
  suspense.isInFallback = false;
3322
- let parent2 = suspense.parent;
3333
+ let parent = suspense.parent;
3323
3334
  let hasUnresolvedAncestor = false;
3324
- while (parent2) {
3325
- if (parent2.pendingBranch) {
3326
- parent2.effects.push(...effects);
3335
+ while (parent) {
3336
+ if (parent.pendingBranch) {
3337
+ parent.effects.push(...effects);
3327
3338
  hasUnresolvedAncestor = true;
3328
3339
  break;
3329
3340
  }
3330
- parent2 = parent2.parent;
3341
+ parent = parent.parent;
3331
3342
  }
3332
3343
  if (!hasUnresolvedAncestor) {
3333
3344
  queuePostFlushCb(effects);
3334
3345
  }
3335
3346
  suspense.effects = [];
3347
+ if (isSuspensible) {
3348
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3349
+ parentSuspense.deps--;
3350
+ if (parentSuspense.deps === 0) {
3351
+ parentSuspense.resolve();
3352
+ }
3353
+ }
3354
+ }
3336
3355
  triggerEvent(vnode2, "onResolve");
3337
3356
  },
3338
3357
  fallback(fallbackVNode) {
@@ -3432,13 +3451,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3432
3451
  }
3433
3452
  });
3434
3453
  },
3435
- unmount(parentSuspense, doRemove) {
3454
+ unmount(parentSuspense2, doRemove) {
3436
3455
  suspense.isUnmounted = true;
3437
3456
  if (suspense.activeBranch) {
3438
3457
  unmount(
3439
3458
  suspense.activeBranch,
3440
3459
  parentComponent,
3441
- parentSuspense,
3460
+ parentSuspense2,
3442
3461
  doRemove
3443
3462
  );
3444
3463
  }
@@ -3446,7 +3465,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3446
3465
  unmount(
3447
3466
  suspense.pendingBranch,
3448
3467
  parentComponent,
3449
- parentSuspense,
3468
+ parentSuspense2,
3450
3469
  doRemove
3451
3470
  );
3452
3471
  }
@@ -3539,33 +3558,41 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3539
3558
  }
3540
3559
  }
3541
3560
 
3542
- function provide(key, value) {
3543
- if (!currentInstance) {
3544
- {
3545
- warn(`provide() can only be used inside setup().`);
3546
- }
3547
- } else {
3548
- let provides = currentInstance.provides;
3549
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3550
- if (parentProvides === provides) {
3551
- provides = currentInstance.provides = Object.create(parentProvides);
3552
- }
3553
- provides[key] = value;
3554
- }
3555
- }
3556
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3557
- const instance = currentInstance || currentRenderingInstance;
3558
- if (instance) {
3559
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3560
- if (provides && key in provides) {
3561
- return provides[key];
3562
- } else if (arguments.length > 1) {
3563
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3561
+ const legacyDirectiveHookMap = {
3562
+ beforeMount: "bind",
3563
+ mounted: "inserted",
3564
+ updated: ["update", "componentUpdated"],
3565
+ unmounted: "unbind"
3566
+ };
3567
+ function mapCompatDirectiveHook(name, dir, instance) {
3568
+ const mappedName = legacyDirectiveHookMap[name];
3569
+ if (mappedName) {
3570
+ if (isArray(mappedName)) {
3571
+ const hook = [];
3572
+ mappedName.forEach((mapped) => {
3573
+ const mappedHook = dir[mapped];
3574
+ if (mappedHook) {
3575
+ softAssertCompatEnabled(
3576
+ "CUSTOM_DIR",
3577
+ instance,
3578
+ mapped,
3579
+ name
3580
+ );
3581
+ hook.push(mappedHook);
3582
+ }
3583
+ });
3584
+ return hook.length ? hook : void 0;
3564
3585
  } else {
3565
- warn(`injection "${String(key)}" not found.`);
3586
+ if (dir[mappedName]) {
3587
+ softAssertCompatEnabled(
3588
+ "CUSTOM_DIR",
3589
+ instance,
3590
+ mappedName,
3591
+ name
3592
+ );
3593
+ }
3594
+ return dir[mappedName];
3566
3595
  }
3567
- } else {
3568
- warn(`inject() can only be used inside setup() or functional components.`);
3569
3596
  }
3570
3597
  }
3571
3598
 
@@ -3804,6 +3831,68 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3804
3831
  return value;
3805
3832
  }
3806
3833
 
3834
+ function validateDirectiveName(name) {
3835
+ if (isBuiltInDirective(name)) {
3836
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3837
+ }
3838
+ }
3839
+ function withDirectives(vnode, directives) {
3840
+ const internalInstance = currentRenderingInstance;
3841
+ if (internalInstance === null) {
3842
+ warn(`withDirectives can only be used inside render functions.`);
3843
+ return vnode;
3844
+ }
3845
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3846
+ const bindings = vnode.dirs || (vnode.dirs = []);
3847
+ for (let i = 0; i < directives.length; i++) {
3848
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3849
+ if (dir) {
3850
+ if (isFunction(dir)) {
3851
+ dir = {
3852
+ mounted: dir,
3853
+ updated: dir
3854
+ };
3855
+ }
3856
+ if (dir.deep) {
3857
+ traverse(value);
3858
+ }
3859
+ bindings.push({
3860
+ dir,
3861
+ instance,
3862
+ value,
3863
+ oldValue: void 0,
3864
+ arg,
3865
+ modifiers
3866
+ });
3867
+ }
3868
+ }
3869
+ return vnode;
3870
+ }
3871
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3872
+ const bindings = vnode.dirs;
3873
+ const oldBindings = prevVNode && prevVNode.dirs;
3874
+ for (let i = 0; i < bindings.length; i++) {
3875
+ const binding = bindings[i];
3876
+ if (oldBindings) {
3877
+ binding.oldValue = oldBindings[i].value;
3878
+ }
3879
+ let hook = binding.dir[name];
3880
+ if (!hook) {
3881
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3882
+ }
3883
+ if (hook) {
3884
+ pauseTracking();
3885
+ callWithAsyncErrorHandling(hook, instance, 8, [
3886
+ vnode.el,
3887
+ binding,
3888
+ vnode,
3889
+ prevVNode
3890
+ ]);
3891
+ resetTracking();
3892
+ }
3893
+ }
3894
+ }
3895
+
3807
3896
  function useTransitionState() {
3808
3897
  const state = {
3809
3898
  isMounted: false,
@@ -4602,106 +4691,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4602
4691
  return listeners;
4603
4692
  }
4604
4693
 
4605
- const legacyDirectiveHookMap = {
4606
- beforeMount: "bind",
4607
- mounted: "inserted",
4608
- updated: ["update", "componentUpdated"],
4609
- unmounted: "unbind"
4610
- };
4611
- function mapCompatDirectiveHook(name, dir, instance) {
4612
- const mappedName = legacyDirectiveHookMap[name];
4613
- if (mappedName) {
4614
- if (isArray(mappedName)) {
4615
- const hook = [];
4616
- mappedName.forEach((mapped) => {
4617
- const mappedHook = dir[mapped];
4618
- if (mappedHook) {
4619
- softAssertCompatEnabled(
4620
- "CUSTOM_DIR",
4621
- instance,
4622
- mapped,
4623
- name
4624
- );
4625
- hook.push(mappedHook);
4626
- }
4627
- });
4628
- return hook.length ? hook : void 0;
4629
- } else {
4630
- if (dir[mappedName]) {
4631
- softAssertCompatEnabled(
4632
- "CUSTOM_DIR",
4633
- instance,
4634
- mappedName,
4635
- name
4636
- );
4637
- }
4638
- return dir[mappedName];
4639
- }
4640
- }
4641
- }
4642
-
4643
- function validateDirectiveName(name) {
4644
- if (isBuiltInDirective(name)) {
4645
- warn("Do not use built-in directive ids as custom directive id: " + name);
4646
- }
4647
- }
4648
- function withDirectives(vnode, directives) {
4649
- const internalInstance = currentRenderingInstance;
4650
- if (internalInstance === null) {
4651
- warn(`withDirectives can only be used inside render functions.`);
4652
- return vnode;
4653
- }
4654
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4655
- const bindings = vnode.dirs || (vnode.dirs = []);
4656
- for (let i = 0; i < directives.length; i++) {
4657
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4658
- if (dir) {
4659
- if (isFunction(dir)) {
4660
- dir = {
4661
- mounted: dir,
4662
- updated: dir
4663
- };
4664
- }
4665
- if (dir.deep) {
4666
- traverse(value);
4667
- }
4668
- bindings.push({
4669
- dir,
4670
- instance,
4671
- value,
4672
- oldValue: void 0,
4673
- arg,
4674
- modifiers
4675
- });
4676
- }
4677
- }
4678
- return vnode;
4679
- }
4680
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4681
- const bindings = vnode.dirs;
4682
- const oldBindings = prevVNode && prevVNode.dirs;
4683
- for (let i = 0; i < bindings.length; i++) {
4684
- const binding = bindings[i];
4685
- if (oldBindings) {
4686
- binding.oldValue = oldBindings[i].value;
4687
- }
4688
- let hook = binding.dir[name];
4689
- if (!hook) {
4690
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4691
- }
4692
- if (hook) {
4693
- pauseTracking();
4694
- callWithAsyncErrorHandling(hook, instance, 8, [
4695
- vnode.el,
4696
- binding,
4697
- vnode,
4698
- prevVNode
4699
- ]);
4700
- resetTracking();
4701
- }
4702
- }
4703
- }
4704
-
4705
4694
  const COMPONENTS = "components";
4706
4695
  const DIRECTIVES = "directives";
4707
4696
  const FILTERS = "filters";
@@ -5417,6 +5406,8 @@ If this is a native custom element, make sure to exclude it from component resol
5417
5406
  if (key === "$attrs") {
5418
5407
  track(instance, "get", key);
5419
5408
  markAttrsAccessed();
5409
+ } else if (key === "$slots") {
5410
+ track(instance, "get", key);
5420
5411
  }
5421
5412
  return publicGetter(instance);
5422
5413
  } else if (
@@ -5606,24 +5597,179 @@ If this is a native custom element, make sure to exclude it from component resol
5606
5597
  return to;
5607
5598
  }
5608
5599
 
5609
- function createDuplicateChecker() {
5610
- const cache = /* @__PURE__ */ Object.create(null);
5611
- return (type, key) => {
5612
- if (cache[key]) {
5613
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5614
- } else {
5615
- cache[key] = type;
5616
- }
5617
- };
5600
+ const warnRuntimeUsage = (method) => warn(
5601
+ `${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.`
5602
+ );
5603
+ function defineProps() {
5604
+ {
5605
+ warnRuntimeUsage(`defineProps`);
5606
+ }
5607
+ return null;
5618
5608
  }
5619
- let shouldCacheAccess = true;
5620
- function applyOptions(instance) {
5621
- const options = resolveMergedOptions(instance);
5622
- const publicThis = instance.proxy;
5623
- const ctx = instance.ctx;
5624
- shouldCacheAccess = false;
5625
- if (options.beforeCreate) {
5626
- callHook$1(options.beforeCreate, instance, "bc");
5609
+ function defineEmits() {
5610
+ {
5611
+ warnRuntimeUsage(`defineEmits`);
5612
+ }
5613
+ return null;
5614
+ }
5615
+ function defineExpose(exposed) {
5616
+ {
5617
+ warnRuntimeUsage(`defineExpose`);
5618
+ }
5619
+ }
5620
+ function defineOptions(options) {
5621
+ {
5622
+ warnRuntimeUsage(`defineOptions`);
5623
+ }
5624
+ }
5625
+ function defineSlots() {
5626
+ {
5627
+ warnRuntimeUsage(`defineSlots`);
5628
+ }
5629
+ return null;
5630
+ }
5631
+ function defineModel() {
5632
+ {
5633
+ warnRuntimeUsage("defineModel");
5634
+ }
5635
+ }
5636
+ function withDefaults(props, defaults) {
5637
+ {
5638
+ warnRuntimeUsage(`withDefaults`);
5639
+ }
5640
+ return null;
5641
+ }
5642
+ function useSlots() {
5643
+ return getContext().slots;
5644
+ }
5645
+ function useAttrs() {
5646
+ return getContext().attrs;
5647
+ }
5648
+ function useModel(props, name, options) {
5649
+ const i = getCurrentInstance();
5650
+ if (!i) {
5651
+ warn(`useModel() called without active instance.`);
5652
+ return ref();
5653
+ }
5654
+ if (!i.propsOptions[0][name]) {
5655
+ warn(`useModel() called with prop "${name}" which is not declared.`);
5656
+ return ref();
5657
+ }
5658
+ if (options && options.local) {
5659
+ const proxy = ref(props[name]);
5660
+ watch(
5661
+ () => props[name],
5662
+ (v) => proxy.value = v
5663
+ );
5664
+ watch(proxy, (value) => {
5665
+ if (value !== props[name]) {
5666
+ i.emit(`update:${name}`, value);
5667
+ }
5668
+ });
5669
+ return proxy;
5670
+ } else {
5671
+ return {
5672
+ __v_isRef: true,
5673
+ get value() {
5674
+ return props[name];
5675
+ },
5676
+ set value(value) {
5677
+ i.emit(`update:${name}`, value);
5678
+ }
5679
+ };
5680
+ }
5681
+ }
5682
+ function getContext() {
5683
+ const i = getCurrentInstance();
5684
+ if (!i) {
5685
+ warn(`useContext() called without active instance.`);
5686
+ }
5687
+ return i.setupContext || (i.setupContext = createSetupContext(i));
5688
+ }
5689
+ function normalizePropsOrEmits(props) {
5690
+ return isArray(props) ? props.reduce(
5691
+ (normalized, p) => (normalized[p] = null, normalized),
5692
+ {}
5693
+ ) : props;
5694
+ }
5695
+ function mergeDefaults(raw, defaults) {
5696
+ const props = normalizePropsOrEmits(raw);
5697
+ for (const key in defaults) {
5698
+ if (key.startsWith("__skip"))
5699
+ continue;
5700
+ let opt = props[key];
5701
+ if (opt) {
5702
+ if (isArray(opt) || isFunction(opt)) {
5703
+ opt = props[key] = { type: opt, default: defaults[key] };
5704
+ } else {
5705
+ opt.default = defaults[key];
5706
+ }
5707
+ } else if (opt === null) {
5708
+ opt = props[key] = { default: defaults[key] };
5709
+ } else {
5710
+ warn(`props default key "${key}" has no corresponding declaration.`);
5711
+ }
5712
+ if (opt && defaults[`__skip_${key}`]) {
5713
+ opt.skipFactory = true;
5714
+ }
5715
+ }
5716
+ return props;
5717
+ }
5718
+ function mergeModels(a, b) {
5719
+ if (!a || !b)
5720
+ return a || b;
5721
+ if (isArray(a) && isArray(b))
5722
+ return a.concat(b);
5723
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5724
+ }
5725
+ function createPropsRestProxy(props, excludedKeys) {
5726
+ const ret = {};
5727
+ for (const key in props) {
5728
+ if (!excludedKeys.includes(key)) {
5729
+ Object.defineProperty(ret, key, {
5730
+ enumerable: true,
5731
+ get: () => props[key]
5732
+ });
5733
+ }
5734
+ }
5735
+ return ret;
5736
+ }
5737
+ function withAsyncContext(getAwaitable) {
5738
+ const ctx = getCurrentInstance();
5739
+ if (!ctx) {
5740
+ warn(
5741
+ `withAsyncContext called without active current instance. This is likely a bug.`
5742
+ );
5743
+ }
5744
+ let awaitable = getAwaitable();
5745
+ unsetCurrentInstance();
5746
+ if (isPromise(awaitable)) {
5747
+ awaitable = awaitable.catch((e) => {
5748
+ setCurrentInstance(ctx);
5749
+ throw e;
5750
+ });
5751
+ }
5752
+ return [awaitable, () => setCurrentInstance(ctx)];
5753
+ }
5754
+
5755
+ function createDuplicateChecker() {
5756
+ const cache = /* @__PURE__ */ Object.create(null);
5757
+ return (type, key) => {
5758
+ if (cache[key]) {
5759
+ warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5760
+ } else {
5761
+ cache[key] = type;
5762
+ }
5763
+ };
5764
+ }
5765
+ let shouldCacheAccess = true;
5766
+ function applyOptions(instance) {
5767
+ const options = resolveMergedOptions(instance);
5768
+ const publicThis = instance.proxy;
5769
+ const ctx = instance.ctx;
5770
+ shouldCacheAccess = false;
5771
+ if (options.beforeCreate) {
5772
+ callHook$1(options.beforeCreate, instance, "bc");
5627
5773
  }
5628
5774
  const {
5629
5775
  // state
@@ -5668,12 +5814,7 @@ If this is a native custom element, make sure to exclude it from component resol
5668
5814
  }
5669
5815
  }
5670
5816
  if (injectOptions) {
5671
- resolveInjections(
5672
- injectOptions,
5673
- ctx,
5674
- checkDuplicateProperties,
5675
- instance.appContext.config.unwrapInjectedRef
5676
- );
5817
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5677
5818
  }
5678
5819
  if (methods) {
5679
5820
  for (const key in methods) {
@@ -5824,7 +5965,7 @@ If this is a native custom element, make sure to exclude it from component resol
5824
5965
  instance.filters = filters;
5825
5966
  }
5826
5967
  }
5827
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
5968
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5828
5969
  if (isArray(injectOptions)) {
5829
5970
  injectOptions = normalizeInject(injectOptions);
5830
5971
  }
@@ -5846,21 +5987,12 @@ If this is a native custom element, make sure to exclude it from component resol
5846
5987
  injected = inject(opt);
5847
5988
  }
5848
5989
  if (isRef(injected)) {
5849
- if (unwrapRef) {
5850
- Object.defineProperty(ctx, key, {
5851
- enumerable: true,
5852
- configurable: true,
5853
- get: () => injected.value,
5854
- set: (v) => injected.value = v
5855
- });
5856
- } else {
5857
- {
5858
- warn(
5859
- `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.)`
5860
- );
5861
- }
5862
- ctx[key] = injected;
5863
- }
5990
+ Object.defineProperty(ctx, key, {
5991
+ enumerable: true,
5992
+ configurable: true,
5993
+ get: () => injected.value,
5994
+ set: (v) => injected.value = v
5995
+ });
5864
5996
  } else {
5865
5997
  ctx[key] = injected;
5866
5998
  }
@@ -5963,10 +6095,8 @@ If this is a native custom element, make sure to exclude it from component resol
5963
6095
  }
5964
6096
  const internalOptionMergeStrats = {
5965
6097
  data: mergeDataFn,
5966
- props: mergeObjectOptions,
5967
- // TODO
5968
- emits: mergeObjectOptions,
5969
- // TODO
6098
+ props: mergeEmitsOrPropsOptions,
6099
+ emits: mergeEmitsOrPropsOptions,
5970
6100
  // objects
5971
6101
  methods: mergeObjectOptions,
5972
6102
  computed: mergeObjectOptions,
@@ -6028,7 +6158,21 @@ If this is a native custom element, make sure to exclude it from component resol
6028
6158
  return to ? [...new Set([].concat(to, from))] : from;
6029
6159
  }
6030
6160
  function mergeObjectOptions(to, from) {
6031
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
6161
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
6162
+ }
6163
+ function mergeEmitsOrPropsOptions(to, from) {
6164
+ if (to) {
6165
+ if (isArray(to) && isArray(from)) {
6166
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
6167
+ }
6168
+ return extend(
6169
+ /* @__PURE__ */ Object.create(null),
6170
+ normalizePropsOrEmits(to),
6171
+ normalizePropsOrEmits(from != null ? from : {})
6172
+ );
6173
+ } else {
6174
+ return from;
6175
+ }
6032
6176
  }
6033
6177
  function mergeWatchOptions(to, from) {
6034
6178
  if (!to)
@@ -6042,1179 +6186,1234 @@ If this is a native custom element, make sure to exclude it from component resol
6042
6186
  return merged;
6043
6187
  }
6044
6188
 
6045
- function createPropsDefaultThis(instance, rawProps, propKey) {
6046
- return new Proxy(
6047
- {},
6048
- {
6049
- get(_, key) {
6050
- warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6051
- if (key === "$options") {
6052
- return resolveMergedOptions(instance);
6053
- }
6054
- if (key in rawProps) {
6055
- return rawProps[key];
6056
- }
6057
- const injections = instance.type.inject;
6058
- if (injections) {
6059
- if (isArray(injections)) {
6060
- if (injections.includes(key)) {
6061
- return inject(key);
6062
- }
6063
- } else if (key in injections) {
6064
- return inject(key);
6065
- }
6189
+ function installLegacyConfigWarnings(config) {
6190
+ const legacyConfigOptions = {
6191
+ silent: "CONFIG_SILENT",
6192
+ devtools: "CONFIG_DEVTOOLS",
6193
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6194
+ keyCodes: "CONFIG_KEY_CODES",
6195
+ productionTip: "CONFIG_PRODUCTION_TIP"
6196
+ };
6197
+ Object.keys(legacyConfigOptions).forEach((key) => {
6198
+ let val = config[key];
6199
+ Object.defineProperty(config, key, {
6200
+ enumerable: true,
6201
+ get() {
6202
+ return val;
6203
+ },
6204
+ set(newVal) {
6205
+ if (!isCopyingConfig) {
6206
+ warnDeprecation$1(legacyConfigOptions[key], null);
6066
6207
  }
6208
+ val = newVal;
6067
6209
  }
6068
- }
6069
- );
6210
+ });
6211
+ });
6070
6212
  }
6071
-
6072
- function shouldSkipAttr(key, instance) {
6073
- if (key === "is") {
6074
- return true;
6075
- }
6076
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6077
- return true;
6078
- }
6079
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6080
- return true;
6081
- }
6082
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6083
- return true;
6084
- }
6085
- return false;
6213
+ function installLegacyOptionMergeStrats(config) {
6214
+ config.optionMergeStrategies = new Proxy({}, {
6215
+ get(target, key) {
6216
+ if (key in target) {
6217
+ return target[key];
6218
+ }
6219
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6220
+ "CONFIG_OPTION_MERGE_STRATS",
6221
+ null
6222
+ )) {
6223
+ return internalOptionMergeStrats[key];
6224
+ }
6225
+ }
6226
+ });
6086
6227
  }
6087
6228
 
6088
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6089
- const props = {};
6090
- const attrs = {};
6091
- def(attrs, InternalObjectKey, 1);
6092
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6093
- setFullProps(instance, rawProps, props, attrs);
6094
- for (const key in instance.propsOptions[0]) {
6095
- if (!(key in props)) {
6096
- props[key] = void 0;
6229
+ let isCopyingConfig = false;
6230
+ let singletonApp;
6231
+ let singletonCtor;
6232
+ function createCompatVue$1(createApp, createSingletonApp) {
6233
+ singletonApp = createSingletonApp({});
6234
+ const Vue = singletonCtor = function Vue2(options = {}) {
6235
+ return createCompatApp(options, Vue2);
6236
+ };
6237
+ function createCompatApp(options = {}, Ctor) {
6238
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6239
+ const { data } = options;
6240
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6241
+ options.data = () => data;
6242
+ }
6243
+ const app = createApp(options);
6244
+ if (Ctor !== Vue) {
6245
+ applySingletonPrototype(app, Ctor);
6246
+ }
6247
+ const vm = app._createRoot(options);
6248
+ if (options.el) {
6249
+ return vm.$mount(options.el);
6250
+ } else {
6251
+ return vm;
6097
6252
  }
6098
6253
  }
6099
- {
6100
- validateProps(rawProps || {}, props, instance);
6101
- }
6102
- if (isStateful) {
6103
- instance.props = isSSR ? props : shallowReactive(props);
6104
- } else {
6105
- if (!instance.type.props) {
6106
- instance.props = attrs;
6254
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
6255
+ Vue.config = singletonApp.config;
6256
+ Vue.use = (p, ...options) => {
6257
+ if (p && isFunction(p.install)) {
6258
+ p.install(Vue, ...options);
6259
+ } else if (isFunction(p)) {
6260
+ p(Vue, ...options);
6261
+ }
6262
+ return Vue;
6263
+ };
6264
+ Vue.mixin = (m) => {
6265
+ singletonApp.mixin(m);
6266
+ return Vue;
6267
+ };
6268
+ Vue.component = (name, comp) => {
6269
+ if (comp) {
6270
+ singletonApp.component(name, comp);
6271
+ return Vue;
6107
6272
  } else {
6108
- instance.props = props;
6273
+ return singletonApp.component(name);
6274
+ }
6275
+ };
6276
+ Vue.directive = (name, dir) => {
6277
+ if (dir) {
6278
+ singletonApp.directive(name, dir);
6279
+ return Vue;
6280
+ } else {
6281
+ return singletonApp.directive(name);
6282
+ }
6283
+ };
6284
+ Vue.options = { _base: Vue };
6285
+ let cid = 1;
6286
+ Vue.cid = cid;
6287
+ Vue.nextTick = nextTick;
6288
+ const extendCache = /* @__PURE__ */ new WeakMap();
6289
+ function extendCtor(extendOptions = {}) {
6290
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6291
+ if (isFunction(extendOptions)) {
6292
+ extendOptions = extendOptions.options;
6293
+ }
6294
+ if (extendCache.has(extendOptions)) {
6295
+ return extendCache.get(extendOptions);
6296
+ }
6297
+ const Super = this;
6298
+ function SubVue(inlineOptions) {
6299
+ if (!inlineOptions) {
6300
+ return createCompatApp(SubVue.options, SubVue);
6301
+ } else {
6302
+ return createCompatApp(
6303
+ mergeOptions(
6304
+ extend({}, SubVue.options),
6305
+ inlineOptions,
6306
+ internalOptionMergeStrats
6307
+ ),
6308
+ SubVue
6309
+ );
6310
+ }
6109
6311
  }
6312
+ SubVue.super = Super;
6313
+ SubVue.prototype = Object.create(Vue.prototype);
6314
+ SubVue.prototype.constructor = SubVue;
6315
+ const mergeBase = {};
6316
+ for (const key in Super.options) {
6317
+ const superValue = Super.options[key];
6318
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6319
+ }
6320
+ SubVue.options = mergeOptions(
6321
+ mergeBase,
6322
+ extendOptions,
6323
+ internalOptionMergeStrats
6324
+ );
6325
+ SubVue.options._base = SubVue;
6326
+ SubVue.extend = extendCtor.bind(SubVue);
6327
+ SubVue.mixin = Super.mixin;
6328
+ SubVue.use = Super.use;
6329
+ SubVue.cid = ++cid;
6330
+ extendCache.set(extendOptions, SubVue);
6331
+ return SubVue;
6110
6332
  }
6111
- instance.attrs = attrs;
6333
+ Vue.extend = extendCtor.bind(Vue);
6334
+ Vue.set = (target, key, value) => {
6335
+ assertCompatEnabled("GLOBAL_SET", null);
6336
+ target[key] = value;
6337
+ };
6338
+ Vue.delete = (target, key) => {
6339
+ assertCompatEnabled("GLOBAL_DELETE", null);
6340
+ delete target[key];
6341
+ };
6342
+ Vue.observable = (target) => {
6343
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6344
+ return reactive(target);
6345
+ };
6346
+ Vue.filter = (name, filter) => {
6347
+ if (filter) {
6348
+ singletonApp.filter(name, filter);
6349
+ return Vue;
6350
+ } else {
6351
+ return singletonApp.filter(name);
6352
+ }
6353
+ };
6354
+ const util = {
6355
+ warn: warn ,
6356
+ extend,
6357
+ mergeOptions: (parent, child, vm) => mergeOptions(
6358
+ parent,
6359
+ child,
6360
+ vm ? void 0 : internalOptionMergeStrats
6361
+ ),
6362
+ defineReactive
6363
+ };
6364
+ Object.defineProperty(Vue, "util", {
6365
+ get() {
6366
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6367
+ return util;
6368
+ }
6369
+ });
6370
+ Vue.configureCompat = configureCompat;
6371
+ return Vue;
6112
6372
  }
6113
- function isInHmrContext(instance) {
6114
- while (instance) {
6115
- if (instance.type.__hmrId)
6116
- return true;
6117
- instance = instance.parent;
6373
+ function installAppCompatProperties(app, context, render) {
6374
+ installFilterMethod(app, context);
6375
+ installLegacyOptionMergeStrats(app.config);
6376
+ if (!singletonApp) {
6377
+ return;
6118
6378
  }
6379
+ installCompatMount(app, context, render);
6380
+ installLegacyAPIs(app);
6381
+ applySingletonAppMutations(app);
6382
+ installLegacyConfigWarnings(app.config);
6119
6383
  }
6120
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6121
- const {
6122
- props,
6123
- attrs,
6124
- vnode: { patchFlag }
6125
- } = instance;
6126
- const rawCurrentProps = toRaw(props);
6127
- const [options] = instance.propsOptions;
6128
- let hasAttrsChanged = false;
6129
- if (
6130
- // always force full diff in dev
6131
- // - #1942 if hmr is enabled with sfc component
6132
- // - vite#872 non-sfc component used by sfc component
6133
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6134
- ) {
6135
- if (patchFlag & 8) {
6136
- const propsToUpdate = instance.vnode.dynamicProps;
6137
- for (let i = 0; i < propsToUpdate.length; i++) {
6138
- let key = propsToUpdate[i];
6139
- if (isEmitListener(instance.emitsOptions, key)) {
6140
- continue;
6141
- }
6142
- const value = rawProps[key];
6143
- if (options) {
6144
- if (hasOwn(attrs, key)) {
6145
- if (value !== attrs[key]) {
6146
- attrs[key] = value;
6147
- hasAttrsChanged = true;
6148
- }
6149
- } else {
6150
- const camelizedKey = camelize(key);
6151
- props[camelizedKey] = resolvePropValue(
6152
- options,
6153
- rawCurrentProps,
6154
- camelizedKey,
6155
- value,
6156
- instance,
6157
- false
6158
- /* isAbsent */
6159
- );
6160
- }
6161
- } else {
6162
- {
6163
- if (isOn(key) && key.endsWith("Native")) {
6164
- key = key.slice(0, -6);
6165
- } else if (shouldSkipAttr(key, instance)) {
6166
- continue;
6167
- }
6168
- }
6169
- if (value !== attrs[key]) {
6170
- attrs[key] = value;
6171
- hasAttrsChanged = true;
6172
- }
6173
- }
6174
- }
6384
+ function installFilterMethod(app, context) {
6385
+ context.filters = {};
6386
+ app.filter = (name, filter) => {
6387
+ assertCompatEnabled("FILTERS", null);
6388
+ if (!filter) {
6389
+ return context.filters[name];
6175
6390
  }
6176
- } else {
6177
- if (setFullProps(instance, rawProps, props, attrs)) {
6178
- hasAttrsChanged = true;
6391
+ if (context.filters[name]) {
6392
+ warn(`Filter "${name}" has already been registered.`);
6179
6393
  }
6180
- let kebabKey;
6181
- for (const key in rawCurrentProps) {
6182
- if (!rawProps || // for camelCase
6183
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6184
- // and converted to camelCase (#955)
6185
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6186
- if (options) {
6187
- if (rawPrevProps && // for camelCase
6188
- (rawPrevProps[key] !== void 0 || // for kebab-case
6189
- rawPrevProps[kebabKey] !== void 0)) {
6190
- props[key] = resolvePropValue(
6191
- options,
6192
- rawCurrentProps,
6193
- key,
6194
- void 0,
6195
- instance,
6196
- true
6197
- /* isAbsent */
6198
- );
6199
- }
6200
- } else {
6201
- delete props[key];
6202
- }
6394
+ context.filters[name] = filter;
6395
+ return app;
6396
+ };
6397
+ }
6398
+ function installLegacyAPIs(app) {
6399
+ Object.defineProperties(app, {
6400
+ // so that app.use() can work with legacy plugins that extend prototypes
6401
+ prototype: {
6402
+ get() {
6403
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6404
+ return app.config.globalProperties;
6203
6405
  }
6204
- }
6205
- if (attrs !== rawCurrentProps) {
6206
- for (const key in attrs) {
6207
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6208
- delete attrs[key];
6209
- hasAttrsChanged = true;
6210
- }
6406
+ },
6407
+ nextTick: { value: nextTick },
6408
+ extend: { value: singletonCtor.extend },
6409
+ set: { value: singletonCtor.set },
6410
+ delete: { value: singletonCtor.delete },
6411
+ observable: { value: singletonCtor.observable },
6412
+ util: {
6413
+ get() {
6414
+ return singletonCtor.util;
6211
6415
  }
6212
6416
  }
6417
+ });
6418
+ }
6419
+ function applySingletonAppMutations(app) {
6420
+ app._context.mixins = [...singletonApp._context.mixins];
6421
+ ["components", "directives", "filters"].forEach((key) => {
6422
+ app._context[key] = Object.create(singletonApp._context[key]);
6423
+ });
6424
+ isCopyingConfig = true;
6425
+ for (const key in singletonApp.config) {
6426
+ if (key === "isNativeTag")
6427
+ continue;
6428
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6429
+ continue;
6430
+ }
6431
+ const val = singletonApp.config[key];
6432
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6433
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6434
+ app.config.compilerOptions.isCustomElement = (tag) => {
6435
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6436
+ };
6437
+ }
6213
6438
  }
6214
- if (hasAttrsChanged) {
6215
- trigger(instance, "set", "$attrs");
6216
- }
6217
- {
6218
- validateProps(rawProps || {}, props, instance);
6439
+ isCopyingConfig = false;
6440
+ applySingletonPrototype(app, singletonCtor);
6441
+ }
6442
+ function applySingletonPrototype(app, Ctor) {
6443
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6444
+ if (enabled) {
6445
+ app.config.globalProperties = Object.create(Ctor.prototype);
6446
+ }
6447
+ let hasPrototypeAugmentations = false;
6448
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6449
+ for (const key in descriptors) {
6450
+ if (key !== "constructor") {
6451
+ hasPrototypeAugmentations = true;
6452
+ if (enabled) {
6453
+ Object.defineProperty(
6454
+ app.config.globalProperties,
6455
+ key,
6456
+ descriptors[key]
6457
+ );
6458
+ }
6459
+ }
6460
+ }
6461
+ if (hasPrototypeAugmentations) {
6462
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6219
6463
  }
6220
6464
  }
6221
- function setFullProps(instance, rawProps, props, attrs) {
6222
- const [options, needCastKeys] = instance.propsOptions;
6223
- let hasAttrsChanged = false;
6224
- let rawCastValues;
6225
- if (rawProps) {
6226
- for (let key in rawProps) {
6227
- if (isReservedProp(key)) {
6228
- continue;
6465
+ function installCompatMount(app, context, render) {
6466
+ let isMounted = false;
6467
+ app._createRoot = (options) => {
6468
+ const component = app._component;
6469
+ const vnode = createVNode(component, options.propsData || null);
6470
+ vnode.appContext = context;
6471
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6472
+ const emptyRender = () => {
6473
+ };
6474
+ const instance = createComponentInstance(vnode, null, null);
6475
+ if (hasNoRender) {
6476
+ instance.render = emptyRender;
6477
+ }
6478
+ setupComponent(instance);
6479
+ vnode.component = instance;
6480
+ vnode.isCompatRoot = true;
6481
+ instance.ctx._compat_mount = (selectorOrEl) => {
6482
+ if (isMounted) {
6483
+ warn(`Root instance is already mounted.`);
6484
+ return;
6229
6485
  }
6230
- {
6231
- if (key.startsWith("onHook:")) {
6232
- softAssertCompatEnabled(
6233
- "INSTANCE_EVENT_HOOKS",
6234
- instance,
6235
- key.slice(2).toLowerCase()
6486
+ let container;
6487
+ if (typeof selectorOrEl === "string") {
6488
+ const result = document.querySelector(selectorOrEl);
6489
+ if (!result) {
6490
+ warn(
6491
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6236
6492
  );
6493
+ return;
6237
6494
  }
6238
- if (key === "inline-template") {
6239
- continue;
6240
- }
6495
+ container = result;
6496
+ } else {
6497
+ container = selectorOrEl || document.createElement("div");
6241
6498
  }
6242
- const value = rawProps[key];
6243
- let camelKey;
6244
- if (options && hasOwn(options, camelKey = camelize(key))) {
6245
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6246
- props[camelKey] = value;
6247
- } else {
6248
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6249
- }
6250
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6499
+ const isSVG = container instanceof SVGElement;
6500
+ {
6501
+ context.reload = () => {
6502
+ const cloned = cloneVNode(vnode);
6503
+ cloned.component = null;
6504
+ render(cloned, container, isSVG);
6505
+ };
6506
+ }
6507
+ if (hasNoRender && instance.render === emptyRender) {
6251
6508
  {
6252
- if (isOn(key) && key.endsWith("Native")) {
6253
- key = key.slice(0, -6);
6254
- } else if (shouldSkipAttr(key, instance)) {
6255
- continue;
6509
+ for (let i = 0; i < container.attributes.length; i++) {
6510
+ const attr = container.attributes[i];
6511
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6512
+ warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6513
+ break;
6514
+ }
6256
6515
  }
6257
6516
  }
6258
- if (!(key in attrs) || value !== attrs[key]) {
6259
- attrs[key] = value;
6260
- hasAttrsChanged = true;
6261
- }
6517
+ instance.render = null;
6518
+ component.template = container.innerHTML;
6519
+ finishComponentSetup(
6520
+ instance,
6521
+ false,
6522
+ true
6523
+ /* skip options */
6524
+ );
6262
6525
  }
6263
- }
6264
- }
6265
- if (needCastKeys) {
6266
- const rawCurrentProps = toRaw(props);
6267
- const castValues = rawCastValues || EMPTY_OBJ;
6268
- for (let i = 0; i < needCastKeys.length; i++) {
6269
- const key = needCastKeys[i];
6270
- props[key] = resolvePropValue(
6271
- options,
6272
- rawCurrentProps,
6273
- key,
6274
- castValues[key],
6275
- instance,
6276
- !hasOwn(castValues, key)
6277
- );
6278
- }
6279
- }
6280
- return hasAttrsChanged;
6281
- }
6282
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6283
- const opt = options[key];
6284
- if (opt != null) {
6285
- const hasDefault = hasOwn(opt, "default");
6286
- if (hasDefault && value === void 0) {
6287
- const defaultValue = opt.default;
6288
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6289
- const { propsDefaults } = instance;
6290
- if (key in propsDefaults) {
6291
- value = propsDefaults[key];
6292
- } else {
6293
- setCurrentInstance(instance);
6294
- value = propsDefaults[key] = defaultValue.call(
6295
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6296
- props
6297
- );
6298
- unsetCurrentInstance();
6526
+ container.innerHTML = "";
6527
+ render(vnode, container, isSVG);
6528
+ if (container instanceof Element) {
6529
+ container.removeAttribute("v-cloak");
6530
+ container.setAttribute("data-v-app", "");
6531
+ }
6532
+ isMounted = true;
6533
+ app._container = container;
6534
+ container.__vue_app__ = app;
6535
+ {
6536
+ devtoolsInitApp(app, version);
6537
+ }
6538
+ return instance.proxy;
6539
+ };
6540
+ instance.ctx._compat_destroy = () => {
6541
+ if (isMounted) {
6542
+ render(null, app._container);
6543
+ {
6544
+ devtoolsUnmountApp(app);
6299
6545
  }
6546
+ delete app._container.__vue_app__;
6300
6547
  } else {
6301
- value = defaultValue;
6302
- }
6303
- }
6304
- if (opt[0 /* shouldCast */]) {
6305
- if (isAbsent && !hasDefault) {
6306
- value = false;
6307
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6308
- value = true;
6548
+ const { bum, scope, um } = instance;
6549
+ if (bum) {
6550
+ invokeArrayFns(bum);
6551
+ }
6552
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6553
+ instance.emit("hook:beforeDestroy");
6554
+ }
6555
+ if (scope) {
6556
+ scope.stop();
6557
+ }
6558
+ if (um) {
6559
+ invokeArrayFns(um);
6560
+ }
6561
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6562
+ instance.emit("hook:destroyed");
6563
+ }
6309
6564
  }
6565
+ };
6566
+ return instance.proxy;
6567
+ };
6568
+ }
6569
+ const methodsToPatch = [
6570
+ "push",
6571
+ "pop",
6572
+ "shift",
6573
+ "unshift",
6574
+ "splice",
6575
+ "sort",
6576
+ "reverse"
6577
+ ];
6578
+ const patched = /* @__PURE__ */ new WeakSet();
6579
+ function defineReactive(obj, key, val) {
6580
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6581
+ const reactiveVal = reactive(val);
6582
+ if (isArray(val)) {
6583
+ methodsToPatch.forEach((m) => {
6584
+ val[m] = (...args) => {
6585
+ Array.prototype[m].call(reactiveVal, ...args);
6586
+ };
6587
+ });
6588
+ } else {
6589
+ Object.keys(val).forEach((key2) => {
6590
+ try {
6591
+ defineReactiveSimple(val, key2, val[key2]);
6592
+ } catch (e) {
6593
+ }
6594
+ });
6310
6595
  }
6311
6596
  }
6312
- return value;
6597
+ const i = obj.$;
6598
+ if (i && obj === i.proxy) {
6599
+ defineReactiveSimple(i.ctx, key, val);
6600
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6601
+ } else if (isReactive(obj)) {
6602
+ obj[key] = val;
6603
+ } else {
6604
+ defineReactiveSimple(obj, key, val);
6605
+ }
6313
6606
  }
6314
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6315
- const cache = appContext.propsCache;
6316
- const cached = cache.get(comp);
6317
- if (cached) {
6318
- return cached;
6319
- }
6320
- const raw = comp.props;
6321
- const normalized = {};
6322
- const needCastKeys = [];
6323
- let hasExtends = false;
6324
- if (!isFunction(comp)) {
6325
- const extendProps = (raw2) => {
6326
- if (isFunction(raw2)) {
6327
- raw2 = raw2.options;
6328
- }
6329
- hasExtends = true;
6330
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6331
- extend(normalized, props);
6332
- if (keys)
6333
- needCastKeys.push(...keys);
6334
- };
6335
- if (!asMixin && appContext.mixins.length) {
6336
- appContext.mixins.forEach(extendProps);
6337
- }
6338
- if (comp.extends) {
6339
- extendProps(comp.extends);
6340
- }
6341
- if (comp.mixins) {
6342
- comp.mixins.forEach(extendProps);
6607
+ function defineReactiveSimple(obj, key, val) {
6608
+ val = isObject(val) ? reactive(val) : val;
6609
+ Object.defineProperty(obj, key, {
6610
+ enumerable: true,
6611
+ configurable: true,
6612
+ get() {
6613
+ track(obj, "get", key);
6614
+ return val;
6615
+ },
6616
+ set(newVal) {
6617
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6618
+ trigger(obj, "set", key, newVal);
6343
6619
  }
6344
- }
6345
- if (!raw && !hasExtends) {
6346
- if (isObject(comp)) {
6347
- cache.set(comp, EMPTY_ARR);
6620
+ });
6621
+ }
6622
+
6623
+ function createAppContext() {
6624
+ return {
6625
+ app: null,
6626
+ config: {
6627
+ isNativeTag: NO,
6628
+ performance: false,
6629
+ globalProperties: {},
6630
+ optionMergeStrategies: {},
6631
+ errorHandler: void 0,
6632
+ warnHandler: void 0,
6633
+ compilerOptions: {}
6634
+ },
6635
+ mixins: [],
6636
+ components: {},
6637
+ directives: {},
6638
+ provides: /* @__PURE__ */ Object.create(null),
6639
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6640
+ propsCache: /* @__PURE__ */ new WeakMap(),
6641
+ emitsCache: /* @__PURE__ */ new WeakMap()
6642
+ };
6643
+ }
6644
+ let uid$1 = 0;
6645
+ function createAppAPI(render, hydrate) {
6646
+ return function createApp(rootComponent, rootProps = null) {
6647
+ if (!isFunction(rootComponent)) {
6648
+ rootComponent = extend({}, rootComponent);
6348
6649
  }
6349
- return EMPTY_ARR;
6350
- }
6351
- if (isArray(raw)) {
6352
- for (let i = 0; i < raw.length; i++) {
6353
- if (!isString(raw[i])) {
6354
- warn(`props must be strings when using array syntax.`, raw[i]);
6355
- }
6356
- const normalizedKey = camelize(raw[i]);
6357
- if (validatePropName(normalizedKey)) {
6358
- normalized[normalizedKey] = EMPTY_OBJ;
6359
- }
6650
+ if (rootProps != null && !isObject(rootProps)) {
6651
+ warn(`root props passed to app.mount() must be an object.`);
6652
+ rootProps = null;
6360
6653
  }
6361
- } else if (raw) {
6362
- if (!isObject(raw)) {
6363
- warn(`invalid props options`, raw);
6654
+ const context = createAppContext();
6655
+ {
6656
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
6657
+ get() {
6658
+ return true;
6659
+ },
6660
+ set() {
6661
+ warn(
6662
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
6663
+ );
6664
+ }
6665
+ });
6364
6666
  }
6365
- for (const key in raw) {
6366
- const normalizedKey = camelize(key);
6367
- if (validatePropName(normalizedKey)) {
6368
- const opt = raw[key];
6369
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6370
- if (prop) {
6371
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6372
- const stringIndex = getTypeIndex(String, prop.type);
6373
- prop[0 /* shouldCast */] = booleanIndex > -1;
6374
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6375
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6376
- needCastKeys.push(normalizedKey);
6667
+ const installedPlugins = /* @__PURE__ */ new Set();
6668
+ let isMounted = false;
6669
+ const app = context.app = {
6670
+ _uid: uid$1++,
6671
+ _component: rootComponent,
6672
+ _props: rootProps,
6673
+ _container: null,
6674
+ _context: context,
6675
+ _instance: null,
6676
+ version,
6677
+ get config() {
6678
+ return context.config;
6679
+ },
6680
+ set config(v) {
6681
+ {
6682
+ warn(
6683
+ `app.config cannot be replaced. Modify individual options instead.`
6684
+ );
6685
+ }
6686
+ },
6687
+ use(plugin, ...options) {
6688
+ if (installedPlugins.has(plugin)) {
6689
+ warn(`Plugin has already been applied to target app.`);
6690
+ } else if (plugin && isFunction(plugin.install)) {
6691
+ installedPlugins.add(plugin);
6692
+ plugin.install(app, ...options);
6693
+ } else if (isFunction(plugin)) {
6694
+ installedPlugins.add(plugin);
6695
+ plugin(app, ...options);
6696
+ } else {
6697
+ warn(
6698
+ `A plugin must either be a function or an object with an "install" function.`
6699
+ );
6700
+ }
6701
+ return app;
6702
+ },
6703
+ mixin(mixin) {
6704
+ {
6705
+ if (!context.mixins.includes(mixin)) {
6706
+ context.mixins.push(mixin);
6707
+ } else {
6708
+ warn(
6709
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6710
+ );
6711
+ }
6712
+ }
6713
+ return app;
6714
+ },
6715
+ component(name, component) {
6716
+ {
6717
+ validateComponentName(name, context.config);
6718
+ }
6719
+ if (!component) {
6720
+ return context.components[name];
6721
+ }
6722
+ if (context.components[name]) {
6723
+ warn(`Component "${name}" has already been registered in target app.`);
6724
+ }
6725
+ context.components[name] = component;
6726
+ return app;
6727
+ },
6728
+ directive(name, directive) {
6729
+ {
6730
+ validateDirectiveName(name);
6731
+ }
6732
+ if (!directive) {
6733
+ return context.directives[name];
6734
+ }
6735
+ if (context.directives[name]) {
6736
+ warn(`Directive "${name}" has already been registered in target app.`);
6737
+ }
6738
+ context.directives[name] = directive;
6739
+ return app;
6740
+ },
6741
+ mount(rootContainer, isHydrate, isSVG) {
6742
+ if (!isMounted) {
6743
+ if (rootContainer.__vue_app__) {
6744
+ warn(
6745
+ `There is already an app instance mounted on the host container.
6746
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6747
+ );
6377
6748
  }
6749
+ const vnode = createVNode(
6750
+ rootComponent,
6751
+ rootProps
6752
+ );
6753
+ vnode.appContext = context;
6754
+ {
6755
+ context.reload = () => {
6756
+ render(cloneVNode(vnode), rootContainer, isSVG);
6757
+ };
6758
+ }
6759
+ if (isHydrate && hydrate) {
6760
+ hydrate(vnode, rootContainer);
6761
+ } else {
6762
+ render(vnode, rootContainer, isSVG);
6763
+ }
6764
+ isMounted = true;
6765
+ app._container = rootContainer;
6766
+ rootContainer.__vue_app__ = app;
6767
+ {
6768
+ app._instance = vnode.component;
6769
+ devtoolsInitApp(app, version);
6770
+ }
6771
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6772
+ } else {
6773
+ warn(
6774
+ `App has already been mounted.
6775
+ 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)\``
6776
+ );
6777
+ }
6778
+ },
6779
+ unmount() {
6780
+ if (isMounted) {
6781
+ render(null, app._container);
6782
+ {
6783
+ app._instance = null;
6784
+ devtoolsUnmountApp(app);
6785
+ }
6786
+ delete app._container.__vue_app__;
6787
+ } else {
6788
+ warn(`Cannot unmount an app that is not mounted.`);
6789
+ }
6790
+ },
6791
+ provide(key, value) {
6792
+ if (key in context.provides) {
6793
+ warn(
6794
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6795
+ );
6796
+ }
6797
+ context.provides[key] = value;
6798
+ return app;
6799
+ },
6800
+ runWithContext(fn) {
6801
+ currentApp = app;
6802
+ try {
6803
+ return fn();
6804
+ } finally {
6805
+ currentApp = null;
6378
6806
  }
6379
6807
  }
6808
+ };
6809
+ {
6810
+ installAppCompatProperties(app, context, render);
6380
6811
  }
6381
- }
6382
- const res = [normalized, needCastKeys];
6383
- if (isObject(comp)) {
6384
- cache.set(comp, res);
6385
- }
6386
- return res;
6812
+ return app;
6813
+ };
6387
6814
  }
6388
- function validatePropName(key) {
6389
- if (key[0] !== "$") {
6390
- return true;
6815
+ let currentApp = null;
6816
+
6817
+ function provide(key, value) {
6818
+ if (!currentInstance) {
6819
+ {
6820
+ warn(`provide() can only be used inside setup().`);
6821
+ }
6391
6822
  } else {
6392
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6823
+ let provides = currentInstance.provides;
6824
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6825
+ if (parentProvides === provides) {
6826
+ provides = currentInstance.provides = Object.create(parentProvides);
6827
+ }
6828
+ provides[key] = value;
6393
6829
  }
6394
- return false;
6395
6830
  }
6396
- function getType(ctor) {
6397
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6398
- return match ? match[2] : ctor === null ? "null" : "";
6399
- }
6400
- function isSameType(a, b) {
6401
- return getType(a) === getType(b);
6402
- }
6403
- function getTypeIndex(type, expectedTypes) {
6404
- if (isArray(expectedTypes)) {
6405
- return expectedTypes.findIndex((t) => isSameType(t, type));
6406
- } else if (isFunction(expectedTypes)) {
6407
- return isSameType(expectedTypes, type) ? 0 : -1;
6831
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6832
+ const instance = currentInstance || currentRenderingInstance;
6833
+ if (instance || currentApp) {
6834
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6835
+ if (provides && key in provides) {
6836
+ return provides[key];
6837
+ } else if (arguments.length > 1) {
6838
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6839
+ } else {
6840
+ warn(`injection "${String(key)}" not found.`);
6841
+ }
6842
+ } else {
6843
+ warn(`inject() can only be used inside setup() or functional components.`);
6408
6844
  }
6409
- return -1;
6410
6845
  }
6411
- function validateProps(rawProps, props, instance) {
6412
- const resolvedValues = toRaw(props);
6413
- const options = instance.propsOptions[0];
6414
- for (const key in options) {
6415
- let opt = options[key];
6416
- if (opt == null)
6417
- continue;
6418
- validateProp(
6419
- key,
6420
- resolvedValues[key],
6421
- opt,
6422
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6423
- );
6424
- }
6846
+ function hasInjectionContext() {
6847
+ return !!(currentInstance || currentRenderingInstance || currentApp);
6425
6848
  }
6426
- function validateProp(name, value, prop, isAbsent) {
6427
- const { type, required, validator, skipCheck } = prop;
6428
- if (required && isAbsent) {
6429
- warn('Missing required prop: "' + name + '"');
6430
- return;
6431
- }
6432
- if (value == null && !prop.required) {
6433
- return;
6434
- }
6435
- if (type != null && type !== true && !skipCheck) {
6436
- let isValid = false;
6437
- const types = isArray(type) ? type : [type];
6438
- const expectedTypes = [];
6439
- for (let i = 0; i < types.length && !isValid; i++) {
6440
- const { valid, expectedType } = assertType(value, types[i]);
6441
- expectedTypes.push(expectedType || "");
6442
- isValid = valid;
6443
- }
6444
- if (!isValid) {
6445
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6446
- return;
6849
+
6850
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6851
+ return new Proxy(
6852
+ {},
6853
+ {
6854
+ get(_, key) {
6855
+ warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6856
+ if (key === "$options") {
6857
+ return resolveMergedOptions(instance);
6858
+ }
6859
+ if (key in rawProps) {
6860
+ return rawProps[key];
6861
+ }
6862
+ const injections = instance.type.inject;
6863
+ if (injections) {
6864
+ if (isArray(injections)) {
6865
+ if (injections.includes(key)) {
6866
+ return inject(key);
6867
+ }
6868
+ } else if (key in injections) {
6869
+ return inject(key);
6870
+ }
6871
+ }
6872
+ }
6447
6873
  }
6448
- }
6449
- if (validator && !validator(value)) {
6450
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6451
- }
6874
+ );
6452
6875
  }
6453
- const isSimpleType = /* @__PURE__ */ makeMap(
6454
- "String,Number,Boolean,Function,Symbol,BigInt"
6455
- );
6456
- function assertType(value, type) {
6457
- let valid;
6458
- const expectedType = getType(type);
6459
- if (isSimpleType(expectedType)) {
6460
- const t = typeof value;
6461
- valid = t === expectedType.toLowerCase();
6462
- if (!valid && t === "object") {
6463
- valid = value instanceof type;
6464
- }
6465
- } else if (expectedType === "Object") {
6466
- valid = isObject(value);
6467
- } else if (expectedType === "Array") {
6468
- valid = isArray(value);
6469
- } else if (expectedType === "null") {
6470
- valid = value === null;
6471
- } else {
6472
- valid = value instanceof type;
6876
+
6877
+ function shouldSkipAttr(key, instance) {
6878
+ if (key === "is") {
6879
+ return true;
6473
6880
  }
6474
- return {
6475
- valid,
6476
- expectedType
6477
- };
6478
- }
6479
- function getInvalidTypeMessage(name, value, expectedTypes) {
6480
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6481
- const expectedType = expectedTypes[0];
6482
- const receivedType = toRawType(value);
6483
- const expectedValue = styleValue(value, expectedType);
6484
- const receivedValue = styleValue(value, receivedType);
6485
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6486
- message += ` with value ${expectedValue}`;
6881
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6882
+ return true;
6487
6883
  }
6488
- message += `, got ${receivedType} `;
6489
- if (isExplicable(receivedType)) {
6490
- message += `with value ${receivedValue}.`;
6884
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6885
+ return true;
6491
6886
  }
6492
- return message;
6493
- }
6494
- function styleValue(value, type) {
6495
- if (type === "String") {
6496
- return `"${value}"`;
6497
- } else if (type === "Number") {
6498
- return `${Number(value)}`;
6499
- } else {
6500
- return `${value}`;
6887
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6888
+ return true;
6501
6889
  }
6502
- }
6503
- function isExplicable(type) {
6504
- const explicitTypes = ["string", "number", "boolean"];
6505
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6506
- }
6507
- function isBoolean(...args) {
6508
- return args.some((elem) => elem.toLowerCase() === "boolean");
6890
+ return false;
6509
6891
  }
6510
6892
 
6511
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6512
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6513
- const normalizeSlot = (key, rawSlot, ctx) => {
6514
- if (rawSlot._n) {
6515
- return rawSlot;
6516
- }
6517
- const normalized = withCtx((...args) => {
6518
- if (currentInstance) {
6519
- warn(
6520
- `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
6521
- );
6522
- }
6523
- return normalizeSlotValue(rawSlot(...args));
6524
- }, ctx);
6525
- normalized._c = false;
6526
- return normalized;
6527
- };
6528
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6529
- const ctx = rawSlots._ctx;
6530
- for (const key in rawSlots) {
6531
- if (isInternalKey(key))
6532
- continue;
6533
- const value = rawSlots[key];
6534
- if (isFunction(value)) {
6535
- slots[key] = normalizeSlot(key, value, ctx);
6536
- } else if (value != null) {
6537
- if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6538
- warn(
6539
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6540
- );
6541
- }
6542
- const normalized = normalizeSlotValue(value);
6543
- slots[key] = () => normalized;
6893
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6894
+ const props = {};
6895
+ const attrs = {};
6896
+ def(attrs, InternalObjectKey, 1);
6897
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6898
+ setFullProps(instance, rawProps, props, attrs);
6899
+ for (const key in instance.propsOptions[0]) {
6900
+ if (!(key in props)) {
6901
+ props[key] = void 0;
6544
6902
  }
6545
6903
  }
6546
- };
6547
- const normalizeVNodeSlots = (instance, children) => {
6548
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6549
- warn(
6550
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6551
- );
6904
+ {
6905
+ validateProps(rawProps || {}, props, instance);
6552
6906
  }
6553
- const normalized = normalizeSlotValue(children);
6554
- instance.slots.default = () => normalized;
6555
- };
6556
- const initSlots = (instance, children) => {
6557
- if (instance.vnode.shapeFlag & 32) {
6558
- const type = children._;
6559
- if (type) {
6560
- instance.slots = toRaw(children);
6561
- def(children, "_", type);
6562
- } else {
6563
- normalizeObjectSlots(
6564
- children,
6565
- instance.slots = {},
6566
- instance
6567
- );
6568
- }
6907
+ if (isStateful) {
6908
+ instance.props = isSSR ? props : shallowReactive(props);
6569
6909
  } else {
6570
- instance.slots = {};
6571
- if (children) {
6572
- normalizeVNodeSlots(instance, children);
6910
+ if (!instance.type.props) {
6911
+ instance.props = attrs;
6912
+ } else {
6913
+ instance.props = props;
6573
6914
  }
6574
6915
  }
6575
- def(instance.slots, InternalObjectKey, 1);
6576
- };
6577
- const updateSlots = (instance, children, optimized) => {
6578
- const { vnode, slots } = instance;
6579
- let needDeletionCheck = true;
6580
- let deletionComparisonTarget = EMPTY_OBJ;
6581
- if (vnode.shapeFlag & 32) {
6582
- const type = children._;
6583
- if (type) {
6584
- if (isHmrUpdating) {
6585
- extend(slots, children);
6586
- } else if (optimized && type === 1) {
6587
- needDeletionCheck = false;
6588
- } else {
6589
- extend(slots, children);
6590
- if (!optimized && type === 1) {
6591
- delete slots._;
6916
+ instance.attrs = attrs;
6917
+ }
6918
+ function isInHmrContext(instance) {
6919
+ while (instance) {
6920
+ if (instance.type.__hmrId)
6921
+ return true;
6922
+ instance = instance.parent;
6923
+ }
6924
+ }
6925
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6926
+ const {
6927
+ props,
6928
+ attrs,
6929
+ vnode: { patchFlag }
6930
+ } = instance;
6931
+ const rawCurrentProps = toRaw(props);
6932
+ const [options] = instance.propsOptions;
6933
+ let hasAttrsChanged = false;
6934
+ if (
6935
+ // always force full diff in dev
6936
+ // - #1942 if hmr is enabled with sfc component
6937
+ // - vite#872 non-sfc component used by sfc component
6938
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6939
+ ) {
6940
+ if (patchFlag & 8) {
6941
+ const propsToUpdate = instance.vnode.dynamicProps;
6942
+ for (let i = 0; i < propsToUpdate.length; i++) {
6943
+ let key = propsToUpdate[i];
6944
+ if (isEmitListener(instance.emitsOptions, key)) {
6945
+ continue;
6946
+ }
6947
+ const value = rawProps[key];
6948
+ if (options) {
6949
+ if (hasOwn(attrs, key)) {
6950
+ if (value !== attrs[key]) {
6951
+ attrs[key] = value;
6952
+ hasAttrsChanged = true;
6953
+ }
6954
+ } else {
6955
+ const camelizedKey = camelize(key);
6956
+ props[camelizedKey] = resolvePropValue(
6957
+ options,
6958
+ rawCurrentProps,
6959
+ camelizedKey,
6960
+ value,
6961
+ instance,
6962
+ false
6963
+ /* isAbsent */
6964
+ );
6965
+ }
6966
+ } else {
6967
+ {
6968
+ if (isOn(key) && key.endsWith("Native")) {
6969
+ key = key.slice(0, -6);
6970
+ } else if (shouldSkipAttr(key, instance)) {
6971
+ continue;
6972
+ }
6973
+ }
6974
+ if (value !== attrs[key]) {
6975
+ attrs[key] = value;
6976
+ hasAttrsChanged = true;
6977
+ }
6592
6978
  }
6593
6979
  }
6594
- } else {
6595
- needDeletionCheck = !children.$stable;
6596
- normalizeObjectSlots(children, slots, instance);
6597
6980
  }
6598
- deletionComparisonTarget = children;
6599
- } else if (children) {
6600
- normalizeVNodeSlots(instance, children);
6601
- deletionComparisonTarget = { default: 1 };
6602
- }
6603
- if (needDeletionCheck) {
6604
- for (const key in slots) {
6605
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6606
- delete slots[key];
6981
+ } else {
6982
+ if (setFullProps(instance, rawProps, props, attrs)) {
6983
+ hasAttrsChanged = true;
6984
+ }
6985
+ let kebabKey;
6986
+ for (const key in rawCurrentProps) {
6987
+ if (!rawProps || // for camelCase
6988
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6989
+ // and converted to camelCase (#955)
6990
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6991
+ if (options) {
6992
+ if (rawPrevProps && // for camelCase
6993
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6994
+ rawPrevProps[kebabKey] !== void 0)) {
6995
+ props[key] = resolvePropValue(
6996
+ options,
6997
+ rawCurrentProps,
6998
+ key,
6999
+ void 0,
7000
+ instance,
7001
+ true
7002
+ /* isAbsent */
7003
+ );
7004
+ }
7005
+ } else {
7006
+ delete props[key];
7007
+ }
6607
7008
  }
6608
7009
  }
6609
- }
6610
- };
6611
-
6612
- function installLegacyConfigWarnings(config) {
6613
- const legacyConfigOptions = {
6614
- silent: "CONFIG_SILENT",
6615
- devtools: "CONFIG_DEVTOOLS",
6616
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6617
- keyCodes: "CONFIG_KEY_CODES",
6618
- productionTip: "CONFIG_PRODUCTION_TIP"
6619
- };
6620
- Object.keys(legacyConfigOptions).forEach((key) => {
6621
- let val = config[key];
6622
- Object.defineProperty(config, key, {
6623
- enumerable: true,
6624
- get() {
6625
- return val;
6626
- },
6627
- set(newVal) {
6628
- if (!isCopyingConfig) {
6629
- warnDeprecation$1(legacyConfigOptions[key], null);
7010
+ if (attrs !== rawCurrentProps) {
7011
+ for (const key in attrs) {
7012
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
7013
+ delete attrs[key];
7014
+ hasAttrsChanged = true;
6630
7015
  }
6631
- val = newVal;
6632
7016
  }
6633
- });
6634
- });
7017
+ }
7018
+ }
7019
+ if (hasAttrsChanged) {
7020
+ trigger(instance, "set", "$attrs");
7021
+ }
7022
+ {
7023
+ validateProps(rawProps || {}, props, instance);
7024
+ }
6635
7025
  }
6636
- function installLegacyOptionMergeStrats(config) {
6637
- config.optionMergeStrategies = new Proxy({}, {
6638
- get(target, key) {
6639
- if (key in target) {
6640
- return target[key];
7026
+ function setFullProps(instance, rawProps, props, attrs) {
7027
+ const [options, needCastKeys] = instance.propsOptions;
7028
+ let hasAttrsChanged = false;
7029
+ let rawCastValues;
7030
+ if (rawProps) {
7031
+ for (let key in rawProps) {
7032
+ if (isReservedProp(key)) {
7033
+ continue;
6641
7034
  }
6642
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6643
- "CONFIG_OPTION_MERGE_STRATS",
6644
- null
6645
- )) {
6646
- return internalOptionMergeStrats[key];
7035
+ {
7036
+ if (key.startsWith("onHook:")) {
7037
+ softAssertCompatEnabled(
7038
+ "INSTANCE_EVENT_HOOKS",
7039
+ instance,
7040
+ key.slice(2).toLowerCase()
7041
+ );
7042
+ }
7043
+ if (key === "inline-template") {
7044
+ continue;
7045
+ }
7046
+ }
7047
+ const value = rawProps[key];
7048
+ let camelKey;
7049
+ if (options && hasOwn(options, camelKey = camelize(key))) {
7050
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
7051
+ props[camelKey] = value;
7052
+ } else {
7053
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
7054
+ }
7055
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
7056
+ {
7057
+ if (isOn(key) && key.endsWith("Native")) {
7058
+ key = key.slice(0, -6);
7059
+ } else if (shouldSkipAttr(key, instance)) {
7060
+ continue;
7061
+ }
7062
+ }
7063
+ if (!(key in attrs) || value !== attrs[key]) {
7064
+ attrs[key] = value;
7065
+ hasAttrsChanged = true;
7066
+ }
6647
7067
  }
6648
7068
  }
6649
- });
7069
+ }
7070
+ if (needCastKeys) {
7071
+ const rawCurrentProps = toRaw(props);
7072
+ const castValues = rawCastValues || EMPTY_OBJ;
7073
+ for (let i = 0; i < needCastKeys.length; i++) {
7074
+ const key = needCastKeys[i];
7075
+ props[key] = resolvePropValue(
7076
+ options,
7077
+ rawCurrentProps,
7078
+ key,
7079
+ castValues[key],
7080
+ instance,
7081
+ !hasOwn(castValues, key)
7082
+ );
7083
+ }
7084
+ }
7085
+ return hasAttrsChanged;
6650
7086
  }
6651
-
6652
- let isCopyingConfig = false;
6653
- let singletonApp;
6654
- let singletonCtor;
6655
- function createCompatVue$1(createApp, createSingletonApp) {
6656
- singletonApp = createSingletonApp({});
6657
- const Vue = singletonCtor = function Vue2(options = {}) {
6658
- return createCompatApp(options, Vue2);
6659
- };
6660
- function createCompatApp(options = {}, Ctor) {
6661
- assertCompatEnabled("GLOBAL_MOUNT", null);
6662
- const { data } = options;
6663
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6664
- options.data = () => data;
7087
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7088
+ const opt = options[key];
7089
+ if (opt != null) {
7090
+ const hasDefault = hasOwn(opt, "default");
7091
+ if (hasDefault && value === void 0) {
7092
+ const defaultValue = opt.default;
7093
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
7094
+ const { propsDefaults } = instance;
7095
+ if (key in propsDefaults) {
7096
+ value = propsDefaults[key];
7097
+ } else {
7098
+ setCurrentInstance(instance);
7099
+ value = propsDefaults[key] = defaultValue.call(
7100
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7101
+ props
7102
+ );
7103
+ unsetCurrentInstance();
7104
+ }
7105
+ } else {
7106
+ value = defaultValue;
7107
+ }
6665
7108
  }
6666
- const app = createApp(options);
6667
- if (Ctor !== Vue) {
6668
- applySingletonPrototype(app, Ctor);
6669
- }
6670
- const vm = app._createRoot(options);
6671
- if (options.el) {
6672
- return vm.$mount(options.el);
6673
- } else {
6674
- return vm;
7109
+ if (opt[0 /* shouldCast */]) {
7110
+ if (isAbsent && !hasDefault) {
7111
+ value = false;
7112
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
7113
+ value = true;
7114
+ }
6675
7115
  }
6676
7116
  }
6677
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.8"}`;
6678
- Vue.config = singletonApp.config;
6679
- Vue.use = (p, ...options) => {
6680
- if (p && isFunction(p.install)) {
6681
- p.install(Vue, ...options);
6682
- } else if (isFunction(p)) {
6683
- p(Vue, ...options);
6684
- }
6685
- return Vue;
6686
- };
6687
- Vue.mixin = (m) => {
6688
- singletonApp.mixin(m);
6689
- return Vue;
6690
- };
6691
- Vue.component = (name, comp) => {
6692
- if (comp) {
6693
- singletonApp.component(name, comp);
6694
- return Vue;
6695
- } else {
6696
- return singletonApp.component(name);
7117
+ return value;
7118
+ }
7119
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
7120
+ const cache = appContext.propsCache;
7121
+ const cached = cache.get(comp);
7122
+ if (cached) {
7123
+ return cached;
7124
+ }
7125
+ const raw = comp.props;
7126
+ const normalized = {};
7127
+ const needCastKeys = [];
7128
+ let hasExtends = false;
7129
+ if (!isFunction(comp)) {
7130
+ const extendProps = (raw2) => {
7131
+ if (isFunction(raw2)) {
7132
+ raw2 = raw2.options;
7133
+ }
7134
+ hasExtends = true;
7135
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
7136
+ extend(normalized, props);
7137
+ if (keys)
7138
+ needCastKeys.push(...keys);
7139
+ };
7140
+ if (!asMixin && appContext.mixins.length) {
7141
+ appContext.mixins.forEach(extendProps);
6697
7142
  }
6698
- };
6699
- Vue.directive = (name, dir) => {
6700
- if (dir) {
6701
- singletonApp.directive(name, dir);
6702
- return Vue;
6703
- } else {
6704
- return singletonApp.directive(name);
7143
+ if (comp.extends) {
7144
+ extendProps(comp.extends);
6705
7145
  }
6706
- };
6707
- Vue.options = { _base: Vue };
6708
- let cid = 1;
6709
- Vue.cid = cid;
6710
- Vue.nextTick = nextTick;
6711
- const extendCache = /* @__PURE__ */ new WeakMap();
6712
- function extendCtor(extendOptions = {}) {
6713
- assertCompatEnabled("GLOBAL_EXTEND", null);
6714
- if (isFunction(extendOptions)) {
6715
- extendOptions = extendOptions.options;
7146
+ if (comp.mixins) {
7147
+ comp.mixins.forEach(extendProps);
6716
7148
  }
6717
- if (extendCache.has(extendOptions)) {
6718
- return extendCache.get(extendOptions);
7149
+ }
7150
+ if (!raw && !hasExtends) {
7151
+ if (isObject(comp)) {
7152
+ cache.set(comp, EMPTY_ARR);
6719
7153
  }
6720
- const Super = this;
6721
- function SubVue(inlineOptions) {
6722
- if (!inlineOptions) {
6723
- return createCompatApp(SubVue.options, SubVue);
6724
- } else {
6725
- return createCompatApp(
6726
- mergeOptions(
6727
- extend({}, SubVue.options),
6728
- inlineOptions,
6729
- internalOptionMergeStrats
6730
- ),
6731
- SubVue
6732
- );
7154
+ return EMPTY_ARR;
7155
+ }
7156
+ if (isArray(raw)) {
7157
+ for (let i = 0; i < raw.length; i++) {
7158
+ if (!isString(raw[i])) {
7159
+ warn(`props must be strings when using array syntax.`, raw[i]);
7160
+ }
7161
+ const normalizedKey = camelize(raw[i]);
7162
+ if (validatePropName(normalizedKey)) {
7163
+ normalized[normalizedKey] = EMPTY_OBJ;
6733
7164
  }
6734
7165
  }
6735
- SubVue.super = Super;
6736
- SubVue.prototype = Object.create(Vue.prototype);
6737
- SubVue.prototype.constructor = SubVue;
6738
- const mergeBase = {};
6739
- for (const key in Super.options) {
6740
- const superValue = Super.options[key];
6741
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
7166
+ } else if (raw) {
7167
+ if (!isObject(raw)) {
7168
+ warn(`invalid props options`, raw);
6742
7169
  }
6743
- SubVue.options = mergeOptions(
6744
- mergeBase,
6745
- extendOptions,
6746
- internalOptionMergeStrats
7170
+ for (const key in raw) {
7171
+ const normalizedKey = camelize(key);
7172
+ if (validatePropName(normalizedKey)) {
7173
+ const opt = raw[key];
7174
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
7175
+ if (prop) {
7176
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
7177
+ const stringIndex = getTypeIndex(String, prop.type);
7178
+ prop[0 /* shouldCast */] = booleanIndex > -1;
7179
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
7180
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
7181
+ needCastKeys.push(normalizedKey);
7182
+ }
7183
+ }
7184
+ }
7185
+ }
7186
+ }
7187
+ const res = [normalized, needCastKeys];
7188
+ if (isObject(comp)) {
7189
+ cache.set(comp, res);
7190
+ }
7191
+ return res;
7192
+ }
7193
+ function validatePropName(key) {
7194
+ if (key[0] !== "$") {
7195
+ return true;
7196
+ } else {
7197
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
7198
+ }
7199
+ return false;
7200
+ }
7201
+ function getType(ctor) {
7202
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7203
+ return match ? match[2] : ctor === null ? "null" : "";
7204
+ }
7205
+ function isSameType(a, b) {
7206
+ return getType(a) === getType(b);
7207
+ }
7208
+ function getTypeIndex(type, expectedTypes) {
7209
+ if (isArray(expectedTypes)) {
7210
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7211
+ } else if (isFunction(expectedTypes)) {
7212
+ return isSameType(expectedTypes, type) ? 0 : -1;
7213
+ }
7214
+ return -1;
7215
+ }
7216
+ function validateProps(rawProps, props, instance) {
7217
+ const resolvedValues = toRaw(props);
7218
+ const options = instance.propsOptions[0];
7219
+ for (const key in options) {
7220
+ let opt = options[key];
7221
+ if (opt == null)
7222
+ continue;
7223
+ validateProp(
7224
+ key,
7225
+ resolvedValues[key],
7226
+ opt,
7227
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6747
7228
  );
6748
- SubVue.options._base = SubVue;
6749
- SubVue.extend = extendCtor.bind(SubVue);
6750
- SubVue.mixin = Super.mixin;
6751
- SubVue.use = Super.use;
6752
- SubVue.cid = ++cid;
6753
- extendCache.set(extendOptions, SubVue);
6754
- return SubVue;
6755
7229
  }
6756
- Vue.extend = extendCtor.bind(Vue);
6757
- Vue.set = (target, key, value) => {
6758
- assertCompatEnabled("GLOBAL_SET", null);
6759
- target[key] = value;
6760
- };
6761
- Vue.delete = (target, key) => {
6762
- assertCompatEnabled("GLOBAL_DELETE", null);
6763
- delete target[key];
6764
- };
6765
- Vue.observable = (target) => {
6766
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6767
- return reactive(target);
6768
- };
6769
- Vue.filter = (name, filter) => {
6770
- if (filter) {
6771
- singletonApp.filter(name, filter);
6772
- return Vue;
6773
- } else {
6774
- return singletonApp.filter(name);
6775
- }
6776
- };
6777
- const util = {
6778
- warn: warn ,
6779
- extend,
6780
- mergeOptions: (parent, child, vm) => mergeOptions(
6781
- parent,
6782
- child,
6783
- vm ? void 0 : internalOptionMergeStrats
6784
- ),
6785
- defineReactive
6786
- };
6787
- Object.defineProperty(Vue, "util", {
6788
- get() {
6789
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6790
- return util;
6791
- }
6792
- });
6793
- Vue.configureCompat = configureCompat;
6794
- return Vue;
6795
7230
  }
6796
- function installAppCompatProperties(app, context, render) {
6797
- installFilterMethod(app, context);
6798
- installLegacyOptionMergeStrats(app.config);
6799
- if (!singletonApp) {
7231
+ function validateProp(name, value, prop, isAbsent) {
7232
+ const { type, required, validator, skipCheck } = prop;
7233
+ if (required && isAbsent) {
7234
+ warn('Missing required prop: "' + name + '"');
6800
7235
  return;
6801
7236
  }
6802
- installCompatMount(app, context, render);
6803
- installLegacyAPIs(app);
6804
- applySingletonAppMutations(app);
6805
- installLegacyConfigWarnings(app.config);
6806
- }
6807
- function installFilterMethod(app, context) {
6808
- context.filters = {};
6809
- app.filter = (name, filter) => {
6810
- assertCompatEnabled("FILTERS", null);
6811
- if (!filter) {
6812
- return context.filters[name];
7237
+ if (value == null && !required) {
7238
+ return;
7239
+ }
7240
+ if (type != null && type !== true && !skipCheck) {
7241
+ let isValid = false;
7242
+ const types = isArray(type) ? type : [type];
7243
+ const expectedTypes = [];
7244
+ for (let i = 0; i < types.length && !isValid; i++) {
7245
+ const { valid, expectedType } = assertType(value, types[i]);
7246
+ expectedTypes.push(expectedType || "");
7247
+ isValid = valid;
6813
7248
  }
6814
- if (context.filters[name]) {
6815
- warn(`Filter "${name}" has already been registered.`);
7249
+ if (!isValid) {
7250
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7251
+ return;
6816
7252
  }
6817
- context.filters[name] = filter;
6818
- return app;
6819
- };
7253
+ }
7254
+ if (validator && !validator(value)) {
7255
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
7256
+ }
6820
7257
  }
6821
- function installLegacyAPIs(app) {
6822
- Object.defineProperties(app, {
6823
- // so that app.use() can work with legacy plugins that extend prototypes
6824
- prototype: {
6825
- get() {
6826
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6827
- return app.config.globalProperties;
6828
- }
6829
- },
6830
- nextTick: { value: nextTick },
6831
- extend: { value: singletonCtor.extend },
6832
- set: { value: singletonCtor.set },
6833
- delete: { value: singletonCtor.delete },
6834
- observable: { value: singletonCtor.observable },
6835
- util: {
6836
- get() {
6837
- return singletonCtor.util;
6838
- }
6839
- }
6840
- });
6841
- }
6842
- function applySingletonAppMutations(app) {
6843
- app._context.mixins = [...singletonApp._context.mixins];
6844
- ["components", "directives", "filters"].forEach((key) => {
6845
- app._context[key] = Object.create(singletonApp._context[key]);
6846
- });
6847
- isCopyingConfig = true;
6848
- for (const key in singletonApp.config) {
6849
- if (key === "isNativeTag")
6850
- continue;
6851
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6852
- continue;
6853
- }
6854
- const val = singletonApp.config[key];
6855
- app.config[key] = isObject(val) ? Object.create(val) : val;
6856
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6857
- app.config.compilerOptions.isCustomElement = (tag) => {
6858
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6859
- };
6860
- }
6861
- }
6862
- isCopyingConfig = false;
6863
- applySingletonPrototype(app, singletonCtor);
6864
- }
6865
- function applySingletonPrototype(app, Ctor) {
6866
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6867
- if (enabled) {
6868
- app.config.globalProperties = Object.create(Ctor.prototype);
6869
- }
6870
- let hasPrototypeAugmentations = false;
6871
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6872
- for (const key in descriptors) {
6873
- if (key !== "constructor") {
6874
- hasPrototypeAugmentations = true;
6875
- if (enabled) {
6876
- Object.defineProperty(
6877
- app.config.globalProperties,
6878
- key,
6879
- descriptors[key]
6880
- );
6881
- }
6882
- }
6883
- }
6884
- if (hasPrototypeAugmentations) {
6885
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6886
- }
6887
- }
6888
- function installCompatMount(app, context, render) {
6889
- let isMounted = false;
6890
- app._createRoot = (options) => {
6891
- const component = app._component;
6892
- const vnode = createVNode(component, options.propsData || null);
6893
- vnode.appContext = context;
6894
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6895
- const emptyRender = () => {
6896
- };
6897
- const instance = createComponentInstance(vnode, null, null);
6898
- if (hasNoRender) {
6899
- instance.render = emptyRender;
6900
- }
6901
- setupComponent(instance);
6902
- vnode.component = instance;
6903
- vnode.isCompatRoot = true;
6904
- instance.ctx._compat_mount = (selectorOrEl) => {
6905
- if (isMounted) {
6906
- warn(`Root instance is already mounted.`);
6907
- return;
6908
- }
6909
- let container;
6910
- if (typeof selectorOrEl === "string") {
6911
- const result = document.querySelector(selectorOrEl);
6912
- if (!result) {
6913
- warn(
6914
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6915
- );
6916
- return;
6917
- }
6918
- container = result;
6919
- } else {
6920
- container = selectorOrEl || document.createElement("div");
6921
- }
6922
- const isSVG = container instanceof SVGElement;
6923
- {
6924
- context.reload = () => {
6925
- const cloned = cloneVNode(vnode);
6926
- cloned.component = null;
6927
- render(cloned, container, isSVG);
6928
- };
6929
- }
6930
- if (hasNoRender && instance.render === emptyRender) {
6931
- {
6932
- for (let i = 0; i < container.attributes.length; i++) {
6933
- const attr = container.attributes[i];
6934
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6935
- warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6936
- break;
6937
- }
6938
- }
6939
- }
6940
- instance.render = null;
6941
- component.template = container.innerHTML;
6942
- finishComponentSetup(
6943
- instance,
6944
- false,
6945
- true
6946
- /* skip options */
6947
- );
6948
- }
6949
- container.innerHTML = "";
6950
- render(vnode, container, isSVG);
6951
- if (container instanceof Element) {
6952
- container.removeAttribute("v-cloak");
6953
- container.setAttribute("data-v-app", "");
6954
- }
6955
- isMounted = true;
6956
- app._container = container;
6957
- container.__vue_app__ = app;
6958
- {
6959
- devtoolsInitApp(app, version);
6960
- }
6961
- return instance.proxy;
6962
- };
6963
- instance.ctx._compat_destroy = () => {
6964
- if (isMounted) {
6965
- render(null, app._container);
6966
- {
6967
- devtoolsUnmountApp(app);
6968
- }
6969
- delete app._container.__vue_app__;
6970
- } else {
6971
- const { bum, scope, um } = instance;
6972
- if (bum) {
6973
- invokeArrayFns(bum);
6974
- }
6975
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6976
- instance.emit("hook:beforeDestroy");
6977
- }
6978
- if (scope) {
6979
- scope.stop();
6980
- }
6981
- if (um) {
6982
- invokeArrayFns(um);
6983
- }
6984
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6985
- instance.emit("hook:destroyed");
6986
- }
6987
- }
6988
- };
6989
- return instance.proxy;
6990
- };
6991
- }
6992
- const methodsToPatch = [
6993
- "push",
6994
- "pop",
6995
- "shift",
6996
- "unshift",
6997
- "splice",
6998
- "sort",
6999
- "reverse"
7000
- ];
7001
- const patched = /* @__PURE__ */ new WeakSet();
7002
- function defineReactive(obj, key, val) {
7003
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
7004
- const reactiveVal = reactive(val);
7005
- if (isArray(val)) {
7006
- methodsToPatch.forEach((m) => {
7007
- val[m] = (...args) => {
7008
- Array.prototype[m].call(reactiveVal, ...args);
7009
- };
7010
- });
7011
- } else {
7012
- Object.keys(val).forEach((key2) => {
7013
- try {
7014
- defineReactiveSimple(val, key2, val[key2]);
7015
- } catch (e) {
7016
- }
7017
- });
7258
+ const isSimpleType = /* @__PURE__ */ makeMap(
7259
+ "String,Number,Boolean,Function,Symbol,BigInt"
7260
+ );
7261
+ function assertType(value, type) {
7262
+ let valid;
7263
+ const expectedType = getType(type);
7264
+ if (isSimpleType(expectedType)) {
7265
+ const t = typeof value;
7266
+ valid = t === expectedType.toLowerCase();
7267
+ if (!valid && t === "object") {
7268
+ valid = value instanceof type;
7018
7269
  }
7019
- }
7020
- const i = obj.$;
7021
- if (i && obj === i.proxy) {
7022
- defineReactiveSimple(i.ctx, key, val);
7023
- i.accessCache = /* @__PURE__ */ Object.create(null);
7024
- } else if (isReactive(obj)) {
7025
- obj[key] = val;
7270
+ } else if (expectedType === "Object") {
7271
+ valid = isObject(value);
7272
+ } else if (expectedType === "Array") {
7273
+ valid = isArray(value);
7274
+ } else if (expectedType === "null") {
7275
+ valid = value === null;
7026
7276
  } else {
7027
- defineReactiveSimple(obj, key, val);
7277
+ valid = value instanceof type;
7028
7278
  }
7029
- }
7030
- function defineReactiveSimple(obj, key, val) {
7031
- val = isObject(val) ? reactive(val) : val;
7032
- Object.defineProperty(obj, key, {
7033
- enumerable: true,
7034
- configurable: true,
7035
- get() {
7036
- track(obj, "get", key);
7037
- return val;
7038
- },
7039
- set(newVal) {
7040
- val = isObject(newVal) ? reactive(newVal) : newVal;
7041
- trigger(obj, "set", key, newVal);
7042
- }
7043
- });
7044
- }
7045
-
7046
- function createAppContext() {
7047
7279
  return {
7048
- app: null,
7049
- config: {
7050
- isNativeTag: NO,
7051
- performance: false,
7052
- globalProperties: {},
7053
- optionMergeStrategies: {},
7054
- errorHandler: void 0,
7055
- warnHandler: void 0,
7056
- compilerOptions: {}
7057
- },
7058
- mixins: [],
7059
- components: {},
7060
- directives: {},
7061
- provides: /* @__PURE__ */ Object.create(null),
7062
- optionsCache: /* @__PURE__ */ new WeakMap(),
7063
- propsCache: /* @__PURE__ */ new WeakMap(),
7064
- emitsCache: /* @__PURE__ */ new WeakMap()
7280
+ valid,
7281
+ expectedType
7065
7282
  };
7066
7283
  }
7067
- let uid$1 = 0;
7068
- function createAppAPI(render, hydrate) {
7069
- return function createApp(rootComponent, rootProps = null) {
7070
- if (!isFunction(rootComponent)) {
7071
- rootComponent = extend({}, rootComponent);
7072
- }
7073
- if (rootProps != null && !isObject(rootProps)) {
7074
- warn(`root props passed to app.mount() must be an object.`);
7075
- rootProps = null;
7076
- }
7077
- const context = createAppContext();
7078
- const installedPlugins = /* @__PURE__ */ new Set();
7079
- let isMounted = false;
7080
- const app = context.app = {
7081
- _uid: uid$1++,
7082
- _component: rootComponent,
7083
- _props: rootProps,
7084
- _container: null,
7085
- _context: context,
7086
- _instance: null,
7087
- version,
7088
- get config() {
7089
- return context.config;
7090
- },
7091
- set config(v) {
7092
- {
7093
- warn(
7094
- `app.config cannot be replaced. Modify individual options instead.`
7095
- );
7096
- }
7097
- },
7098
- use(plugin, ...options) {
7099
- if (installedPlugins.has(plugin)) {
7100
- warn(`Plugin has already been applied to target app.`);
7101
- } else if (plugin && isFunction(plugin.install)) {
7102
- installedPlugins.add(plugin);
7103
- plugin.install(app, ...options);
7104
- } else if (isFunction(plugin)) {
7105
- installedPlugins.add(plugin);
7106
- plugin(app, ...options);
7107
- } else {
7108
- warn(
7109
- `A plugin must either be a function or an object with an "install" function.`
7110
- );
7111
- }
7112
- return app;
7113
- },
7114
- mixin(mixin) {
7115
- {
7116
- if (!context.mixins.includes(mixin)) {
7117
- context.mixins.push(mixin);
7118
- } else {
7119
- warn(
7120
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7121
- );
7122
- }
7123
- }
7124
- return app;
7125
- },
7126
- component(name, component) {
7127
- {
7128
- validateComponentName(name, context.config);
7129
- }
7130
- if (!component) {
7131
- return context.components[name];
7132
- }
7133
- if (context.components[name]) {
7134
- warn(`Component "${name}" has already been registered in target app.`);
7135
- }
7136
- context.components[name] = component;
7137
- return app;
7138
- },
7139
- directive(name, directive) {
7140
- {
7141
- validateDirectiveName(name);
7142
- }
7143
- if (!directive) {
7144
- return context.directives[name];
7145
- }
7146
- if (context.directives[name]) {
7147
- warn(`Directive "${name}" has already been registered in target app.`);
7148
- }
7149
- context.directives[name] = directive;
7150
- return app;
7151
- },
7152
- mount(rootContainer, isHydrate, isSVG) {
7153
- if (!isMounted) {
7154
- if (rootContainer.__vue_app__) {
7155
- warn(
7156
- `There is already an app instance mounted on the host container.
7157
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7158
- );
7159
- }
7160
- const vnode = createVNode(
7161
- rootComponent,
7162
- rootProps
7163
- );
7164
- vnode.appContext = context;
7165
- {
7166
- context.reload = () => {
7167
- render(cloneVNode(vnode), rootContainer, isSVG);
7168
- };
7169
- }
7170
- if (isHydrate && hydrate) {
7171
- hydrate(vnode, rootContainer);
7172
- } else {
7173
- render(vnode, rootContainer, isSVG);
7174
- }
7175
- isMounted = true;
7176
- app._container = rootContainer;
7177
- rootContainer.__vue_app__ = app;
7178
- {
7179
- app._instance = vnode.component;
7180
- devtoolsInitApp(app, version);
7181
- }
7182
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7183
- } else {
7184
- warn(
7185
- `App has already been mounted.
7186
- If you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. \`const createMyApp = () => createApp(App)\``
7187
- );
7188
- }
7189
- },
7190
- unmount() {
7191
- if (isMounted) {
7192
- render(null, app._container);
7193
- {
7194
- app._instance = null;
7195
- devtoolsUnmountApp(app);
7196
- }
7197
- delete app._container.__vue_app__;
7198
- } else {
7199
- warn(`Cannot unmount an app that is not mounted.`);
7200
- }
7201
- },
7202
- provide(key, value) {
7203
- if (key in context.provides) {
7204
- warn(
7205
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7206
- );
7284
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7285
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7286
+ const expectedType = expectedTypes[0];
7287
+ const receivedType = toRawType(value);
7288
+ const expectedValue = styleValue(value, expectedType);
7289
+ const receivedValue = styleValue(value, receivedType);
7290
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7291
+ message += ` with value ${expectedValue}`;
7292
+ }
7293
+ message += `, got ${receivedType} `;
7294
+ if (isExplicable(receivedType)) {
7295
+ message += `with value ${receivedValue}.`;
7296
+ }
7297
+ return message;
7298
+ }
7299
+ function styleValue(value, type) {
7300
+ if (type === "String") {
7301
+ return `"${value}"`;
7302
+ } else if (type === "Number") {
7303
+ return `${Number(value)}`;
7304
+ } else {
7305
+ return `${value}`;
7306
+ }
7307
+ }
7308
+ function isExplicable(type) {
7309
+ const explicitTypes = ["string", "number", "boolean"];
7310
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7311
+ }
7312
+ function isBoolean(...args) {
7313
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7314
+ }
7315
+
7316
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7317
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7318
+ const normalizeSlot = (key, rawSlot, ctx) => {
7319
+ if (rawSlot._n) {
7320
+ return rawSlot;
7321
+ }
7322
+ const normalized = withCtx((...args) => {
7323
+ if (currentInstance) {
7324
+ warn(
7325
+ `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.`
7326
+ );
7327
+ }
7328
+ return normalizeSlotValue(rawSlot(...args));
7329
+ }, ctx);
7330
+ normalized._c = false;
7331
+ return normalized;
7332
+ };
7333
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7334
+ const ctx = rawSlots._ctx;
7335
+ for (const key in rawSlots) {
7336
+ if (isInternalKey(key))
7337
+ continue;
7338
+ const value = rawSlots[key];
7339
+ if (isFunction(value)) {
7340
+ slots[key] = normalizeSlot(key, value, ctx);
7341
+ } else if (value != null) {
7342
+ if (!isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7343
+ warn(
7344
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7345
+ );
7346
+ }
7347
+ const normalized = normalizeSlotValue(value);
7348
+ slots[key] = () => normalized;
7349
+ }
7350
+ }
7351
+ };
7352
+ const normalizeVNodeSlots = (instance, children) => {
7353
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7354
+ warn(
7355
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7356
+ );
7357
+ }
7358
+ const normalized = normalizeSlotValue(children);
7359
+ instance.slots.default = () => normalized;
7360
+ };
7361
+ const initSlots = (instance, children) => {
7362
+ if (instance.vnode.shapeFlag & 32) {
7363
+ const type = children._;
7364
+ if (type) {
7365
+ instance.slots = toRaw(children);
7366
+ def(children, "_", type);
7367
+ } else {
7368
+ normalizeObjectSlots(
7369
+ children,
7370
+ instance.slots = {},
7371
+ instance
7372
+ );
7373
+ }
7374
+ } else {
7375
+ instance.slots = {};
7376
+ if (children) {
7377
+ normalizeVNodeSlots(instance, children);
7378
+ }
7379
+ }
7380
+ def(instance.slots, InternalObjectKey, 1);
7381
+ };
7382
+ const updateSlots = (instance, children, optimized) => {
7383
+ const { vnode, slots } = instance;
7384
+ let needDeletionCheck = true;
7385
+ let deletionComparisonTarget = EMPTY_OBJ;
7386
+ if (vnode.shapeFlag & 32) {
7387
+ const type = children._;
7388
+ if (type) {
7389
+ if (isHmrUpdating) {
7390
+ extend(slots, children);
7391
+ trigger(instance, "set", "$slots");
7392
+ } else if (optimized && type === 1) {
7393
+ needDeletionCheck = false;
7394
+ } else {
7395
+ extend(slots, children);
7396
+ if (!optimized && type === 1) {
7397
+ delete slots._;
7207
7398
  }
7208
- context.provides[key] = value;
7209
- return app;
7210
7399
  }
7211
- };
7212
- {
7213
- installAppCompatProperties(app, context, render);
7400
+ } else {
7401
+ needDeletionCheck = !children.$stable;
7402
+ normalizeObjectSlots(children, slots, instance);
7214
7403
  }
7215
- return app;
7216
- };
7217
- }
7404
+ deletionComparisonTarget = children;
7405
+ } else if (children) {
7406
+ normalizeVNodeSlots(instance, children);
7407
+ deletionComparisonTarget = { default: 1 };
7408
+ }
7409
+ if (needDeletionCheck) {
7410
+ for (const key in slots) {
7411
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7412
+ delete slots[key];
7413
+ }
7414
+ }
7415
+ }
7416
+ };
7218
7417
 
7219
7418
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7220
7419
  if (isArray(rawRef)) {
@@ -8118,7 +8317,7 @@ If you want to remount the same app, move your app creation logic into a factory
8118
8317
  areChildrenSVG,
8119
8318
  slotScopeIds
8120
8319
  );
8121
- if (parentComponent && parentComponent.type.__hmrId) {
8320
+ {
8122
8321
  traverseStaticChildren(n1, n2);
8123
8322
  }
8124
8323
  } else if (!optimized) {
@@ -8314,21 +8513,8 @@ If you want to remount the same app, move your app creation logic into a factory
8314
8513
  isSVG,
8315
8514
  slotScopeIds
8316
8515
  );
8317
- if (parentComponent && parentComponent.type.__hmrId) {
8516
+ {
8318
8517
  traverseStaticChildren(n1, n2);
8319
- } else if (
8320
- // #2080 if the stable fragment has a key, it's a <template v-for> that may
8321
- // get moved around. Make sure all root level vnodes inherit el.
8322
- // #2134 or if it's a component root, it may also get moved around
8323
- // as the component is being moved.
8324
- n2.key != null || parentComponent && n2 === parentComponent.subTree
8325
- ) {
8326
- traverseStaticChildren(
8327
- n1,
8328
- n2,
8329
- true
8330
- /* shallow */
8331
- );
8332
8518
  }
8333
8519
  } else {
8334
8520
  patchChildren(
@@ -9997,6 +10183,8 @@ Component that was made reactive: `,
9997
10183
  refs: EMPTY_OBJ,
9998
10184
  setupState: EMPTY_OBJ,
9999
10185
  setupContext: null,
10186
+ attrsProxy: null,
10187
+ slotsProxy: null,
10000
10188
  // suspense related
10001
10189
  suspense,
10002
10190
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -10236,8 +10424,8 @@ Component that was made reactive: `,
10236
10424
  }
10237
10425
  }
10238
10426
  }
10239
- function createAttrsProxy(instance) {
10240
- return new Proxy(
10427
+ function getAttrsProxy(instance) {
10428
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10241
10429
  instance.attrs,
10242
10430
  {
10243
10431
  get(target, key) {
@@ -10254,7 +10442,23 @@ Component that was made reactive: `,
10254
10442
  return false;
10255
10443
  }
10256
10444
  }
10257
- );
10445
+ ));
10446
+ }
10447
+ function getSlotsProxy(instance) {
10448
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
10449
+ get(target, key) {
10450
+ track(instance, "get", "$slots");
10451
+ return target[key];
10452
+ },
10453
+ set() {
10454
+ warn(`setupContext.slots is readonly.`);
10455
+ return false;
10456
+ },
10457
+ deleteProperty() {
10458
+ warn(`setupContext.slots is readonly.`);
10459
+ return false;
10460
+ }
10461
+ }));
10258
10462
  }
10259
10463
  function createSetupContext(instance) {
10260
10464
  const expose = (exposed) => {
@@ -10280,14 +10484,13 @@ Component that was made reactive: `,
10280
10484
  }
10281
10485
  instance.exposed = exposed || {};
10282
10486
  };
10283
- let attrs;
10284
10487
  {
10285
10488
  return Object.freeze({
10286
10489
  get attrs() {
10287
- return attrs || (attrs = createAttrsProxy(instance));
10490
+ return getAttrsProxy(instance);
10288
10491
  },
10289
10492
  get slots() {
10290
- return shallowReadonly(instance.slots);
10493
+ return getSlotsProxy(instance);
10291
10494
  },
10292
10495
  get emit() {
10293
10496
  return (event, ...args) => instance.emit(event, ...args);
@@ -10347,111 +10550,6 @@ Component that was made reactive: `,
10347
10550
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10348
10551
  };
10349
10552
 
10350
- const warnRuntimeUsage = (method) => warn(
10351
- `${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.`
10352
- );
10353
- function defineProps() {
10354
- {
10355
- warnRuntimeUsage(`defineProps`);
10356
- }
10357
- return null;
10358
- }
10359
- function defineEmits() {
10360
- {
10361
- warnRuntimeUsage(`defineEmits`);
10362
- }
10363
- return null;
10364
- }
10365
- function defineExpose(exposed) {
10366
- {
10367
- warnRuntimeUsage(`defineExpose`);
10368
- }
10369
- }
10370
- function defineOptions(options) {
10371
- {
10372
- warnRuntimeUsage(`defineOptions`);
10373
- }
10374
- }
10375
- function defineSlots() {
10376
- {
10377
- warnRuntimeUsage(`defineSlots`);
10378
- }
10379
- }
10380
- function withDefaults(props, defaults) {
10381
- {
10382
- warnRuntimeUsage(`withDefaults`);
10383
- }
10384
- return null;
10385
- }
10386
- function useSlots() {
10387
- return getContext().slots;
10388
- }
10389
- function useAttrs() {
10390
- return getContext().attrs;
10391
- }
10392
- function getContext() {
10393
- const i = getCurrentInstance();
10394
- if (!i) {
10395
- warn(`useContext() called without active instance.`);
10396
- }
10397
- return i.setupContext || (i.setupContext = createSetupContext(i));
10398
- }
10399
- function mergeDefaults(raw, defaults) {
10400
- const props = isArray(raw) ? raw.reduce(
10401
- (normalized, p) => (normalized[p] = {}, normalized),
10402
- {}
10403
- ) : raw;
10404
- for (const key in defaults) {
10405
- if (key.startsWith("__skip"))
10406
- continue;
10407
- let opt = props[key];
10408
- if (opt) {
10409
- if (isArray(opt) || isFunction(opt)) {
10410
- opt = props[key] = { type: opt, default: defaults[key] };
10411
- } else {
10412
- opt.default = defaults[key];
10413
- }
10414
- } else if (opt === null) {
10415
- opt = props[key] = { default: defaults[key] };
10416
- } else {
10417
- warn(`props default key "${key}" has no corresponding declaration.`);
10418
- }
10419
- if (opt && defaults[`__skip_${key}`]) {
10420
- opt.skipFactory = true;
10421
- }
10422
- }
10423
- return props;
10424
- }
10425
- function createPropsRestProxy(props, excludedKeys) {
10426
- const ret = {};
10427
- for (const key in props) {
10428
- if (!excludedKeys.includes(key)) {
10429
- Object.defineProperty(ret, key, {
10430
- enumerable: true,
10431
- get: () => props[key]
10432
- });
10433
- }
10434
- }
10435
- return ret;
10436
- }
10437
- function withAsyncContext(getAwaitable) {
10438
- const ctx = getCurrentInstance();
10439
- if (!ctx) {
10440
- warn(
10441
- `withAsyncContext called without active current instance. This is likely a bug.`
10442
- );
10443
- }
10444
- let awaitable = getAwaitable();
10445
- unsetCurrentInstance();
10446
- if (isPromise(awaitable)) {
10447
- awaitable = awaitable.catch((e) => {
10448
- setCurrentInstance(ctx);
10449
- throw e;
10450
- });
10451
- }
10452
- return [awaitable, () => setCurrentInstance(ctx)];
10453
- }
10454
-
10455
10553
  function h(type, propsOrChildren, children) {
10456
10554
  const l = arguments.length;
10457
10555
  if (l === 2) {
@@ -10681,7 +10779,7 @@ Component that was made reactive: `,
10681
10779
  return true;
10682
10780
  }
10683
10781
 
10684
- const version = "3.3.0-alpha.8";
10782
+ const version = "3.3.0-beta.1";
10685
10783
  const ssrUtils = null;
10686
10784
  const resolveFilter = resolveFilter$1 ;
10687
10785
  const _compatUtils = {
@@ -12325,6 +12423,7 @@ Component that was made reactive: `,
12325
12423
  defineCustomElement: defineCustomElement,
12326
12424
  defineEmits: defineEmits,
12327
12425
  defineExpose: defineExpose,
12426
+ defineModel: defineModel,
12328
12427
  defineOptions: defineOptions,
12329
12428
  defineProps: defineProps,
12330
12429
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12338,6 +12437,7 @@ Component that was made reactive: `,
12338
12437
  guardReactiveProps: guardReactiveProps,
12339
12438
  h: h,
12340
12439
  handleError: handleError,
12440
+ hasInjectionContext: hasInjectionContext,
12341
12441
  hydrate: hydrate,
12342
12442
  initCustomFormatter: initCustomFormatter,
12343
12443
  initDirectivesForSSR: initDirectivesForSSR,
@@ -12352,6 +12452,7 @@ Component that was made reactive: `,
12352
12452
  isVNode: isVNode,
12353
12453
  markRaw: markRaw,
12354
12454
  mergeDefaults: mergeDefaults,
12455
+ mergeModels: mergeModels,
12355
12456
  mergeProps: mergeProps,
12356
12457
  nextTick: nextTick,
12357
12458
  normalizeClass: normalizeClass,
@@ -12410,6 +12511,7 @@ Component that was made reactive: `,
12410
12511
  useAttrs: useAttrs,
12411
12512
  useCssModule: useCssModule,
12412
12513
  useCssVars: useCssVars,
12514
+ useModel: useModel,
12413
12515
  useSSRContext: useSSRContext,
12414
12516
  useSlots: useSlots,
12415
12517
  useTransitionState: useTransitionState,
@@ -12537,8 +12639,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12537
12639
  [48]: `ES module mode is not supported in this build of compiler.`,
12538
12640
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12539
12641
  [50]: `"scopeId" option is only supported in module mode.`,
12642
+ // deprecations
12643
+ [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.`,
12644
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12540
12645
  // just to fulfill types
12541
- [51]: ``
12646
+ [53]: ``
12542
12647
  };
12543
12648
 
12544
12649
  const FRAGMENT = Symbol(`Fragment` );
@@ -15904,6 +16009,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15904
16009
  }
15905
16010
  const isDir = !isExplicitDynamic && findDir(node, "is");
15906
16011
  if (isDir && isDir.exp) {
16012
+ {
16013
+ context.onWarn(
16014
+ createCompilerError(52, isDir.loc)
16015
+ );
16016
+ }
15907
16017
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
15908
16018
  isDir.exp
15909
16019
  ]);
@@ -16409,6 +16519,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16409
16519
  if (arg.type === 4) {
16410
16520
  if (arg.isStatic) {
16411
16521
  let rawName = arg.content;
16522
+ if (rawName.startsWith("vnode")) {
16523
+ context.onWarn(
16524
+ createCompilerError(51, arg.loc)
16525
+ );
16526
+ }
16412
16527
  if (rawName.startsWith("vue:")) {
16413
16528
  rawName = `vnode-${rawName.slice(4)}`;
16414
16529
  }
@@ -16605,7 +16720,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16605
16720
  const seen$1 = /* @__PURE__ */ new WeakSet();
16606
16721
  const transformOnce = (node, context) => {
16607
16722
  if (node.type === 1 && findDir(node, "once", true)) {
16608
- if (seen$1.has(node) || context.inVOnce) {
16723
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
16609
16724
  return;
16610
16725
  }
16611
16726
  seen$1.add(node);
@@ -17056,29 +17171,29 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17056
17171
  );
17057
17172
  }
17058
17173
  const DOMErrorMessages = {
17059
- [51]: `v-html is missing expression.`,
17060
- [52]: `v-html will override element children.`,
17061
- [53]: `v-text is missing expression.`,
17062
- [54]: `v-text will override element children.`,
17063
- [55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17064
- [56]: `v-model argument is not supported on plain elements.`,
17065
- [57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17066
- [58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17067
- [59]: `v-show is missing expression.`,
17068
- [60]: `<Transition> expects exactly one child element or component.`,
17069
- [61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17174
+ [53]: `v-html is missing expression.`,
17175
+ [54]: `v-html will override element children.`,
17176
+ [55]: `v-text is missing expression.`,
17177
+ [56]: `v-text will override element children.`,
17178
+ [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17179
+ [58]: `v-model argument is not supported on plain elements.`,
17180
+ [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17181
+ [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17182
+ [61]: `v-show is missing expression.`,
17183
+ [62]: `<Transition> expects exactly one child element or component.`,
17184
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17070
17185
  };
17071
17186
 
17072
17187
  const transformVHtml = (dir, node, context) => {
17073
17188
  const { exp, loc } = dir;
17074
17189
  if (!exp) {
17075
17190
  context.onError(
17076
- createDOMCompilerError(51, loc)
17191
+ createDOMCompilerError(53, loc)
17077
17192
  );
17078
17193
  }
17079
17194
  if (node.children.length) {
17080
17195
  context.onError(
17081
- createDOMCompilerError(52, loc)
17196
+ createDOMCompilerError(54, loc)
17082
17197
  );
17083
17198
  node.children.length = 0;
17084
17199
  }
@@ -17096,12 +17211,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17096
17211
  const { exp, loc } = dir;
17097
17212
  if (!exp) {
17098
17213
  context.onError(
17099
- createDOMCompilerError(53, loc)
17214
+ createDOMCompilerError(55, loc)
17100
17215
  );
17101
17216
  }
17102
17217
  if (node.children.length) {
17103
17218
  context.onError(
17104
- createDOMCompilerError(54, loc)
17219
+ createDOMCompilerError(56, loc)
17105
17220
  );
17106
17221
  node.children.length = 0;
17107
17222
  }
@@ -17127,7 +17242,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17127
17242
  if (dir.arg) {
17128
17243
  context.onError(
17129
17244
  createDOMCompilerError(
17130
- 56,
17245
+ 58,
17131
17246
  dir.arg.loc
17132
17247
  )
17133
17248
  );
@@ -17137,7 +17252,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17137
17252
  if (value) {
17138
17253
  context.onError(
17139
17254
  createDOMCompilerError(
17140
- 58,
17255
+ 60,
17141
17256
  value.loc
17142
17257
  )
17143
17258
  );
@@ -17165,7 +17280,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17165
17280
  isInvalidType = true;
17166
17281
  context.onError(
17167
17282
  createDOMCompilerError(
17168
- 57,
17283
+ 59,
17169
17284
  dir.loc
17170
17285
  )
17171
17286
  );
@@ -17191,7 +17306,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17191
17306
  } else {
17192
17307
  context.onError(
17193
17308
  createDOMCompilerError(
17194
- 55,
17309
+ 57,
17195
17310
  dir.loc
17196
17311
  )
17197
17312
  );
@@ -17303,7 +17418,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17303
17418
  const { exp, loc } = dir;
17304
17419
  if (!exp) {
17305
17420
  context.onError(
17306
- createDOMCompilerError(59, loc)
17421
+ createDOMCompilerError(61, loc)
17307
17422
  );
17308
17423
  }
17309
17424
  return {
@@ -17323,7 +17438,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17323
17438
  if (hasMultipleChildren(node)) {
17324
17439
  context.onError(
17325
17440
  createDOMCompilerError(
17326
- 60,
17441
+ 62,
17327
17442
  {
17328
17443
  start: node.children[0].loc.start,
17329
17444
  end: node.children[node.children.length - 1].loc.end,
@@ -17360,7 +17475,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17360
17475
  const ignoreSideEffectTags = (node, context) => {
17361
17476
  if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
17362
17477
  context.onError(
17363
- createDOMCompilerError(61, node.loc)
17478
+ createDOMCompilerError(63, node.loc)
17364
17479
  );
17365
17480
  context.removeNode();
17366
17481
  }