@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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  var parser = require('@babel/parser');
4
4
  var estreeWalker = require('estree-walker');
5
- var sourceMap = require('source-map');
5
+ var sourceMapJs = require('source-map-js');
6
6
 
7
7
  function makeMap(str, expectsLowerCase) {
8
8
  const map = /* @__PURE__ */ Object.create(null);
@@ -107,7 +107,7 @@ function genPropsAccessExp(name) {
107
107
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
108
108
  }
109
109
 
110
- 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";
110
+ 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";
111
111
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
112
112
 
113
113
  function normalizeStyle(value) {
@@ -2404,7 +2404,8 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
2404
2404
  }
2405
2405
  }
2406
2406
  }
2407
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2407
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2408
+ var _a;
2408
2409
  const {
2409
2410
  p: patch,
2410
2411
  m: move,
@@ -2412,10 +2413,18 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2412
2413
  n: next,
2413
2414
  o: { parentNode, remove }
2414
2415
  } = rendererInternals;
2416
+ let parentSuspenseId;
2417
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
2418
+ if (isSuspensible) {
2419
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
2420
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
2421
+ parentSuspense.deps++;
2422
+ }
2423
+ }
2415
2424
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
2416
2425
  const suspense = {
2417
2426
  vnode,
2418
- parent,
2427
+ parent: parentSuspense,
2419
2428
  parentComponent,
2420
2429
  isSVG,
2421
2430
  container,
@@ -2463,20 +2472,28 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2463
2472
  setActiveBranch(suspense, pendingBranch);
2464
2473
  suspense.pendingBranch = null;
2465
2474
  suspense.isInFallback = false;
2466
- let parent2 = suspense.parent;
2475
+ let parent = suspense.parent;
2467
2476
  let hasUnresolvedAncestor = false;
2468
- while (parent2) {
2469
- if (parent2.pendingBranch) {
2470
- parent2.effects.push(...effects);
2477
+ while (parent) {
2478
+ if (parent.pendingBranch) {
2479
+ parent.effects.push(...effects);
2471
2480
  hasUnresolvedAncestor = true;
2472
2481
  break;
2473
2482
  }
2474
- parent2 = parent2.parent;
2483
+ parent = parent.parent;
2475
2484
  }
2476
2485
  if (!hasUnresolvedAncestor) {
2477
2486
  queuePostFlushCb(effects);
2478
2487
  }
2479
2488
  suspense.effects = [];
2489
+ if (isSuspensible) {
2490
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
2491
+ parentSuspense.deps--;
2492
+ if (parentSuspense.deps === 0) {
2493
+ parentSuspense.resolve();
2494
+ }
2495
+ }
2496
+ }
2480
2497
  triggerEvent(vnode2, "onResolve");
2481
2498
  },
2482
2499
  fallback(fallbackVNode) {
@@ -2570,13 +2587,13 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2570
2587
  }
2571
2588
  });
2572
2589
  },
2573
- unmount(parentSuspense, doRemove) {
2590
+ unmount(parentSuspense2, doRemove) {
2574
2591
  suspense.isUnmounted = true;
2575
2592
  if (suspense.activeBranch) {
2576
2593
  unmount(
2577
2594
  suspense.activeBranch,
2578
2595
  parentComponent,
2579
- parentSuspense,
2596
+ parentSuspense2,
2580
2597
  doRemove
2581
2598
  );
2582
2599
  }
@@ -2584,7 +2601,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
2584
2601
  unmount(
2585
2602
  suspense.pendingBranch,
2586
2603
  parentComponent,
2587
- parentSuspense,
2604
+ parentSuspense2,
2588
2605
  doRemove
2589
2606
  );
2590
2607
  }
@@ -2674,25 +2691,41 @@ function setActiveBranch(suspense, branch) {
2674
2691
  }
2675
2692
  }
2676
2693
 
2677
- function provide(key, value) {
2678
- if (!currentInstance) ; else {
2679
- let provides = currentInstance.provides;
2680
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
2681
- if (parentProvides === provides) {
2682
- provides = currentInstance.provides = Object.create(parentProvides);
2694
+ const legacyDirectiveHookMap = {
2695
+ beforeMount: "bind",
2696
+ mounted: "inserted",
2697
+ updated: ["update", "componentUpdated"],
2698
+ unmounted: "unbind"
2699
+ };
2700
+ function mapCompatDirectiveHook(name, dir, instance) {
2701
+ const mappedName = legacyDirectiveHookMap[name];
2702
+ if (mappedName) {
2703
+ if (isArray(mappedName)) {
2704
+ const hook = [];
2705
+ mappedName.forEach((mapped) => {
2706
+ const mappedHook = dir[mapped];
2707
+ if (mappedHook) {
2708
+ softAssertCompatEnabled(
2709
+ "CUSTOM_DIR",
2710
+ instance,
2711
+ mapped,
2712
+ name
2713
+ );
2714
+ hook.push(mappedHook);
2715
+ }
2716
+ });
2717
+ return hook.length ? hook : void 0;
2718
+ } else {
2719
+ if (dir[mappedName]) {
2720
+ softAssertCompatEnabled(
2721
+ "CUSTOM_DIR",
2722
+ instance,
2723
+ mappedName,
2724
+ name
2725
+ );
2726
+ }
2727
+ return dir[mappedName];
2683
2728
  }
2684
- provides[key] = value;
2685
- }
2686
- }
2687
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
2688
- const instance = currentInstance || currentRenderingInstance;
2689
- if (instance) {
2690
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
2691
- if (provides && key in provides) {
2692
- return provides[key];
2693
- } else if (arguments.length > 1) {
2694
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
2695
- } else ;
2696
2729
  }
2697
2730
  }
2698
2731
 
@@ -2921,6 +2954,62 @@ function traverse(value, seen) {
2921
2954
  return value;
2922
2955
  }
2923
2956
 
2957
+ function withDirectives(vnode, directives) {
2958
+ const internalInstance = currentRenderingInstance;
2959
+ if (internalInstance === null) {
2960
+ return vnode;
2961
+ }
2962
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
2963
+ const bindings = vnode.dirs || (vnode.dirs = []);
2964
+ for (let i = 0; i < directives.length; i++) {
2965
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
2966
+ if (dir) {
2967
+ if (isFunction(dir)) {
2968
+ dir = {
2969
+ mounted: dir,
2970
+ updated: dir
2971
+ };
2972
+ }
2973
+ if (dir.deep) {
2974
+ traverse(value);
2975
+ }
2976
+ bindings.push({
2977
+ dir,
2978
+ instance,
2979
+ value,
2980
+ oldValue: void 0,
2981
+ arg,
2982
+ modifiers
2983
+ });
2984
+ }
2985
+ }
2986
+ return vnode;
2987
+ }
2988
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
2989
+ const bindings = vnode.dirs;
2990
+ const oldBindings = prevVNode && prevVNode.dirs;
2991
+ for (let i = 0; i < bindings.length; i++) {
2992
+ const binding = bindings[i];
2993
+ if (oldBindings) {
2994
+ binding.oldValue = oldBindings[i].value;
2995
+ }
2996
+ let hook = binding.dir[name];
2997
+ if (!hook) {
2998
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
2999
+ }
3000
+ if (hook) {
3001
+ pauseTracking();
3002
+ callWithAsyncErrorHandling(hook, instance, 8, [
3003
+ vnode.el,
3004
+ binding,
3005
+ vnode,
3006
+ prevVNode
3007
+ ]);
3008
+ resetTracking();
3009
+ }
3010
+ }
3011
+ }
3012
+
2924
3013
  function useTransitionState() {
2925
3014
  const state = {
2926
3015
  isMounted: false,
@@ -3690,100 +3779,6 @@ function getCompatListeners(instance) {
3690
3779
  return listeners;
3691
3780
  }
3692
3781
 
3693
- const legacyDirectiveHookMap = {
3694
- beforeMount: "bind",
3695
- mounted: "inserted",
3696
- updated: ["update", "componentUpdated"],
3697
- unmounted: "unbind"
3698
- };
3699
- function mapCompatDirectiveHook(name, dir, instance) {
3700
- const mappedName = legacyDirectiveHookMap[name];
3701
- if (mappedName) {
3702
- if (isArray(mappedName)) {
3703
- const hook = [];
3704
- mappedName.forEach((mapped) => {
3705
- const mappedHook = dir[mapped];
3706
- if (mappedHook) {
3707
- softAssertCompatEnabled(
3708
- "CUSTOM_DIR",
3709
- instance,
3710
- mapped,
3711
- name
3712
- );
3713
- hook.push(mappedHook);
3714
- }
3715
- });
3716
- return hook.length ? hook : void 0;
3717
- } else {
3718
- if (dir[mappedName]) {
3719
- softAssertCompatEnabled(
3720
- "CUSTOM_DIR",
3721
- instance,
3722
- mappedName,
3723
- name
3724
- );
3725
- }
3726
- return dir[mappedName];
3727
- }
3728
- }
3729
- }
3730
-
3731
- function withDirectives(vnode, directives) {
3732
- const internalInstance = currentRenderingInstance;
3733
- if (internalInstance === null) {
3734
- return vnode;
3735
- }
3736
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3737
- const bindings = vnode.dirs || (vnode.dirs = []);
3738
- for (let i = 0; i < directives.length; i++) {
3739
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3740
- if (dir) {
3741
- if (isFunction(dir)) {
3742
- dir = {
3743
- mounted: dir,
3744
- updated: dir
3745
- };
3746
- }
3747
- if (dir.deep) {
3748
- traverse(value);
3749
- }
3750
- bindings.push({
3751
- dir,
3752
- instance,
3753
- value,
3754
- oldValue: void 0,
3755
- arg,
3756
- modifiers
3757
- });
3758
- }
3759
- }
3760
- return vnode;
3761
- }
3762
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3763
- const bindings = vnode.dirs;
3764
- const oldBindings = prevVNode && prevVNode.dirs;
3765
- for (let i = 0; i < bindings.length; i++) {
3766
- const binding = bindings[i];
3767
- if (oldBindings) {
3768
- binding.oldValue = oldBindings[i].value;
3769
- }
3770
- let hook = binding.dir[name];
3771
- if (!hook) {
3772
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
3773
- }
3774
- if (hook) {
3775
- pauseTracking();
3776
- callWithAsyncErrorHandling(hook, instance, 8, [
3777
- vnode.el,
3778
- binding,
3779
- vnode,
3780
- prevVNode
3781
- ]);
3782
- resetTracking();
3783
- }
3784
- }
3785
- }
3786
-
3787
3782
  const COMPONENTS = "components";
3788
3783
  const DIRECTIVES = "directives";
3789
3784
  const FILTERS = "filters";
@@ -4562,20 +4557,133 @@ function deepMergeData(to, from) {
4562
4557
  return to;
4563
4558
  }
4564
4559
 
4565
- let shouldCacheAccess = true;
4566
- function applyOptions(instance) {
4567
- const options = resolveMergedOptions(instance);
4568
- const publicThis = instance.proxy;
4569
- const ctx = instance.ctx;
4570
- shouldCacheAccess = false;
4571
- if (options.beforeCreate) {
4572
- callHook$1(options.beforeCreate, instance, "bc");
4560
+ function defineProps() {
4561
+ return null;
4562
+ }
4563
+ function defineEmits() {
4564
+ return null;
4565
+ }
4566
+ function defineExpose(exposed) {
4567
+ }
4568
+ function defineOptions(options) {
4569
+ }
4570
+ function defineSlots() {
4571
+ return null;
4572
+ }
4573
+ function defineModel() {
4574
+ }
4575
+ function withDefaults(props, defaults) {
4576
+ return null;
4577
+ }
4578
+ function useSlots() {
4579
+ return getContext().slots;
4580
+ }
4581
+ function useAttrs() {
4582
+ return getContext().attrs;
4583
+ }
4584
+ function useModel(props, name, options) {
4585
+ const i = getCurrentInstance();
4586
+ if (options && options.local) {
4587
+ const proxy = ref(props[name]);
4588
+ watch(
4589
+ () => props[name],
4590
+ (v) => proxy.value = v
4591
+ );
4592
+ watch(proxy, (value) => {
4593
+ if (value !== props[name]) {
4594
+ i.emit(`update:${name}`, value);
4595
+ }
4596
+ });
4597
+ return proxy;
4598
+ } else {
4599
+ return {
4600
+ __v_isRef: true,
4601
+ get value() {
4602
+ return props[name];
4603
+ },
4604
+ set value(value) {
4605
+ i.emit(`update:${name}`, value);
4606
+ }
4607
+ };
4573
4608
  }
4574
- const {
4575
- // state
4576
- data: dataOptions,
4577
- computed: computedOptions,
4578
- methods,
4609
+ }
4610
+ function getContext() {
4611
+ const i = getCurrentInstance();
4612
+ return i.setupContext || (i.setupContext = createSetupContext(i));
4613
+ }
4614
+ function normalizePropsOrEmits(props) {
4615
+ return isArray(props) ? props.reduce(
4616
+ (normalized, p) => (normalized[p] = null, normalized),
4617
+ {}
4618
+ ) : props;
4619
+ }
4620
+ function mergeDefaults(raw, defaults) {
4621
+ const props = normalizePropsOrEmits(raw);
4622
+ for (const key in defaults) {
4623
+ if (key.startsWith("__skip"))
4624
+ continue;
4625
+ let opt = props[key];
4626
+ if (opt) {
4627
+ if (isArray(opt) || isFunction(opt)) {
4628
+ opt = props[key] = { type: opt, default: defaults[key] };
4629
+ } else {
4630
+ opt.default = defaults[key];
4631
+ }
4632
+ } else if (opt === null) {
4633
+ opt = props[key] = { default: defaults[key] };
4634
+ } else ;
4635
+ if (opt && defaults[`__skip_${key}`]) {
4636
+ opt.skipFactory = true;
4637
+ }
4638
+ }
4639
+ return props;
4640
+ }
4641
+ function mergeModels(a, b) {
4642
+ if (!a || !b)
4643
+ return a || b;
4644
+ if (isArray(a) && isArray(b))
4645
+ return a.concat(b);
4646
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
4647
+ }
4648
+ function createPropsRestProxy(props, excludedKeys) {
4649
+ const ret = {};
4650
+ for (const key in props) {
4651
+ if (!excludedKeys.includes(key)) {
4652
+ Object.defineProperty(ret, key, {
4653
+ enumerable: true,
4654
+ get: () => props[key]
4655
+ });
4656
+ }
4657
+ }
4658
+ return ret;
4659
+ }
4660
+ function withAsyncContext(getAwaitable) {
4661
+ const ctx = getCurrentInstance();
4662
+ let awaitable = getAwaitable();
4663
+ unsetCurrentInstance();
4664
+ if (isPromise(awaitable)) {
4665
+ awaitable = awaitable.catch((e) => {
4666
+ setCurrentInstance(ctx);
4667
+ throw e;
4668
+ });
4669
+ }
4670
+ return [awaitable, () => setCurrentInstance(ctx)];
4671
+ }
4672
+
4673
+ let shouldCacheAccess = true;
4674
+ function applyOptions(instance) {
4675
+ const options = resolveMergedOptions(instance);
4676
+ const publicThis = instance.proxy;
4677
+ const ctx = instance.ctx;
4678
+ shouldCacheAccess = false;
4679
+ if (options.beforeCreate) {
4680
+ callHook$1(options.beforeCreate, instance, "bc");
4681
+ }
4682
+ const {
4683
+ // state
4684
+ data: dataOptions,
4685
+ computed: computedOptions,
4686
+ methods,
4579
4687
  watch: watchOptions,
4580
4688
  provide: provideOptions,
4581
4689
  inject: injectOptions,
@@ -4606,12 +4714,7 @@ function applyOptions(instance) {
4606
4714
  } = options;
4607
4715
  const checkDuplicateProperties = null;
4608
4716
  if (injectOptions) {
4609
- resolveInjections(
4610
- injectOptions,
4611
- ctx,
4612
- checkDuplicateProperties,
4613
- instance.appContext.config.unwrapInjectedRef
4614
- );
4717
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
4615
4718
  }
4616
4719
  if (methods) {
4617
4720
  for (const key in methods) {
@@ -4715,7 +4818,7 @@ function applyOptions(instance) {
4715
4818
  instance.filters = filters;
4716
4819
  }
4717
4820
  }
4718
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
4821
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
4719
4822
  if (isArray(injectOptions)) {
4720
4823
  injectOptions = normalizeInject(injectOptions);
4721
4824
  }
@@ -4737,16 +4840,12 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
4737
4840
  injected = inject(opt);
4738
4841
  }
4739
4842
  if (isRef(injected)) {
4740
- if (unwrapRef) {
4741
- Object.defineProperty(ctx, key, {
4742
- enumerable: true,
4743
- configurable: true,
4744
- get: () => injected.value,
4745
- set: (v) => injected.value = v
4746
- });
4747
- } else {
4748
- ctx[key] = injected;
4749
- }
4843
+ Object.defineProperty(ctx, key, {
4844
+ enumerable: true,
4845
+ configurable: true,
4846
+ get: () => injected.value,
4847
+ set: (v) => injected.value = v
4848
+ });
4750
4849
  } else {
4751
4850
  ctx[key] = injected;
4752
4851
  }
@@ -4836,10 +4935,8 @@ function mergeOptions(to, from, strats, asMixin = false) {
4836
4935
  }
4837
4936
  const internalOptionMergeStrats = {
4838
4937
  data: mergeDataFn,
4839
- props: mergeObjectOptions,
4840
- // TODO
4841
- emits: mergeObjectOptions,
4842
- // TODO
4938
+ props: mergeEmitsOrPropsOptions,
4939
+ emits: mergeEmitsOrPropsOptions,
4843
4940
  // objects
4844
4941
  methods: mergeObjectOptions,
4845
4942
  computed: mergeObjectOptions,
@@ -4901,7 +4998,21 @@ function mergeAsArray$1(to, from) {
4901
4998
  return to ? [...new Set([].concat(to, from))] : from;
4902
4999
  }
4903
5000
  function mergeObjectOptions(to, from) {
4904
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
5001
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5002
+ }
5003
+ function mergeEmitsOrPropsOptions(to, from) {
5004
+ if (to) {
5005
+ if (isArray(to) && isArray(from)) {
5006
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
5007
+ }
5008
+ return extend(
5009
+ /* @__PURE__ */ Object.create(null),
5010
+ normalizePropsOrEmits(to),
5011
+ normalizePropsOrEmits(from != null ? from : {})
5012
+ );
5013
+ } else {
5014
+ return from;
5015
+ }
4905
5016
  }
4906
5017
  function mergeWatchOptions(to, from) {
4907
5018
  if (!to)
@@ -4915,918 +5026,952 @@ function mergeWatchOptions(to, from) {
4915
5026
  return merged;
4916
5027
  }
4917
5028
 
4918
- function createPropsDefaultThis(instance, rawProps, propKey) {
4919
- return new Proxy(
4920
- {},
4921
- {
4922
- get(_, key) {
4923
- if (key === "$options") {
4924
- return resolveMergedOptions(instance);
4925
- }
4926
- if (key in rawProps) {
4927
- return rawProps[key];
4928
- }
4929
- const injections = instance.type.inject;
4930
- if (injections) {
4931
- if (isArray(injections)) {
4932
- if (injections.includes(key)) {
4933
- return inject(key);
4934
- }
4935
- } else if (key in injections) {
4936
- return inject(key);
4937
- }
4938
- }
5029
+ function installLegacyOptionMergeStrats(config) {
5030
+ config.optionMergeStrategies = new Proxy({}, {
5031
+ get(target, key) {
5032
+ if (key in target) {
5033
+ return target[key];
5034
+ }
5035
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
5036
+ "CONFIG_OPTION_MERGE_STRATS",
5037
+ null
5038
+ )) {
5039
+ return internalOptionMergeStrats[key];
4939
5040
  }
4940
5041
  }
4941
- );
4942
- }
4943
-
4944
- function shouldSkipAttr(key, instance) {
4945
- if (key === "is") {
4946
- return true;
4947
- }
4948
- if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
4949
- return true;
4950
- }
4951
- if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
4952
- return true;
4953
- }
4954
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
4955
- return true;
4956
- }
4957
- return false;
5042
+ });
4958
5043
  }
4959
5044
 
4960
- function initProps(instance, rawProps, isStateful, isSSR = false) {
4961
- const props = {};
4962
- const attrs = {};
4963
- def(attrs, InternalObjectKey, 1);
4964
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
4965
- setFullProps(instance, rawProps, props, attrs);
4966
- for (const key in instance.propsOptions[0]) {
4967
- if (!(key in props)) {
4968
- props[key] = void 0;
5045
+ let singletonApp;
5046
+ let singletonCtor;
5047
+ function createCompatVue$1(createApp, createSingletonApp) {
5048
+ singletonApp = createSingletonApp({});
5049
+ const Vue = singletonCtor = function Vue2(options = {}) {
5050
+ return createCompatApp(options, Vue2);
5051
+ };
5052
+ function createCompatApp(options = {}, Ctor) {
5053
+ assertCompatEnabled("GLOBAL_MOUNT", null);
5054
+ const { data } = options;
5055
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
5056
+ options.data = () => data;
4969
5057
  }
4970
- }
4971
- if (isStateful) {
4972
- instance.props = isSSR ? props : shallowReactive(props);
4973
- } else {
4974
- if (!instance.type.props) {
4975
- instance.props = attrs;
5058
+ const app = createApp(options);
5059
+ if (Ctor !== Vue) {
5060
+ applySingletonPrototype(app, Ctor);
5061
+ }
5062
+ const vm = app._createRoot(options);
5063
+ if (options.el) {
5064
+ return vm.$mount(options.el);
4976
5065
  } else {
4977
- instance.props = props;
5066
+ return vm;
4978
5067
  }
4979
5068
  }
4980
- instance.attrs = attrs;
4981
- }
4982
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
4983
- const {
4984
- props,
4985
- attrs,
4986
- vnode: { patchFlag }
4987
- } = instance;
4988
- const rawCurrentProps = toRaw(props);
4989
- const [options] = instance.propsOptions;
4990
- let hasAttrsChanged = false;
4991
- if (
4992
- // always force full diff in dev
4993
- // - #1942 if hmr is enabled with sfc component
4994
- // - vite#872 non-sfc component used by sfc component
4995
- (optimized || patchFlag > 0) && !(patchFlag & 16)
4996
- ) {
4997
- if (patchFlag & 8) {
4998
- const propsToUpdate = instance.vnode.dynamicProps;
4999
- for (let i = 0; i < propsToUpdate.length; i++) {
5000
- let key = propsToUpdate[i];
5001
- if (isEmitListener(instance.emitsOptions, key)) {
5002
- continue;
5003
- }
5004
- const value = rawProps[key];
5005
- if (options) {
5006
- if (hasOwn(attrs, key)) {
5007
- if (value !== attrs[key]) {
5008
- attrs[key] = value;
5009
- hasAttrsChanged = true;
5010
- }
5011
- } else {
5012
- const camelizedKey = camelize(key);
5013
- props[camelizedKey] = resolvePropValue(
5014
- options,
5015
- rawCurrentProps,
5016
- camelizedKey,
5017
- value,
5018
- instance,
5019
- false
5020
- /* isAbsent */
5021
- );
5022
- }
5023
- } else {
5024
- {
5025
- if (isOn(key) && key.endsWith("Native")) {
5026
- key = key.slice(0, -6);
5027
- } else if (shouldSkipAttr(key, instance)) {
5028
- continue;
5029
- }
5030
- }
5031
- if (value !== attrs[key]) {
5032
- attrs[key] = value;
5033
- hasAttrsChanged = true;
5034
- }
5035
- }
5036
- }
5069
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
5070
+ Vue.config = singletonApp.config;
5071
+ Vue.use = (p, ...options) => {
5072
+ if (p && isFunction(p.install)) {
5073
+ p.install(Vue, ...options);
5074
+ } else if (isFunction(p)) {
5075
+ p(Vue, ...options);
5037
5076
  }
5038
- } else {
5039
- if (setFullProps(instance, rawProps, props, attrs)) {
5040
- hasAttrsChanged = true;
5077
+ return Vue;
5078
+ };
5079
+ Vue.mixin = (m) => {
5080
+ singletonApp.mixin(m);
5081
+ return Vue;
5082
+ };
5083
+ Vue.component = (name, comp) => {
5084
+ if (comp) {
5085
+ singletonApp.component(name, comp);
5086
+ return Vue;
5087
+ } else {
5088
+ return singletonApp.component(name);
5041
5089
  }
5042
- let kebabKey;
5043
- for (const key in rawCurrentProps) {
5044
- if (!rawProps || // for camelCase
5045
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
5046
- // and converted to camelCase (#955)
5047
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
5048
- if (options) {
5049
- if (rawPrevProps && // for camelCase
5050
- (rawPrevProps[key] !== void 0 || // for kebab-case
5051
- rawPrevProps[kebabKey] !== void 0)) {
5052
- props[key] = resolvePropValue(
5053
- options,
5054
- rawCurrentProps,
5055
- key,
5056
- void 0,
5057
- instance,
5058
- true
5059
- /* isAbsent */
5060
- );
5061
- }
5062
- } else {
5063
- delete props[key];
5064
- }
5065
- }
5090
+ };
5091
+ Vue.directive = (name, dir) => {
5092
+ if (dir) {
5093
+ singletonApp.directive(name, dir);
5094
+ return Vue;
5095
+ } else {
5096
+ return singletonApp.directive(name);
5066
5097
  }
5067
- if (attrs !== rawCurrentProps) {
5068
- for (const key in attrs) {
5069
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
5070
- delete attrs[key];
5071
- hasAttrsChanged = true;
5072
- }
5098
+ };
5099
+ Vue.options = { _base: Vue };
5100
+ let cid = 1;
5101
+ Vue.cid = cid;
5102
+ Vue.nextTick = nextTick;
5103
+ const extendCache = /* @__PURE__ */ new WeakMap();
5104
+ function extendCtor(extendOptions = {}) {
5105
+ assertCompatEnabled("GLOBAL_EXTEND", null);
5106
+ if (isFunction(extendOptions)) {
5107
+ extendOptions = extendOptions.options;
5108
+ }
5109
+ if (extendCache.has(extendOptions)) {
5110
+ return extendCache.get(extendOptions);
5111
+ }
5112
+ const Super = this;
5113
+ function SubVue(inlineOptions) {
5114
+ if (!inlineOptions) {
5115
+ return createCompatApp(SubVue.options, SubVue);
5116
+ } else {
5117
+ return createCompatApp(
5118
+ mergeOptions(
5119
+ extend({}, SubVue.options),
5120
+ inlineOptions,
5121
+ internalOptionMergeStrats
5122
+ ),
5123
+ SubVue
5124
+ );
5073
5125
  }
5074
5126
  }
5127
+ SubVue.super = Super;
5128
+ SubVue.prototype = Object.create(Vue.prototype);
5129
+ SubVue.prototype.constructor = SubVue;
5130
+ const mergeBase = {};
5131
+ for (const key in Super.options) {
5132
+ const superValue = Super.options[key];
5133
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
5134
+ }
5135
+ SubVue.options = mergeOptions(
5136
+ mergeBase,
5137
+ extendOptions,
5138
+ internalOptionMergeStrats
5139
+ );
5140
+ SubVue.options._base = SubVue;
5141
+ SubVue.extend = extendCtor.bind(SubVue);
5142
+ SubVue.mixin = Super.mixin;
5143
+ SubVue.use = Super.use;
5144
+ SubVue.cid = ++cid;
5145
+ extendCache.set(extendOptions, SubVue);
5146
+ return SubVue;
5075
5147
  }
5076
- if (hasAttrsChanged) {
5077
- trigger(instance, "set", "$attrs");
5148
+ Vue.extend = extendCtor.bind(Vue);
5149
+ Vue.set = (target, key, value) => {
5150
+ assertCompatEnabled("GLOBAL_SET", null);
5151
+ target[key] = value;
5152
+ };
5153
+ Vue.delete = (target, key) => {
5154
+ assertCompatEnabled("GLOBAL_DELETE", null);
5155
+ delete target[key];
5156
+ };
5157
+ Vue.observable = (target) => {
5158
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
5159
+ return reactive(target);
5160
+ };
5161
+ Vue.filter = (name, filter) => {
5162
+ if (filter) {
5163
+ singletonApp.filter(name, filter);
5164
+ return Vue;
5165
+ } else {
5166
+ return singletonApp.filter(name);
5167
+ }
5168
+ };
5169
+ const util = {
5170
+ warn: NOOP,
5171
+ extend,
5172
+ mergeOptions: (parent, child, vm) => mergeOptions(
5173
+ parent,
5174
+ child,
5175
+ vm ? void 0 : internalOptionMergeStrats
5176
+ ),
5177
+ defineReactive
5178
+ };
5179
+ Object.defineProperty(Vue, "util", {
5180
+ get() {
5181
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
5182
+ return util;
5183
+ }
5184
+ });
5185
+ Vue.configureCompat = configureCompat;
5186
+ return Vue;
5187
+ }
5188
+ function installAppCompatProperties(app, context, render) {
5189
+ installFilterMethod(app, context);
5190
+ installLegacyOptionMergeStrats(app.config);
5191
+ if (!singletonApp) {
5192
+ return;
5078
5193
  }
5194
+ installCompatMount(app, context, render);
5195
+ installLegacyAPIs(app);
5196
+ applySingletonAppMutations(app);
5079
5197
  }
5080
- function setFullProps(instance, rawProps, props, attrs) {
5081
- const [options, needCastKeys] = instance.propsOptions;
5082
- let hasAttrsChanged = false;
5083
- let rawCastValues;
5084
- if (rawProps) {
5085
- for (let key in rawProps) {
5086
- if (isReservedProp(key)) {
5087
- continue;
5088
- }
5089
- {
5090
- if (key.startsWith("onHook:")) {
5091
- softAssertCompatEnabled(
5092
- "INSTANCE_EVENT_HOOKS",
5093
- instance,
5094
- key.slice(2).toLowerCase()
5095
- );
5096
- }
5097
- if (key === "inline-template") {
5098
- continue;
5099
- }
5198
+ function installFilterMethod(app, context) {
5199
+ context.filters = {};
5200
+ app.filter = (name, filter) => {
5201
+ assertCompatEnabled("FILTERS", null);
5202
+ if (!filter) {
5203
+ return context.filters[name];
5204
+ }
5205
+ context.filters[name] = filter;
5206
+ return app;
5207
+ };
5208
+ }
5209
+ function installLegacyAPIs(app) {
5210
+ Object.defineProperties(app, {
5211
+ // so that app.use() can work with legacy plugins that extend prototypes
5212
+ prototype: {
5213
+ get() {
5214
+ return app.config.globalProperties;
5100
5215
  }
5101
- const value = rawProps[key];
5102
- let camelKey;
5103
- if (options && hasOwn(options, camelKey = camelize(key))) {
5104
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
5105
- props[camelKey] = value;
5106
- } else {
5107
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
5108
- }
5109
- } else if (!isEmitListener(instance.emitsOptions, key)) {
5110
- {
5111
- if (isOn(key) && key.endsWith("Native")) {
5112
- key = key.slice(0, -6);
5113
- } else if (shouldSkipAttr(key, instance)) {
5114
- continue;
5115
- }
5116
- }
5117
- if (!(key in attrs) || value !== attrs[key]) {
5118
- attrs[key] = value;
5119
- hasAttrsChanged = true;
5120
- }
5216
+ },
5217
+ nextTick: { value: nextTick },
5218
+ extend: { value: singletonCtor.extend },
5219
+ set: { value: singletonCtor.set },
5220
+ delete: { value: singletonCtor.delete },
5221
+ observable: { value: singletonCtor.observable },
5222
+ util: {
5223
+ get() {
5224
+ return singletonCtor.util;
5121
5225
  }
5122
5226
  }
5123
- }
5124
- if (needCastKeys) {
5125
- const rawCurrentProps = toRaw(props);
5126
- const castValues = rawCastValues || EMPTY_OBJ;
5127
- for (let i = 0; i < needCastKeys.length; i++) {
5128
- const key = needCastKeys[i];
5129
- props[key] = resolvePropValue(
5130
- options,
5131
- rawCurrentProps,
5132
- key,
5133
- castValues[key],
5134
- instance,
5135
- !hasOwn(castValues, key)
5136
- );
5137
- }
5138
- }
5139
- return hasAttrsChanged;
5227
+ });
5140
5228
  }
5141
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
5142
- const opt = options[key];
5143
- if (opt != null) {
5144
- const hasDefault = hasOwn(opt, "default");
5145
- if (hasDefault && value === void 0) {
5146
- const defaultValue = opt.default;
5147
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
5148
- const { propsDefaults } = instance;
5149
- if (key in propsDefaults) {
5150
- value = propsDefaults[key];
5151
- } else {
5152
- setCurrentInstance(instance);
5153
- value = propsDefaults[key] = defaultValue.call(
5154
- isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props) : null,
5155
- props
5156
- );
5157
- unsetCurrentInstance();
5158
- }
5159
- } else {
5160
- value = defaultValue;
5161
- }
5229
+ function applySingletonAppMutations(app) {
5230
+ app._context.mixins = [...singletonApp._context.mixins];
5231
+ ["components", "directives", "filters"].forEach((key) => {
5232
+ app._context[key] = Object.create(singletonApp._context[key]);
5233
+ });
5234
+ for (const key in singletonApp.config) {
5235
+ if (key === "isNativeTag")
5236
+ continue;
5237
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
5238
+ continue;
5162
5239
  }
5163
- if (opt[0 /* shouldCast */]) {
5164
- if (isAbsent && !hasDefault) {
5165
- value = false;
5166
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
5167
- value = true;
5168
- }
5240
+ const val = singletonApp.config[key];
5241
+ app.config[key] = isObject(val) ? Object.create(val) : val;
5242
+ if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
5243
+ app.config.compilerOptions.isCustomElement = (tag) => {
5244
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
5245
+ };
5169
5246
  }
5170
5247
  }
5171
- return value;
5248
+ applySingletonPrototype(app, singletonCtor);
5172
5249
  }
5173
- function normalizePropsOptions(comp, appContext, asMixin = false) {
5174
- const cache = appContext.propsCache;
5175
- const cached = cache.get(comp);
5176
- if (cached) {
5177
- return cached;
5250
+ function applySingletonPrototype(app, Ctor) {
5251
+ const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
5252
+ if (enabled) {
5253
+ app.config.globalProperties = Object.create(Ctor.prototype);
5178
5254
  }
5179
- const raw = comp.props;
5180
- const normalized = {};
5181
- const needCastKeys = [];
5182
- let hasExtends = false;
5183
- if (!isFunction(comp)) {
5184
- const extendProps = (raw2) => {
5185
- if (isFunction(raw2)) {
5186
- raw2 = raw2.options;
5255
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
5256
+ for (const key in descriptors) {
5257
+ if (key !== "constructor") {
5258
+ if (enabled) {
5259
+ Object.defineProperty(
5260
+ app.config.globalProperties,
5261
+ key,
5262
+ descriptors[key]
5263
+ );
5187
5264
  }
5188
- hasExtends = true;
5189
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
5190
- extend(normalized, props);
5191
- if (keys)
5192
- needCastKeys.push(...keys);
5193
- };
5194
- if (!asMixin && appContext.mixins.length) {
5195
- appContext.mixins.forEach(extendProps);
5196
- }
5197
- if (comp.extends) {
5198
- extendProps(comp.extends);
5199
- }
5200
- if (comp.mixins) {
5201
- comp.mixins.forEach(extendProps);
5202
5265
  }
5203
5266
  }
5204
- if (!raw && !hasExtends) {
5205
- if (isObject(comp)) {
5206
- cache.set(comp, EMPTY_ARR);
5267
+ }
5268
+ function installCompatMount(app, context, render) {
5269
+ let isMounted = false;
5270
+ app._createRoot = (options) => {
5271
+ const component = app._component;
5272
+ const vnode = createVNode(component, options.propsData || null);
5273
+ vnode.appContext = context;
5274
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
5275
+ const emptyRender = () => {
5276
+ };
5277
+ const instance = createComponentInstance(vnode, null, null);
5278
+ if (hasNoRender) {
5279
+ instance.render = emptyRender;
5207
5280
  }
5208
- return EMPTY_ARR;
5209
- }
5210
- if (isArray(raw)) {
5211
- for (let i = 0; i < raw.length; i++) {
5212
- const normalizedKey = camelize(raw[i]);
5213
- if (validatePropName(normalizedKey)) {
5214
- normalized[normalizedKey] = EMPTY_OBJ;
5281
+ setupComponent(instance);
5282
+ vnode.component = instance;
5283
+ vnode.isCompatRoot = true;
5284
+ instance.ctx._compat_mount = (selectorOrEl) => {
5285
+ if (isMounted) {
5286
+ return;
5215
5287
  }
5216
- }
5217
- } else if (raw) {
5218
- for (const key in raw) {
5219
- const normalizedKey = camelize(key);
5220
- if (validatePropName(normalizedKey)) {
5221
- const opt = raw[key];
5222
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5223
- if (prop) {
5224
- const booleanIndex = getTypeIndex(Boolean, prop.type);
5225
- const stringIndex = getTypeIndex(String, prop.type);
5226
- prop[0 /* shouldCast */] = booleanIndex > -1;
5227
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
5228
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
5229
- needCastKeys.push(normalizedKey);
5230
- }
5288
+ let container;
5289
+ if (typeof selectorOrEl === "string") {
5290
+ const result = document.querySelector(selectorOrEl);
5291
+ if (!result) {
5292
+ return;
5231
5293
  }
5294
+ container = result;
5295
+ } else {
5296
+ container = selectorOrEl || document.createElement("div");
5232
5297
  }
5233
- }
5234
- }
5235
- const res = [normalized, needCastKeys];
5236
- if (isObject(comp)) {
5237
- cache.set(comp, res);
5238
- }
5239
- return res;
5240
- }
5241
- function validatePropName(key) {
5242
- if (key[0] !== "$") {
5243
- return true;
5244
- }
5245
- return false;
5246
- }
5247
- function getType(ctor) {
5248
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
5249
- return match ? match[2] : ctor === null ? "null" : "";
5250
- }
5251
- function isSameType(a, b) {
5252
- return getType(a) === getType(b);
5253
- }
5254
- function getTypeIndex(type, expectedTypes) {
5255
- if (isArray(expectedTypes)) {
5256
- return expectedTypes.findIndex((t) => isSameType(t, type));
5257
- } else if (isFunction(expectedTypes)) {
5258
- return isSameType(expectedTypes, type) ? 0 : -1;
5259
- }
5260
- return -1;
5261
- }
5262
-
5263
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5264
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5265
- const normalizeSlot = (key, rawSlot, ctx) => {
5266
- if (rawSlot._n) {
5267
- return rawSlot;
5268
- }
5269
- const normalized = withCtx((...args) => {
5270
- if (false) ;
5271
- return normalizeSlotValue(rawSlot(...args));
5272
- }, ctx);
5273
- normalized._c = false;
5274
- return normalized;
5275
- };
5276
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
5277
- const ctx = rawSlots._ctx;
5278
- for (const key in rawSlots) {
5279
- if (isInternalKey(key))
5280
- continue;
5281
- const value = rawSlots[key];
5282
- if (isFunction(value)) {
5283
- slots[key] = normalizeSlot(key, value, ctx);
5284
- } else if (value != null) {
5285
- const normalized = normalizeSlotValue(value);
5286
- slots[key] = () => normalized;
5287
- }
5288
- }
5289
- };
5290
- const normalizeVNodeSlots = (instance, children) => {
5291
- const normalized = normalizeSlotValue(children);
5292
- instance.slots.default = () => normalized;
5293
- };
5294
- const initSlots = (instance, children) => {
5295
- if (instance.vnode.shapeFlag & 32) {
5296
- const type = children._;
5297
- if (type) {
5298
- instance.slots = toRaw(children);
5299
- def(children, "_", type);
5300
- } else {
5301
- normalizeObjectSlots(
5302
- children,
5303
- instance.slots = {});
5304
- }
5305
- } else {
5306
- instance.slots = {};
5307
- if (children) {
5308
- normalizeVNodeSlots(instance, children);
5309
- }
5310
- }
5311
- def(instance.slots, InternalObjectKey, 1);
5312
- };
5313
- const updateSlots = (instance, children, optimized) => {
5314
- const { vnode, slots } = instance;
5315
- let needDeletionCheck = true;
5316
- let deletionComparisonTarget = EMPTY_OBJ;
5317
- if (vnode.shapeFlag & 32) {
5318
- const type = children._;
5319
- if (type) {
5320
- if (optimized && type === 1) {
5321
- needDeletionCheck = false;
5298
+ const isSVG = container instanceof SVGElement;
5299
+ if (hasNoRender && instance.render === emptyRender) {
5300
+ instance.render = null;
5301
+ component.template = container.innerHTML;
5302
+ finishComponentSetup(
5303
+ instance,
5304
+ false,
5305
+ true
5306
+ /* skip options */
5307
+ );
5308
+ }
5309
+ container.innerHTML = "";
5310
+ render(vnode, container, isSVG);
5311
+ if (container instanceof Element) {
5312
+ container.removeAttribute("v-cloak");
5313
+ container.setAttribute("data-v-app", "");
5314
+ }
5315
+ isMounted = true;
5316
+ app._container = container;
5317
+ container.__vue_app__ = app;
5318
+ return instance.proxy;
5319
+ };
5320
+ instance.ctx._compat_destroy = () => {
5321
+ if (isMounted) {
5322
+ render(null, app._container);
5323
+ delete app._container.__vue_app__;
5322
5324
  } else {
5323
- extend(slots, children);
5324
- if (!optimized && type === 1) {
5325
- delete slots._;
5325
+ const { bum, scope, um } = instance;
5326
+ if (bum) {
5327
+ invokeArrayFns(bum);
5328
+ }
5329
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
5330
+ instance.emit("hook:beforeDestroy");
5331
+ }
5332
+ if (scope) {
5333
+ scope.stop();
5334
+ }
5335
+ if (um) {
5336
+ invokeArrayFns(um);
5337
+ }
5338
+ if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
5339
+ instance.emit("hook:destroyed");
5326
5340
  }
5327
5341
  }
5342
+ };
5343
+ return instance.proxy;
5344
+ };
5345
+ }
5346
+ const methodsToPatch = [
5347
+ "push",
5348
+ "pop",
5349
+ "shift",
5350
+ "unshift",
5351
+ "splice",
5352
+ "sort",
5353
+ "reverse"
5354
+ ];
5355
+ const patched = /* @__PURE__ */ new WeakSet();
5356
+ function defineReactive(obj, key, val) {
5357
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
5358
+ const reactiveVal = reactive(val);
5359
+ if (isArray(val)) {
5360
+ methodsToPatch.forEach((m) => {
5361
+ val[m] = (...args) => {
5362
+ Array.prototype[m].call(reactiveVal, ...args);
5363
+ };
5364
+ });
5328
5365
  } else {
5329
- needDeletionCheck = !children.$stable;
5330
- normalizeObjectSlots(children, slots);
5366
+ Object.keys(val).forEach((key2) => {
5367
+ try {
5368
+ defineReactiveSimple(val, key2, val[key2]);
5369
+ } catch (e) {
5370
+ }
5371
+ });
5331
5372
  }
5332
- deletionComparisonTarget = children;
5333
- } else if (children) {
5334
- normalizeVNodeSlots(instance, children);
5335
- deletionComparisonTarget = { default: 1 };
5336
5373
  }
5337
- if (needDeletionCheck) {
5338
- for (const key in slots) {
5339
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
5340
- delete slots[key];
5341
- }
5342
- }
5374
+ const i = obj.$;
5375
+ if (i && obj === i.proxy) {
5376
+ defineReactiveSimple(i.ctx, key, val);
5377
+ i.accessCache = /* @__PURE__ */ Object.create(null);
5378
+ } else if (isReactive(obj)) {
5379
+ obj[key] = val;
5380
+ } else {
5381
+ defineReactiveSimple(obj, key, val);
5343
5382
  }
5344
- };
5345
-
5346
- function installLegacyOptionMergeStrats(config) {
5347
- config.optionMergeStrategies = new Proxy({}, {
5348
- get(target, key) {
5349
- if (key in target) {
5350
- return target[key];
5351
- }
5352
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
5353
- "CONFIG_OPTION_MERGE_STRATS",
5354
- null
5355
- )) {
5356
- return internalOptionMergeStrats[key];
5357
- }
5383
+ }
5384
+ function defineReactiveSimple(obj, key, val) {
5385
+ val = isObject(val) ? reactive(val) : val;
5386
+ Object.defineProperty(obj, key, {
5387
+ enumerable: true,
5388
+ configurable: true,
5389
+ get() {
5390
+ track(obj, "get", key);
5391
+ return val;
5392
+ },
5393
+ set(newVal) {
5394
+ val = isObject(newVal) ? reactive(newVal) : newVal;
5395
+ trigger(obj, "set", key, newVal);
5358
5396
  }
5359
5397
  });
5360
5398
  }
5361
5399
 
5362
- let singletonApp;
5363
- let singletonCtor;
5364
- function createCompatVue$1(createApp, createSingletonApp) {
5365
- singletonApp = createSingletonApp({});
5366
- const Vue = singletonCtor = function Vue2(options = {}) {
5367
- return createCompatApp(options, Vue2);
5368
- };
5369
- function createCompatApp(options = {}, Ctor) {
5370
- assertCompatEnabled("GLOBAL_MOUNT", null);
5371
- const { data } = options;
5372
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
5373
- options.data = () => data;
5374
- }
5375
- const app = createApp(options);
5376
- if (Ctor !== Vue) {
5377
- applySingletonPrototype(app, Ctor);
5378
- }
5379
- const vm = app._createRoot(options);
5380
- if (options.el) {
5381
- return vm.$mount(options.el);
5382
- } else {
5383
- return vm;
5384
- }
5385
- }
5386
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.8"}`;
5387
- Vue.config = singletonApp.config;
5388
- Vue.use = (p, ...options) => {
5389
- if (p && isFunction(p.install)) {
5390
- p.install(Vue, ...options);
5391
- } else if (isFunction(p)) {
5392
- p(Vue, ...options);
5393
- }
5394
- return Vue;
5395
- };
5396
- Vue.mixin = (m) => {
5397
- singletonApp.mixin(m);
5398
- return Vue;
5399
- };
5400
- Vue.component = (name, comp) => {
5401
- if (comp) {
5402
- singletonApp.component(name, comp);
5403
- return Vue;
5404
- } else {
5405
- return singletonApp.component(name);
5406
- }
5407
- };
5408
- Vue.directive = (name, dir) => {
5409
- if (dir) {
5410
- singletonApp.directive(name, dir);
5411
- return Vue;
5412
- } else {
5413
- return singletonApp.directive(name);
5414
- }
5400
+ function createAppContext() {
5401
+ return {
5402
+ app: null,
5403
+ config: {
5404
+ isNativeTag: NO,
5405
+ performance: false,
5406
+ globalProperties: {},
5407
+ optionMergeStrategies: {},
5408
+ errorHandler: void 0,
5409
+ warnHandler: void 0,
5410
+ compilerOptions: {}
5411
+ },
5412
+ mixins: [],
5413
+ components: {},
5414
+ directives: {},
5415
+ provides: /* @__PURE__ */ Object.create(null),
5416
+ optionsCache: /* @__PURE__ */ new WeakMap(),
5417
+ propsCache: /* @__PURE__ */ new WeakMap(),
5418
+ emitsCache: /* @__PURE__ */ new WeakMap()
5415
5419
  };
5416
- Vue.options = { _base: Vue };
5417
- let cid = 1;
5418
- Vue.cid = cid;
5419
- Vue.nextTick = nextTick;
5420
- const extendCache = /* @__PURE__ */ new WeakMap();
5421
- function extendCtor(extendOptions = {}) {
5422
- assertCompatEnabled("GLOBAL_EXTEND", null);
5423
- if (isFunction(extendOptions)) {
5424
- extendOptions = extendOptions.options;
5420
+ }
5421
+ let uid$1 = 0;
5422
+ function createAppAPI(render, hydrate) {
5423
+ return function createApp(rootComponent, rootProps = null) {
5424
+ if (!isFunction(rootComponent)) {
5425
+ rootComponent = extend({}, rootComponent);
5425
5426
  }
5426
- if (extendCache.has(extendOptions)) {
5427
- return extendCache.get(extendOptions);
5427
+ if (rootProps != null && !isObject(rootProps)) {
5428
+ rootProps = null;
5428
5429
  }
5429
- const Super = this;
5430
- function SubVue(inlineOptions) {
5431
- if (!inlineOptions) {
5432
- return createCompatApp(SubVue.options, SubVue);
5433
- } else {
5434
- return createCompatApp(
5435
- mergeOptions(
5436
- extend({}, SubVue.options),
5437
- inlineOptions,
5438
- internalOptionMergeStrats
5439
- ),
5440
- SubVue
5441
- );
5430
+ const context = createAppContext();
5431
+ const installedPlugins = /* @__PURE__ */ new Set();
5432
+ let isMounted = false;
5433
+ const app = context.app = {
5434
+ _uid: uid$1++,
5435
+ _component: rootComponent,
5436
+ _props: rootProps,
5437
+ _container: null,
5438
+ _context: context,
5439
+ _instance: null,
5440
+ version,
5441
+ get config() {
5442
+ return context.config;
5443
+ },
5444
+ set config(v) {
5445
+ },
5446
+ use(plugin, ...options) {
5447
+ if (installedPlugins.has(plugin)) ; else if (plugin && isFunction(plugin.install)) {
5448
+ installedPlugins.add(plugin);
5449
+ plugin.install(app, ...options);
5450
+ } else if (isFunction(plugin)) {
5451
+ installedPlugins.add(plugin);
5452
+ plugin(app, ...options);
5453
+ } else ;
5454
+ return app;
5455
+ },
5456
+ mixin(mixin) {
5457
+ {
5458
+ if (!context.mixins.includes(mixin)) {
5459
+ context.mixins.push(mixin);
5460
+ }
5461
+ }
5462
+ return app;
5463
+ },
5464
+ component(name, component) {
5465
+ if (!component) {
5466
+ return context.components[name];
5467
+ }
5468
+ context.components[name] = component;
5469
+ return app;
5470
+ },
5471
+ directive(name, directive) {
5472
+ if (!directive) {
5473
+ return context.directives[name];
5474
+ }
5475
+ context.directives[name] = directive;
5476
+ return app;
5477
+ },
5478
+ mount(rootContainer, isHydrate, isSVG) {
5479
+ if (!isMounted) {
5480
+ const vnode = createVNode(
5481
+ rootComponent,
5482
+ rootProps
5483
+ );
5484
+ vnode.appContext = context;
5485
+ if (isHydrate && hydrate) {
5486
+ hydrate(vnode, rootContainer);
5487
+ } else {
5488
+ render(vnode, rootContainer, isSVG);
5489
+ }
5490
+ isMounted = true;
5491
+ app._container = rootContainer;
5492
+ rootContainer.__vue_app__ = app;
5493
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
5494
+ }
5495
+ },
5496
+ unmount() {
5497
+ if (isMounted) {
5498
+ render(null, app._container);
5499
+ delete app._container.__vue_app__;
5500
+ }
5501
+ },
5502
+ provide(key, value) {
5503
+ context.provides[key] = value;
5504
+ return app;
5505
+ },
5506
+ runWithContext(fn) {
5507
+ currentApp = app;
5508
+ try {
5509
+ return fn();
5510
+ } finally {
5511
+ currentApp = null;
5512
+ }
5442
5513
  }
5514
+ };
5515
+ {
5516
+ installAppCompatProperties(app, context, render);
5443
5517
  }
5444
- SubVue.super = Super;
5445
- SubVue.prototype = Object.create(Vue.prototype);
5446
- SubVue.prototype.constructor = SubVue;
5447
- const mergeBase = {};
5448
- for (const key in Super.options) {
5449
- const superValue = Super.options[key];
5450
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
5518
+ return app;
5519
+ };
5520
+ }
5521
+ let currentApp = null;
5522
+
5523
+ function provide(key, value) {
5524
+ if (!currentInstance) ; else {
5525
+ let provides = currentInstance.provides;
5526
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
5527
+ if (parentProvides === provides) {
5528
+ provides = currentInstance.provides = Object.create(parentProvides);
5451
5529
  }
5452
- SubVue.options = mergeOptions(
5453
- mergeBase,
5454
- extendOptions,
5455
- internalOptionMergeStrats
5456
- );
5457
- SubVue.options._base = SubVue;
5458
- SubVue.extend = extendCtor.bind(SubVue);
5459
- SubVue.mixin = Super.mixin;
5460
- SubVue.use = Super.use;
5461
- SubVue.cid = ++cid;
5462
- extendCache.set(extendOptions, SubVue);
5463
- return SubVue;
5530
+ provides[key] = value;
5464
5531
  }
5465
- Vue.extend = extendCtor.bind(Vue);
5466
- Vue.set = (target, key, value) => {
5467
- assertCompatEnabled("GLOBAL_SET", null);
5468
- target[key] = value;
5469
- };
5470
- Vue.delete = (target, key) => {
5471
- assertCompatEnabled("GLOBAL_DELETE", null);
5472
- delete target[key];
5473
- };
5474
- Vue.observable = (target) => {
5475
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
5476
- return reactive(target);
5477
- };
5478
- Vue.filter = (name, filter) => {
5479
- if (filter) {
5480
- singletonApp.filter(name, filter);
5481
- return Vue;
5482
- } else {
5483
- return singletonApp.filter(name);
5484
- }
5485
- };
5486
- const util = {
5487
- warn: NOOP,
5488
- extend,
5489
- mergeOptions: (parent, child, vm) => mergeOptions(
5490
- parent,
5491
- child,
5492
- vm ? void 0 : internalOptionMergeStrats
5493
- ),
5494
- defineReactive
5495
- };
5496
- Object.defineProperty(Vue, "util", {
5497
- get() {
5498
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
5499
- return util;
5532
+ }
5533
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
5534
+ const instance = currentInstance || currentRenderingInstance;
5535
+ if (instance || currentApp) {
5536
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5537
+ if (provides && key in provides) {
5538
+ return provides[key];
5539
+ } else if (arguments.length > 1) {
5540
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
5541
+ } else ;
5542
+ }
5543
+ }
5544
+ function hasInjectionContext() {
5545
+ return !!(currentInstance || currentRenderingInstance || currentApp);
5546
+ }
5547
+
5548
+ function createPropsDefaultThis(instance, rawProps, propKey) {
5549
+ return new Proxy(
5550
+ {},
5551
+ {
5552
+ get(_, key) {
5553
+ if (key === "$options") {
5554
+ return resolveMergedOptions(instance);
5555
+ }
5556
+ if (key in rawProps) {
5557
+ return rawProps[key];
5558
+ }
5559
+ const injections = instance.type.inject;
5560
+ if (injections) {
5561
+ if (isArray(injections)) {
5562
+ if (injections.includes(key)) {
5563
+ return inject(key);
5564
+ }
5565
+ } else if (key in injections) {
5566
+ return inject(key);
5567
+ }
5568
+ }
5569
+ }
5500
5570
  }
5501
- });
5502
- Vue.configureCompat = configureCompat;
5503
- return Vue;
5571
+ );
5504
5572
  }
5505
- function installAppCompatProperties(app, context, render) {
5506
- installFilterMethod(app, context);
5507
- installLegacyOptionMergeStrats(app.config);
5508
- if (!singletonApp) {
5509
- return;
5573
+
5574
+ function shouldSkipAttr(key, instance) {
5575
+ if (key === "is") {
5576
+ return true;
5510
5577
  }
5511
- installCompatMount(app, context, render);
5512
- installLegacyAPIs(app);
5513
- applySingletonAppMutations(app);
5578
+ if ((key === "class" || key === "style") && isCompatEnabled$1("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
5579
+ return true;
5580
+ }
5581
+ if (isOn(key) && isCompatEnabled$1("INSTANCE_LISTENERS", instance)) {
5582
+ return true;
5583
+ }
5584
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
5585
+ return true;
5586
+ }
5587
+ return false;
5514
5588
  }
5515
- function installFilterMethod(app, context) {
5516
- context.filters = {};
5517
- app.filter = (name, filter) => {
5518
- assertCompatEnabled("FILTERS", null);
5519
- if (!filter) {
5520
- return context.filters[name];
5589
+
5590
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
5591
+ const props = {};
5592
+ const attrs = {};
5593
+ def(attrs, InternalObjectKey, 1);
5594
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5595
+ setFullProps(instance, rawProps, props, attrs);
5596
+ for (const key in instance.propsOptions[0]) {
5597
+ if (!(key in props)) {
5598
+ props[key] = void 0;
5521
5599
  }
5522
- context.filters[name] = filter;
5523
- return app;
5524
- };
5600
+ }
5601
+ if (isStateful) {
5602
+ instance.props = isSSR ? props : shallowReactive(props);
5603
+ } else {
5604
+ if (!instance.type.props) {
5605
+ instance.props = attrs;
5606
+ } else {
5607
+ instance.props = props;
5608
+ }
5609
+ }
5610
+ instance.attrs = attrs;
5525
5611
  }
5526
- function installLegacyAPIs(app) {
5527
- Object.defineProperties(app, {
5528
- // so that app.use() can work with legacy plugins that extend prototypes
5529
- prototype: {
5530
- get() {
5531
- return app.config.globalProperties;
5612
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
5613
+ const {
5614
+ props,
5615
+ attrs,
5616
+ vnode: { patchFlag }
5617
+ } = instance;
5618
+ const rawCurrentProps = toRaw(props);
5619
+ const [options] = instance.propsOptions;
5620
+ let hasAttrsChanged = false;
5621
+ if (
5622
+ // always force full diff in dev
5623
+ // - #1942 if hmr is enabled with sfc component
5624
+ // - vite#872 non-sfc component used by sfc component
5625
+ (optimized || patchFlag > 0) && !(patchFlag & 16)
5626
+ ) {
5627
+ if (patchFlag & 8) {
5628
+ const propsToUpdate = instance.vnode.dynamicProps;
5629
+ for (let i = 0; i < propsToUpdate.length; i++) {
5630
+ let key = propsToUpdate[i];
5631
+ if (isEmitListener(instance.emitsOptions, key)) {
5632
+ continue;
5633
+ }
5634
+ const value = rawProps[key];
5635
+ if (options) {
5636
+ if (hasOwn(attrs, key)) {
5637
+ if (value !== attrs[key]) {
5638
+ attrs[key] = value;
5639
+ hasAttrsChanged = true;
5640
+ }
5641
+ } else {
5642
+ const camelizedKey = camelize(key);
5643
+ props[camelizedKey] = resolvePropValue(
5644
+ options,
5645
+ rawCurrentProps,
5646
+ camelizedKey,
5647
+ value,
5648
+ instance,
5649
+ false
5650
+ /* isAbsent */
5651
+ );
5652
+ }
5653
+ } else {
5654
+ {
5655
+ if (isOn(key) && key.endsWith("Native")) {
5656
+ key = key.slice(0, -6);
5657
+ } else if (shouldSkipAttr(key, instance)) {
5658
+ continue;
5659
+ }
5660
+ }
5661
+ if (value !== attrs[key]) {
5662
+ attrs[key] = value;
5663
+ hasAttrsChanged = true;
5664
+ }
5665
+ }
5532
5666
  }
5533
- },
5534
- nextTick: { value: nextTick },
5535
- extend: { value: singletonCtor.extend },
5536
- set: { value: singletonCtor.set },
5537
- delete: { value: singletonCtor.delete },
5538
- observable: { value: singletonCtor.observable },
5539
- util: {
5540
- get() {
5541
- return singletonCtor.util;
5667
+ }
5668
+ } else {
5669
+ if (setFullProps(instance, rawProps, props, attrs)) {
5670
+ hasAttrsChanged = true;
5671
+ }
5672
+ let kebabKey;
5673
+ for (const key in rawCurrentProps) {
5674
+ if (!rawProps || // for camelCase
5675
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
5676
+ // and converted to camelCase (#955)
5677
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
5678
+ if (options) {
5679
+ if (rawPrevProps && // for camelCase
5680
+ (rawPrevProps[key] !== void 0 || // for kebab-case
5681
+ rawPrevProps[kebabKey] !== void 0)) {
5682
+ props[key] = resolvePropValue(
5683
+ options,
5684
+ rawCurrentProps,
5685
+ key,
5686
+ void 0,
5687
+ instance,
5688
+ true
5689
+ /* isAbsent */
5690
+ );
5691
+ }
5692
+ } else {
5693
+ delete props[key];
5694
+ }
5695
+ }
5696
+ }
5697
+ if (attrs !== rawCurrentProps) {
5698
+ for (const key in attrs) {
5699
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
5700
+ delete attrs[key];
5701
+ hasAttrsChanged = true;
5702
+ }
5703
+ }
5704
+ }
5705
+ }
5706
+ if (hasAttrsChanged) {
5707
+ trigger(instance, "set", "$attrs");
5708
+ }
5709
+ }
5710
+ function setFullProps(instance, rawProps, props, attrs) {
5711
+ const [options, needCastKeys] = instance.propsOptions;
5712
+ let hasAttrsChanged = false;
5713
+ let rawCastValues;
5714
+ if (rawProps) {
5715
+ for (let key in rawProps) {
5716
+ if (isReservedProp(key)) {
5717
+ continue;
5718
+ }
5719
+ {
5720
+ if (key.startsWith("onHook:")) {
5721
+ softAssertCompatEnabled(
5722
+ "INSTANCE_EVENT_HOOKS",
5723
+ instance,
5724
+ key.slice(2).toLowerCase()
5725
+ );
5726
+ }
5727
+ if (key === "inline-template") {
5728
+ continue;
5729
+ }
5730
+ }
5731
+ const value = rawProps[key];
5732
+ let camelKey;
5733
+ if (options && hasOwn(options, camelKey = camelize(key))) {
5734
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
5735
+ props[camelKey] = value;
5736
+ } else {
5737
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
5738
+ }
5739
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
5740
+ {
5741
+ if (isOn(key) && key.endsWith("Native")) {
5742
+ key = key.slice(0, -6);
5743
+ } else if (shouldSkipAttr(key, instance)) {
5744
+ continue;
5745
+ }
5746
+ }
5747
+ if (!(key in attrs) || value !== attrs[key]) {
5748
+ attrs[key] = value;
5749
+ hasAttrsChanged = true;
5750
+ }
5751
+ }
5752
+ }
5753
+ }
5754
+ if (needCastKeys) {
5755
+ const rawCurrentProps = toRaw(props);
5756
+ const castValues = rawCastValues || EMPTY_OBJ;
5757
+ for (let i = 0; i < needCastKeys.length; i++) {
5758
+ const key = needCastKeys[i];
5759
+ props[key] = resolvePropValue(
5760
+ options,
5761
+ rawCurrentProps,
5762
+ key,
5763
+ castValues[key],
5764
+ instance,
5765
+ !hasOwn(castValues, key)
5766
+ );
5767
+ }
5768
+ }
5769
+ return hasAttrsChanged;
5770
+ }
5771
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
5772
+ const opt = options[key];
5773
+ if (opt != null) {
5774
+ const hasDefault = hasOwn(opt, "default");
5775
+ if (hasDefault && value === void 0) {
5776
+ const defaultValue = opt.default;
5777
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
5778
+ const { propsDefaults } = instance;
5779
+ if (key in propsDefaults) {
5780
+ value = propsDefaults[key];
5781
+ } else {
5782
+ setCurrentInstance(instance);
5783
+ value = propsDefaults[key] = defaultValue.call(
5784
+ isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props) : null,
5785
+ props
5786
+ );
5787
+ unsetCurrentInstance();
5788
+ }
5789
+ } else {
5790
+ value = defaultValue;
5542
5791
  }
5543
5792
  }
5544
- });
5545
- }
5546
- function applySingletonAppMutations(app) {
5547
- app._context.mixins = [...singletonApp._context.mixins];
5548
- ["components", "directives", "filters"].forEach((key) => {
5549
- app._context[key] = Object.create(singletonApp._context[key]);
5550
- });
5551
- for (const key in singletonApp.config) {
5552
- if (key === "isNativeTag")
5553
- continue;
5554
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
5555
- continue;
5556
- }
5557
- const val = singletonApp.config[key];
5558
- app.config[key] = isObject(val) ? Object.create(val) : val;
5559
- if (key === "ignoredElements" && isCompatEnabled$1("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
5560
- app.config.compilerOptions.isCustomElement = (tag) => {
5561
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
5562
- };
5793
+ if (opt[0 /* shouldCast */]) {
5794
+ if (isAbsent && !hasDefault) {
5795
+ value = false;
5796
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
5797
+ value = true;
5798
+ }
5563
5799
  }
5564
5800
  }
5565
- applySingletonPrototype(app, singletonCtor);
5801
+ return value;
5566
5802
  }
5567
- function applySingletonPrototype(app, Ctor) {
5568
- const enabled = isCompatEnabled$1("GLOBAL_PROTOTYPE", null);
5569
- if (enabled) {
5570
- app.config.globalProperties = Object.create(Ctor.prototype);
5803
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
5804
+ const cache = appContext.propsCache;
5805
+ const cached = cache.get(comp);
5806
+ if (cached) {
5807
+ return cached;
5571
5808
  }
5572
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
5573
- for (const key in descriptors) {
5574
- if (key !== "constructor") {
5575
- if (enabled) {
5576
- Object.defineProperty(
5577
- app.config.globalProperties,
5578
- key,
5579
- descriptors[key]
5580
- );
5809
+ const raw = comp.props;
5810
+ const normalized = {};
5811
+ const needCastKeys = [];
5812
+ let hasExtends = false;
5813
+ if (!isFunction(comp)) {
5814
+ const extendProps = (raw2) => {
5815
+ if (isFunction(raw2)) {
5816
+ raw2 = raw2.options;
5581
5817
  }
5818
+ hasExtends = true;
5819
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
5820
+ extend(normalized, props);
5821
+ if (keys)
5822
+ needCastKeys.push(...keys);
5823
+ };
5824
+ if (!asMixin && appContext.mixins.length) {
5825
+ appContext.mixins.forEach(extendProps);
5826
+ }
5827
+ if (comp.extends) {
5828
+ extendProps(comp.extends);
5829
+ }
5830
+ if (comp.mixins) {
5831
+ comp.mixins.forEach(extendProps);
5582
5832
  }
5583
5833
  }
5584
- }
5585
- function installCompatMount(app, context, render) {
5586
- let isMounted = false;
5587
- app._createRoot = (options) => {
5588
- const component = app._component;
5589
- const vnode = createVNode(component, options.propsData || null);
5590
- vnode.appContext = context;
5591
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
5592
- const emptyRender = () => {
5593
- };
5594
- const instance = createComponentInstance(vnode, null, null);
5595
- if (hasNoRender) {
5596
- instance.render = emptyRender;
5834
+ if (!raw && !hasExtends) {
5835
+ if (isObject(comp)) {
5836
+ cache.set(comp, EMPTY_ARR);
5597
5837
  }
5598
- setupComponent(instance);
5599
- vnode.component = instance;
5600
- vnode.isCompatRoot = true;
5601
- instance.ctx._compat_mount = (selectorOrEl) => {
5602
- if (isMounted) {
5603
- return;
5838
+ return EMPTY_ARR;
5839
+ }
5840
+ if (isArray(raw)) {
5841
+ for (let i = 0; i < raw.length; i++) {
5842
+ const normalizedKey = camelize(raw[i]);
5843
+ if (validatePropName(normalizedKey)) {
5844
+ normalized[normalizedKey] = EMPTY_OBJ;
5604
5845
  }
5605
- let container;
5606
- if (typeof selectorOrEl === "string") {
5607
- const result = document.querySelector(selectorOrEl);
5608
- if (!result) {
5609
- return;
5846
+ }
5847
+ } else if (raw) {
5848
+ for (const key in raw) {
5849
+ const normalizedKey = camelize(key);
5850
+ if (validatePropName(normalizedKey)) {
5851
+ const opt = raw[key];
5852
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
5853
+ if (prop) {
5854
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
5855
+ const stringIndex = getTypeIndex(String, prop.type);
5856
+ prop[0 /* shouldCast */] = booleanIndex > -1;
5857
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
5858
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
5859
+ needCastKeys.push(normalizedKey);
5860
+ }
5610
5861
  }
5611
- container = result;
5612
- } else {
5613
- container = selectorOrEl || document.createElement("div");
5614
- }
5615
- const isSVG = container instanceof SVGElement;
5616
- if (hasNoRender && instance.render === emptyRender) {
5617
- instance.render = null;
5618
- component.template = container.innerHTML;
5619
- finishComponentSetup(
5620
- instance,
5621
- false,
5622
- true
5623
- /* skip options */
5624
- );
5625
- }
5626
- container.innerHTML = "";
5627
- render(vnode, container, isSVG);
5628
- if (container instanceof Element) {
5629
- container.removeAttribute("v-cloak");
5630
- container.setAttribute("data-v-app", "");
5631
5862
  }
5632
- isMounted = true;
5633
- app._container = container;
5634
- container.__vue_app__ = app;
5635
- return instance.proxy;
5636
- };
5637
- instance.ctx._compat_destroy = () => {
5638
- if (isMounted) {
5639
- render(null, app._container);
5640
- delete app._container.__vue_app__;
5863
+ }
5864
+ }
5865
+ const res = [normalized, needCastKeys];
5866
+ if (isObject(comp)) {
5867
+ cache.set(comp, res);
5868
+ }
5869
+ return res;
5870
+ }
5871
+ function validatePropName(key) {
5872
+ if (key[0] !== "$") {
5873
+ return true;
5874
+ }
5875
+ return false;
5876
+ }
5877
+ function getType(ctor) {
5878
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
5879
+ return match ? match[2] : ctor === null ? "null" : "";
5880
+ }
5881
+ function isSameType(a, b) {
5882
+ return getType(a) === getType(b);
5883
+ }
5884
+ function getTypeIndex(type, expectedTypes) {
5885
+ if (isArray(expectedTypes)) {
5886
+ return expectedTypes.findIndex((t) => isSameType(t, type));
5887
+ } else if (isFunction(expectedTypes)) {
5888
+ return isSameType(expectedTypes, type) ? 0 : -1;
5889
+ }
5890
+ return -1;
5891
+ }
5892
+
5893
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5894
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5895
+ const normalizeSlot = (key, rawSlot, ctx) => {
5896
+ if (rawSlot._n) {
5897
+ return rawSlot;
5898
+ }
5899
+ const normalized = withCtx((...args) => {
5900
+ if (false) ;
5901
+ return normalizeSlotValue(rawSlot(...args));
5902
+ }, ctx);
5903
+ normalized._c = false;
5904
+ return normalized;
5905
+ };
5906
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
5907
+ const ctx = rawSlots._ctx;
5908
+ for (const key in rawSlots) {
5909
+ if (isInternalKey(key))
5910
+ continue;
5911
+ const value = rawSlots[key];
5912
+ if (isFunction(value)) {
5913
+ slots[key] = normalizeSlot(key, value, ctx);
5914
+ } else if (value != null) {
5915
+ const normalized = normalizeSlotValue(value);
5916
+ slots[key] = () => normalized;
5917
+ }
5918
+ }
5919
+ };
5920
+ const normalizeVNodeSlots = (instance, children) => {
5921
+ const normalized = normalizeSlotValue(children);
5922
+ instance.slots.default = () => normalized;
5923
+ };
5924
+ const initSlots = (instance, children) => {
5925
+ if (instance.vnode.shapeFlag & 32) {
5926
+ const type = children._;
5927
+ if (type) {
5928
+ instance.slots = toRaw(children);
5929
+ def(children, "_", type);
5930
+ } else {
5931
+ normalizeObjectSlots(
5932
+ children,
5933
+ instance.slots = {});
5934
+ }
5935
+ } else {
5936
+ instance.slots = {};
5937
+ if (children) {
5938
+ normalizeVNodeSlots(instance, children);
5939
+ }
5940
+ }
5941
+ def(instance.slots, InternalObjectKey, 1);
5942
+ };
5943
+ const updateSlots = (instance, children, optimized) => {
5944
+ const { vnode, slots } = instance;
5945
+ let needDeletionCheck = true;
5946
+ let deletionComparisonTarget = EMPTY_OBJ;
5947
+ if (vnode.shapeFlag & 32) {
5948
+ const type = children._;
5949
+ if (type) {
5950
+ if (optimized && type === 1) {
5951
+ needDeletionCheck = false;
5641
5952
  } else {
5642
- const { bum, scope, um } = instance;
5643
- if (bum) {
5644
- invokeArrayFns(bum);
5645
- }
5646
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
5647
- instance.emit("hook:beforeDestroy");
5648
- }
5649
- if (scope) {
5650
- scope.stop();
5651
- }
5652
- if (um) {
5653
- invokeArrayFns(um);
5654
- }
5655
- if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
5656
- instance.emit("hook:destroyed");
5953
+ extend(slots, children);
5954
+ if (!optimized && type === 1) {
5955
+ delete slots._;
5657
5956
  }
5658
5957
  }
5659
- };
5660
- return instance.proxy;
5661
- };
5662
- }
5663
- const methodsToPatch = [
5664
- "push",
5665
- "pop",
5666
- "shift",
5667
- "unshift",
5668
- "splice",
5669
- "sort",
5670
- "reverse"
5671
- ];
5672
- const patched = /* @__PURE__ */ new WeakSet();
5673
- function defineReactive(obj, key, val) {
5674
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
5675
- const reactiveVal = reactive(val);
5676
- if (isArray(val)) {
5677
- methodsToPatch.forEach((m) => {
5678
- val[m] = (...args) => {
5679
- Array.prototype[m].call(reactiveVal, ...args);
5680
- };
5681
- });
5682
5958
  } else {
5683
- Object.keys(val).forEach((key2) => {
5684
- try {
5685
- defineReactiveSimple(val, key2, val[key2]);
5686
- } catch (e) {
5687
- }
5688
- });
5959
+ needDeletionCheck = !children.$stable;
5960
+ normalizeObjectSlots(children, slots);
5689
5961
  }
5962
+ deletionComparisonTarget = children;
5963
+ } else if (children) {
5964
+ normalizeVNodeSlots(instance, children);
5965
+ deletionComparisonTarget = { default: 1 };
5690
5966
  }
5691
- const i = obj.$;
5692
- if (i && obj === i.proxy) {
5693
- defineReactiveSimple(i.ctx, key, val);
5694
- i.accessCache = /* @__PURE__ */ Object.create(null);
5695
- } else if (isReactive(obj)) {
5696
- obj[key] = val;
5697
- } else {
5698
- defineReactiveSimple(obj, key, val);
5699
- }
5700
- }
5701
- function defineReactiveSimple(obj, key, val) {
5702
- val = isObject(val) ? reactive(val) : val;
5703
- Object.defineProperty(obj, key, {
5704
- enumerable: true,
5705
- configurable: true,
5706
- get() {
5707
- track(obj, "get", key);
5708
- return val;
5709
- },
5710
- set(newVal) {
5711
- val = isObject(newVal) ? reactive(newVal) : newVal;
5712
- trigger(obj, "set", key, newVal);
5713
- }
5714
- });
5715
- }
5716
-
5717
- function createAppContext() {
5718
- return {
5719
- app: null,
5720
- config: {
5721
- isNativeTag: NO,
5722
- performance: false,
5723
- globalProperties: {},
5724
- optionMergeStrategies: {},
5725
- errorHandler: void 0,
5726
- warnHandler: void 0,
5727
- compilerOptions: {}
5728
- },
5729
- mixins: [],
5730
- components: {},
5731
- directives: {},
5732
- provides: /* @__PURE__ */ Object.create(null),
5733
- optionsCache: /* @__PURE__ */ new WeakMap(),
5734
- propsCache: /* @__PURE__ */ new WeakMap(),
5735
- emitsCache: /* @__PURE__ */ new WeakMap()
5736
- };
5737
- }
5738
- let uid$1 = 0;
5739
- function createAppAPI(render, hydrate) {
5740
- return function createApp(rootComponent, rootProps = null) {
5741
- if (!isFunction(rootComponent)) {
5742
- rootComponent = extend({}, rootComponent);
5743
- }
5744
- if (rootProps != null && !isObject(rootProps)) {
5745
- rootProps = null;
5746
- }
5747
- const context = createAppContext();
5748
- const installedPlugins = /* @__PURE__ */ new Set();
5749
- let isMounted = false;
5750
- const app = context.app = {
5751
- _uid: uid$1++,
5752
- _component: rootComponent,
5753
- _props: rootProps,
5754
- _container: null,
5755
- _context: context,
5756
- _instance: null,
5757
- version,
5758
- get config() {
5759
- return context.config;
5760
- },
5761
- set config(v) {
5762
- },
5763
- use(plugin, ...options) {
5764
- if (installedPlugins.has(plugin)) ; else if (plugin && isFunction(plugin.install)) {
5765
- installedPlugins.add(plugin);
5766
- plugin.install(app, ...options);
5767
- } else if (isFunction(plugin)) {
5768
- installedPlugins.add(plugin);
5769
- plugin(app, ...options);
5770
- } else ;
5771
- return app;
5772
- },
5773
- mixin(mixin) {
5774
- {
5775
- if (!context.mixins.includes(mixin)) {
5776
- context.mixins.push(mixin);
5777
- }
5778
- }
5779
- return app;
5780
- },
5781
- component(name, component) {
5782
- if (!component) {
5783
- return context.components[name];
5784
- }
5785
- context.components[name] = component;
5786
- return app;
5787
- },
5788
- directive(name, directive) {
5789
- if (!directive) {
5790
- return context.directives[name];
5791
- }
5792
- context.directives[name] = directive;
5793
- return app;
5794
- },
5795
- mount(rootContainer, isHydrate, isSVG) {
5796
- if (!isMounted) {
5797
- const vnode = createVNode(
5798
- rootComponent,
5799
- rootProps
5800
- );
5801
- vnode.appContext = context;
5802
- if (isHydrate && hydrate) {
5803
- hydrate(vnode, rootContainer);
5804
- } else {
5805
- render(vnode, rootContainer, isSVG);
5806
- }
5807
- isMounted = true;
5808
- app._container = rootContainer;
5809
- rootContainer.__vue_app__ = app;
5810
- return getExposeProxy(vnode.component) || vnode.component.proxy;
5811
- }
5812
- },
5813
- unmount() {
5814
- if (isMounted) {
5815
- render(null, app._container);
5816
- delete app._container.__vue_app__;
5817
- }
5818
- },
5819
- provide(key, value) {
5820
- context.provides[key] = value;
5821
- return app;
5967
+ if (needDeletionCheck) {
5968
+ for (const key in slots) {
5969
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
5970
+ delete slots[key];
5822
5971
  }
5823
- };
5824
- {
5825
- installAppCompatProperties(app, context, render);
5826
5972
  }
5827
- return app;
5828
- };
5829
- }
5973
+ }
5974
+ };
5830
5975
 
5831
5976
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5832
5977
  if (isArray(rawRef)) {
@@ -8311,6 +8456,8 @@ function createComponentInstance(vnode, parent, suspense) {
8311
8456
  refs: EMPTY_OBJ,
8312
8457
  setupState: EMPTY_OBJ,
8313
8458
  setupContext: null,
8459
+ attrsProxy: null,
8460
+ slotsProxy: null,
8314
8461
  // suspense related
8315
8462
  suspense,
8316
8463
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -8487,8 +8634,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
8487
8634
  unsetCurrentInstance();
8488
8635
  }
8489
8636
  }
8490
- function createAttrsProxy(instance) {
8491
- return new Proxy(
8637
+ function getAttrsProxy(instance) {
8638
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
8492
8639
  instance.attrs,
8493
8640
  {
8494
8641
  get(target, key) {
@@ -8496,17 +8643,16 @@ function createAttrsProxy(instance) {
8496
8643
  return target[key];
8497
8644
  }
8498
8645
  }
8499
- );
8646
+ ));
8500
8647
  }
8501
8648
  function createSetupContext(instance) {
8502
8649
  const expose = (exposed) => {
8503
8650
  instance.exposed = exposed || {};
8504
8651
  };
8505
- let attrs;
8506
8652
  {
8507
8653
  return {
8508
8654
  get attrs() {
8509
- return attrs || (attrs = createAttrsProxy(instance));
8655
+ return getAttrsProxy(instance);
8510
8656
  },
8511
8657
  slots: instance.slots,
8512
8658
  emit: instance.emit,
@@ -8541,80 +8687,6 @@ const computed = (getterOrOptions, debugOptions) => {
8541
8687
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
8542
8688
  };
8543
8689
 
8544
- function defineProps() {
8545
- return null;
8546
- }
8547
- function defineEmits() {
8548
- return null;
8549
- }
8550
- function defineExpose(exposed) {
8551
- }
8552
- function defineOptions(options) {
8553
- }
8554
- function defineSlots() {
8555
- }
8556
- function withDefaults(props, defaults) {
8557
- return null;
8558
- }
8559
- function useSlots() {
8560
- return getContext().slots;
8561
- }
8562
- function useAttrs() {
8563
- return getContext().attrs;
8564
- }
8565
- function getContext() {
8566
- const i = getCurrentInstance();
8567
- return i.setupContext || (i.setupContext = createSetupContext(i));
8568
- }
8569
- function mergeDefaults(raw, defaults) {
8570
- const props = isArray(raw) ? raw.reduce(
8571
- (normalized, p) => (normalized[p] = {}, normalized),
8572
- {}
8573
- ) : raw;
8574
- for (const key in defaults) {
8575
- if (key.startsWith("__skip"))
8576
- continue;
8577
- let opt = props[key];
8578
- if (opt) {
8579
- if (isArray(opt) || isFunction(opt)) {
8580
- opt = props[key] = { type: opt, default: defaults[key] };
8581
- } else {
8582
- opt.default = defaults[key];
8583
- }
8584
- } else if (opt === null) {
8585
- opt = props[key] = { default: defaults[key] };
8586
- } else ;
8587
- if (opt && defaults[`__skip_${key}`]) {
8588
- opt.skipFactory = true;
8589
- }
8590
- }
8591
- return props;
8592
- }
8593
- function createPropsRestProxy(props, excludedKeys) {
8594
- const ret = {};
8595
- for (const key in props) {
8596
- if (!excludedKeys.includes(key)) {
8597
- Object.defineProperty(ret, key, {
8598
- enumerable: true,
8599
- get: () => props[key]
8600
- });
8601
- }
8602
- }
8603
- return ret;
8604
- }
8605
- function withAsyncContext(getAwaitable) {
8606
- const ctx = getCurrentInstance();
8607
- let awaitable = getAwaitable();
8608
- unsetCurrentInstance();
8609
- if (isPromise(awaitable)) {
8610
- awaitable = awaitable.catch((e) => {
8611
- setCurrentInstance(ctx);
8612
- throw e;
8613
- });
8614
- }
8615
- return [awaitable, () => setCurrentInstance(ctx)];
8616
- }
8617
-
8618
8690
  function h(type, propsOrChildren, children) {
8619
8691
  const l = arguments.length;
8620
8692
  if (l === 2) {
@@ -8675,7 +8747,7 @@ function isMemoSame(cached, memo) {
8675
8747
  return true;
8676
8748
  }
8677
8749
 
8678
- const version = "3.3.0-alpha.8";
8750
+ const version = "3.3.0-beta.1";
8679
8751
  const _ssrUtils = {
8680
8752
  createComponentInstance,
8681
8753
  setupComponent,
@@ -10212,6 +10284,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10212
10284
  defineCustomElement: defineCustomElement,
10213
10285
  defineEmits: defineEmits,
10214
10286
  defineExpose: defineExpose,
10287
+ defineModel: defineModel,
10215
10288
  defineOptions: defineOptions,
10216
10289
  defineProps: defineProps,
10217
10290
  defineSSRCustomElement: defineSSRCustomElement,
@@ -10225,6 +10298,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10225
10298
  guardReactiveProps: guardReactiveProps,
10226
10299
  h: h,
10227
10300
  handleError: handleError,
10301
+ hasInjectionContext: hasInjectionContext,
10228
10302
  hydrate: hydrate,
10229
10303
  initCustomFormatter: initCustomFormatter,
10230
10304
  initDirectivesForSSR: initDirectivesForSSR,
@@ -10239,6 +10313,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10239
10313
  isVNode: isVNode,
10240
10314
  markRaw: markRaw,
10241
10315
  mergeDefaults: mergeDefaults,
10316
+ mergeModels: mergeModels,
10242
10317
  mergeProps: mergeProps,
10243
10318
  nextTick: nextTick,
10244
10319
  normalizeClass: normalizeClass,
@@ -10297,6 +10372,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10297
10372
  useAttrs: useAttrs,
10298
10373
  useCssModule: useCssModule,
10299
10374
  useCssVars: useCssVars,
10375
+ useModel: useModel,
10300
10376
  useSSRContext: useSSRContext,
10301
10377
  useSlots: useSlots,
10302
10378
  useTransitionState: useTransitionState,
@@ -10408,8 +10484,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
10408
10484
  [48]: `ES module mode is not supported in this build of compiler.`,
10409
10485
  [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
10410
10486
  [50]: `"scopeId" option is only supported in module mode.`,
10487
+ // deprecations
10488
+ [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.`,
10489
+ [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
10411
10490
  // just to fulfill types
10412
- [51]: ``
10491
+ [53]: ``
10413
10492
  };
10414
10493
 
10415
10494
  const FRAGMENT = Symbol(``);
@@ -12186,7 +12265,7 @@ const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
12186
12265
  function createCodegenContext(ast, {
12187
12266
  mode = "function",
12188
12267
  prefixIdentifiers = mode === "module",
12189
- sourceMap: sourceMap$1 = false,
12268
+ sourceMap = false,
12190
12269
  filename = `template.vue.html`,
12191
12270
  scopeId = null,
12192
12271
  optimizeImports = false,
@@ -12200,7 +12279,7 @@ function createCodegenContext(ast, {
12200
12279
  const context = {
12201
12280
  mode,
12202
12281
  prefixIdentifiers,
12203
- sourceMap: sourceMap$1,
12282
+ sourceMap,
12204
12283
  filename,
12205
12284
  scopeId,
12206
12285
  optimizeImports,
@@ -12272,8 +12351,8 @@ function createCodegenContext(ast, {
12272
12351
  }
12273
12352
  });
12274
12353
  }
12275
- if (sourceMap$1) {
12276
- context.map = new sourceMap.SourceMapGenerator();
12354
+ if (sourceMap) {
12355
+ context.map = new sourceMapJs.SourceMapGenerator();
12277
12356
  context.map.setSourceContent(filename, context.source);
12278
12357
  }
12279
12358
  return context;
@@ -13245,12 +13324,10 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
13245
13324
  return genPropsAccessExp(bindingMetadata.__propsAliases[raw]);
13246
13325
  }
13247
13326
  } else {
13248
- if (type && type.startsWith("setup")) {
13327
+ if (type && type.startsWith("setup") || type === "literal-const") {
13249
13328
  return `$setup.${raw}`;
13250
13329
  } else if (type === "props-aliased") {
13251
13330
  return `$props['${bindingMetadata.__propsAliases[raw]}']`;
13252
- } else if (type === "literal-const") {
13253
- return raw;
13254
13331
  } else if (type) {
13255
13332
  return `$${type}.${raw}`;
13256
13333
  }
@@ -15044,7 +15121,7 @@ const transformText = (node, context) => {
15044
15121
  const seen$1 = /* @__PURE__ */ new WeakSet();
15045
15122
  const transformOnce = (node, context) => {
15046
15123
  if (node.type === 1 && findDir(node, "once", true)) {
15047
- if (seen$1.has(node) || context.inVOnce) {
15124
+ if (seen$1.has(node) || context.inVOnce || context.inSSR) {
15048
15125
  return;
15049
15126
  }
15050
15127
  seen$1.add(node);
@@ -17842,29 +17919,29 @@ function createDOMCompilerError(code, loc) {
17842
17919
  );
17843
17920
  }
17844
17921
  const DOMErrorMessages = {
17845
- [51]: `v-html is missing expression.`,
17846
- [52]: `v-html will override element children.`,
17847
- [53]: `v-text is missing expression.`,
17848
- [54]: `v-text will override element children.`,
17849
- [55]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17850
- [56]: `v-model argument is not supported on plain elements.`,
17851
- [57]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17852
- [58]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17853
- [59]: `v-show is missing expression.`,
17854
- [60]: `<Transition> expects exactly one child element or component.`,
17855
- [61]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17922
+ [53]: `v-html is missing expression.`,
17923
+ [54]: `v-html will override element children.`,
17924
+ [55]: `v-text is missing expression.`,
17925
+ [56]: `v-text will override element children.`,
17926
+ [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
17927
+ [58]: `v-model argument is not supported on plain elements.`,
17928
+ [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
17929
+ [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
17930
+ [61]: `v-show is missing expression.`,
17931
+ [62]: `<Transition> expects exactly one child element or component.`,
17932
+ [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
17856
17933
  };
17857
17934
 
17858
17935
  const transformVHtml = (dir, node, context) => {
17859
17936
  const { exp, loc } = dir;
17860
17937
  if (!exp) {
17861
17938
  context.onError(
17862
- createDOMCompilerError(51, loc)
17939
+ createDOMCompilerError(53, loc)
17863
17940
  );
17864
17941
  }
17865
17942
  if (node.children.length) {
17866
17943
  context.onError(
17867
- createDOMCompilerError(52, loc)
17944
+ createDOMCompilerError(54, loc)
17868
17945
  );
17869
17946
  node.children.length = 0;
17870
17947
  }
@@ -17882,12 +17959,12 @@ const transformVText = (dir, node, context) => {
17882
17959
  const { exp, loc } = dir;
17883
17960
  if (!exp) {
17884
17961
  context.onError(
17885
- createDOMCompilerError(53, loc)
17962
+ createDOMCompilerError(55, loc)
17886
17963
  );
17887
17964
  }
17888
17965
  if (node.children.length) {
17889
17966
  context.onError(
17890
- createDOMCompilerError(54, loc)
17967
+ createDOMCompilerError(56, loc)
17891
17968
  );
17892
17969
  node.children.length = 0;
17893
17970
  }
@@ -17913,7 +17990,7 @@ const transformModel = (dir, node, context) => {
17913
17990
  if (dir.arg) {
17914
17991
  context.onError(
17915
17992
  createDOMCompilerError(
17916
- 56,
17993
+ 58,
17917
17994
  dir.arg.loc
17918
17995
  )
17919
17996
  );
@@ -17940,7 +18017,7 @@ const transformModel = (dir, node, context) => {
17940
18017
  isInvalidType = true;
17941
18018
  context.onError(
17942
18019
  createDOMCompilerError(
17943
- 57,
18020
+ 59,
17944
18021
  dir.loc
17945
18022
  )
17946
18023
  );
@@ -17959,7 +18036,7 @@ const transformModel = (dir, node, context) => {
17959
18036
  } else {
17960
18037
  context.onError(
17961
18038
  createDOMCompilerError(
17962
- 55,
18039
+ 57,
17963
18040
  dir.loc
17964
18041
  )
17965
18042
  );
@@ -18069,7 +18146,7 @@ const transformShow = (dir, node, context) => {
18069
18146
  const { exp, loc } = dir;
18070
18147
  if (!exp) {
18071
18148
  context.onError(
18072
- createDOMCompilerError(59, loc)
18149
+ createDOMCompilerError(61, loc)
18073
18150
  );
18074
18151
  }
18075
18152
  return {
@@ -18292,7 +18369,7 @@ function evaluateConstant(exp) {
18292
18369
  const ignoreSideEffectTags = (node, context) => {
18293
18370
  if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
18294
18371
  context.onError(
18295
- createDOMCompilerError(61, node.loc)
18372
+ createDOMCompilerError(63, node.loc)
18296
18373
  );
18297
18374
  context.removeNode();
18298
18375
  }