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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,7 +120,7 @@ const slotFlagsText = {
120
120
  [3]: "FORWARDED"
121
121
  };
122
122
 
123
- const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
123
+ const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
124
124
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
125
125
 
126
126
  const range = 2;
@@ -1935,6 +1935,8 @@ function reload(id, newComp) {
1935
1935
  }
1936
1936
  hmrDirtyComponents.add(oldComp);
1937
1937
  }
1938
+ instance.appContext.propsCache.delete(instance.type);
1939
+ instance.appContext.emitsCache.delete(instance.type);
1938
1940
  instance.appContext.optionsCache.delete(instance.type);
1939
1941
  if (instance.ceReload) {
1940
1942
  hmrDirtyComponents.add(oldComp);
@@ -3253,7 +3255,8 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
3253
3255
  }
3254
3256
  }
3255
3257
  let hasWarned = false;
3256
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3258
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3259
+ var _a;
3257
3260
  if (process.env.NODE_ENV !== "production" && true && !hasWarned) {
3258
3261
  hasWarned = true;
3259
3262
  console[console.info ? "info" : "log"](
@@ -3267,13 +3270,21 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3267
3270
  n: next,
3268
3271
  o: { parentNode, remove }
3269
3272
  } = rendererInternals;
3273
+ let parentSuspenseId;
3274
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3275
+ if (isSuspensible) {
3276
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3277
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
3278
+ parentSuspense.deps++;
3279
+ }
3280
+ }
3270
3281
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3271
3282
  if (process.env.NODE_ENV !== "production") {
3272
3283
  assertNumber(timeout, `Suspense timeout`);
3273
3284
  }
3274
3285
  const suspense = {
3275
3286
  vnode,
3276
- parent,
3287
+ parent: parentSuspense,
3277
3288
  parentComponent,
3278
3289
  isSVG,
3279
3290
  container,
@@ -3333,20 +3344,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3333
3344
  setActiveBranch(suspense, pendingBranch);
3334
3345
  suspense.pendingBranch = null;
3335
3346
  suspense.isInFallback = false;
3336
- let parent2 = suspense.parent;
3347
+ let parent = suspense.parent;
3337
3348
  let hasUnresolvedAncestor = false;
3338
- while (parent2) {
3339
- if (parent2.pendingBranch) {
3340
- parent2.effects.push(...effects);
3349
+ while (parent) {
3350
+ if (parent.pendingBranch) {
3351
+ parent.effects.push(...effects);
3341
3352
  hasUnresolvedAncestor = true;
3342
3353
  break;
3343
3354
  }
3344
- parent2 = parent2.parent;
3355
+ parent = parent.parent;
3345
3356
  }
3346
3357
  if (!hasUnresolvedAncestor) {
3347
3358
  queuePostFlushCb(effects);
3348
3359
  }
3349
3360
  suspense.effects = [];
3361
+ if (isSuspensible) {
3362
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3363
+ parentSuspense.deps--;
3364
+ if (parentSuspense.deps === 0) {
3365
+ parentSuspense.resolve();
3366
+ }
3367
+ }
3368
+ }
3350
3369
  triggerEvent(vnode2, "onResolve");
3351
3370
  },
3352
3371
  fallback(fallbackVNode) {
@@ -3446,13 +3465,13 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3446
3465
  }
3447
3466
  });
3448
3467
  },
3449
- unmount(parentSuspense, doRemove) {
3468
+ unmount(parentSuspense2, doRemove) {
3450
3469
  suspense.isUnmounted = true;
3451
3470
  if (suspense.activeBranch) {
3452
3471
  unmount(
3453
3472
  suspense.activeBranch,
3454
3473
  parentComponent,
3455
- parentSuspense,
3474
+ parentSuspense2,
3456
3475
  doRemove
3457
3476
  );
3458
3477
  }
@@ -3460,7 +3479,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
3460
3479
  unmount(
3461
3480
  suspense.pendingBranch,
3462
3481
  parentComponent,
3463
- parentSuspense,
3482
+ parentSuspense2,
3464
3483
  doRemove
3465
3484
  );
3466
3485
  }
@@ -3553,33 +3572,41 @@ function setActiveBranch(suspense, branch) {
3553
3572
  }
3554
3573
  }
3555
3574
 
3556
- function provide(key, value) {
3557
- if (!currentInstance) {
3558
- if (process.env.NODE_ENV !== "production") {
3559
- warn(`provide() can only be used inside setup().`);
3560
- }
3561
- } else {
3562
- let provides = currentInstance.provides;
3563
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3564
- if (parentProvides === provides) {
3565
- provides = currentInstance.provides = Object.create(parentProvides);
3566
- }
3567
- provides[key] = value;
3568
- }
3569
- }
3570
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3571
- const instance = currentInstance || currentRenderingInstance;
3572
- if (instance) {
3573
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3574
- if (provides && key in provides) {
3575
- return provides[key];
3576
- } else if (arguments.length > 1) {
3577
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3578
- } else if (process.env.NODE_ENV !== "production") {
3579
- warn(`injection "${String(key)}" not found.`);
3575
+ const legacyDirectiveHookMap = {
3576
+ beforeMount: "bind",
3577
+ mounted: "inserted",
3578
+ updated: ["update", "componentUpdated"],
3579
+ unmounted: "unbind"
3580
+ };
3581
+ function mapCompatDirectiveHook(name, dir, instance) {
3582
+ const mappedName = legacyDirectiveHookMap[name];
3583
+ if (mappedName) {
3584
+ if (isArray(mappedName)) {
3585
+ const hook = [];
3586
+ mappedName.forEach((mapped) => {
3587
+ const mappedHook = dir[mapped];
3588
+ if (mappedHook) {
3589
+ softAssertCompatEnabled(
3590
+ "CUSTOM_DIR",
3591
+ instance,
3592
+ mapped,
3593
+ name
3594
+ );
3595
+ hook.push(mappedHook);
3596
+ }
3597
+ });
3598
+ return hook.length ? hook : void 0;
3599
+ } else {
3600
+ if (dir[mappedName]) {
3601
+ softAssertCompatEnabled(
3602
+ "CUSTOM_DIR",
3603
+ instance,
3604
+ mappedName,
3605
+ name
3606
+ );
3607
+ }
3608
+ return dir[mappedName];
3580
3609
  }
3581
- } else if (process.env.NODE_ENV !== "production") {
3582
- warn(`inject() can only be used inside setup() or functional components.`);
3583
3610
  }
3584
3611
  }
3585
3612
 
@@ -3839,6 +3866,68 @@ function traverse(value, seen) {
3839
3866
  return value;
3840
3867
  }
3841
3868
 
3869
+ function validateDirectiveName(name) {
3870
+ if (isBuiltInDirective(name)) {
3871
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3872
+ }
3873
+ }
3874
+ function withDirectives(vnode, directives) {
3875
+ const internalInstance = currentRenderingInstance;
3876
+ if (internalInstance === null) {
3877
+ process.env.NODE_ENV !== "production" && warn(`withDirectives can only be used inside render functions.`);
3878
+ return vnode;
3879
+ }
3880
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3881
+ const bindings = vnode.dirs || (vnode.dirs = []);
3882
+ for (let i = 0; i < directives.length; i++) {
3883
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3884
+ if (dir) {
3885
+ if (isFunction(dir)) {
3886
+ dir = {
3887
+ mounted: dir,
3888
+ updated: dir
3889
+ };
3890
+ }
3891
+ if (dir.deep) {
3892
+ traverse(value);
3893
+ }
3894
+ bindings.push({
3895
+ dir,
3896
+ instance,
3897
+ value,
3898
+ oldValue: void 0,
3899
+ arg,
3900
+ modifiers
3901
+ });
3902
+ }
3903
+ }
3904
+ return vnode;
3905
+ }
3906
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3907
+ const bindings = vnode.dirs;
3908
+ const oldBindings = prevVNode && prevVNode.dirs;
3909
+ for (let i = 0; i < bindings.length; i++) {
3910
+ const binding = bindings[i];
3911
+ if (oldBindings) {
3912
+ binding.oldValue = oldBindings[i].value;
3913
+ }
3914
+ let hook = binding.dir[name];
3915
+ if (!hook) {
3916
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3917
+ }
3918
+ if (hook) {
3919
+ pauseTracking();
3920
+ callWithAsyncErrorHandling(hook, instance, 8, [
3921
+ vnode.el,
3922
+ binding,
3923
+ vnode,
3924
+ prevVNode
3925
+ ]);
3926
+ resetTracking();
3927
+ }
3928
+ }
3929
+ }
3930
+
3842
3931
  function useTransitionState() {
3843
3932
  const state = {
3844
3933
  isMounted: false,
@@ -4645,106 +4734,6 @@ function getCompatListeners(instance) {
4645
4734
  return listeners;
4646
4735
  }
4647
4736
 
4648
- const legacyDirectiveHookMap = {
4649
- beforeMount: "bind",
4650
- mounted: "inserted",
4651
- updated: ["update", "componentUpdated"],
4652
- unmounted: "unbind"
4653
- };
4654
- function mapCompatDirectiveHook(name, dir, instance) {
4655
- const mappedName = legacyDirectiveHookMap[name];
4656
- if (mappedName) {
4657
- if (isArray(mappedName)) {
4658
- const hook = [];
4659
- mappedName.forEach((mapped) => {
4660
- const mappedHook = dir[mapped];
4661
- if (mappedHook) {
4662
- softAssertCompatEnabled(
4663
- "CUSTOM_DIR",
4664
- instance,
4665
- mapped,
4666
- name
4667
- );
4668
- hook.push(mappedHook);
4669
- }
4670
- });
4671
- return hook.length ? hook : void 0;
4672
- } else {
4673
- if (dir[mappedName]) {
4674
- softAssertCompatEnabled(
4675
- "CUSTOM_DIR",
4676
- instance,
4677
- mappedName,
4678
- name
4679
- );
4680
- }
4681
- return dir[mappedName];
4682
- }
4683
- }
4684
- }
4685
-
4686
- function validateDirectiveName(name) {
4687
- if (isBuiltInDirective(name)) {
4688
- warn("Do not use built-in directive ids as custom directive id: " + name);
4689
- }
4690
- }
4691
- function withDirectives(vnode, directives) {
4692
- const internalInstance = currentRenderingInstance;
4693
- if (internalInstance === null) {
4694
- process.env.NODE_ENV !== "production" && warn(`withDirectives can only be used inside render functions.`);
4695
- return vnode;
4696
- }
4697
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4698
- const bindings = vnode.dirs || (vnode.dirs = []);
4699
- for (let i = 0; i < directives.length; i++) {
4700
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4701
- if (dir) {
4702
- if (isFunction(dir)) {
4703
- dir = {
4704
- mounted: dir,
4705
- updated: dir
4706
- };
4707
- }
4708
- if (dir.deep) {
4709
- traverse(value);
4710
- }
4711
- bindings.push({
4712
- dir,
4713
- instance,
4714
- value,
4715
- oldValue: void 0,
4716
- arg,
4717
- modifiers
4718
- });
4719
- }
4720
- }
4721
- return vnode;
4722
- }
4723
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4724
- const bindings = vnode.dirs;
4725
- const oldBindings = prevVNode && prevVNode.dirs;
4726
- for (let i = 0; i < bindings.length; i++) {
4727
- const binding = bindings[i];
4728
- if (oldBindings) {
4729
- binding.oldValue = oldBindings[i].value;
4730
- }
4731
- let hook = binding.dir[name];
4732
- if (!hook) {
4733
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4734
- }
4735
- if (hook) {
4736
- pauseTracking();
4737
- callWithAsyncErrorHandling(hook, instance, 8, [
4738
- vnode.el,
4739
- binding,
4740
- vnode,
4741
- prevVNode
4742
- ]);
4743
- resetTracking();
4744
- }
4745
- }
4746
- }
4747
-
4748
4737
  const COMPONENTS = "components";
4749
4738
  const DIRECTIVES = "directives";
4750
4739
  const FILTERS = "filters";
@@ -5460,6 +5449,8 @@ const PublicInstanceProxyHandlers = {
5460
5449
  if (key === "$attrs") {
5461
5450
  track(instance, "get", key);
5462
5451
  process.env.NODE_ENV !== "production" && markAttrsAccessed();
5452
+ } else if (process.env.NODE_ENV !== "production" && key === "$slots") {
5453
+ track(instance, "get", key);
5463
5454
  }
5464
5455
  return publicGetter(instance);
5465
5456
  } else if (
@@ -5649,27 +5640,182 @@ function deepMergeData(to, from) {
5649
5640
  return to;
5650
5641
  }
5651
5642
 
5652
- function createDuplicateChecker() {
5653
- const cache = /* @__PURE__ */ Object.create(null);
5654
- return (type, key) => {
5655
- if (cache[key]) {
5656
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5657
- } else {
5658
- cache[key] = type;
5659
- }
5660
- };
5661
- }
5662
- let shouldCacheAccess = true;
5663
- function applyOptions(instance) {
5664
- const options = resolveMergedOptions(instance);
5665
- const publicThis = instance.proxy;
5666
- const ctx = instance.ctx;
5667
- shouldCacheAccess = false;
5668
- if (options.beforeCreate) {
5669
- callHook$1(options.beforeCreate, instance, "bc");
5643
+ const warnRuntimeUsage = (method) => warn(
5644
+ `${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.`
5645
+ );
5646
+ function defineProps() {
5647
+ if (process.env.NODE_ENV !== "production") {
5648
+ warnRuntimeUsage(`defineProps`);
5670
5649
  }
5671
- const {
5672
- // state
5650
+ return null;
5651
+ }
5652
+ function defineEmits() {
5653
+ if (process.env.NODE_ENV !== "production") {
5654
+ warnRuntimeUsage(`defineEmits`);
5655
+ }
5656
+ return null;
5657
+ }
5658
+ function defineExpose(exposed) {
5659
+ if (process.env.NODE_ENV !== "production") {
5660
+ warnRuntimeUsage(`defineExpose`);
5661
+ }
5662
+ }
5663
+ function defineOptions(options) {
5664
+ if (process.env.NODE_ENV !== "production") {
5665
+ warnRuntimeUsage(`defineOptions`);
5666
+ }
5667
+ }
5668
+ function defineSlots() {
5669
+ if (process.env.NODE_ENV !== "production") {
5670
+ warnRuntimeUsage(`defineSlots`);
5671
+ }
5672
+ return null;
5673
+ }
5674
+ function defineModel() {
5675
+ if (process.env.NODE_ENV !== "production") {
5676
+ warnRuntimeUsage("defineModel");
5677
+ }
5678
+ }
5679
+ function withDefaults(props, defaults) {
5680
+ if (process.env.NODE_ENV !== "production") {
5681
+ warnRuntimeUsage(`withDefaults`);
5682
+ }
5683
+ return null;
5684
+ }
5685
+ function useSlots() {
5686
+ return getContext().slots;
5687
+ }
5688
+ function useAttrs() {
5689
+ return getContext().attrs;
5690
+ }
5691
+ function useModel(props, name, options) {
5692
+ const i = getCurrentInstance();
5693
+ if (process.env.NODE_ENV !== "production" && !i) {
5694
+ warn(`useModel() called without active instance.`);
5695
+ return ref();
5696
+ }
5697
+ if (process.env.NODE_ENV !== "production" && !i.propsOptions[0][name]) {
5698
+ warn(`useModel() called with prop "${name}" which is not declared.`);
5699
+ return ref();
5700
+ }
5701
+ if (options && options.local) {
5702
+ const proxy = ref(props[name]);
5703
+ watch(
5704
+ () => props[name],
5705
+ (v) => proxy.value = v
5706
+ );
5707
+ watch(proxy, (value) => {
5708
+ if (value !== props[name]) {
5709
+ i.emit(`update:${name}`, value);
5710
+ }
5711
+ });
5712
+ return proxy;
5713
+ } else {
5714
+ return {
5715
+ __v_isRef: true,
5716
+ get value() {
5717
+ return props[name];
5718
+ },
5719
+ set value(value) {
5720
+ i.emit(`update:${name}`, value);
5721
+ }
5722
+ };
5723
+ }
5724
+ }
5725
+ function getContext() {
5726
+ const i = getCurrentInstance();
5727
+ if (process.env.NODE_ENV !== "production" && !i) {
5728
+ warn(`useContext() called without active instance.`);
5729
+ }
5730
+ return i.setupContext || (i.setupContext = createSetupContext(i));
5731
+ }
5732
+ function normalizePropsOrEmits(props) {
5733
+ return isArray(props) ? props.reduce(
5734
+ (normalized, p) => (normalized[p] = null, normalized),
5735
+ {}
5736
+ ) : props;
5737
+ }
5738
+ function mergeDefaults(raw, defaults) {
5739
+ const props = normalizePropsOrEmits(raw);
5740
+ for (const key in defaults) {
5741
+ if (key.startsWith("__skip"))
5742
+ continue;
5743
+ let opt = props[key];
5744
+ if (opt) {
5745
+ if (isArray(opt) || isFunction(opt)) {
5746
+ opt = props[key] = { type: opt, default: defaults[key] };
5747
+ } else {
5748
+ opt.default = defaults[key];
5749
+ }
5750
+ } else if (opt === null) {
5751
+ opt = props[key] = { default: defaults[key] };
5752
+ } else if (process.env.NODE_ENV !== "production") {
5753
+ warn(`props default key "${key}" has no corresponding declaration.`);
5754
+ }
5755
+ if (opt && defaults[`__skip_${key}`]) {
5756
+ opt.skipFactory = true;
5757
+ }
5758
+ }
5759
+ return props;
5760
+ }
5761
+ function mergeModels(a, b) {
5762
+ if (!a || !b)
5763
+ return a || b;
5764
+ if (isArray(a) && isArray(b))
5765
+ return a.concat(b);
5766
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5767
+ }
5768
+ function createPropsRestProxy(props, excludedKeys) {
5769
+ const ret = {};
5770
+ for (const key in props) {
5771
+ if (!excludedKeys.includes(key)) {
5772
+ Object.defineProperty(ret, key, {
5773
+ enumerable: true,
5774
+ get: () => props[key]
5775
+ });
5776
+ }
5777
+ }
5778
+ return ret;
5779
+ }
5780
+ function withAsyncContext(getAwaitable) {
5781
+ const ctx = getCurrentInstance();
5782
+ if (process.env.NODE_ENV !== "production" && !ctx) {
5783
+ warn(
5784
+ `withAsyncContext called without active current instance. This is likely a bug.`
5785
+ );
5786
+ }
5787
+ let awaitable = getAwaitable();
5788
+ unsetCurrentInstance();
5789
+ if (isPromise(awaitable)) {
5790
+ awaitable = awaitable.catch((e) => {
5791
+ setCurrentInstance(ctx);
5792
+ throw e;
5793
+ });
5794
+ }
5795
+ return [awaitable, () => setCurrentInstance(ctx)];
5796
+ }
5797
+
5798
+ function createDuplicateChecker() {
5799
+ const cache = /* @__PURE__ */ Object.create(null);
5800
+ return (type, key) => {
5801
+ if (cache[key]) {
5802
+ warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5803
+ } else {
5804
+ cache[key] = type;
5805
+ }
5806
+ };
5807
+ }
5808
+ let shouldCacheAccess = true;
5809
+ function applyOptions(instance) {
5810
+ const options = resolveMergedOptions(instance);
5811
+ const publicThis = instance.proxy;
5812
+ const ctx = instance.ctx;
5813
+ shouldCacheAccess = false;
5814
+ if (options.beforeCreate) {
5815
+ callHook$1(options.beforeCreate, instance, "bc");
5816
+ }
5817
+ const {
5818
+ // state
5673
5819
  data: dataOptions,
5674
5820
  computed: computedOptions,
5675
5821
  methods,
@@ -5711,12 +5857,7 @@ function applyOptions(instance) {
5711
5857
  }
5712
5858
  }
5713
5859
  if (injectOptions) {
5714
- resolveInjections(
5715
- injectOptions,
5716
- ctx,
5717
- checkDuplicateProperties,
5718
- instance.appContext.config.unwrapInjectedRef
5719
- );
5860
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5720
5861
  }
5721
5862
  if (methods) {
5722
5863
  for (const key in methods) {
@@ -5869,7 +6010,7 @@ function applyOptions(instance) {
5869
6010
  instance.filters = filters;
5870
6011
  }
5871
6012
  }
5872
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
6013
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5873
6014
  if (isArray(injectOptions)) {
5874
6015
  injectOptions = normalizeInject(injectOptions);
5875
6016
  }
@@ -5891,21 +6032,12 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
5891
6032
  injected = inject(opt);
5892
6033
  }
5893
6034
  if (isRef(injected)) {
5894
- if (unwrapRef) {
5895
- Object.defineProperty(ctx, key, {
5896
- enumerable: true,
5897
- configurable: true,
5898
- get: () => injected.value,
5899
- set: (v) => injected.value = v
5900
- });
5901
- } else {
5902
- if (process.env.NODE_ENV !== "production") {
5903
- warn(
5904
- `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.)`
5905
- );
5906
- }
5907
- ctx[key] = injected;
5908
- }
6035
+ Object.defineProperty(ctx, key, {
6036
+ enumerable: true,
6037
+ configurable: true,
6038
+ get: () => injected.value,
6039
+ set: (v) => injected.value = v
6040
+ });
5909
6041
  } else {
5910
6042
  ctx[key] = injected;
5911
6043
  }
@@ -6008,10 +6140,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
6008
6140
  }
6009
6141
  const internalOptionMergeStrats = {
6010
6142
  data: mergeDataFn,
6011
- props: mergeObjectOptions,
6012
- // TODO
6013
- emits: mergeObjectOptions,
6014
- // TODO
6143
+ props: mergeEmitsOrPropsOptions,
6144
+ emits: mergeEmitsOrPropsOptions,
6015
6145
  // objects
6016
6146
  methods: mergeObjectOptions,
6017
6147
  computed: mergeObjectOptions,
@@ -6073,7 +6203,21 @@ function mergeAsArray$1(to, from) {
6073
6203
  return to ? [...new Set([].concat(to, from))] : from;
6074
6204
  }
6075
6205
  function mergeObjectOptions(to, from) {
6076
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
6206
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
6207
+ }
6208
+ function mergeEmitsOrPropsOptions(to, from) {
6209
+ if (to) {
6210
+ if (isArray(to) && isArray(from)) {
6211
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
6212
+ }
6213
+ return extend(
6214
+ /* @__PURE__ */ Object.create(null),
6215
+ normalizePropsOrEmits(to),
6216
+ normalizePropsOrEmits(from != null ? from : {})
6217
+ );
6218
+ } else {
6219
+ return from;
6220
+ }
6077
6221
  }
6078
6222
  function mergeWatchOptions(to, from) {
6079
6223
  if (!to)
@@ -6087,1182 +6231,1237 @@ function mergeWatchOptions(to, from) {
6087
6231
  return merged;
6088
6232
  }
6089
6233
 
6090
- function createPropsDefaultThis(instance, rawProps, propKey) {
6091
- return new Proxy(
6092
- {},
6093
- {
6094
- get(_, key) {
6095
- process.env.NODE_ENV !== "production" && warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6096
- if (key === "$options") {
6097
- return resolveMergedOptions(instance);
6098
- }
6099
- if (key in rawProps) {
6100
- return rawProps[key];
6101
- }
6102
- const injections = instance.type.inject;
6103
- if (injections) {
6104
- if (isArray(injections)) {
6105
- if (injections.includes(key)) {
6106
- return inject(key);
6107
- }
6108
- } else if (key in injections) {
6109
- return inject(key);
6110
- }
6234
+ function installLegacyConfigWarnings(config) {
6235
+ const legacyConfigOptions = {
6236
+ silent: "CONFIG_SILENT",
6237
+ devtools: "CONFIG_DEVTOOLS",
6238
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6239
+ keyCodes: "CONFIG_KEY_CODES",
6240
+ productionTip: "CONFIG_PRODUCTION_TIP"
6241
+ };
6242
+ Object.keys(legacyConfigOptions).forEach((key) => {
6243
+ let val = config[key];
6244
+ Object.defineProperty(config, key, {
6245
+ enumerable: true,
6246
+ get() {
6247
+ return val;
6248
+ },
6249
+ set(newVal) {
6250
+ if (!isCopyingConfig) {
6251
+ warnDeprecation$1(legacyConfigOptions[key], null);
6111
6252
  }
6253
+ val = newVal;
6112
6254
  }
6113
- }
6114
- );
6255
+ });
6256
+ });
6115
6257
  }
6116
-
6117
- function shouldSkipAttr(key, instance) {
6118
- if (key === "is") {
6119
- return true;
6120
- }
6121
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6122
- return true;
6123
- }
6124
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6125
- return true;
6126
- }
6127
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6128
- return true;
6129
- }
6130
- return false;
6258
+ function installLegacyOptionMergeStrats(config) {
6259
+ config.optionMergeStrategies = new Proxy({}, {
6260
+ get(target, key) {
6261
+ if (key in target) {
6262
+ return target[key];
6263
+ }
6264
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6265
+ "CONFIG_OPTION_MERGE_STRATS",
6266
+ null
6267
+ )) {
6268
+ return internalOptionMergeStrats[key];
6269
+ }
6270
+ }
6271
+ });
6131
6272
  }
6132
6273
 
6133
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6134
- const props = {};
6135
- const attrs = {};
6136
- def(attrs, InternalObjectKey, 1);
6137
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6138
- setFullProps(instance, rawProps, props, attrs);
6139
- for (const key in instance.propsOptions[0]) {
6140
- if (!(key in props)) {
6141
- props[key] = void 0;
6274
+ let isCopyingConfig = false;
6275
+ let singletonApp;
6276
+ let singletonCtor;
6277
+ function createCompatVue$1(createApp, createSingletonApp) {
6278
+ singletonApp = createSingletonApp({});
6279
+ const Vue = singletonCtor = function Vue2(options = {}) {
6280
+ return createCompatApp(options, Vue2);
6281
+ };
6282
+ function createCompatApp(options = {}, Ctor) {
6283
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6284
+ const { data } = options;
6285
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6286
+ options.data = () => data;
6142
6287
  }
6143
- }
6144
- if (process.env.NODE_ENV !== "production") {
6145
- validateProps(rawProps || {}, props, instance);
6146
- }
6147
- if (isStateful) {
6148
- instance.props = isSSR ? props : shallowReactive(props);
6149
- } else {
6150
- if (!instance.type.props) {
6151
- instance.props = attrs;
6288
+ const app = createApp(options);
6289
+ if (Ctor !== Vue) {
6290
+ applySingletonPrototype(app, Ctor);
6291
+ }
6292
+ const vm = app._createRoot(options);
6293
+ if (options.el) {
6294
+ return vm.$mount(options.el);
6152
6295
  } else {
6153
- instance.props = props;
6296
+ return vm;
6154
6297
  }
6155
6298
  }
6156
- instance.attrs = attrs;
6157
- }
6158
- function isInHmrContext(instance) {
6159
- while (instance) {
6160
- if (instance.type.__hmrId)
6161
- return true;
6162
- instance = instance.parent;
6163
- }
6164
- }
6165
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6166
- const {
6167
- props,
6168
- attrs,
6169
- vnode: { patchFlag }
6170
- } = instance;
6171
- const rawCurrentProps = toRaw(props);
6172
- const [options] = instance.propsOptions;
6173
- let hasAttrsChanged = false;
6174
- if (
6175
- // always force full diff in dev
6176
- // - #1942 if hmr is enabled with sfc component
6177
- // - vite#872 non-sfc component used by sfc component
6178
- !(process.env.NODE_ENV !== "production" && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6179
- ) {
6180
- if (patchFlag & 8) {
6181
- const propsToUpdate = instance.vnode.dynamicProps;
6182
- for (let i = 0; i < propsToUpdate.length; i++) {
6183
- let key = propsToUpdate[i];
6184
- if (isEmitListener(instance.emitsOptions, key)) {
6185
- continue;
6186
- }
6187
- const value = rawProps[key];
6188
- if (options) {
6189
- if (hasOwn(attrs, key)) {
6190
- if (value !== attrs[key]) {
6191
- attrs[key] = value;
6192
- hasAttrsChanged = true;
6193
- }
6194
- } else {
6195
- const camelizedKey = camelize(key);
6196
- props[camelizedKey] = resolvePropValue(
6197
- options,
6198
- rawCurrentProps,
6199
- camelizedKey,
6200
- value,
6201
- instance,
6202
- false
6203
- /* isAbsent */
6204
- );
6205
- }
6206
- } else {
6207
- {
6208
- if (isOn(key) && key.endsWith("Native")) {
6209
- key = key.slice(0, -6);
6210
- } else if (shouldSkipAttr(key, instance)) {
6211
- continue;
6212
- }
6213
- }
6214
- if (value !== attrs[key]) {
6215
- attrs[key] = value;
6216
- hasAttrsChanged = true;
6217
- }
6218
- }
6219
- }
6220
- }
6221
- } else {
6222
- if (setFullProps(instance, rawProps, props, attrs)) {
6223
- hasAttrsChanged = true;
6299
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
6300
+ Vue.config = singletonApp.config;
6301
+ Vue.use = (p, ...options) => {
6302
+ if (p && isFunction(p.install)) {
6303
+ p.install(Vue, ...options);
6304
+ } else if (isFunction(p)) {
6305
+ p(Vue, ...options);
6224
6306
  }
6225
- let kebabKey;
6226
- for (const key in rawCurrentProps) {
6227
- if (!rawProps || // for camelCase
6228
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6229
- // and converted to camelCase (#955)
6230
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6231
- if (options) {
6232
- if (rawPrevProps && // for camelCase
6233
- (rawPrevProps[key] !== void 0 || // for kebab-case
6234
- rawPrevProps[kebabKey] !== void 0)) {
6235
- props[key] = resolvePropValue(
6236
- options,
6237
- rawCurrentProps,
6238
- key,
6239
- void 0,
6240
- instance,
6241
- true
6242
- /* isAbsent */
6243
- );
6244
- }
6245
- } else {
6246
- delete props[key];
6247
- }
6248
- }
6307
+ return Vue;
6308
+ };
6309
+ Vue.mixin = (m) => {
6310
+ singletonApp.mixin(m);
6311
+ return Vue;
6312
+ };
6313
+ Vue.component = (name, comp) => {
6314
+ if (comp) {
6315
+ singletonApp.component(name, comp);
6316
+ return Vue;
6317
+ } else {
6318
+ return singletonApp.component(name);
6249
6319
  }
6250
- if (attrs !== rawCurrentProps) {
6251
- for (const key in attrs) {
6252
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6253
- delete attrs[key];
6254
- hasAttrsChanged = true;
6255
- }
6256
- }
6320
+ };
6321
+ Vue.directive = (name, dir) => {
6322
+ if (dir) {
6323
+ singletonApp.directive(name, dir);
6324
+ return Vue;
6325
+ } else {
6326
+ return singletonApp.directive(name);
6257
6327
  }
6258
- }
6259
- if (hasAttrsChanged) {
6260
- trigger(instance, "set", "$attrs");
6261
- }
6262
- if (process.env.NODE_ENV !== "production") {
6263
- validateProps(rawProps || {}, props, instance);
6264
- }
6265
- }
6266
- function setFullProps(instance, rawProps, props, attrs) {
6267
- const [options, needCastKeys] = instance.propsOptions;
6268
- let hasAttrsChanged = false;
6269
- let rawCastValues;
6270
- if (rawProps) {
6271
- for (let key in rawProps) {
6272
- if (isReservedProp(key)) {
6273
- continue;
6274
- }
6275
- {
6276
- if (key.startsWith("onHook:")) {
6277
- softAssertCompatEnabled(
6278
- "INSTANCE_EVENT_HOOKS",
6279
- instance,
6280
- key.slice(2).toLowerCase()
6281
- );
6282
- }
6283
- if (key === "inline-template") {
6284
- continue;
6285
- }
6286
- }
6287
- const value = rawProps[key];
6288
- let camelKey;
6289
- if (options && hasOwn(options, camelKey = camelize(key))) {
6290
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6291
- props[camelKey] = value;
6292
- } else {
6293
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6294
- }
6295
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6296
- {
6297
- if (isOn(key) && key.endsWith("Native")) {
6298
- key = key.slice(0, -6);
6299
- } else if (shouldSkipAttr(key, instance)) {
6300
- continue;
6301
- }
6302
- }
6303
- if (!(key in attrs) || value !== attrs[key]) {
6304
- attrs[key] = value;
6305
- hasAttrsChanged = true;
6306
- }
6307
- }
6328
+ };
6329
+ Vue.options = { _base: Vue };
6330
+ let cid = 1;
6331
+ Vue.cid = cid;
6332
+ Vue.nextTick = nextTick;
6333
+ const extendCache = /* @__PURE__ */ new WeakMap();
6334
+ function extendCtor(extendOptions = {}) {
6335
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6336
+ if (isFunction(extendOptions)) {
6337
+ extendOptions = extendOptions.options;
6308
6338
  }
6309
- }
6310
- if (needCastKeys) {
6311
- const rawCurrentProps = toRaw(props);
6312
- const castValues = rawCastValues || EMPTY_OBJ;
6313
- for (let i = 0; i < needCastKeys.length; i++) {
6314
- const key = needCastKeys[i];
6315
- props[key] = resolvePropValue(
6316
- options,
6317
- rawCurrentProps,
6318
- key,
6319
- castValues[key],
6320
- instance,
6321
- !hasOwn(castValues, key)
6322
- );
6339
+ if (extendCache.has(extendOptions)) {
6340
+ return extendCache.get(extendOptions);
6323
6341
  }
6324
- }
6325
- return hasAttrsChanged;
6326
- }
6327
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6328
- const opt = options[key];
6329
- if (opt != null) {
6330
- const hasDefault = hasOwn(opt, "default");
6331
- if (hasDefault && value === void 0) {
6332
- const defaultValue = opt.default;
6333
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6334
- const { propsDefaults } = instance;
6335
- if (key in propsDefaults) {
6336
- value = propsDefaults[key];
6337
- } else {
6338
- setCurrentInstance(instance);
6339
- value = propsDefaults[key] = defaultValue.call(
6340
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6341
- props
6342
- );
6343
- unsetCurrentInstance();
6344
- }
6342
+ const Super = this;
6343
+ function SubVue(inlineOptions) {
6344
+ if (!inlineOptions) {
6345
+ return createCompatApp(SubVue.options, SubVue);
6345
6346
  } else {
6346
- value = defaultValue;
6347
+ return createCompatApp(
6348
+ mergeOptions(
6349
+ extend({}, SubVue.options),
6350
+ inlineOptions,
6351
+ internalOptionMergeStrats
6352
+ ),
6353
+ SubVue
6354
+ );
6347
6355
  }
6348
6356
  }
6349
- if (opt[0 /* shouldCast */]) {
6350
- if (isAbsent && !hasDefault) {
6351
- value = false;
6352
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6353
- value = true;
6354
- }
6357
+ SubVue.super = Super;
6358
+ SubVue.prototype = Object.create(Vue.prototype);
6359
+ SubVue.prototype.constructor = SubVue;
6360
+ const mergeBase = {};
6361
+ for (const key in Super.options) {
6362
+ const superValue = Super.options[key];
6363
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6355
6364
  }
6365
+ SubVue.options = mergeOptions(
6366
+ mergeBase,
6367
+ extendOptions,
6368
+ internalOptionMergeStrats
6369
+ );
6370
+ SubVue.options._base = SubVue;
6371
+ SubVue.extend = extendCtor.bind(SubVue);
6372
+ SubVue.mixin = Super.mixin;
6373
+ SubVue.use = Super.use;
6374
+ SubVue.cid = ++cid;
6375
+ extendCache.set(extendOptions, SubVue);
6376
+ return SubVue;
6356
6377
  }
6357
- return value;
6358
- }
6359
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6360
- const cache = appContext.propsCache;
6361
- const cached = cache.get(comp);
6362
- if (cached) {
6363
- return cached;
6364
- }
6365
- const raw = comp.props;
6366
- const normalized = {};
6367
- const needCastKeys = [];
6368
- let hasExtends = false;
6369
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
6370
- const extendProps = (raw2) => {
6371
- if (isFunction(raw2)) {
6372
- raw2 = raw2.options;
6373
- }
6374
- hasExtends = true;
6375
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6376
- extend(normalized, props);
6377
- if (keys)
6378
- needCastKeys.push(...keys);
6379
- };
6380
- if (!asMixin && appContext.mixins.length) {
6381
- appContext.mixins.forEach(extendProps);
6382
- }
6383
- if (comp.extends) {
6384
- extendProps(comp.extends);
6378
+ Vue.extend = extendCtor.bind(Vue);
6379
+ Vue.set = (target, key, value) => {
6380
+ assertCompatEnabled("GLOBAL_SET", null);
6381
+ target[key] = value;
6382
+ };
6383
+ Vue.delete = (target, key) => {
6384
+ assertCompatEnabled("GLOBAL_DELETE", null);
6385
+ delete target[key];
6386
+ };
6387
+ Vue.observable = (target) => {
6388
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6389
+ return reactive(target);
6390
+ };
6391
+ Vue.filter = (name, filter) => {
6392
+ if (filter) {
6393
+ singletonApp.filter(name, filter);
6394
+ return Vue;
6395
+ } else {
6396
+ return singletonApp.filter(name);
6385
6397
  }
6386
- if (comp.mixins) {
6387
- comp.mixins.forEach(extendProps);
6398
+ };
6399
+ const util = {
6400
+ warn: process.env.NODE_ENV !== "production" ? warn : NOOP,
6401
+ extend,
6402
+ mergeOptions: (parent, child, vm) => mergeOptions(
6403
+ parent,
6404
+ child,
6405
+ vm ? void 0 : internalOptionMergeStrats
6406
+ ),
6407
+ defineReactive
6408
+ };
6409
+ Object.defineProperty(Vue, "util", {
6410
+ get() {
6411
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6412
+ return util;
6388
6413
  }
6414
+ });
6415
+ Vue.configureCompat = configureCompat$1;
6416
+ return Vue;
6417
+ }
6418
+ function installAppCompatProperties(app, context, render) {
6419
+ installFilterMethod(app, context);
6420
+ installLegacyOptionMergeStrats(app.config);
6421
+ if (!singletonApp) {
6422
+ return;
6389
6423
  }
6390
- if (!raw && !hasExtends) {
6391
- if (isObject(comp)) {
6392
- cache.set(comp, EMPTY_ARR);
6424
+ installCompatMount(app, context, render);
6425
+ installLegacyAPIs(app);
6426
+ applySingletonAppMutations(app);
6427
+ if (process.env.NODE_ENV !== "production")
6428
+ installLegacyConfigWarnings(app.config);
6429
+ }
6430
+ function installFilterMethod(app, context) {
6431
+ context.filters = {};
6432
+ app.filter = (name, filter) => {
6433
+ assertCompatEnabled("FILTERS", null);
6434
+ if (!filter) {
6435
+ return context.filters[name];
6393
6436
  }
6394
- return EMPTY_ARR;
6395
- }
6396
- if (isArray(raw)) {
6397
- for (let i = 0; i < raw.length; i++) {
6398
- if (process.env.NODE_ENV !== "production" && !isString(raw[i])) {
6399
- warn(`props must be strings when using array syntax.`, raw[i]);
6437
+ if (process.env.NODE_ENV !== "production" && context.filters[name]) {
6438
+ warn(`Filter "${name}" has already been registered.`);
6439
+ }
6440
+ context.filters[name] = filter;
6441
+ return app;
6442
+ };
6443
+ }
6444
+ function installLegacyAPIs(app) {
6445
+ Object.defineProperties(app, {
6446
+ // so that app.use() can work with legacy plugins that extend prototypes
6447
+ prototype: {
6448
+ get() {
6449
+ process.env.NODE_ENV !== "production" && warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6450
+ return app.config.globalProperties;
6400
6451
  }
6401
- const normalizedKey = camelize(raw[i]);
6402
- if (validatePropName(normalizedKey)) {
6403
- normalized[normalizedKey] = EMPTY_OBJ;
6452
+ },
6453
+ nextTick: { value: nextTick },
6454
+ extend: { value: singletonCtor.extend },
6455
+ set: { value: singletonCtor.set },
6456
+ delete: { value: singletonCtor.delete },
6457
+ observable: { value: singletonCtor.observable },
6458
+ util: {
6459
+ get() {
6460
+ return singletonCtor.util;
6404
6461
  }
6405
6462
  }
6406
- } else if (raw) {
6407
- if (process.env.NODE_ENV !== "production" && !isObject(raw)) {
6408
- warn(`invalid props options`, raw);
6463
+ });
6464
+ }
6465
+ function applySingletonAppMutations(app) {
6466
+ app._context.mixins = [...singletonApp._context.mixins];
6467
+ ["components", "directives", "filters"].forEach((key) => {
6468
+ app._context[key] = Object.create(singletonApp._context[key]);
6469
+ });
6470
+ isCopyingConfig = true;
6471
+ for (const key in singletonApp.config) {
6472
+ if (key === "isNativeTag")
6473
+ continue;
6474
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6475
+ continue;
6409
6476
  }
6410
- for (const key in raw) {
6411
- const normalizedKey = camelize(key);
6412
- if (validatePropName(normalizedKey)) {
6413
- const opt = raw[key];
6414
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6415
- if (prop) {
6416
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6417
- const stringIndex = getTypeIndex(String, prop.type);
6418
- prop[0 /* shouldCast */] = booleanIndex > -1;
6419
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6420
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6421
- needCastKeys.push(normalizedKey);
6422
- }
6423
- }
6424
- }
6477
+ const val = singletonApp.config[key];
6478
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6479
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6480
+ app.config.compilerOptions.isCustomElement = (tag) => {
6481
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6482
+ };
6425
6483
  }
6426
6484
  }
6427
- const res = [normalized, needCastKeys];
6428
- if (isObject(comp)) {
6429
- cache.set(comp, res);
6430
- }
6431
- return res;
6485
+ isCopyingConfig = false;
6486
+ applySingletonPrototype(app, singletonCtor);
6432
6487
  }
6433
- function validatePropName(key) {
6434
- if (key[0] !== "$") {
6435
- return true;
6436
- } else if (process.env.NODE_ENV !== "production") {
6437
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6488
+ function applySingletonPrototype(app, Ctor) {
6489
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6490
+ if (enabled) {
6491
+ app.config.globalProperties = Object.create(Ctor.prototype);
6438
6492
  }
6439
- return false;
6440
- }
6441
- function getType(ctor) {
6442
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6443
- return match ? match[2] : ctor === null ? "null" : "";
6444
- }
6445
- function isSameType(a, b) {
6446
- return getType(a) === getType(b);
6447
- }
6448
- function getTypeIndex(type, expectedTypes) {
6449
- if (isArray(expectedTypes)) {
6450
- return expectedTypes.findIndex((t) => isSameType(t, type));
6451
- } else if (isFunction(expectedTypes)) {
6452
- return isSameType(expectedTypes, type) ? 0 : -1;
6493
+ let hasPrototypeAugmentations = false;
6494
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6495
+ for (const key in descriptors) {
6496
+ if (key !== "constructor") {
6497
+ hasPrototypeAugmentations = true;
6498
+ if (enabled) {
6499
+ Object.defineProperty(
6500
+ app.config.globalProperties,
6501
+ key,
6502
+ descriptors[key]
6503
+ );
6504
+ }
6505
+ }
6453
6506
  }
6454
- return -1;
6455
- }
6456
- function validateProps(rawProps, props, instance) {
6457
- const resolvedValues = toRaw(props);
6458
- const options = instance.propsOptions[0];
6459
- for (const key in options) {
6460
- let opt = options[key];
6461
- if (opt == null)
6462
- continue;
6463
- validateProp(
6464
- key,
6465
- resolvedValues[key],
6466
- opt,
6467
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6468
- );
6507
+ if (process.env.NODE_ENV !== "production" && hasPrototypeAugmentations) {
6508
+ warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6469
6509
  }
6470
6510
  }
6471
- function validateProp(name, value, prop, isAbsent) {
6472
- const { type, required, validator, skipCheck } = prop;
6473
- if (required && isAbsent) {
6474
- warn('Missing required prop: "' + name + '"');
6475
- return;
6476
- }
6477
- if (value == null && !prop.required) {
6478
- return;
6479
- }
6480
- if (type != null && type !== true && !skipCheck) {
6481
- let isValid = false;
6482
- const types = isArray(type) ? type : [type];
6483
- const expectedTypes = [];
6484
- for (let i = 0; i < types.length && !isValid; i++) {
6485
- const { valid, expectedType } = assertType(value, types[i]);
6486
- expectedTypes.push(expectedType || "");
6487
- isValid = valid;
6488
- }
6489
- if (!isValid) {
6490
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6491
- return;
6492
- }
6493
- }
6494
- if (validator && !validator(value)) {
6495
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6496
- }
6497
- }
6498
- const isSimpleType = /* @__PURE__ */ makeMap(
6499
- "String,Number,Boolean,Function,Symbol,BigInt"
6500
- );
6501
- function assertType(value, type) {
6502
- let valid;
6503
- const expectedType = getType(type);
6504
- if (isSimpleType(expectedType)) {
6505
- const t = typeof value;
6506
- valid = t === expectedType.toLowerCase();
6507
- if (!valid && t === "object") {
6508
- valid = value instanceof type;
6511
+ function installCompatMount(app, context, render) {
6512
+ let isMounted = false;
6513
+ app._createRoot = (options) => {
6514
+ const component = app._component;
6515
+ const vnode = createVNode(component, options.propsData || null);
6516
+ vnode.appContext = context;
6517
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6518
+ const emptyRender = () => {
6519
+ };
6520
+ const instance = createComponentInstance(vnode, null, null);
6521
+ if (hasNoRender) {
6522
+ instance.render = emptyRender;
6509
6523
  }
6510
- } else if (expectedType === "Object") {
6511
- valid = isObject(value);
6512
- } else if (expectedType === "Array") {
6513
- valid = isArray(value);
6514
- } else if (expectedType === "null") {
6515
- valid = value === null;
6516
- } else {
6517
- valid = value instanceof type;
6518
- }
6519
- return {
6520
- valid,
6521
- expectedType
6524
+ setupComponent(instance);
6525
+ vnode.component = instance;
6526
+ vnode.isCompatRoot = true;
6527
+ instance.ctx._compat_mount = (selectorOrEl) => {
6528
+ if (isMounted) {
6529
+ process.env.NODE_ENV !== "production" && warn(`Root instance is already mounted.`);
6530
+ return;
6531
+ }
6532
+ let container;
6533
+ if (typeof selectorOrEl === "string") {
6534
+ const result = document.querySelector(selectorOrEl);
6535
+ if (!result) {
6536
+ process.env.NODE_ENV !== "production" && warn(
6537
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6538
+ );
6539
+ return;
6540
+ }
6541
+ container = result;
6542
+ } else {
6543
+ container = selectorOrEl || document.createElement("div");
6544
+ }
6545
+ const isSVG = container instanceof SVGElement;
6546
+ if (process.env.NODE_ENV !== "production") {
6547
+ context.reload = () => {
6548
+ const cloned = cloneVNode(vnode);
6549
+ cloned.component = null;
6550
+ render(cloned, container, isSVG);
6551
+ };
6552
+ }
6553
+ if (hasNoRender && instance.render === emptyRender) {
6554
+ if (process.env.NODE_ENV !== "production") {
6555
+ for (let i = 0; i < container.attributes.length; i++) {
6556
+ const attr = container.attributes[i];
6557
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6558
+ warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6559
+ break;
6560
+ }
6561
+ }
6562
+ }
6563
+ instance.render = null;
6564
+ component.template = container.innerHTML;
6565
+ finishComponentSetup(
6566
+ instance,
6567
+ false,
6568
+ true
6569
+ /* skip options */
6570
+ );
6571
+ }
6572
+ container.innerHTML = "";
6573
+ render(vnode, container, isSVG);
6574
+ if (container instanceof Element) {
6575
+ container.removeAttribute("v-cloak");
6576
+ container.setAttribute("data-v-app", "");
6577
+ }
6578
+ isMounted = true;
6579
+ app._container = container;
6580
+ container.__vue_app__ = app;
6581
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6582
+ devtoolsInitApp(app, version);
6583
+ }
6584
+ return instance.proxy;
6585
+ };
6586
+ instance.ctx._compat_destroy = () => {
6587
+ if (isMounted) {
6588
+ render(null, app._container);
6589
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6590
+ devtoolsUnmountApp(app);
6591
+ }
6592
+ delete app._container.__vue_app__;
6593
+ } else {
6594
+ const { bum, scope, um } = instance;
6595
+ if (bum) {
6596
+ invokeArrayFns(bum);
6597
+ }
6598
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6599
+ instance.emit("hook:beforeDestroy");
6600
+ }
6601
+ if (scope) {
6602
+ scope.stop();
6603
+ }
6604
+ if (um) {
6605
+ invokeArrayFns(um);
6606
+ }
6607
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
6608
+ instance.emit("hook:destroyed");
6609
+ }
6610
+ }
6611
+ };
6612
+ return instance.proxy;
6522
6613
  };
6523
6614
  }
6524
- function getInvalidTypeMessage(name, value, expectedTypes) {
6525
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6526
- const expectedType = expectedTypes[0];
6527
- const receivedType = toRawType(value);
6528
- const expectedValue = styleValue(value, expectedType);
6529
- const receivedValue = styleValue(value, receivedType);
6530
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6531
- message += ` with value ${expectedValue}`;
6532
- }
6533
- message += `, got ${receivedType} `;
6534
- if (isExplicable(receivedType)) {
6535
- message += `with value ${receivedValue}.`;
6615
+ const methodsToPatch = [
6616
+ "push",
6617
+ "pop",
6618
+ "shift",
6619
+ "unshift",
6620
+ "splice",
6621
+ "sort",
6622
+ "reverse"
6623
+ ];
6624
+ const patched = /* @__PURE__ */ new WeakSet();
6625
+ function defineReactive(obj, key, val) {
6626
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6627
+ const reactiveVal = reactive(val);
6628
+ if (isArray(val)) {
6629
+ methodsToPatch.forEach((m) => {
6630
+ val[m] = (...args) => {
6631
+ Array.prototype[m].call(reactiveVal, ...args);
6632
+ };
6633
+ });
6634
+ } else {
6635
+ Object.keys(val).forEach((key2) => {
6636
+ try {
6637
+ defineReactiveSimple(val, key2, val[key2]);
6638
+ } catch (e) {
6639
+ }
6640
+ });
6641
+ }
6536
6642
  }
6537
- return message;
6538
- }
6539
- function styleValue(value, type) {
6540
- if (type === "String") {
6541
- return `"${value}"`;
6542
- } else if (type === "Number") {
6543
- return `${Number(value)}`;
6643
+ const i = obj.$;
6644
+ if (i && obj === i.proxy) {
6645
+ defineReactiveSimple(i.ctx, key, val);
6646
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6647
+ } else if (isReactive(obj)) {
6648
+ obj[key] = val;
6544
6649
  } else {
6545
- return `${value}`;
6650
+ defineReactiveSimple(obj, key, val);
6546
6651
  }
6547
6652
  }
6548
- function isExplicable(type) {
6549
- const explicitTypes = ["string", "number", "boolean"];
6550
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6551
- }
6552
- function isBoolean(...args) {
6553
- return args.some((elem) => elem.toLowerCase() === "boolean");
6653
+ function defineReactiveSimple(obj, key, val) {
6654
+ val = isObject(val) ? reactive(val) : val;
6655
+ Object.defineProperty(obj, key, {
6656
+ enumerable: true,
6657
+ configurable: true,
6658
+ get() {
6659
+ track(obj, "get", key);
6660
+ return val;
6661
+ },
6662
+ set(newVal) {
6663
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6664
+ trigger(obj, "set", key, newVal);
6665
+ }
6666
+ });
6554
6667
  }
6555
6668
 
6556
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6557
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6558
- const normalizeSlot = (key, rawSlot, ctx) => {
6559
- if (rawSlot._n) {
6560
- return rawSlot;
6561
- }
6562
- const normalized = withCtx((...args) => {
6563
- if (process.env.NODE_ENV !== "production" && currentInstance) {
6564
- warn(
6565
- `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.`
6566
- );
6669
+ function createAppContext() {
6670
+ return {
6671
+ app: null,
6672
+ config: {
6673
+ isNativeTag: NO,
6674
+ performance: false,
6675
+ globalProperties: {},
6676
+ optionMergeStrategies: {},
6677
+ errorHandler: void 0,
6678
+ warnHandler: void 0,
6679
+ compilerOptions: {}
6680
+ },
6681
+ mixins: [],
6682
+ components: {},
6683
+ directives: {},
6684
+ provides: /* @__PURE__ */ Object.create(null),
6685
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6686
+ propsCache: /* @__PURE__ */ new WeakMap(),
6687
+ emitsCache: /* @__PURE__ */ new WeakMap()
6688
+ };
6689
+ }
6690
+ let uid$1 = 0;
6691
+ function createAppAPI(render, hydrate) {
6692
+ return function createApp(rootComponent, rootProps = null) {
6693
+ if (!isFunction(rootComponent)) {
6694
+ rootComponent = extend({}, rootComponent);
6567
6695
  }
6568
- return normalizeSlotValue(rawSlot(...args));
6569
- }, ctx);
6570
- normalized._c = false;
6571
- return normalized;
6572
- };
6573
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6574
- const ctx = rawSlots._ctx;
6575
- for (const key in rawSlots) {
6576
- if (isInternalKey(key))
6577
- continue;
6578
- const value = rawSlots[key];
6579
- if (isFunction(value)) {
6580
- slots[key] = normalizeSlot(key, value, ctx);
6581
- } else if (value != null) {
6582
- if (process.env.NODE_ENV !== "production" && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6583
- warn(
6584
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6585
- );
6586
- }
6587
- const normalized = normalizeSlotValue(value);
6588
- slots[key] = () => normalized;
6589
- }
6590
- }
6591
- };
6592
- const normalizeVNodeSlots = (instance, children) => {
6593
- if (process.env.NODE_ENV !== "production" && !isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
6594
- warn(
6595
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6596
- );
6597
- }
6598
- const normalized = normalizeSlotValue(children);
6599
- instance.slots.default = () => normalized;
6600
- };
6601
- const initSlots = (instance, children) => {
6602
- if (instance.vnode.shapeFlag & 32) {
6603
- const type = children._;
6604
- if (type) {
6605
- instance.slots = toRaw(children);
6606
- def(children, "_", type);
6607
- } else {
6608
- normalizeObjectSlots(
6609
- children,
6610
- instance.slots = {},
6611
- instance
6612
- );
6613
- }
6614
- } else {
6615
- instance.slots = {};
6616
- if (children) {
6617
- normalizeVNodeSlots(instance, children);
6696
+ if (rootProps != null && !isObject(rootProps)) {
6697
+ process.env.NODE_ENV !== "production" && warn(`root props passed to app.mount() must be an object.`);
6698
+ rootProps = null;
6618
6699
  }
6619
- }
6620
- def(instance.slots, InternalObjectKey, 1);
6621
- };
6622
- const updateSlots = (instance, children, optimized) => {
6623
- const { vnode, slots } = instance;
6624
- let needDeletionCheck = true;
6625
- let deletionComparisonTarget = EMPTY_OBJ;
6626
- if (vnode.shapeFlag & 32) {
6627
- const type = children._;
6628
- if (type) {
6629
- if (process.env.NODE_ENV !== "production" && isHmrUpdating) {
6630
- extend(slots, children);
6631
- } else if (optimized && type === 1) {
6632
- needDeletionCheck = false;
6633
- } else {
6634
- extend(slots, children);
6635
- if (!optimized && type === 1) {
6636
- delete slots._;
6700
+ const context = createAppContext();
6701
+ if (process.env.NODE_ENV !== "production") {
6702
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
6703
+ get() {
6704
+ return true;
6705
+ },
6706
+ set() {
6707
+ warn(
6708
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
6709
+ );
6637
6710
  }
6638
- }
6639
- } else {
6640
- needDeletionCheck = !children.$stable;
6641
- normalizeObjectSlots(children, slots, instance);
6642
- }
6643
- deletionComparisonTarget = children;
6644
- } else if (children) {
6645
- normalizeVNodeSlots(instance, children);
6646
- deletionComparisonTarget = { default: 1 };
6647
- }
6648
- if (needDeletionCheck) {
6649
- for (const key in slots) {
6650
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6651
- delete slots[key];
6652
- }
6711
+ });
6653
6712
  }
6654
- }
6655
- };
6656
-
6657
- function installLegacyConfigWarnings(config) {
6658
- const legacyConfigOptions = {
6659
- silent: "CONFIG_SILENT",
6660
- devtools: "CONFIG_DEVTOOLS",
6661
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6662
- keyCodes: "CONFIG_KEY_CODES",
6663
- productionTip: "CONFIG_PRODUCTION_TIP"
6664
- };
6665
- Object.keys(legacyConfigOptions).forEach((key) => {
6666
- let val = config[key];
6667
- Object.defineProperty(config, key, {
6668
- enumerable: true,
6669
- get() {
6670
- return val;
6713
+ const installedPlugins = /* @__PURE__ */ new Set();
6714
+ let isMounted = false;
6715
+ const app = context.app = {
6716
+ _uid: uid$1++,
6717
+ _component: rootComponent,
6718
+ _props: rootProps,
6719
+ _container: null,
6720
+ _context: context,
6721
+ _instance: null,
6722
+ version,
6723
+ get config() {
6724
+ return context.config;
6671
6725
  },
6672
- set(newVal) {
6673
- if (!isCopyingConfig) {
6674
- warnDeprecation$1(legacyConfigOptions[key], null);
6726
+ set config(v) {
6727
+ if (process.env.NODE_ENV !== "production") {
6728
+ warn(
6729
+ `app.config cannot be replaced. Modify individual options instead.`
6730
+ );
6731
+ }
6732
+ },
6733
+ use(plugin, ...options) {
6734
+ if (installedPlugins.has(plugin)) {
6735
+ process.env.NODE_ENV !== "production" && warn(`Plugin has already been applied to target app.`);
6736
+ } else if (plugin && isFunction(plugin.install)) {
6737
+ installedPlugins.add(plugin);
6738
+ plugin.install(app, ...options);
6739
+ } else if (isFunction(plugin)) {
6740
+ installedPlugins.add(plugin);
6741
+ plugin(app, ...options);
6742
+ } else if (process.env.NODE_ENV !== "production") {
6743
+ warn(
6744
+ `A plugin must either be a function or an object with an "install" function.`
6745
+ );
6746
+ }
6747
+ return app;
6748
+ },
6749
+ mixin(mixin) {
6750
+ if (__VUE_OPTIONS_API__) {
6751
+ if (!context.mixins.includes(mixin)) {
6752
+ context.mixins.push(mixin);
6753
+ } else if (process.env.NODE_ENV !== "production") {
6754
+ warn(
6755
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6756
+ );
6757
+ }
6758
+ } else if (process.env.NODE_ENV !== "production") {
6759
+ warn("Mixins are only available in builds supporting Options API");
6760
+ }
6761
+ return app;
6762
+ },
6763
+ component(name, component) {
6764
+ if (process.env.NODE_ENV !== "production") {
6765
+ validateComponentName(name, context.config);
6766
+ }
6767
+ if (!component) {
6768
+ return context.components[name];
6769
+ }
6770
+ if (process.env.NODE_ENV !== "production" && context.components[name]) {
6771
+ warn(`Component "${name}" has already been registered in target app.`);
6772
+ }
6773
+ context.components[name] = component;
6774
+ return app;
6775
+ },
6776
+ directive(name, directive) {
6777
+ if (process.env.NODE_ENV !== "production") {
6778
+ validateDirectiveName(name);
6779
+ }
6780
+ if (!directive) {
6781
+ return context.directives[name];
6782
+ }
6783
+ if (process.env.NODE_ENV !== "production" && context.directives[name]) {
6784
+ warn(`Directive "${name}" has already been registered in target app.`);
6785
+ }
6786
+ context.directives[name] = directive;
6787
+ return app;
6788
+ },
6789
+ mount(rootContainer, isHydrate, isSVG) {
6790
+ if (!isMounted) {
6791
+ if (process.env.NODE_ENV !== "production" && rootContainer.__vue_app__) {
6792
+ warn(
6793
+ `There is already an app instance mounted on the host container.
6794
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6795
+ );
6796
+ }
6797
+ const vnode = createVNode(
6798
+ rootComponent,
6799
+ rootProps
6800
+ );
6801
+ vnode.appContext = context;
6802
+ if (process.env.NODE_ENV !== "production") {
6803
+ context.reload = () => {
6804
+ render(cloneVNode(vnode), rootContainer, isSVG);
6805
+ };
6806
+ }
6807
+ if (isHydrate && hydrate) {
6808
+ hydrate(vnode, rootContainer);
6809
+ } else {
6810
+ render(vnode, rootContainer, isSVG);
6811
+ }
6812
+ isMounted = true;
6813
+ app._container = rootContainer;
6814
+ rootContainer.__vue_app__ = app;
6815
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6816
+ app._instance = vnode.component;
6817
+ devtoolsInitApp(app, version);
6818
+ }
6819
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6820
+ } else if (process.env.NODE_ENV !== "production") {
6821
+ warn(
6822
+ `App has already been mounted.
6823
+ 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)\``
6824
+ );
6825
+ }
6826
+ },
6827
+ unmount() {
6828
+ if (isMounted) {
6829
+ render(null, app._container);
6830
+ if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
6831
+ app._instance = null;
6832
+ devtoolsUnmountApp(app);
6833
+ }
6834
+ delete app._container.__vue_app__;
6835
+ } else if (process.env.NODE_ENV !== "production") {
6836
+ warn(`Cannot unmount an app that is not mounted.`);
6837
+ }
6838
+ },
6839
+ provide(key, value) {
6840
+ if (process.env.NODE_ENV !== "production" && key in context.provides) {
6841
+ warn(
6842
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6843
+ );
6844
+ }
6845
+ context.provides[key] = value;
6846
+ return app;
6847
+ },
6848
+ runWithContext(fn) {
6849
+ currentApp = app;
6850
+ try {
6851
+ return fn();
6852
+ } finally {
6853
+ currentApp = null;
6675
6854
  }
6676
- val = newVal;
6677
- }
6678
- });
6679
- });
6680
- }
6681
- function installLegacyOptionMergeStrats(config) {
6682
- config.optionMergeStrategies = new Proxy({}, {
6683
- get(target, key) {
6684
- if (key in target) {
6685
- return target[key];
6686
- }
6687
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6688
- "CONFIG_OPTION_MERGE_STRATS",
6689
- null
6690
- )) {
6691
- return internalOptionMergeStrats[key];
6692
6855
  }
6856
+ };
6857
+ {
6858
+ installAppCompatProperties(app, context, render);
6693
6859
  }
6694
- });
6860
+ return app;
6861
+ };
6695
6862
  }
6863
+ let currentApp = null;
6696
6864
 
6697
- let isCopyingConfig = false;
6698
- let singletonApp;
6699
- let singletonCtor;
6700
- function createCompatVue$1(createApp, createSingletonApp) {
6701
- singletonApp = createSingletonApp({});
6702
- const Vue = singletonCtor = function Vue2(options = {}) {
6703
- return createCompatApp(options, Vue2);
6704
- };
6705
- function createCompatApp(options = {}, Ctor) {
6706
- assertCompatEnabled("GLOBAL_MOUNT", null);
6707
- const { data } = options;
6708
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6709
- options.data = () => data;
6710
- }
6711
- const app = createApp(options);
6712
- if (Ctor !== Vue) {
6713
- applySingletonPrototype(app, Ctor);
6865
+ function provide(key, value) {
6866
+ if (!currentInstance) {
6867
+ if (process.env.NODE_ENV !== "production") {
6868
+ warn(`provide() can only be used inside setup().`);
6714
6869
  }
6715
- const vm = app._createRoot(options);
6716
- if (options.el) {
6717
- return vm.$mount(options.el);
6718
- } else {
6719
- return vm;
6870
+ } else {
6871
+ let provides = currentInstance.provides;
6872
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6873
+ if (parentProvides === provides) {
6874
+ provides = currentInstance.provides = Object.create(parentProvides);
6720
6875
  }
6876
+ provides[key] = value;
6721
6877
  }
6722
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.8"}`;
6723
- Vue.config = singletonApp.config;
6724
- Vue.use = (p, ...options) => {
6725
- if (p && isFunction(p.install)) {
6726
- p.install(Vue, ...options);
6727
- } else if (isFunction(p)) {
6728
- p(Vue, ...options);
6729
- }
6730
- return Vue;
6731
- };
6732
- Vue.mixin = (m) => {
6733
- singletonApp.mixin(m);
6734
- return Vue;
6735
- };
6736
- Vue.component = (name, comp) => {
6737
- if (comp) {
6738
- singletonApp.component(name, comp);
6739
- return Vue;
6740
- } else {
6741
- return singletonApp.component(name);
6742
- }
6743
- };
6744
- Vue.directive = (name, dir) => {
6745
- if (dir) {
6746
- singletonApp.directive(name, dir);
6747
- return Vue;
6748
- } else {
6749
- return singletonApp.directive(name);
6750
- }
6751
- };
6752
- Vue.options = { _base: Vue };
6753
- let cid = 1;
6754
- Vue.cid = cid;
6755
- Vue.nextTick = nextTick;
6756
- const extendCache = /* @__PURE__ */ new WeakMap();
6757
- function extendCtor(extendOptions = {}) {
6758
- assertCompatEnabled("GLOBAL_EXTEND", null);
6759
- if (isFunction(extendOptions)) {
6760
- extendOptions = extendOptions.options;
6761
- }
6762
- if (extendCache.has(extendOptions)) {
6763
- return extendCache.get(extendOptions);
6764
- }
6765
- const Super = this;
6766
- function SubVue(inlineOptions) {
6767
- if (!inlineOptions) {
6768
- return createCompatApp(SubVue.options, SubVue);
6769
- } else {
6770
- return createCompatApp(
6771
- mergeOptions(
6772
- extend({}, SubVue.options),
6773
- inlineOptions,
6774
- internalOptionMergeStrats
6775
- ),
6776
- SubVue
6777
- );
6778
- }
6779
- }
6780
- SubVue.super = Super;
6781
- SubVue.prototype = Object.create(Vue.prototype);
6782
- SubVue.prototype.constructor = SubVue;
6783
- const mergeBase = {};
6784
- for (const key in Super.options) {
6785
- const superValue = Super.options[key];
6786
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6878
+ }
6879
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6880
+ const instance = currentInstance || currentRenderingInstance;
6881
+ if (instance || currentApp) {
6882
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6883
+ if (provides && key in provides) {
6884
+ return provides[key];
6885
+ } else if (arguments.length > 1) {
6886
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6887
+ } else if (process.env.NODE_ENV !== "production") {
6888
+ warn(`injection "${String(key)}" not found.`);
6787
6889
  }
6788
- SubVue.options = mergeOptions(
6789
- mergeBase,
6790
- extendOptions,
6791
- internalOptionMergeStrats
6792
- );
6793
- SubVue.options._base = SubVue;
6794
- SubVue.extend = extendCtor.bind(SubVue);
6795
- SubVue.mixin = Super.mixin;
6796
- SubVue.use = Super.use;
6797
- SubVue.cid = ++cid;
6798
- extendCache.set(extendOptions, SubVue);
6799
- return SubVue;
6890
+ } else if (process.env.NODE_ENV !== "production") {
6891
+ warn(`inject() can only be used inside setup() or functional components.`);
6800
6892
  }
6801
- Vue.extend = extendCtor.bind(Vue);
6802
- Vue.set = (target, key, value) => {
6803
- assertCompatEnabled("GLOBAL_SET", null);
6804
- target[key] = value;
6805
- };
6806
- Vue.delete = (target, key) => {
6807
- assertCompatEnabled("GLOBAL_DELETE", null);
6808
- delete target[key];
6809
- };
6810
- Vue.observable = (target) => {
6811
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6812
- return reactive(target);
6813
- };
6814
- Vue.filter = (name, filter) => {
6815
- if (filter) {
6816
- singletonApp.filter(name, filter);
6817
- return Vue;
6818
- } else {
6819
- return singletonApp.filter(name);
6820
- }
6821
- };
6822
- const util = {
6823
- warn: process.env.NODE_ENV !== "production" ? warn : NOOP,
6824
- extend,
6825
- mergeOptions: (parent, child, vm) => mergeOptions(
6826
- parent,
6827
- child,
6828
- vm ? void 0 : internalOptionMergeStrats
6829
- ),
6830
- defineReactive
6831
- };
6832
- Object.defineProperty(Vue, "util", {
6833
- get() {
6834
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6835
- return util;
6893
+ }
6894
+ function hasInjectionContext() {
6895
+ return !!(currentInstance || currentRenderingInstance || currentApp);
6896
+ }
6897
+
6898
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6899
+ return new Proxy(
6900
+ {},
6901
+ {
6902
+ get(_, key) {
6903
+ process.env.NODE_ENV !== "production" && warnDeprecation$1("PROPS_DEFAULT_THIS", null, propKey);
6904
+ if (key === "$options") {
6905
+ return resolveMergedOptions(instance);
6906
+ }
6907
+ if (key in rawProps) {
6908
+ return rawProps[key];
6909
+ }
6910
+ const injections = instance.type.inject;
6911
+ if (injections) {
6912
+ if (isArray(injections)) {
6913
+ if (injections.includes(key)) {
6914
+ return inject(key);
6915
+ }
6916
+ } else if (key in injections) {
6917
+ return inject(key);
6918
+ }
6919
+ }
6920
+ }
6836
6921
  }
6837
- });
6838
- Vue.configureCompat = configureCompat$1;
6839
- return Vue;
6922
+ );
6840
6923
  }
6841
- function installAppCompatProperties(app, context, render) {
6842
- installFilterMethod(app, context);
6843
- installLegacyOptionMergeStrats(app.config);
6844
- if (!singletonApp) {
6845
- return;
6924
+
6925
+ function shouldSkipAttr(key, instance) {
6926
+ if (key === "is") {
6927
+ return true;
6846
6928
  }
6847
- installCompatMount(app, context, render);
6848
- installLegacyAPIs(app);
6849
- applySingletonAppMutations(app);
6850
- if (process.env.NODE_ENV !== "production")
6851
- installLegacyConfigWarnings(app.config);
6929
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6930
+ return true;
6931
+ }
6932
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
6933
+ return true;
6934
+ }
6935
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6936
+ return true;
6937
+ }
6938
+ return false;
6852
6939
  }
6853
- function installFilterMethod(app, context) {
6854
- context.filters = {};
6855
- app.filter = (name, filter) => {
6856
- assertCompatEnabled("FILTERS", null);
6857
- if (!filter) {
6858
- return context.filters[name];
6940
+
6941
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6942
+ const props = {};
6943
+ const attrs = {};
6944
+ def(attrs, InternalObjectKey, 1);
6945
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6946
+ setFullProps(instance, rawProps, props, attrs);
6947
+ for (const key in instance.propsOptions[0]) {
6948
+ if (!(key in props)) {
6949
+ props[key] = void 0;
6859
6950
  }
6860
- if (process.env.NODE_ENV !== "production" && context.filters[name]) {
6861
- warn(`Filter "${name}" has already been registered.`);
6951
+ }
6952
+ if (process.env.NODE_ENV !== "production") {
6953
+ validateProps(rawProps || {}, props, instance);
6954
+ }
6955
+ if (isStateful) {
6956
+ instance.props = isSSR ? props : shallowReactive(props);
6957
+ } else {
6958
+ if (!instance.type.props) {
6959
+ instance.props = attrs;
6960
+ } else {
6961
+ instance.props = props;
6862
6962
  }
6863
- context.filters[name] = filter;
6864
- return app;
6865
- };
6963
+ }
6964
+ instance.attrs = attrs;
6866
6965
  }
6867
- function installLegacyAPIs(app) {
6868
- Object.defineProperties(app, {
6869
- // so that app.use() can work with legacy plugins that extend prototypes
6870
- prototype: {
6871
- get() {
6872
- process.env.NODE_ENV !== "production" && warnDeprecation$1("GLOBAL_PROTOTYPE", null);
6873
- return app.config.globalProperties;
6874
- }
6875
- },
6876
- nextTick: { value: nextTick },
6877
- extend: { value: singletonCtor.extend },
6878
- set: { value: singletonCtor.set },
6879
- delete: { value: singletonCtor.delete },
6880
- observable: { value: singletonCtor.observable },
6881
- util: {
6882
- get() {
6883
- return singletonCtor.util;
6966
+ function isInHmrContext(instance) {
6967
+ while (instance) {
6968
+ if (instance.type.__hmrId)
6969
+ return true;
6970
+ instance = instance.parent;
6971
+ }
6972
+ }
6973
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6974
+ const {
6975
+ props,
6976
+ attrs,
6977
+ vnode: { patchFlag }
6978
+ } = instance;
6979
+ const rawCurrentProps = toRaw(props);
6980
+ const [options] = instance.propsOptions;
6981
+ let hasAttrsChanged = false;
6982
+ if (
6983
+ // always force full diff in dev
6984
+ // - #1942 if hmr is enabled with sfc component
6985
+ // - vite#872 non-sfc component used by sfc component
6986
+ !(process.env.NODE_ENV !== "production" && isInHmrContext(instance)) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6987
+ ) {
6988
+ if (patchFlag & 8) {
6989
+ const propsToUpdate = instance.vnode.dynamicProps;
6990
+ for (let i = 0; i < propsToUpdate.length; i++) {
6991
+ let key = propsToUpdate[i];
6992
+ if (isEmitListener(instance.emitsOptions, key)) {
6993
+ continue;
6994
+ }
6995
+ const value = rawProps[key];
6996
+ if (options) {
6997
+ if (hasOwn(attrs, key)) {
6998
+ if (value !== attrs[key]) {
6999
+ attrs[key] = value;
7000
+ hasAttrsChanged = true;
7001
+ }
7002
+ } else {
7003
+ const camelizedKey = camelize(key);
7004
+ props[camelizedKey] = resolvePropValue(
7005
+ options,
7006
+ rawCurrentProps,
7007
+ camelizedKey,
7008
+ value,
7009
+ instance,
7010
+ false
7011
+ /* isAbsent */
7012
+ );
7013
+ }
7014
+ } else {
7015
+ {
7016
+ if (isOn(key) && key.endsWith("Native")) {
7017
+ key = key.slice(0, -6);
7018
+ } else if (shouldSkipAttr(key, instance)) {
7019
+ continue;
7020
+ }
7021
+ }
7022
+ if (value !== attrs[key]) {
7023
+ attrs[key] = value;
7024
+ hasAttrsChanged = true;
7025
+ }
7026
+ }
6884
7027
  }
6885
7028
  }
6886
- });
6887
- }
6888
- function applySingletonAppMutations(app) {
6889
- app._context.mixins = [...singletonApp._context.mixins];
6890
- ["components", "directives", "filters"].forEach((key) => {
6891
- app._context[key] = Object.create(singletonApp._context[key]);
6892
- });
6893
- isCopyingConfig = true;
6894
- for (const key in singletonApp.config) {
6895
- if (key === "isNativeTag")
6896
- continue;
6897
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6898
- continue;
7029
+ } else {
7030
+ if (setFullProps(instance, rawProps, props, attrs)) {
7031
+ hasAttrsChanged = true;
6899
7032
  }
6900
- const val = singletonApp.config[key];
6901
- app.config[key] = isObject(val) ? Object.create(val) : val;
6902
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6903
- app.config.compilerOptions.isCustomElement = (tag) => {
6904
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6905
- };
7033
+ let kebabKey;
7034
+ for (const key in rawCurrentProps) {
7035
+ if (!rawProps || // for camelCase
7036
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
7037
+ // and converted to camelCase (#955)
7038
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
7039
+ if (options) {
7040
+ if (rawPrevProps && // for camelCase
7041
+ (rawPrevProps[key] !== void 0 || // for kebab-case
7042
+ rawPrevProps[kebabKey] !== void 0)) {
7043
+ props[key] = resolvePropValue(
7044
+ options,
7045
+ rawCurrentProps,
7046
+ key,
7047
+ void 0,
7048
+ instance,
7049
+ true
7050
+ /* isAbsent */
7051
+ );
7052
+ }
7053
+ } else {
7054
+ delete props[key];
7055
+ }
7056
+ }
7057
+ }
7058
+ if (attrs !== rawCurrentProps) {
7059
+ for (const key in attrs) {
7060
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
7061
+ delete attrs[key];
7062
+ hasAttrsChanged = true;
7063
+ }
7064
+ }
6906
7065
  }
6907
7066
  }
6908
- isCopyingConfig = false;
6909
- applySingletonPrototype(app, singletonCtor);
6910
- }
6911
- function applySingletonPrototype(app, Ctor) {
6912
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
6913
- if (enabled) {
6914
- app.config.globalProperties = Object.create(Ctor.prototype);
7067
+ if (hasAttrsChanged) {
7068
+ trigger(instance, "set", "$attrs");
6915
7069
  }
6916
- let hasPrototypeAugmentations = false;
6917
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6918
- for (const key in descriptors) {
6919
- if (key !== "constructor") {
6920
- hasPrototypeAugmentations = true;
6921
- if (enabled) {
6922
- Object.defineProperty(
6923
- app.config.globalProperties,
6924
- key,
6925
- descriptors[key]
6926
- );
7070
+ if (process.env.NODE_ENV !== "production") {
7071
+ validateProps(rawProps || {}, props, instance);
7072
+ }
7073
+ }
7074
+ function setFullProps(instance, rawProps, props, attrs) {
7075
+ const [options, needCastKeys] = instance.propsOptions;
7076
+ let hasAttrsChanged = false;
7077
+ let rawCastValues;
7078
+ if (rawProps) {
7079
+ for (let key in rawProps) {
7080
+ if (isReservedProp(key)) {
7081
+ continue;
7082
+ }
7083
+ {
7084
+ if (key.startsWith("onHook:")) {
7085
+ softAssertCompatEnabled(
7086
+ "INSTANCE_EVENT_HOOKS",
7087
+ instance,
7088
+ key.slice(2).toLowerCase()
7089
+ );
7090
+ }
7091
+ if (key === "inline-template") {
7092
+ continue;
7093
+ }
7094
+ }
7095
+ const value = rawProps[key];
7096
+ let camelKey;
7097
+ if (options && hasOwn(options, camelKey = camelize(key))) {
7098
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
7099
+ props[camelKey] = value;
7100
+ } else {
7101
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
7102
+ }
7103
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
7104
+ {
7105
+ if (isOn(key) && key.endsWith("Native")) {
7106
+ key = key.slice(0, -6);
7107
+ } else if (shouldSkipAttr(key, instance)) {
7108
+ continue;
7109
+ }
7110
+ }
7111
+ if (!(key in attrs) || value !== attrs[key]) {
7112
+ attrs[key] = value;
7113
+ hasAttrsChanged = true;
7114
+ }
6927
7115
  }
6928
7116
  }
6929
7117
  }
6930
- if (process.env.NODE_ENV !== "production" && hasPrototypeAugmentations) {
6931
- warnDeprecation$1("GLOBAL_PROTOTYPE", null);
7118
+ if (needCastKeys) {
7119
+ const rawCurrentProps = toRaw(props);
7120
+ const castValues = rawCastValues || EMPTY_OBJ;
7121
+ for (let i = 0; i < needCastKeys.length; i++) {
7122
+ const key = needCastKeys[i];
7123
+ props[key] = resolvePropValue(
7124
+ options,
7125
+ rawCurrentProps,
7126
+ key,
7127
+ castValues[key],
7128
+ instance,
7129
+ !hasOwn(castValues, key)
7130
+ );
7131
+ }
6932
7132
  }
7133
+ return hasAttrsChanged;
6933
7134
  }
6934
- function installCompatMount(app, context, render) {
6935
- let isMounted = false;
6936
- app._createRoot = (options) => {
6937
- const component = app._component;
6938
- const vnode = createVNode(component, options.propsData || null);
6939
- vnode.appContext = context;
6940
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6941
- const emptyRender = () => {
6942
- };
6943
- const instance = createComponentInstance(vnode, null, null);
6944
- if (hasNoRender) {
6945
- instance.render = emptyRender;
6946
- }
6947
- setupComponent(instance);
6948
- vnode.component = instance;
6949
- vnode.isCompatRoot = true;
6950
- instance.ctx._compat_mount = (selectorOrEl) => {
6951
- if (isMounted) {
6952
- process.env.NODE_ENV !== "production" && warn(`Root instance is already mounted.`);
6953
- return;
6954
- }
6955
- let container;
6956
- if (typeof selectorOrEl === "string") {
6957
- const result = document.querySelector(selectorOrEl);
6958
- if (!result) {
6959
- process.env.NODE_ENV !== "production" && warn(
6960
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
7135
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7136
+ const opt = options[key];
7137
+ if (opt != null) {
7138
+ const hasDefault = hasOwn(opt, "default");
7139
+ if (hasDefault && value === void 0) {
7140
+ const defaultValue = opt.default;
7141
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
7142
+ const { propsDefaults } = instance;
7143
+ if (key in propsDefaults) {
7144
+ value = propsDefaults[key];
7145
+ } else {
7146
+ setCurrentInstance(instance);
7147
+ value = propsDefaults[key] = defaultValue.call(
7148
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7149
+ props
6961
7150
  );
6962
- return;
7151
+ unsetCurrentInstance();
6963
7152
  }
6964
- container = result;
6965
7153
  } else {
6966
- container = selectorOrEl || document.createElement("div");
7154
+ value = defaultValue;
6967
7155
  }
6968
- const isSVG = container instanceof SVGElement;
6969
- if (process.env.NODE_ENV !== "production") {
6970
- context.reload = () => {
6971
- const cloned = cloneVNode(vnode);
6972
- cloned.component = null;
6973
- render(cloned, container, isSVG);
6974
- };
7156
+ }
7157
+ if (opt[0 /* shouldCast */]) {
7158
+ if (isAbsent && !hasDefault) {
7159
+ value = false;
7160
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
7161
+ value = true;
6975
7162
  }
6976
- if (hasNoRender && instance.render === emptyRender) {
6977
- if (process.env.NODE_ENV !== "production") {
6978
- for (let i = 0; i < container.attributes.length; i++) {
6979
- const attr = container.attributes[i];
6980
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6981
- warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
6982
- break;
6983
- }
6984
- }
6985
- }
6986
- instance.render = null;
6987
- component.template = container.innerHTML;
6988
- finishComponentSetup(
6989
- instance,
6990
- false,
6991
- true
6992
- /* skip options */
6993
- );
7163
+ }
7164
+ }
7165
+ return value;
7166
+ }
7167
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
7168
+ const cache = appContext.propsCache;
7169
+ const cached = cache.get(comp);
7170
+ if (cached) {
7171
+ return cached;
7172
+ }
7173
+ const raw = comp.props;
7174
+ const normalized = {};
7175
+ const needCastKeys = [];
7176
+ let hasExtends = false;
7177
+ if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
7178
+ const extendProps = (raw2) => {
7179
+ if (isFunction(raw2)) {
7180
+ raw2 = raw2.options;
6994
7181
  }
6995
- container.innerHTML = "";
6996
- render(vnode, container, isSVG);
6997
- if (container instanceof Element) {
6998
- container.removeAttribute("v-cloak");
6999
- container.setAttribute("data-v-app", "");
7182
+ hasExtends = true;
7183
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
7184
+ extend(normalized, props);
7185
+ if (keys)
7186
+ needCastKeys.push(...keys);
7187
+ };
7188
+ if (!asMixin && appContext.mixins.length) {
7189
+ appContext.mixins.forEach(extendProps);
7190
+ }
7191
+ if (comp.extends) {
7192
+ extendProps(comp.extends);
7193
+ }
7194
+ if (comp.mixins) {
7195
+ comp.mixins.forEach(extendProps);
7196
+ }
7197
+ }
7198
+ if (!raw && !hasExtends) {
7199
+ if (isObject(comp)) {
7200
+ cache.set(comp, EMPTY_ARR);
7201
+ }
7202
+ return EMPTY_ARR;
7203
+ }
7204
+ if (isArray(raw)) {
7205
+ for (let i = 0; i < raw.length; i++) {
7206
+ if (process.env.NODE_ENV !== "production" && !isString(raw[i])) {
7207
+ warn(`props must be strings when using array syntax.`, raw[i]);
7000
7208
  }
7001
- isMounted = true;
7002
- app._container = container;
7003
- container.__vue_app__ = app;
7004
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
7005
- devtoolsInitApp(app, version);
7209
+ const normalizedKey = camelize(raw[i]);
7210
+ if (validatePropName(normalizedKey)) {
7211
+ normalized[normalizedKey] = EMPTY_OBJ;
7006
7212
  }
7007
- return instance.proxy;
7008
- };
7009
- instance.ctx._compat_destroy = () => {
7010
- if (isMounted) {
7011
- render(null, app._container);
7012
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
7013
- devtoolsUnmountApp(app);
7014
- }
7015
- delete app._container.__vue_app__;
7016
- } else {
7017
- const { bum, scope, um } = instance;
7018
- if (bum) {
7019
- invokeArrayFns(bum);
7020
- }
7021
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7022
- instance.emit("hook:beforeDestroy");
7023
- }
7024
- if (scope) {
7025
- scope.stop();
7026
- }
7027
- if (um) {
7028
- invokeArrayFns(um);
7029
- }
7030
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7031
- instance.emit("hook:destroyed");
7213
+ }
7214
+ } else if (raw) {
7215
+ if (process.env.NODE_ENV !== "production" && !isObject(raw)) {
7216
+ warn(`invalid props options`, raw);
7217
+ }
7218
+ for (const key in raw) {
7219
+ const normalizedKey = camelize(key);
7220
+ if (validatePropName(normalizedKey)) {
7221
+ const opt = raw[key];
7222
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
7223
+ if (prop) {
7224
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
7225
+ const stringIndex = getTypeIndex(String, prop.type);
7226
+ prop[0 /* shouldCast */] = booleanIndex > -1;
7227
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
7228
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
7229
+ needCastKeys.push(normalizedKey);
7230
+ }
7032
7231
  }
7033
7232
  }
7034
- };
7035
- return instance.proxy;
7036
- };
7233
+ }
7234
+ }
7235
+ const res = [normalized, needCastKeys];
7236
+ if (isObject(comp)) {
7237
+ cache.set(comp, res);
7238
+ }
7239
+ return res;
7240
+ }
7241
+ function validatePropName(key) {
7242
+ if (key[0] !== "$") {
7243
+ return true;
7244
+ } else if (process.env.NODE_ENV !== "production") {
7245
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
7246
+ }
7247
+ return false;
7248
+ }
7249
+ function getType(ctor) {
7250
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7251
+ return match ? match[2] : ctor === null ? "null" : "";
7252
+ }
7253
+ function isSameType(a, b) {
7254
+ return getType(a) === getType(b);
7255
+ }
7256
+ function getTypeIndex(type, expectedTypes) {
7257
+ if (isArray(expectedTypes)) {
7258
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7259
+ } else if (isFunction(expectedTypes)) {
7260
+ return isSameType(expectedTypes, type) ? 0 : -1;
7261
+ }
7262
+ return -1;
7263
+ }
7264
+ function validateProps(rawProps, props, instance) {
7265
+ const resolvedValues = toRaw(props);
7266
+ const options = instance.propsOptions[0];
7267
+ for (const key in options) {
7268
+ let opt = options[key];
7269
+ if (opt == null)
7270
+ continue;
7271
+ validateProp(
7272
+ key,
7273
+ resolvedValues[key],
7274
+ opt,
7275
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
7276
+ );
7277
+ }
7037
7278
  }
7038
- const methodsToPatch = [
7039
- "push",
7040
- "pop",
7041
- "shift",
7042
- "unshift",
7043
- "splice",
7044
- "sort",
7045
- "reverse"
7046
- ];
7047
- const patched = /* @__PURE__ */ new WeakSet();
7048
- function defineReactive(obj, key, val) {
7049
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
7050
- const reactiveVal = reactive(val);
7051
- if (isArray(val)) {
7052
- methodsToPatch.forEach((m) => {
7053
- val[m] = (...args) => {
7054
- Array.prototype[m].call(reactiveVal, ...args);
7055
- };
7056
- });
7057
- } else {
7058
- Object.keys(val).forEach((key2) => {
7059
- try {
7060
- defineReactiveSimple(val, key2, val[key2]);
7061
- } catch (e) {
7062
- }
7063
- });
7279
+ function validateProp(name, value, prop, isAbsent) {
7280
+ const { type, required, validator, skipCheck } = prop;
7281
+ if (required && isAbsent) {
7282
+ warn('Missing required prop: "' + name + '"');
7283
+ return;
7284
+ }
7285
+ if (value == null && !required) {
7286
+ return;
7287
+ }
7288
+ if (type != null && type !== true && !skipCheck) {
7289
+ let isValid = false;
7290
+ const types = isArray(type) ? type : [type];
7291
+ const expectedTypes = [];
7292
+ for (let i = 0; i < types.length && !isValid; i++) {
7293
+ const { valid, expectedType } = assertType(value, types[i]);
7294
+ expectedTypes.push(expectedType || "");
7295
+ isValid = valid;
7296
+ }
7297
+ if (!isValid) {
7298
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7299
+ return;
7064
7300
  }
7065
7301
  }
7066
- const i = obj.$;
7067
- if (i && obj === i.proxy) {
7068
- defineReactiveSimple(i.ctx, key, val);
7069
- i.accessCache = /* @__PURE__ */ Object.create(null);
7070
- } else if (isReactive(obj)) {
7071
- obj[key] = val;
7072
- } else {
7073
- defineReactiveSimple(obj, key, val);
7302
+ if (validator && !validator(value)) {
7303
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
7074
7304
  }
7075
7305
  }
7076
- function defineReactiveSimple(obj, key, val) {
7077
- val = isObject(val) ? reactive(val) : val;
7078
- Object.defineProperty(obj, key, {
7079
- enumerable: true,
7080
- configurable: true,
7081
- get() {
7082
- track(obj, "get", key);
7083
- return val;
7084
- },
7085
- set(newVal) {
7086
- val = isObject(newVal) ? reactive(newVal) : newVal;
7087
- trigger(obj, "set", key, newVal);
7306
+ const isSimpleType = /* @__PURE__ */ makeMap(
7307
+ "String,Number,Boolean,Function,Symbol,BigInt"
7308
+ );
7309
+ function assertType(value, type) {
7310
+ let valid;
7311
+ const expectedType = getType(type);
7312
+ if (isSimpleType(expectedType)) {
7313
+ const t = typeof value;
7314
+ valid = t === expectedType.toLowerCase();
7315
+ if (!valid && t === "object") {
7316
+ valid = value instanceof type;
7088
7317
  }
7089
- });
7090
- }
7091
-
7092
- function createAppContext() {
7318
+ } else if (expectedType === "Object") {
7319
+ valid = isObject(value);
7320
+ } else if (expectedType === "Array") {
7321
+ valid = isArray(value);
7322
+ } else if (expectedType === "null") {
7323
+ valid = value === null;
7324
+ } else {
7325
+ valid = value instanceof type;
7326
+ }
7093
7327
  return {
7094
- app: null,
7095
- config: {
7096
- isNativeTag: NO,
7097
- performance: false,
7098
- globalProperties: {},
7099
- optionMergeStrategies: {},
7100
- errorHandler: void 0,
7101
- warnHandler: void 0,
7102
- compilerOptions: {}
7103
- },
7104
- mixins: [],
7105
- components: {},
7106
- directives: {},
7107
- provides: /* @__PURE__ */ Object.create(null),
7108
- optionsCache: /* @__PURE__ */ new WeakMap(),
7109
- propsCache: /* @__PURE__ */ new WeakMap(),
7110
- emitsCache: /* @__PURE__ */ new WeakMap()
7328
+ valid,
7329
+ expectedType
7111
7330
  };
7112
7331
  }
7113
- let uid$1 = 0;
7114
- function createAppAPI(render, hydrate) {
7115
- return function createApp(rootComponent, rootProps = null) {
7116
- if (!isFunction(rootComponent)) {
7117
- rootComponent = extend({}, rootComponent);
7118
- }
7119
- if (rootProps != null && !isObject(rootProps)) {
7120
- process.env.NODE_ENV !== "production" && warn(`root props passed to app.mount() must be an object.`);
7121
- rootProps = null;
7122
- }
7123
- const context = createAppContext();
7124
- const installedPlugins = /* @__PURE__ */ new Set();
7125
- let isMounted = false;
7126
- const app = context.app = {
7127
- _uid: uid$1++,
7128
- _component: rootComponent,
7129
- _props: rootProps,
7130
- _container: null,
7131
- _context: context,
7132
- _instance: null,
7133
- version,
7134
- get config() {
7135
- return context.config;
7136
- },
7137
- set config(v) {
7138
- if (process.env.NODE_ENV !== "production") {
7139
- warn(
7140
- `app.config cannot be replaced. Modify individual options instead.`
7141
- );
7142
- }
7143
- },
7144
- use(plugin, ...options) {
7145
- if (installedPlugins.has(plugin)) {
7146
- process.env.NODE_ENV !== "production" && warn(`Plugin has already been applied to target app.`);
7147
- } else if (plugin && isFunction(plugin.install)) {
7148
- installedPlugins.add(plugin);
7149
- plugin.install(app, ...options);
7150
- } else if (isFunction(plugin)) {
7151
- installedPlugins.add(plugin);
7152
- plugin(app, ...options);
7153
- } else if (process.env.NODE_ENV !== "production") {
7154
- warn(
7155
- `A plugin must either be a function or an object with an "install" function.`
7156
- );
7157
- }
7158
- return app;
7159
- },
7160
- mixin(mixin) {
7161
- if (__VUE_OPTIONS_API__) {
7162
- if (!context.mixins.includes(mixin)) {
7163
- context.mixins.push(mixin);
7164
- } else if (process.env.NODE_ENV !== "production") {
7165
- warn(
7166
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7167
- );
7168
- }
7169
- } else if (process.env.NODE_ENV !== "production") {
7170
- warn("Mixins are only available in builds supporting Options API");
7171
- }
7172
- return app;
7173
- },
7174
- component(name, component) {
7175
- if (process.env.NODE_ENV !== "production") {
7176
- validateComponentName(name, context.config);
7177
- }
7178
- if (!component) {
7179
- return context.components[name];
7180
- }
7181
- if (process.env.NODE_ENV !== "production" && context.components[name]) {
7182
- warn(`Component "${name}" has already been registered in target app.`);
7183
- }
7184
- context.components[name] = component;
7185
- return app;
7186
- },
7187
- directive(name, directive) {
7188
- if (process.env.NODE_ENV !== "production") {
7189
- validateDirectiveName(name);
7190
- }
7191
- if (!directive) {
7192
- return context.directives[name];
7193
- }
7194
- if (process.env.NODE_ENV !== "production" && context.directives[name]) {
7195
- warn(`Directive "${name}" has already been registered in target app.`);
7196
- }
7197
- context.directives[name] = directive;
7198
- return app;
7199
- },
7200
- mount(rootContainer, isHydrate, isSVG) {
7201
- if (!isMounted) {
7202
- if (process.env.NODE_ENV !== "production" && rootContainer.__vue_app__) {
7203
- warn(
7204
- `There is already an app instance mounted on the host container.
7205
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7206
- );
7207
- }
7208
- const vnode = createVNode(
7209
- rootComponent,
7210
- rootProps
7211
- );
7212
- vnode.appContext = context;
7213
- if (process.env.NODE_ENV !== "production") {
7214
- context.reload = () => {
7215
- render(cloneVNode(vnode), rootContainer, isSVG);
7216
- };
7217
- }
7218
- if (isHydrate && hydrate) {
7219
- hydrate(vnode, rootContainer);
7220
- } else {
7221
- render(vnode, rootContainer, isSVG);
7222
- }
7223
- isMounted = true;
7224
- app._container = rootContainer;
7225
- rootContainer.__vue_app__ = app;
7226
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
7227
- app._instance = vnode.component;
7228
- devtoolsInitApp(app, version);
7229
- }
7230
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7231
- } else if (process.env.NODE_ENV !== "production") {
7232
- warn(
7233
- `App has already been mounted.
7234
- 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)\``
7235
- );
7236
- }
7237
- },
7238
- unmount() {
7239
- if (isMounted) {
7240
- render(null, app._container);
7241
- if (process.env.NODE_ENV !== "production" || __VUE_PROD_DEVTOOLS__) {
7242
- app._instance = null;
7243
- devtoolsUnmountApp(app);
7244
- }
7245
- delete app._container.__vue_app__;
7246
- } else if (process.env.NODE_ENV !== "production") {
7247
- warn(`Cannot unmount an app that is not mounted.`);
7248
- }
7249
- },
7250
- provide(key, value) {
7251
- if (process.env.NODE_ENV !== "production" && key in context.provides) {
7252
- warn(
7253
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7254
- );
7332
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7333
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7334
+ const expectedType = expectedTypes[0];
7335
+ const receivedType = toRawType(value);
7336
+ const expectedValue = styleValue(value, expectedType);
7337
+ const receivedValue = styleValue(value, receivedType);
7338
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7339
+ message += ` with value ${expectedValue}`;
7340
+ }
7341
+ message += `, got ${receivedType} `;
7342
+ if (isExplicable(receivedType)) {
7343
+ message += `with value ${receivedValue}.`;
7344
+ }
7345
+ return message;
7346
+ }
7347
+ function styleValue(value, type) {
7348
+ if (type === "String") {
7349
+ return `"${value}"`;
7350
+ } else if (type === "Number") {
7351
+ return `${Number(value)}`;
7352
+ } else {
7353
+ return `${value}`;
7354
+ }
7355
+ }
7356
+ function isExplicable(type) {
7357
+ const explicitTypes = ["string", "number", "boolean"];
7358
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7359
+ }
7360
+ function isBoolean(...args) {
7361
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7362
+ }
7363
+
7364
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7365
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7366
+ const normalizeSlot = (key, rawSlot, ctx) => {
7367
+ if (rawSlot._n) {
7368
+ return rawSlot;
7369
+ }
7370
+ const normalized = withCtx((...args) => {
7371
+ if (process.env.NODE_ENV !== "production" && currentInstance) {
7372
+ warn(
7373
+ `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.`
7374
+ );
7375
+ }
7376
+ return normalizeSlotValue(rawSlot(...args));
7377
+ }, ctx);
7378
+ normalized._c = false;
7379
+ return normalized;
7380
+ };
7381
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7382
+ const ctx = rawSlots._ctx;
7383
+ for (const key in rawSlots) {
7384
+ if (isInternalKey(key))
7385
+ continue;
7386
+ const value = rawSlots[key];
7387
+ if (isFunction(value)) {
7388
+ slots[key] = normalizeSlot(key, value, ctx);
7389
+ } else if (value != null) {
7390
+ if (process.env.NODE_ENV !== "production" && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7391
+ warn(
7392
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7393
+ );
7394
+ }
7395
+ const normalized = normalizeSlotValue(value);
7396
+ slots[key] = () => normalized;
7397
+ }
7398
+ }
7399
+ };
7400
+ const normalizeVNodeSlots = (instance, children) => {
7401
+ if (process.env.NODE_ENV !== "production" && !isKeepAlive(instance.vnode) && !isCompatEnabled$1("RENDER_FUNCTION", instance)) {
7402
+ warn(
7403
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7404
+ );
7405
+ }
7406
+ const normalized = normalizeSlotValue(children);
7407
+ instance.slots.default = () => normalized;
7408
+ };
7409
+ const initSlots = (instance, children) => {
7410
+ if (instance.vnode.shapeFlag & 32) {
7411
+ const type = children._;
7412
+ if (type) {
7413
+ instance.slots = toRaw(children);
7414
+ def(children, "_", type);
7415
+ } else {
7416
+ normalizeObjectSlots(
7417
+ children,
7418
+ instance.slots = {},
7419
+ instance
7420
+ );
7421
+ }
7422
+ } else {
7423
+ instance.slots = {};
7424
+ if (children) {
7425
+ normalizeVNodeSlots(instance, children);
7426
+ }
7427
+ }
7428
+ def(instance.slots, InternalObjectKey, 1);
7429
+ };
7430
+ const updateSlots = (instance, children, optimized) => {
7431
+ const { vnode, slots } = instance;
7432
+ let needDeletionCheck = true;
7433
+ let deletionComparisonTarget = EMPTY_OBJ;
7434
+ if (vnode.shapeFlag & 32) {
7435
+ const type = children._;
7436
+ if (type) {
7437
+ if (process.env.NODE_ENV !== "production" && isHmrUpdating) {
7438
+ extend(slots, children);
7439
+ trigger(instance, "set", "$slots");
7440
+ } else if (optimized && type === 1) {
7441
+ needDeletionCheck = false;
7442
+ } else {
7443
+ extend(slots, children);
7444
+ if (!optimized && type === 1) {
7445
+ delete slots._;
7255
7446
  }
7256
- context.provides[key] = value;
7257
- return app;
7258
7447
  }
7259
- };
7260
- {
7261
- installAppCompatProperties(app, context, render);
7448
+ } else {
7449
+ needDeletionCheck = !children.$stable;
7450
+ normalizeObjectSlots(children, slots, instance);
7262
7451
  }
7263
- return app;
7264
- };
7265
- }
7452
+ deletionComparisonTarget = children;
7453
+ } else if (children) {
7454
+ normalizeVNodeSlots(instance, children);
7455
+ deletionComparisonTarget = { default: 1 };
7456
+ }
7457
+ if (needDeletionCheck) {
7458
+ for (const key in slots) {
7459
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7460
+ delete slots[key];
7461
+ }
7462
+ }
7463
+ }
7464
+ };
7266
7465
 
7267
7466
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7268
7467
  if (isArray(rawRef)) {
@@ -8189,7 +8388,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8189
8388
  areChildrenSVG,
8190
8389
  slotScopeIds
8191
8390
  );
8192
- if (process.env.NODE_ENV !== "production" && parentComponent && parentComponent.type.__hmrId) {
8391
+ if (process.env.NODE_ENV !== "production") {
8193
8392
  traverseStaticChildren(n1, n2);
8194
8393
  }
8195
8394
  } else if (!optimized) {
@@ -8383,7 +8582,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8383
8582
  isSVG,
8384
8583
  slotScopeIds
8385
8584
  );
8386
- if (process.env.NODE_ENV !== "production" && parentComponent && parentComponent.type.__hmrId) {
8585
+ if (process.env.NODE_ENV !== "production") {
8387
8586
  traverseStaticChildren(n1, n2);
8388
8587
  } else if (
8389
8588
  // #2080 if the stable fragment has a key, it's a <template v-for> that may
@@ -10066,6 +10265,8 @@ function createComponentInstance(vnode, parent, suspense) {
10066
10265
  refs: EMPTY_OBJ,
10067
10266
  setupState: EMPTY_OBJ,
10068
10267
  setupContext: null,
10268
+ attrsProxy: null,
10269
+ slotsProxy: null,
10069
10270
  // suspense related
10070
10271
  suspense,
10071
10272
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -10319,8 +10520,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
10319
10520
  }
10320
10521
  }
10321
10522
  }
10322
- function createAttrsProxy(instance) {
10323
- return new Proxy(
10523
+ function getAttrsProxy(instance) {
10524
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10324
10525
  instance.attrs,
10325
10526
  process.env.NODE_ENV !== "production" ? {
10326
10527
  get(target, key) {
@@ -10342,7 +10543,23 @@ function createAttrsProxy(instance) {
10342
10543
  return target[key];
10343
10544
  }
10344
10545
  }
10345
- );
10546
+ ));
10547
+ }
10548
+ function getSlotsProxy(instance) {
10549
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
10550
+ get(target, key) {
10551
+ track(instance, "get", "$slots");
10552
+ return target[key];
10553
+ },
10554
+ set() {
10555
+ warn(`setupContext.slots is readonly.`);
10556
+ return false;
10557
+ },
10558
+ deleteProperty() {
10559
+ warn(`setupContext.slots is readonly.`);
10560
+ return false;
10561
+ }
10562
+ }));
10346
10563
  }
10347
10564
  function createSetupContext(instance) {
10348
10565
  const expose = (exposed) => {
@@ -10368,14 +10585,13 @@ function createSetupContext(instance) {
10368
10585
  }
10369
10586
  instance.exposed = exposed || {};
10370
10587
  };
10371
- let attrs;
10372
10588
  if (process.env.NODE_ENV !== "production") {
10373
10589
  return Object.freeze({
10374
10590
  get attrs() {
10375
- return attrs || (attrs = createAttrsProxy(instance));
10591
+ return getAttrsProxy(instance);
10376
10592
  },
10377
10593
  get slots() {
10378
- return shallowReadonly(instance.slots);
10594
+ return getSlotsProxy(instance);
10379
10595
  },
10380
10596
  get emit() {
10381
10597
  return (event, ...args) => instance.emit(event, ...args);
@@ -10385,7 +10601,7 @@ function createSetupContext(instance) {
10385
10601
  } else {
10386
10602
  return {
10387
10603
  get attrs() {
10388
- return attrs || (attrs = createAttrsProxy(instance));
10604
+ return getAttrsProxy(instance);
10389
10605
  },
10390
10606
  slots: instance.slots,
10391
10607
  emit: instance.emit,
@@ -10444,111 +10660,6 @@ const computed = (getterOrOptions, debugOptions) => {
10444
10660
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10445
10661
  };
10446
10662
 
10447
- const warnRuntimeUsage = (method) => warn(
10448
- `${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.`
10449
- );
10450
- function defineProps() {
10451
- if (process.env.NODE_ENV !== "production") {
10452
- warnRuntimeUsage(`defineProps`);
10453
- }
10454
- return null;
10455
- }
10456
- function defineEmits() {
10457
- if (process.env.NODE_ENV !== "production") {
10458
- warnRuntimeUsage(`defineEmits`);
10459
- }
10460
- return null;
10461
- }
10462
- function defineExpose(exposed) {
10463
- if (process.env.NODE_ENV !== "production") {
10464
- warnRuntimeUsage(`defineExpose`);
10465
- }
10466
- }
10467
- function defineOptions(options) {
10468
- if (process.env.NODE_ENV !== "production") {
10469
- warnRuntimeUsage(`defineOptions`);
10470
- }
10471
- }
10472
- function defineSlots() {
10473
- if (process.env.NODE_ENV !== "production") {
10474
- warnRuntimeUsage(`defineSlots`);
10475
- }
10476
- }
10477
- function withDefaults(props, defaults) {
10478
- if (process.env.NODE_ENV !== "production") {
10479
- warnRuntimeUsage(`withDefaults`);
10480
- }
10481
- return null;
10482
- }
10483
- function useSlots() {
10484
- return getContext().slots;
10485
- }
10486
- function useAttrs() {
10487
- return getContext().attrs;
10488
- }
10489
- function getContext() {
10490
- const i = getCurrentInstance();
10491
- if (process.env.NODE_ENV !== "production" && !i) {
10492
- warn(`useContext() called without active instance.`);
10493
- }
10494
- return i.setupContext || (i.setupContext = createSetupContext(i));
10495
- }
10496
- function mergeDefaults(raw, defaults) {
10497
- const props = isArray(raw) ? raw.reduce(
10498
- (normalized, p) => (normalized[p] = {}, normalized),
10499
- {}
10500
- ) : raw;
10501
- for (const key in defaults) {
10502
- if (key.startsWith("__skip"))
10503
- continue;
10504
- let opt = props[key];
10505
- if (opt) {
10506
- if (isArray(opt) || isFunction(opt)) {
10507
- opt = props[key] = { type: opt, default: defaults[key] };
10508
- } else {
10509
- opt.default = defaults[key];
10510
- }
10511
- } else if (opt === null) {
10512
- opt = props[key] = { default: defaults[key] };
10513
- } else if (process.env.NODE_ENV !== "production") {
10514
- warn(`props default key "${key}" has no corresponding declaration.`);
10515
- }
10516
- if (opt && defaults[`__skip_${key}`]) {
10517
- opt.skipFactory = true;
10518
- }
10519
- }
10520
- return props;
10521
- }
10522
- function createPropsRestProxy(props, excludedKeys) {
10523
- const ret = {};
10524
- for (const key in props) {
10525
- if (!excludedKeys.includes(key)) {
10526
- Object.defineProperty(ret, key, {
10527
- enumerable: true,
10528
- get: () => props[key]
10529
- });
10530
- }
10531
- }
10532
- return ret;
10533
- }
10534
- function withAsyncContext(getAwaitable) {
10535
- const ctx = getCurrentInstance();
10536
- if (process.env.NODE_ENV !== "production" && !ctx) {
10537
- warn(
10538
- `withAsyncContext called without active current instance. This is likely a bug.`
10539
- );
10540
- }
10541
- let awaitable = getAwaitable();
10542
- unsetCurrentInstance();
10543
- if (isPromise(awaitable)) {
10544
- awaitable = awaitable.catch((e) => {
10545
- setCurrentInstance(ctx);
10546
- throw e;
10547
- });
10548
- }
10549
- return [awaitable, () => setCurrentInstance(ctx)];
10550
- }
10551
-
10552
10663
  function h(type, propsOrChildren, children) {
10553
10664
  const l = arguments.length;
10554
10665
  if (l === 2) {
@@ -10784,7 +10895,7 @@ function isMemoSame(cached, memo) {
10784
10895
  return true;
10785
10896
  }
10786
10897
 
10787
- const version = "3.3.0-alpha.8";
10898
+ const version = "3.3.0-beta.1";
10788
10899
  const _ssrUtils = {
10789
10900
  createComponentInstance,
10790
10901
  setupComponent,
@@ -12496,6 +12607,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12496
12607
  defineCustomElement: defineCustomElement,
12497
12608
  defineEmits: defineEmits,
12498
12609
  defineExpose: defineExpose,
12610
+ defineModel: defineModel,
12499
12611
  defineOptions: defineOptions,
12500
12612
  defineProps: defineProps,
12501
12613
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12509,6 +12621,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12509
12621
  guardReactiveProps: guardReactiveProps,
12510
12622
  h: h,
12511
12623
  handleError: handleError,
12624
+ hasInjectionContext: hasInjectionContext,
12512
12625
  hydrate: hydrate,
12513
12626
  initCustomFormatter: initCustomFormatter,
12514
12627
  initDirectivesForSSR: initDirectivesForSSR,
@@ -12523,6 +12636,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12523
12636
  isVNode: isVNode,
12524
12637
  markRaw: markRaw,
12525
12638
  mergeDefaults: mergeDefaults,
12639
+ mergeModels: mergeModels,
12526
12640
  mergeProps: mergeProps,
12527
12641
  nextTick: nextTick,
12528
12642
  normalizeClass: normalizeClass,
@@ -12581,6 +12695,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12581
12695
  useAttrs: useAttrs,
12582
12696
  useCssModule: useCssModule,
12583
12697
  useCssVars: useCssVars,
12698
+ useModel: useModel,
12584
12699
  useSSRContext: useSSRContext,
12585
12700
  useSlots: useSlots,
12586
12701
  useTransitionState: useTransitionState,
@@ -12702,8 +12817,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
12702
12817
  [48]: `ES module mode is not supported in this build of compiler.`,
12703
12818
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
12704
12819
  [50]: `"scopeId" option is only supported in module mode.`,
12820
+ // deprecations
12821
+ [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.`,
12822
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
12705
12823
  // just to fulfill types
12706
- [51]: ``
12824
+ [53]: ``
12707
12825
  };
12708
12826
 
12709
12827
  const FRAGMENT = Symbol(process.env.NODE_ENV !== "production" ? `Fragment` : ``);
@@ -16072,6 +16190,11 @@ function resolveComponentType(node, context, ssr = false) {
16072
16190
  }
16073
16191
  const isDir = !isExplicitDynamic && findDir(node, "is");
16074
16192
  if (isDir && isDir.exp) {
16193
+ if (process.env.NODE_ENV !== "production") {
16194
+ context.onWarn(
16195
+ createCompilerError(52, isDir.loc)
16196
+ );
16197
+ }
16075
16198
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
16076
16199
  isDir.exp
16077
16200
  ]);
@@ -16577,6 +16700,11 @@ const transformOn$1 = (dir, node, context, augmentor) => {
16577
16700
  if (arg.type === 4) {
16578
16701
  if (arg.isStatic) {
16579
16702
  let rawName = arg.content;
16703
+ if (process.env.NODE_ENV !== "production" && rawName.startsWith("vnode")) {
16704
+ context.onWarn(
16705
+ createCompilerError(51, arg.loc)
16706
+ );
16707
+ }
16580
16708
  if (rawName.startsWith("vue:")) {
16581
16709
  rawName = `vnode-${rawName.slice(4)}`;
16582
16710
  }
@@ -16773,7 +16901,7 @@ const transformText = (node, context) => {
16773
16901
  const seen$1 = /* @__PURE__ */ new WeakSet();
16774
16902
  const transformOnce = (node, context) => {
16775
16903
  if (node.type === 1 && findDir(node, "once", true)) {
16776
- if (seen$1.has(node) || context.inVOnce) {
16904
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
16777
16905
  return;
16778
16906
  }
16779
16907
  seen$1.add(node);
@@ -17224,29 +17352,29 @@ function createDOMCompilerError(code, loc) {
17224
17352
  );
17225
17353
  }
17226
17354
  const DOMErrorMessages = {
17227
- [51]: `v-html is missing expression.`,
17228
- [52]: `v-html will override element children.`,
17229
- [53]: `v-text is missing expression.`,
17230
- [54]: `v-text will override element children.`,
17231
- [55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17232
- [56]: `v-model argument is not supported on plain elements.`,
17233
- [57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17234
- [58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17235
- [59]: `v-show is missing expression.`,
17236
- [60]: `<Transition> expects exactly one child element or component.`,
17237
- [61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17355
+ [53]: `v-html is missing expression.`,
17356
+ [54]: `v-html will override element children.`,
17357
+ [55]: `v-text is missing expression.`,
17358
+ [56]: `v-text will override element children.`,
17359
+ [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17360
+ [58]: `v-model argument is not supported on plain elements.`,
17361
+ [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17362
+ [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17363
+ [61]: `v-show is missing expression.`,
17364
+ [62]: `<Transition> expects exactly one child element or component.`,
17365
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17238
17366
  };
17239
17367
 
17240
17368
  const transformVHtml = (dir, node, context) => {
17241
17369
  const { exp, loc } = dir;
17242
17370
  if (!exp) {
17243
17371
  context.onError(
17244
- createDOMCompilerError(51, loc)
17372
+ createDOMCompilerError(53, loc)
17245
17373
  );
17246
17374
  }
17247
17375
  if (node.children.length) {
17248
17376
  context.onError(
17249
- createDOMCompilerError(52, loc)
17377
+ createDOMCompilerError(54, loc)
17250
17378
  );
17251
17379
  node.children.length = 0;
17252
17380
  }
@@ -17264,12 +17392,12 @@ const transformVText = (dir, node, context) => {
17264
17392
  const { exp, loc } = dir;
17265
17393
  if (!exp) {
17266
17394
  context.onError(
17267
- createDOMCompilerError(53, loc)
17395
+ createDOMCompilerError(55, loc)
17268
17396
  );
17269
17397
  }
17270
17398
  if (node.children.length) {
17271
17399
  context.onError(
17272
- createDOMCompilerError(54, loc)
17400
+ createDOMCompilerError(56, loc)
17273
17401
  );
17274
17402
  node.children.length = 0;
17275
17403
  }
@@ -17295,7 +17423,7 @@ const transformModel = (dir, node, context) => {
17295
17423
  if (dir.arg) {
17296
17424
  context.onError(
17297
17425
  createDOMCompilerError(
17298
- 56,
17426
+ 58,
17299
17427
  dir.arg.loc
17300
17428
  )
17301
17429
  );
@@ -17305,7 +17433,7 @@ const transformModel = (dir, node, context) => {
17305
17433
  if (value) {
17306
17434
  context.onError(
17307
17435
  createDOMCompilerError(
17308
- 58,
17436
+ 60,
17309
17437
  value.loc
17310
17438
  )
17311
17439
  );
@@ -17333,7 +17461,7 @@ const transformModel = (dir, node, context) => {
17333
17461
  isInvalidType = true;
17334
17462
  context.onError(
17335
17463
  createDOMCompilerError(
17336
- 57,
17464
+ 59,
17337
17465
  dir.loc
17338
17466
  )
17339
17467
  );
@@ -17359,7 +17487,7 @@ const transformModel = (dir, node, context) => {
17359
17487
  } else {
17360
17488
  context.onError(
17361
17489
  createDOMCompilerError(
17362
- 55,
17490
+ 57,
17363
17491
  dir.loc
17364
17492
  )
17365
17493
  );
@@ -17471,7 +17599,7 @@ const transformShow = (dir, node, context) => {
17471
17599
  const { exp, loc } = dir;
17472
17600
  if (!exp) {
17473
17601
  context.onError(
17474
- createDOMCompilerError(59, loc)
17602
+ createDOMCompilerError(61, loc)
17475
17603
  );
17476
17604
  }
17477
17605
  return {
@@ -17491,7 +17619,7 @@ const transformTransition = (node, context) => {
17491
17619
  if (hasMultipleChildren(node)) {
17492
17620
  context.onError(
17493
17621
  createDOMCompilerError(
17494
- 60,
17622
+ 62,
17495
17623
  {
17496
17624
  start: node.children[0].loc.start,
17497
17625
  end: node.children[node.children.length - 1].loc.end,
@@ -17528,7 +17656,7 @@ function hasMultipleChildren(node) {
17528
17656
  const ignoreSideEffectTags = (node, context) => {
17529
17657
  if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
17530
17658
  context.onError(
17531
- createDOMCompilerError(61, node.loc)
17659
+ createDOMCompilerError(63, node.loc)
17532
17660
  );
17533
17661
  context.removeNode();
17534
17662
  }
@@ -17628,4 +17756,4 @@ var Vue$1 = Vue;
17628
17756
 
17629
17757
  const { configureCompat } = Vue$1;
17630
17758
 
17631
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
17759
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };