@vue/runtime-dom 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.
@@ -100,7 +100,7 @@ var VueRuntimeDOM = (function (exports) {
100
100
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
101
101
  };
102
102
 
103
- 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";
103
+ 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";
104
104
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
105
105
 
106
106
  function normalizeStyle(value) {
@@ -1859,6 +1859,8 @@ var VueRuntimeDOM = (function (exports) {
1859
1859
  }
1860
1860
  hmrDirtyComponents.add(oldComp);
1861
1861
  }
1862
+ instance.appContext.propsCache.delete(instance.type);
1863
+ instance.appContext.emitsCache.delete(instance.type);
1862
1864
  instance.appContext.optionsCache.delete(instance.type);
1863
1865
  if (instance.ceReload) {
1864
1866
  hmrDirtyComponents.add(oldComp);
@@ -2701,7 +2703,8 @@ var VueRuntimeDOM = (function (exports) {
2701
2703
  }
2702
2704
  }
2703
2705
  let hasWarned = false;
2704
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2706
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
2707
+ var _a;
2705
2708
  if (!hasWarned) {
2706
2709
  hasWarned = true;
2707
2710
  console[console.info ? "info" : "log"](
@@ -2715,13 +2718,21 @@ var VueRuntimeDOM = (function (exports) {
2715
2718
  n: next,
2716
2719
  o: { parentNode, remove }
2717
2720
  } = rendererInternals;
2721
+ let parentSuspenseId;
2722
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
2723
+ if (isSuspensible) {
2724
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
2725
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
2726
+ parentSuspense.deps++;
2727
+ }
2728
+ }
2718
2729
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
2719
2730
  {
2720
2731
  assertNumber(timeout, `Suspense timeout`);
2721
2732
  }
2722
2733
  const suspense = {
2723
2734
  vnode,
2724
- parent,
2735
+ parent: parentSuspense,
2725
2736
  parentComponent,
2726
2737
  isSVG,
2727
2738
  container,
@@ -2781,20 +2792,28 @@ var VueRuntimeDOM = (function (exports) {
2781
2792
  setActiveBranch(suspense, pendingBranch);
2782
2793
  suspense.pendingBranch = null;
2783
2794
  suspense.isInFallback = false;
2784
- let parent2 = suspense.parent;
2795
+ let parent = suspense.parent;
2785
2796
  let hasUnresolvedAncestor = false;
2786
- while (parent2) {
2787
- if (parent2.pendingBranch) {
2788
- parent2.effects.push(...effects);
2797
+ while (parent) {
2798
+ if (parent.pendingBranch) {
2799
+ parent.effects.push(...effects);
2789
2800
  hasUnresolvedAncestor = true;
2790
2801
  break;
2791
2802
  }
2792
- parent2 = parent2.parent;
2803
+ parent = parent.parent;
2793
2804
  }
2794
2805
  if (!hasUnresolvedAncestor) {
2795
2806
  queuePostFlushCb(effects);
2796
2807
  }
2797
2808
  suspense.effects = [];
2809
+ if (isSuspensible) {
2810
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
2811
+ parentSuspense.deps--;
2812
+ if (parentSuspense.deps === 0) {
2813
+ parentSuspense.resolve();
2814
+ }
2815
+ }
2816
+ }
2798
2817
  triggerEvent(vnode2, "onResolve");
2799
2818
  },
2800
2819
  fallback(fallbackVNode) {
@@ -2894,13 +2913,13 @@ var VueRuntimeDOM = (function (exports) {
2894
2913
  }
2895
2914
  });
2896
2915
  },
2897
- unmount(parentSuspense, doRemove) {
2916
+ unmount(parentSuspense2, doRemove) {
2898
2917
  suspense.isUnmounted = true;
2899
2918
  if (suspense.activeBranch) {
2900
2919
  unmount(
2901
2920
  suspense.activeBranch,
2902
2921
  parentComponent,
2903
- parentSuspense,
2922
+ parentSuspense2,
2904
2923
  doRemove
2905
2924
  );
2906
2925
  }
@@ -2908,7 +2927,7 @@ var VueRuntimeDOM = (function (exports) {
2908
2927
  unmount(
2909
2928
  suspense.pendingBranch,
2910
2929
  parentComponent,
2911
- parentSuspense,
2930
+ parentSuspense2,
2912
2931
  doRemove
2913
2932
  );
2914
2933
  }
@@ -3001,36 +3020,6 @@ var VueRuntimeDOM = (function (exports) {
3001
3020
  }
3002
3021
  }
3003
3022
 
3004
- function provide(key, value) {
3005
- if (!currentInstance) {
3006
- {
3007
- warn(`provide() can only be used inside setup().`);
3008
- }
3009
- } else {
3010
- let provides = currentInstance.provides;
3011
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3012
- if (parentProvides === provides) {
3013
- provides = currentInstance.provides = Object.create(parentProvides);
3014
- }
3015
- provides[key] = value;
3016
- }
3017
- }
3018
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3019
- const instance = currentInstance || currentRenderingInstance;
3020
- if (instance) {
3021
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3022
- if (provides && key in provides) {
3023
- return provides[key];
3024
- } else if (arguments.length > 1) {
3025
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3026
- } else {
3027
- warn(`injection "${String(key)}" not found.`);
3028
- }
3029
- } else {
3030
- warn(`inject() can only be used inside setup() or functional components.`);
3031
- }
3032
- }
3033
-
3034
3023
  function watchEffect(effect, options) {
3035
3024
  return doWatch(effect, null, options);
3036
3025
  }
@@ -3256,6 +3245,65 @@ var VueRuntimeDOM = (function (exports) {
3256
3245
  return value;
3257
3246
  }
3258
3247
 
3248
+ function validateDirectiveName(name) {
3249
+ if (isBuiltInDirective(name)) {
3250
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3251
+ }
3252
+ }
3253
+ function withDirectives(vnode, directives) {
3254
+ const internalInstance = currentRenderingInstance;
3255
+ if (internalInstance === null) {
3256
+ warn(`withDirectives can only be used inside render functions.`);
3257
+ return vnode;
3258
+ }
3259
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3260
+ const bindings = vnode.dirs || (vnode.dirs = []);
3261
+ for (let i = 0; i < directives.length; i++) {
3262
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3263
+ if (dir) {
3264
+ if (isFunction(dir)) {
3265
+ dir = {
3266
+ mounted: dir,
3267
+ updated: dir
3268
+ };
3269
+ }
3270
+ if (dir.deep) {
3271
+ traverse(value);
3272
+ }
3273
+ bindings.push({
3274
+ dir,
3275
+ instance,
3276
+ value,
3277
+ oldValue: void 0,
3278
+ arg,
3279
+ modifiers
3280
+ });
3281
+ }
3282
+ }
3283
+ return vnode;
3284
+ }
3285
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3286
+ const bindings = vnode.dirs;
3287
+ const oldBindings = prevVNode && prevVNode.dirs;
3288
+ for (let i = 0; i < bindings.length; i++) {
3289
+ const binding = bindings[i];
3290
+ if (oldBindings) {
3291
+ binding.oldValue = oldBindings[i].value;
3292
+ }
3293
+ let hook = binding.dir[name];
3294
+ if (hook) {
3295
+ pauseTracking();
3296
+ callWithAsyncErrorHandling(hook, instance, 8, [
3297
+ vnode.el,
3298
+ binding,
3299
+ vnode,
3300
+ prevVNode
3301
+ ]);
3302
+ resetTracking();
3303
+ }
3304
+ }
3305
+ }
3306
+
3259
3307
  function useTransitionState() {
3260
3308
  const state = {
3261
3309
  isMounted: false,
@@ -4013,65 +4061,6 @@ var VueRuntimeDOM = (function (exports) {
4013
4061
  injectHook("ec", hook, target);
4014
4062
  }
4015
4063
 
4016
- function validateDirectiveName(name) {
4017
- if (isBuiltInDirective(name)) {
4018
- warn("Do not use built-in directive ids as custom directive id: " + name);
4019
- }
4020
- }
4021
- function withDirectives(vnode, directives) {
4022
- const internalInstance = currentRenderingInstance;
4023
- if (internalInstance === null) {
4024
- warn(`withDirectives can only be used inside render functions.`);
4025
- return vnode;
4026
- }
4027
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4028
- const bindings = vnode.dirs || (vnode.dirs = []);
4029
- for (let i = 0; i < directives.length; i++) {
4030
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4031
- if (dir) {
4032
- if (isFunction(dir)) {
4033
- dir = {
4034
- mounted: dir,
4035
- updated: dir
4036
- };
4037
- }
4038
- if (dir.deep) {
4039
- traverse(value);
4040
- }
4041
- bindings.push({
4042
- dir,
4043
- instance,
4044
- value,
4045
- oldValue: void 0,
4046
- arg,
4047
- modifiers
4048
- });
4049
- }
4050
- }
4051
- return vnode;
4052
- }
4053
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4054
- const bindings = vnode.dirs;
4055
- const oldBindings = prevVNode && prevVNode.dirs;
4056
- for (let i = 0; i < bindings.length; i++) {
4057
- const binding = bindings[i];
4058
- if (oldBindings) {
4059
- binding.oldValue = oldBindings[i].value;
4060
- }
4061
- let hook = binding.dir[name];
4062
- if (hook) {
4063
- pauseTracking();
4064
- callWithAsyncErrorHandling(hook, instance, 8, [
4065
- vnode.el,
4066
- binding,
4067
- vnode,
4068
- prevVNode
4069
- ]);
4070
- resetTracking();
4071
- }
4072
- }
4073
- }
4074
-
4075
4064
  const COMPONENTS = "components";
4076
4065
  const DIRECTIVES = "directives";
4077
4066
  function resolveComponent(name, maybeSelfReference) {
@@ -4320,6 +4309,8 @@ If this is a native custom element, make sure to exclude it from component resol
4320
4309
  if (key === "$attrs") {
4321
4310
  track(instance, "get", key);
4322
4311
  markAttrsAccessed();
4312
+ } else if (key === "$slots") {
4313
+ track(instance, "get", key);
4323
4314
  }
4324
4315
  return publicGetter(instance);
4325
4316
  } else if (
@@ -4489,96 +4480,246 @@ If this is a native custom element, make sure to exclude it from component resol
4489
4480
  });
4490
4481
  }
4491
4482
 
4492
- function createDuplicateChecker() {
4493
- const cache = /* @__PURE__ */ Object.create(null);
4494
- return (type, key) => {
4495
- if (cache[key]) {
4496
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
4497
- } else {
4498
- cache[key] = type;
4499
- }
4500
- };
4501
- }
4502
- let shouldCacheAccess = true;
4503
- function applyOptions(instance) {
4504
- const options = resolveMergedOptions(instance);
4505
- const publicThis = instance.proxy;
4506
- const ctx = instance.ctx;
4507
- shouldCacheAccess = false;
4508
- if (options.beforeCreate) {
4509
- callHook$1(options.beforeCreate, instance, "bc");
4483
+ const warnRuntimeUsage = (method) => warn(
4484
+ `${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.`
4485
+ );
4486
+ function defineProps() {
4487
+ {
4488
+ warnRuntimeUsage(`defineProps`);
4510
4489
  }
4511
- const {
4512
- // state
4513
- data: dataOptions,
4514
- computed: computedOptions,
4515
- methods,
4516
- watch: watchOptions,
4517
- provide: provideOptions,
4518
- inject: injectOptions,
4519
- // lifecycle
4520
- created,
4521
- beforeMount,
4522
- mounted,
4523
- beforeUpdate,
4524
- updated,
4525
- activated,
4526
- deactivated,
4527
- beforeDestroy,
4528
- beforeUnmount,
4529
- destroyed,
4530
- unmounted,
4531
- render,
4532
- renderTracked,
4533
- renderTriggered,
4534
- errorCaptured,
4535
- serverPrefetch,
4536
- // public API
4537
- expose,
4538
- inheritAttrs,
4539
- // assets
4540
- components,
4541
- directives,
4542
- filters
4543
- } = options;
4544
- const checkDuplicateProperties = createDuplicateChecker() ;
4490
+ return null;
4491
+ }
4492
+ function defineEmits() {
4545
4493
  {
4546
- const [propsOptions] = instance.propsOptions;
4547
- if (propsOptions) {
4548
- for (const key in propsOptions) {
4549
- checkDuplicateProperties("Props" /* PROPS */, key);
4550
- }
4551
- }
4494
+ warnRuntimeUsage(`defineEmits`);
4552
4495
  }
4553
- if (injectOptions) {
4554
- resolveInjections(
4555
- injectOptions,
4556
- ctx,
4557
- checkDuplicateProperties,
4558
- instance.appContext.config.unwrapInjectedRef
4559
- );
4496
+ return null;
4497
+ }
4498
+ function defineExpose(exposed) {
4499
+ {
4500
+ warnRuntimeUsage(`defineExpose`);
4560
4501
  }
4561
- if (methods) {
4562
- for (const key in methods) {
4563
- const methodHandler = methods[key];
4564
- if (isFunction(methodHandler)) {
4565
- {
4566
- Object.defineProperty(ctx, key, {
4567
- value: methodHandler.bind(publicThis),
4568
- configurable: true,
4569
- enumerable: true,
4570
- writable: true
4571
- });
4572
- }
4573
- {
4574
- checkDuplicateProperties("Methods" /* METHODS */, key);
4575
- }
4576
- } else {
4577
- warn(
4578
- `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
4579
- );
4580
- }
4581
- }
4502
+ }
4503
+ function defineOptions(options) {
4504
+ {
4505
+ warnRuntimeUsage(`defineOptions`);
4506
+ }
4507
+ }
4508
+ function defineSlots() {
4509
+ {
4510
+ warnRuntimeUsage(`defineSlots`);
4511
+ }
4512
+ return null;
4513
+ }
4514
+ function defineModel() {
4515
+ {
4516
+ warnRuntimeUsage("defineModel");
4517
+ }
4518
+ }
4519
+ function withDefaults(props, defaults) {
4520
+ {
4521
+ warnRuntimeUsage(`withDefaults`);
4522
+ }
4523
+ return null;
4524
+ }
4525
+ function useSlots() {
4526
+ return getContext().slots;
4527
+ }
4528
+ function useAttrs() {
4529
+ return getContext().attrs;
4530
+ }
4531
+ function useModel(props, name, options) {
4532
+ const i = getCurrentInstance();
4533
+ if (!i) {
4534
+ warn(`useModel() called without active instance.`);
4535
+ return ref();
4536
+ }
4537
+ if (!i.propsOptions[0][name]) {
4538
+ warn(`useModel() called with prop "${name}" which is not declared.`);
4539
+ return ref();
4540
+ }
4541
+ if (options && options.local) {
4542
+ const proxy = ref(props[name]);
4543
+ watch(
4544
+ () => props[name],
4545
+ (v) => proxy.value = v
4546
+ );
4547
+ watch(proxy, (value) => {
4548
+ if (value !== props[name]) {
4549
+ i.emit(`update:${name}`, value);
4550
+ }
4551
+ });
4552
+ return proxy;
4553
+ } else {
4554
+ return {
4555
+ __v_isRef: true,
4556
+ get value() {
4557
+ return props[name];
4558
+ },
4559
+ set value(value) {
4560
+ i.emit(`update:${name}`, value);
4561
+ }
4562
+ };
4563
+ }
4564
+ }
4565
+ function getContext() {
4566
+ const i = getCurrentInstance();
4567
+ if (!i) {
4568
+ warn(`useContext() called without active instance.`);
4569
+ }
4570
+ return i.setupContext || (i.setupContext = createSetupContext(i));
4571
+ }
4572
+ function normalizePropsOrEmits(props) {
4573
+ return isArray(props) ? props.reduce(
4574
+ (normalized, p) => (normalized[p] = null, normalized),
4575
+ {}
4576
+ ) : props;
4577
+ }
4578
+ function mergeDefaults(raw, defaults) {
4579
+ const props = normalizePropsOrEmits(raw);
4580
+ for (const key in defaults) {
4581
+ if (key.startsWith("__skip"))
4582
+ continue;
4583
+ let opt = props[key];
4584
+ if (opt) {
4585
+ if (isArray(opt) || isFunction(opt)) {
4586
+ opt = props[key] = { type: opt, default: defaults[key] };
4587
+ } else {
4588
+ opt.default = defaults[key];
4589
+ }
4590
+ } else if (opt === null) {
4591
+ opt = props[key] = { default: defaults[key] };
4592
+ } else {
4593
+ warn(`props default key "${key}" has no corresponding declaration.`);
4594
+ }
4595
+ if (opt && defaults[`__skip_${key}`]) {
4596
+ opt.skipFactory = true;
4597
+ }
4598
+ }
4599
+ return props;
4600
+ }
4601
+ function mergeModels(a, b) {
4602
+ if (!a || !b)
4603
+ return a || b;
4604
+ if (isArray(a) && isArray(b))
4605
+ return a.concat(b);
4606
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
4607
+ }
4608
+ function createPropsRestProxy(props, excludedKeys) {
4609
+ const ret = {};
4610
+ for (const key in props) {
4611
+ if (!excludedKeys.includes(key)) {
4612
+ Object.defineProperty(ret, key, {
4613
+ enumerable: true,
4614
+ get: () => props[key]
4615
+ });
4616
+ }
4617
+ }
4618
+ return ret;
4619
+ }
4620
+ function withAsyncContext(getAwaitable) {
4621
+ const ctx = getCurrentInstance();
4622
+ if (!ctx) {
4623
+ warn(
4624
+ `withAsyncContext called without active current instance. This is likely a bug.`
4625
+ );
4626
+ }
4627
+ let awaitable = getAwaitable();
4628
+ unsetCurrentInstance();
4629
+ if (isPromise(awaitable)) {
4630
+ awaitable = awaitable.catch((e) => {
4631
+ setCurrentInstance(ctx);
4632
+ throw e;
4633
+ });
4634
+ }
4635
+ return [awaitable, () => setCurrentInstance(ctx)];
4636
+ }
4637
+
4638
+ function createDuplicateChecker() {
4639
+ const cache = /* @__PURE__ */ Object.create(null);
4640
+ return (type, key) => {
4641
+ if (cache[key]) {
4642
+ warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
4643
+ } else {
4644
+ cache[key] = type;
4645
+ }
4646
+ };
4647
+ }
4648
+ let shouldCacheAccess = true;
4649
+ function applyOptions(instance) {
4650
+ const options = resolveMergedOptions(instance);
4651
+ const publicThis = instance.proxy;
4652
+ const ctx = instance.ctx;
4653
+ shouldCacheAccess = false;
4654
+ if (options.beforeCreate) {
4655
+ callHook$1(options.beforeCreate, instance, "bc");
4656
+ }
4657
+ const {
4658
+ // state
4659
+ data: dataOptions,
4660
+ computed: computedOptions,
4661
+ methods,
4662
+ watch: watchOptions,
4663
+ provide: provideOptions,
4664
+ inject: injectOptions,
4665
+ // lifecycle
4666
+ created,
4667
+ beforeMount,
4668
+ mounted,
4669
+ beforeUpdate,
4670
+ updated,
4671
+ activated,
4672
+ deactivated,
4673
+ beforeDestroy,
4674
+ beforeUnmount,
4675
+ destroyed,
4676
+ unmounted,
4677
+ render,
4678
+ renderTracked,
4679
+ renderTriggered,
4680
+ errorCaptured,
4681
+ serverPrefetch,
4682
+ // public API
4683
+ expose,
4684
+ inheritAttrs,
4685
+ // assets
4686
+ components,
4687
+ directives,
4688
+ filters
4689
+ } = options;
4690
+ const checkDuplicateProperties = createDuplicateChecker() ;
4691
+ {
4692
+ const [propsOptions] = instance.propsOptions;
4693
+ if (propsOptions) {
4694
+ for (const key in propsOptions) {
4695
+ checkDuplicateProperties("Props" /* PROPS */, key);
4696
+ }
4697
+ }
4698
+ }
4699
+ if (injectOptions) {
4700
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
4701
+ }
4702
+ if (methods) {
4703
+ for (const key in methods) {
4704
+ const methodHandler = methods[key];
4705
+ if (isFunction(methodHandler)) {
4706
+ {
4707
+ Object.defineProperty(ctx, key, {
4708
+ value: methodHandler.bind(publicThis),
4709
+ configurable: true,
4710
+ enumerable: true,
4711
+ writable: true
4712
+ });
4713
+ }
4714
+ {
4715
+ checkDuplicateProperties("Methods" /* METHODS */, key);
4716
+ }
4717
+ } else {
4718
+ warn(
4719
+ `Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`
4720
+ );
4721
+ }
4722
+ }
4582
4723
  }
4583
4724
  if (dataOptions) {
4584
4725
  if (!isFunction(dataOptions)) {
@@ -4696,7 +4837,7 @@ If this is a native custom element, make sure to exclude it from component resol
4696
4837
  if (directives)
4697
4838
  instance.directives = directives;
4698
4839
  }
4699
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
4840
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
4700
4841
  if (isArray(injectOptions)) {
4701
4842
  injectOptions = normalizeInject(injectOptions);
4702
4843
  }
@@ -4718,21 +4859,12 @@ If this is a native custom element, make sure to exclude it from component resol
4718
4859
  injected = inject(opt);
4719
4860
  }
4720
4861
  if (isRef(injected)) {
4721
- if (unwrapRef) {
4722
- Object.defineProperty(ctx, key, {
4723
- enumerable: true,
4724
- configurable: true,
4725
- get: () => injected.value,
4726
- set: (v) => injected.value = v
4727
- });
4728
- } else {
4729
- {
4730
- warn(
4731
- `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.)`
4732
- );
4733
- }
4734
- ctx[key] = injected;
4735
- }
4862
+ Object.defineProperty(ctx, key, {
4863
+ enumerable: true,
4864
+ configurable: true,
4865
+ get: () => injected.value,
4866
+ set: (v) => injected.value = v
4867
+ });
4736
4868
  } else {
4737
4869
  ctx[key] = injected;
4738
4870
  }
@@ -4828,10 +4960,8 @@ If this is a native custom element, make sure to exclude it from component resol
4828
4960
  }
4829
4961
  const internalOptionMergeStrats = {
4830
4962
  data: mergeDataFn,
4831
- props: mergeObjectOptions,
4832
- // TODO
4833
- emits: mergeObjectOptions,
4834
- // TODO
4963
+ props: mergeEmitsOrPropsOptions,
4964
+ emits: mergeEmitsOrPropsOptions,
4835
4965
  // objects
4836
4966
  methods: mergeObjectOptions,
4837
4967
  computed: mergeObjectOptions,
@@ -4890,7 +5020,21 @@ If this is a native custom element, make sure to exclude it from component resol
4890
5020
  return to ? [...new Set([].concat(to, from))] : from;
4891
5021
  }
4892
5022
  function mergeObjectOptions(to, from) {
4893
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
5023
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
5024
+ }
5025
+ function mergeEmitsOrPropsOptions(to, from) {
5026
+ if (to) {
5027
+ if (isArray(to) && isArray(from)) {
5028
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
5029
+ }
5030
+ return extend(
5031
+ /* @__PURE__ */ Object.create(null),
5032
+ normalizePropsOrEmits(to),
5033
+ normalizePropsOrEmits(from != null ? from : {})
5034
+ );
5035
+ } else {
5036
+ return from;
5037
+ }
4894
5038
  }
4895
5039
  function mergeWatchOptions(to, from) {
4896
5040
  if (!to)
@@ -4904,30 +5048,254 @@ If this is a native custom element, make sure to exclude it from component resol
4904
5048
  return merged;
4905
5049
  }
4906
5050
 
4907
- function initProps(instance, rawProps, isStateful, isSSR = false) {
4908
- const props = {};
4909
- const attrs = {};
4910
- def(attrs, InternalObjectKey, 1);
4911
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
4912
- setFullProps(instance, rawProps, props, attrs);
4913
- for (const key in instance.propsOptions[0]) {
4914
- if (!(key in props)) {
4915
- props[key] = void 0;
5051
+ function createAppContext() {
5052
+ return {
5053
+ app: null,
5054
+ config: {
5055
+ isNativeTag: NO,
5056
+ performance: false,
5057
+ globalProperties: {},
5058
+ optionMergeStrategies: {},
5059
+ errorHandler: void 0,
5060
+ warnHandler: void 0,
5061
+ compilerOptions: {}
5062
+ },
5063
+ mixins: [],
5064
+ components: {},
5065
+ directives: {},
5066
+ provides: /* @__PURE__ */ Object.create(null),
5067
+ optionsCache: /* @__PURE__ */ new WeakMap(),
5068
+ propsCache: /* @__PURE__ */ new WeakMap(),
5069
+ emitsCache: /* @__PURE__ */ new WeakMap()
5070
+ };
5071
+ }
5072
+ let uid$1 = 0;
5073
+ function createAppAPI(render, hydrate) {
5074
+ return function createApp(rootComponent, rootProps = null) {
5075
+ if (!isFunction(rootComponent)) {
5076
+ rootComponent = extend({}, rootComponent);
4916
5077
  }
4917
- }
4918
- {
4919
- validateProps(rawProps || {}, props, instance);
4920
- }
4921
- if (isStateful) {
4922
- instance.props = isSSR ? props : shallowReactive(props);
4923
- } else {
4924
- if (!instance.type.props) {
4925
- instance.props = attrs;
4926
- } else {
4927
- instance.props = props;
5078
+ if (rootProps != null && !isObject(rootProps)) {
5079
+ warn(`root props passed to app.mount() must be an object.`);
5080
+ rootProps = null;
4928
5081
  }
4929
- }
4930
- instance.attrs = attrs;
5082
+ const context = createAppContext();
5083
+ {
5084
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
5085
+ get() {
5086
+ return true;
5087
+ },
5088
+ set() {
5089
+ warn(
5090
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
5091
+ );
5092
+ }
5093
+ });
5094
+ }
5095
+ const installedPlugins = /* @__PURE__ */ new Set();
5096
+ let isMounted = false;
5097
+ const app = context.app = {
5098
+ _uid: uid$1++,
5099
+ _component: rootComponent,
5100
+ _props: rootProps,
5101
+ _container: null,
5102
+ _context: context,
5103
+ _instance: null,
5104
+ version,
5105
+ get config() {
5106
+ return context.config;
5107
+ },
5108
+ set config(v) {
5109
+ {
5110
+ warn(
5111
+ `app.config cannot be replaced. Modify individual options instead.`
5112
+ );
5113
+ }
5114
+ },
5115
+ use(plugin, ...options) {
5116
+ if (installedPlugins.has(plugin)) {
5117
+ warn(`Plugin has already been applied to target app.`);
5118
+ } else if (plugin && isFunction(plugin.install)) {
5119
+ installedPlugins.add(plugin);
5120
+ plugin.install(app, ...options);
5121
+ } else if (isFunction(plugin)) {
5122
+ installedPlugins.add(plugin);
5123
+ plugin(app, ...options);
5124
+ } else {
5125
+ warn(
5126
+ `A plugin must either be a function or an object with an "install" function.`
5127
+ );
5128
+ }
5129
+ return app;
5130
+ },
5131
+ mixin(mixin) {
5132
+ {
5133
+ if (!context.mixins.includes(mixin)) {
5134
+ context.mixins.push(mixin);
5135
+ } else {
5136
+ warn(
5137
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
5138
+ );
5139
+ }
5140
+ }
5141
+ return app;
5142
+ },
5143
+ component(name, component) {
5144
+ {
5145
+ validateComponentName(name, context.config);
5146
+ }
5147
+ if (!component) {
5148
+ return context.components[name];
5149
+ }
5150
+ if (context.components[name]) {
5151
+ warn(`Component "${name}" has already been registered in target app.`);
5152
+ }
5153
+ context.components[name] = component;
5154
+ return app;
5155
+ },
5156
+ directive(name, directive) {
5157
+ {
5158
+ validateDirectiveName(name);
5159
+ }
5160
+ if (!directive) {
5161
+ return context.directives[name];
5162
+ }
5163
+ if (context.directives[name]) {
5164
+ warn(`Directive "${name}" has already been registered in target app.`);
5165
+ }
5166
+ context.directives[name] = directive;
5167
+ return app;
5168
+ },
5169
+ mount(rootContainer, isHydrate, isSVG) {
5170
+ if (!isMounted) {
5171
+ if (rootContainer.__vue_app__) {
5172
+ warn(
5173
+ `There is already an app instance mounted on the host container.
5174
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
5175
+ );
5176
+ }
5177
+ const vnode = createVNode(
5178
+ rootComponent,
5179
+ rootProps
5180
+ );
5181
+ vnode.appContext = context;
5182
+ {
5183
+ context.reload = () => {
5184
+ render(cloneVNode(vnode), rootContainer, isSVG);
5185
+ };
5186
+ }
5187
+ if (isHydrate && hydrate) {
5188
+ hydrate(vnode, rootContainer);
5189
+ } else {
5190
+ render(vnode, rootContainer, isSVG);
5191
+ }
5192
+ isMounted = true;
5193
+ app._container = rootContainer;
5194
+ rootContainer.__vue_app__ = app;
5195
+ {
5196
+ app._instance = vnode.component;
5197
+ devtoolsInitApp(app, version);
5198
+ }
5199
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
5200
+ } else {
5201
+ warn(
5202
+ `App has already been mounted.
5203
+ 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)\``
5204
+ );
5205
+ }
5206
+ },
5207
+ unmount() {
5208
+ if (isMounted) {
5209
+ render(null, app._container);
5210
+ {
5211
+ app._instance = null;
5212
+ devtoolsUnmountApp(app);
5213
+ }
5214
+ delete app._container.__vue_app__;
5215
+ } else {
5216
+ warn(`Cannot unmount an app that is not mounted.`);
5217
+ }
5218
+ },
5219
+ provide(key, value) {
5220
+ if (key in context.provides) {
5221
+ warn(
5222
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
5223
+ );
5224
+ }
5225
+ context.provides[key] = value;
5226
+ return app;
5227
+ },
5228
+ runWithContext(fn) {
5229
+ currentApp = app;
5230
+ try {
5231
+ return fn();
5232
+ } finally {
5233
+ currentApp = null;
5234
+ }
5235
+ }
5236
+ };
5237
+ return app;
5238
+ };
5239
+ }
5240
+ let currentApp = null;
5241
+
5242
+ function provide(key, value) {
5243
+ if (!currentInstance) {
5244
+ {
5245
+ warn(`provide() can only be used inside setup().`);
5246
+ }
5247
+ } else {
5248
+ let provides = currentInstance.provides;
5249
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
5250
+ if (parentProvides === provides) {
5251
+ provides = currentInstance.provides = Object.create(parentProvides);
5252
+ }
5253
+ provides[key] = value;
5254
+ }
5255
+ }
5256
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
5257
+ const instance = currentInstance || currentRenderingInstance;
5258
+ if (instance || currentApp) {
5259
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5260
+ if (provides && key in provides) {
5261
+ return provides[key];
5262
+ } else if (arguments.length > 1) {
5263
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
5264
+ } else {
5265
+ warn(`injection "${String(key)}" not found.`);
5266
+ }
5267
+ } else {
5268
+ warn(`inject() can only be used inside setup() or functional components.`);
5269
+ }
5270
+ }
5271
+ function hasInjectionContext() {
5272
+ return !!(currentInstance || currentRenderingInstance || currentApp);
5273
+ }
5274
+
5275
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
5276
+ const props = {};
5277
+ const attrs = {};
5278
+ def(attrs, InternalObjectKey, 1);
5279
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
5280
+ setFullProps(instance, rawProps, props, attrs);
5281
+ for (const key in instance.propsOptions[0]) {
5282
+ if (!(key in props)) {
5283
+ props[key] = void 0;
5284
+ }
5285
+ }
5286
+ {
5287
+ validateProps(rawProps || {}, props, instance);
5288
+ }
5289
+ if (isStateful) {
5290
+ instance.props = isSSR ? props : shallowReactive(props);
5291
+ } else {
5292
+ if (!instance.type.props) {
5293
+ instance.props = attrs;
5294
+ } else {
5295
+ instance.props = props;
5296
+ }
5297
+ }
5298
+ instance.attrs = attrs;
4931
5299
  }
4932
5300
  function isInHmrContext(instance) {
4933
5301
  while (instance) {
@@ -5219,7 +5587,7 @@ If this is a native custom element, make sure to exclude it from component resol
5219
5587
  warn('Missing required prop: "' + name + '"');
5220
5588
  return;
5221
5589
  }
5222
- if (value == null && !prop.required) {
5590
+ if (value == null && !required) {
5223
5591
  return;
5224
5592
  }
5225
5593
  if (type != null && type !== true && !skipCheck) {
@@ -5253,319 +5621,150 @@ If this is a native custom element, make sure to exclude it from component resol
5253
5621
  valid = value instanceof type;
5254
5622
  }
5255
5623
  } else if (expectedType === "Object") {
5256
- valid = isObject(value);
5257
- } else if (expectedType === "Array") {
5258
- valid = isArray(value);
5259
- } else if (expectedType === "null") {
5260
- valid = value === null;
5261
- } else {
5262
- valid = value instanceof type;
5263
- }
5264
- return {
5265
- valid,
5266
- expectedType
5267
- };
5268
- }
5269
- function getInvalidTypeMessage(name, value, expectedTypes) {
5270
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5271
- const expectedType = expectedTypes[0];
5272
- const receivedType = toRawType(value);
5273
- const expectedValue = styleValue(value, expectedType);
5274
- const receivedValue = styleValue(value, receivedType);
5275
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5276
- message += ` with value ${expectedValue}`;
5277
- }
5278
- message += `, got ${receivedType} `;
5279
- if (isExplicable(receivedType)) {
5280
- message += `with value ${receivedValue}.`;
5281
- }
5282
- return message;
5283
- }
5284
- function styleValue(value, type) {
5285
- if (type === "String") {
5286
- return `"${value}"`;
5287
- } else if (type === "Number") {
5288
- return `${Number(value)}`;
5289
- } else {
5290
- return `${value}`;
5291
- }
5292
- }
5293
- function isExplicable(type) {
5294
- const explicitTypes = ["string", "number", "boolean"];
5295
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
5296
- }
5297
- function isBoolean(...args) {
5298
- return args.some((elem) => elem.toLowerCase() === "boolean");
5299
- }
5300
-
5301
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5302
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5303
- const normalizeSlot = (key, rawSlot, ctx) => {
5304
- if (rawSlot._n) {
5305
- return rawSlot;
5306
- }
5307
- const normalized = withCtx((...args) => {
5308
- if (currentInstance) {
5309
- warn(
5310
- `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.`
5311
- );
5312
- }
5313
- return normalizeSlotValue(rawSlot(...args));
5314
- }, ctx);
5315
- normalized._c = false;
5316
- return normalized;
5317
- };
5318
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
5319
- const ctx = rawSlots._ctx;
5320
- for (const key in rawSlots) {
5321
- if (isInternalKey(key))
5322
- continue;
5323
- const value = rawSlots[key];
5324
- if (isFunction(value)) {
5325
- slots[key] = normalizeSlot(key, value, ctx);
5326
- } else if (value != null) {
5327
- {
5328
- warn(
5329
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
5330
- );
5331
- }
5332
- const normalized = normalizeSlotValue(value);
5333
- slots[key] = () => normalized;
5334
- }
5335
- }
5336
- };
5337
- const normalizeVNodeSlots = (instance, children) => {
5338
- if (!isKeepAlive(instance.vnode) && true) {
5339
- warn(
5340
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
5341
- );
5342
- }
5343
- const normalized = normalizeSlotValue(children);
5344
- instance.slots.default = () => normalized;
5345
- };
5346
- const initSlots = (instance, children) => {
5347
- if (instance.vnode.shapeFlag & 32) {
5348
- const type = children._;
5349
- if (type) {
5350
- instance.slots = toRaw(children);
5351
- def(children, "_", type);
5352
- } else {
5353
- normalizeObjectSlots(
5354
- children,
5355
- instance.slots = {});
5356
- }
5357
- } else {
5358
- instance.slots = {};
5359
- if (children) {
5360
- normalizeVNodeSlots(instance, children);
5361
- }
5362
- }
5363
- def(instance.slots, InternalObjectKey, 1);
5364
- };
5365
- const updateSlots = (instance, children, optimized) => {
5366
- const { vnode, slots } = instance;
5367
- let needDeletionCheck = true;
5368
- let deletionComparisonTarget = EMPTY_OBJ;
5369
- if (vnode.shapeFlag & 32) {
5370
- const type = children._;
5371
- if (type) {
5372
- if (isHmrUpdating) {
5373
- extend(slots, children);
5374
- } else if (optimized && type === 1) {
5375
- needDeletionCheck = false;
5376
- } else {
5377
- extend(slots, children);
5378
- if (!optimized && type === 1) {
5379
- delete slots._;
5380
- }
5381
- }
5382
- } else {
5383
- needDeletionCheck = !children.$stable;
5384
- normalizeObjectSlots(children, slots);
5385
- }
5386
- deletionComparisonTarget = children;
5387
- } else if (children) {
5388
- normalizeVNodeSlots(instance, children);
5389
- deletionComparisonTarget = { default: 1 };
5390
- }
5391
- if (needDeletionCheck) {
5392
- for (const key in slots) {
5393
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
5394
- delete slots[key];
5395
- }
5396
- }
5397
- }
5398
- };
5399
-
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()
5419
- };
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);
5426
- }
5427
- if (rootProps != null && !isObject(rootProps)) {
5428
- warn(`root props passed to app.mount() must be an object.`);
5429
- rootProps = null;
5430
- }
5431
- const context = createAppContext();
5432
- const installedPlugins = /* @__PURE__ */ new Set();
5433
- let isMounted = false;
5434
- const app = context.app = {
5435
- _uid: uid$1++,
5436
- _component: rootComponent,
5437
- _props: rootProps,
5438
- _container: null,
5439
- _context: context,
5440
- _instance: null,
5441
- version,
5442
- get config() {
5443
- return context.config;
5444
- },
5445
- set config(v) {
5446
- {
5447
- warn(
5448
- `app.config cannot be replaced. Modify individual options instead.`
5449
- );
5450
- }
5451
- },
5452
- use(plugin, ...options) {
5453
- if (installedPlugins.has(plugin)) {
5454
- warn(`Plugin has already been applied to target app.`);
5455
- } else if (plugin && isFunction(plugin.install)) {
5456
- installedPlugins.add(plugin);
5457
- plugin.install(app, ...options);
5458
- } else if (isFunction(plugin)) {
5459
- installedPlugins.add(plugin);
5460
- plugin(app, ...options);
5461
- } else {
5462
- warn(
5463
- `A plugin must either be a function or an object with an "install" function.`
5464
- );
5465
- }
5466
- return app;
5467
- },
5468
- mixin(mixin) {
5469
- {
5470
- if (!context.mixins.includes(mixin)) {
5471
- context.mixins.push(mixin);
5472
- } else {
5473
- warn(
5474
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
5475
- );
5476
- }
5477
- }
5478
- return app;
5479
- },
5480
- component(name, component) {
5481
- {
5482
- validateComponentName(name, context.config);
5483
- }
5484
- if (!component) {
5485
- return context.components[name];
5486
- }
5487
- if (context.components[name]) {
5488
- warn(`Component "${name}" has already been registered in target app.`);
5489
- }
5490
- context.components[name] = component;
5491
- return app;
5492
- },
5493
- directive(name, directive) {
5494
- {
5495
- validateDirectiveName(name);
5496
- }
5497
- if (!directive) {
5498
- return context.directives[name];
5499
- }
5500
- if (context.directives[name]) {
5501
- warn(`Directive "${name}" has already been registered in target app.`);
5502
- }
5503
- context.directives[name] = directive;
5504
- return app;
5505
- },
5506
- mount(rootContainer, isHydrate, isSVG) {
5507
- if (!isMounted) {
5508
- if (rootContainer.__vue_app__) {
5509
- warn(
5510
- `There is already an app instance mounted on the host container.
5511
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
5512
- );
5513
- }
5514
- const vnode = createVNode(
5515
- rootComponent,
5516
- rootProps
5517
- );
5518
- vnode.appContext = context;
5519
- {
5520
- context.reload = () => {
5521
- render(cloneVNode(vnode), rootContainer, isSVG);
5522
- };
5523
- }
5524
- if (isHydrate && hydrate) {
5525
- hydrate(vnode, rootContainer);
5526
- } else {
5527
- render(vnode, rootContainer, isSVG);
5528
- }
5529
- isMounted = true;
5530
- app._container = rootContainer;
5531
- rootContainer.__vue_app__ = app;
5532
- {
5533
- app._instance = vnode.component;
5534
- devtoolsInitApp(app, version);
5535
- }
5536
- return getExposeProxy(vnode.component) || vnode.component.proxy;
5537
- } else {
5538
- warn(
5539
- `App has already been mounted.
5540
- 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)\``
5541
- );
5542
- }
5543
- },
5544
- unmount() {
5545
- if (isMounted) {
5546
- render(null, app._container);
5547
- {
5548
- app._instance = null;
5549
- devtoolsUnmountApp(app);
5550
- }
5551
- delete app._container.__vue_app__;
5552
- } else {
5553
- warn(`Cannot unmount an app that is not mounted.`);
5554
- }
5555
- },
5556
- provide(key, value) {
5557
- if (key in context.provides) {
5558
- warn(
5559
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
5560
- );
5561
- }
5562
- context.provides[key] = value;
5563
- return app;
5564
- }
5565
- };
5566
- return app;
5624
+ valid = isObject(value);
5625
+ } else if (expectedType === "Array") {
5626
+ valid = isArray(value);
5627
+ } else if (expectedType === "null") {
5628
+ valid = value === null;
5629
+ } else {
5630
+ valid = value instanceof type;
5631
+ }
5632
+ return {
5633
+ valid,
5634
+ expectedType
5567
5635
  };
5568
5636
  }
5637
+ function getInvalidTypeMessage(name, value, expectedTypes) {
5638
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
5639
+ const expectedType = expectedTypes[0];
5640
+ const receivedType = toRawType(value);
5641
+ const expectedValue = styleValue(value, expectedType);
5642
+ const receivedValue = styleValue(value, receivedType);
5643
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
5644
+ message += ` with value ${expectedValue}`;
5645
+ }
5646
+ message += `, got ${receivedType} `;
5647
+ if (isExplicable(receivedType)) {
5648
+ message += `with value ${receivedValue}.`;
5649
+ }
5650
+ return message;
5651
+ }
5652
+ function styleValue(value, type) {
5653
+ if (type === "String") {
5654
+ return `"${value}"`;
5655
+ } else if (type === "Number") {
5656
+ return `${Number(value)}`;
5657
+ } else {
5658
+ return `${value}`;
5659
+ }
5660
+ }
5661
+ function isExplicable(type) {
5662
+ const explicitTypes = ["string", "number", "boolean"];
5663
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
5664
+ }
5665
+ function isBoolean(...args) {
5666
+ return args.some((elem) => elem.toLowerCase() === "boolean");
5667
+ }
5668
+
5669
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5670
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5671
+ const normalizeSlot = (key, rawSlot, ctx) => {
5672
+ if (rawSlot._n) {
5673
+ return rawSlot;
5674
+ }
5675
+ const normalized = withCtx((...args) => {
5676
+ if (currentInstance) {
5677
+ warn(
5678
+ `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.`
5679
+ );
5680
+ }
5681
+ return normalizeSlotValue(rawSlot(...args));
5682
+ }, ctx);
5683
+ normalized._c = false;
5684
+ return normalized;
5685
+ };
5686
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
5687
+ const ctx = rawSlots._ctx;
5688
+ for (const key in rawSlots) {
5689
+ if (isInternalKey(key))
5690
+ continue;
5691
+ const value = rawSlots[key];
5692
+ if (isFunction(value)) {
5693
+ slots[key] = normalizeSlot(key, value, ctx);
5694
+ } else if (value != null) {
5695
+ {
5696
+ warn(
5697
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
5698
+ );
5699
+ }
5700
+ const normalized = normalizeSlotValue(value);
5701
+ slots[key] = () => normalized;
5702
+ }
5703
+ }
5704
+ };
5705
+ const normalizeVNodeSlots = (instance, children) => {
5706
+ if (!isKeepAlive(instance.vnode) && true) {
5707
+ warn(
5708
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
5709
+ );
5710
+ }
5711
+ const normalized = normalizeSlotValue(children);
5712
+ instance.slots.default = () => normalized;
5713
+ };
5714
+ const initSlots = (instance, children) => {
5715
+ if (instance.vnode.shapeFlag & 32) {
5716
+ const type = children._;
5717
+ if (type) {
5718
+ instance.slots = toRaw(children);
5719
+ def(children, "_", type);
5720
+ } else {
5721
+ normalizeObjectSlots(
5722
+ children,
5723
+ instance.slots = {});
5724
+ }
5725
+ } else {
5726
+ instance.slots = {};
5727
+ if (children) {
5728
+ normalizeVNodeSlots(instance, children);
5729
+ }
5730
+ }
5731
+ def(instance.slots, InternalObjectKey, 1);
5732
+ };
5733
+ const updateSlots = (instance, children, optimized) => {
5734
+ const { vnode, slots } = instance;
5735
+ let needDeletionCheck = true;
5736
+ let deletionComparisonTarget = EMPTY_OBJ;
5737
+ if (vnode.shapeFlag & 32) {
5738
+ const type = children._;
5739
+ if (type) {
5740
+ if (isHmrUpdating) {
5741
+ extend(slots, children);
5742
+ trigger(instance, "set", "$slots");
5743
+ } else if (optimized && type === 1) {
5744
+ needDeletionCheck = false;
5745
+ } else {
5746
+ extend(slots, children);
5747
+ if (!optimized && type === 1) {
5748
+ delete slots._;
5749
+ }
5750
+ }
5751
+ } else {
5752
+ needDeletionCheck = !children.$stable;
5753
+ normalizeObjectSlots(children, slots);
5754
+ }
5755
+ deletionComparisonTarget = children;
5756
+ } else if (children) {
5757
+ normalizeVNodeSlots(instance, children);
5758
+ deletionComparisonTarget = { default: 1 };
5759
+ }
5760
+ if (needDeletionCheck) {
5761
+ for (const key in slots) {
5762
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
5763
+ delete slots[key];
5764
+ }
5765
+ }
5766
+ }
5767
+ };
5569
5768
 
5570
5769
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
5571
5770
  if (isArray(rawRef)) {
@@ -6469,7 +6668,7 @@ If you want to remount the same app, move your app creation logic into a factory
6469
6668
  areChildrenSVG,
6470
6669
  slotScopeIds
6471
6670
  );
6472
- if (parentComponent && parentComponent.type.__hmrId) {
6671
+ {
6473
6672
  traverseStaticChildren(n1, n2);
6474
6673
  }
6475
6674
  } else if (!optimized) {
@@ -6665,21 +6864,8 @@ If you want to remount the same app, move your app creation logic into a factory
6665
6864
  isSVG,
6666
6865
  slotScopeIds
6667
6866
  );
6668
- if (parentComponent && parentComponent.type.__hmrId) {
6867
+ {
6669
6868
  traverseStaticChildren(n1, n2);
6670
- } else if (
6671
- // #2080 if the stable fragment has a key, it's a <template v-for> that may
6672
- // get moved around. Make sure all root level vnodes inherit el.
6673
- // #2134 or if it's a component root, it may also get moved around
6674
- // as the component is being moved.
6675
- n2.key != null || parentComponent && n2 === parentComponent.subTree
6676
- ) {
6677
- traverseStaticChildren(
6678
- n1,
6679
- n2,
6680
- true
6681
- /* shallow */
6682
- );
6683
6869
  }
6684
6870
  } else {
6685
6871
  patchChildren(
@@ -8253,6 +8439,8 @@ Component that was made reactive: `,
8253
8439
  refs: EMPTY_OBJ,
8254
8440
  setupState: EMPTY_OBJ,
8255
8441
  setupContext: null,
8442
+ attrsProxy: null,
8443
+ slotsProxy: null,
8256
8444
  // suspense related
8257
8445
  suspense,
8258
8446
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -8480,8 +8668,8 @@ Component that was made reactive: `,
8480
8668
  }
8481
8669
  }
8482
8670
  }
8483
- function createAttrsProxy(instance) {
8484
- return new Proxy(
8671
+ function getAttrsProxy(instance) {
8672
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
8485
8673
  instance.attrs,
8486
8674
  {
8487
8675
  get(target, key) {
@@ -8498,7 +8686,23 @@ Component that was made reactive: `,
8498
8686
  return false;
8499
8687
  }
8500
8688
  }
8501
- );
8689
+ ));
8690
+ }
8691
+ function getSlotsProxy(instance) {
8692
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
8693
+ get(target, key) {
8694
+ track(instance, "get", "$slots");
8695
+ return target[key];
8696
+ },
8697
+ set() {
8698
+ warn(`setupContext.slots is readonly.`);
8699
+ return false;
8700
+ },
8701
+ deleteProperty() {
8702
+ warn(`setupContext.slots is readonly.`);
8703
+ return false;
8704
+ }
8705
+ }));
8502
8706
  }
8503
8707
  function createSetupContext(instance) {
8504
8708
  const expose = (exposed) => {
@@ -8524,14 +8728,13 @@ Component that was made reactive: `,
8524
8728
  }
8525
8729
  instance.exposed = exposed || {};
8526
8730
  };
8527
- let attrs;
8528
8731
  {
8529
8732
  return Object.freeze({
8530
8733
  get attrs() {
8531
- return attrs || (attrs = createAttrsProxy(instance));
8734
+ return getAttrsProxy(instance);
8532
8735
  },
8533
8736
  get slots() {
8534
- return shallowReadonly(instance.slots);
8737
+ return getSlotsProxy(instance);
8535
8738
  },
8536
8739
  get emit() {
8537
8740
  return (event, ...args) => instance.emit(event, ...args);
@@ -8591,111 +8794,6 @@ Component that was made reactive: `,
8591
8794
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
8592
8795
  };
8593
8796
 
8594
- const warnRuntimeUsage = (method) => warn(
8595
- `${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.`
8596
- );
8597
- function defineProps() {
8598
- {
8599
- warnRuntimeUsage(`defineProps`);
8600
- }
8601
- return null;
8602
- }
8603
- function defineEmits() {
8604
- {
8605
- warnRuntimeUsage(`defineEmits`);
8606
- }
8607
- return null;
8608
- }
8609
- function defineExpose(exposed) {
8610
- {
8611
- warnRuntimeUsage(`defineExpose`);
8612
- }
8613
- }
8614
- function defineOptions(options) {
8615
- {
8616
- warnRuntimeUsage(`defineOptions`);
8617
- }
8618
- }
8619
- function defineSlots() {
8620
- {
8621
- warnRuntimeUsage(`defineSlots`);
8622
- }
8623
- }
8624
- function withDefaults(props, defaults) {
8625
- {
8626
- warnRuntimeUsage(`withDefaults`);
8627
- }
8628
- return null;
8629
- }
8630
- function useSlots() {
8631
- return getContext().slots;
8632
- }
8633
- function useAttrs() {
8634
- return getContext().attrs;
8635
- }
8636
- function getContext() {
8637
- const i = getCurrentInstance();
8638
- if (!i) {
8639
- warn(`useContext() called without active instance.`);
8640
- }
8641
- return i.setupContext || (i.setupContext = createSetupContext(i));
8642
- }
8643
- function mergeDefaults(raw, defaults) {
8644
- const props = isArray(raw) ? raw.reduce(
8645
- (normalized, p) => (normalized[p] = {}, normalized),
8646
- {}
8647
- ) : raw;
8648
- for (const key in defaults) {
8649
- if (key.startsWith("__skip"))
8650
- continue;
8651
- let opt = props[key];
8652
- if (opt) {
8653
- if (isArray(opt) || isFunction(opt)) {
8654
- opt = props[key] = { type: opt, default: defaults[key] };
8655
- } else {
8656
- opt.default = defaults[key];
8657
- }
8658
- } else if (opt === null) {
8659
- opt = props[key] = { default: defaults[key] };
8660
- } else {
8661
- warn(`props default key "${key}" has no corresponding declaration.`);
8662
- }
8663
- if (opt && defaults[`__skip_${key}`]) {
8664
- opt.skipFactory = true;
8665
- }
8666
- }
8667
- return props;
8668
- }
8669
- function createPropsRestProxy(props, excludedKeys) {
8670
- const ret = {};
8671
- for (const key in props) {
8672
- if (!excludedKeys.includes(key)) {
8673
- Object.defineProperty(ret, key, {
8674
- enumerable: true,
8675
- get: () => props[key]
8676
- });
8677
- }
8678
- }
8679
- return ret;
8680
- }
8681
- function withAsyncContext(getAwaitable) {
8682
- const ctx = getCurrentInstance();
8683
- if (!ctx) {
8684
- warn(
8685
- `withAsyncContext called without active current instance. This is likely a bug.`
8686
- );
8687
- }
8688
- let awaitable = getAwaitable();
8689
- unsetCurrentInstance();
8690
- if (isPromise(awaitable)) {
8691
- awaitable = awaitable.catch((e) => {
8692
- setCurrentInstance(ctx);
8693
- throw e;
8694
- });
8695
- }
8696
- return [awaitable, () => setCurrentInstance(ctx)];
8697
- }
8698
-
8699
8797
  function h(type, propsOrChildren, children) {
8700
8798
  const l = arguments.length;
8701
8799
  if (l === 2) {
@@ -8925,7 +9023,7 @@ Component that was made reactive: `,
8925
9023
  return true;
8926
9024
  }
8927
9025
 
8928
- const version = "3.3.0-alpha.8";
9026
+ const version = "3.3.0-beta.1";
8929
9027
  const ssrUtils = null;
8930
9028
  const resolveFilter = null;
8931
9029
  const compatUtils = null;
@@ -10423,6 +10521,7 @@ Component that was made reactive: `,
10423
10521
  exports.defineCustomElement = defineCustomElement;
10424
10522
  exports.defineEmits = defineEmits;
10425
10523
  exports.defineExpose = defineExpose;
10524
+ exports.defineModel = defineModel;
10426
10525
  exports.defineOptions = defineOptions;
10427
10526
  exports.defineProps = defineProps;
10428
10527
  exports.defineSSRCustomElement = defineSSRCustomElement;
@@ -10435,6 +10534,7 @@ Component that was made reactive: `,
10435
10534
  exports.guardReactiveProps = guardReactiveProps;
10436
10535
  exports.h = h;
10437
10536
  exports.handleError = handleError;
10537
+ exports.hasInjectionContext = hasInjectionContext;
10438
10538
  exports.hydrate = hydrate;
10439
10539
  exports.initCustomFormatter = initCustomFormatter;
10440
10540
  exports.initDirectivesForSSR = initDirectivesForSSR;
@@ -10449,6 +10549,7 @@ Component that was made reactive: `,
10449
10549
  exports.isVNode = isVNode;
10450
10550
  exports.markRaw = markRaw;
10451
10551
  exports.mergeDefaults = mergeDefaults;
10552
+ exports.mergeModels = mergeModels;
10452
10553
  exports.mergeProps = mergeProps;
10453
10554
  exports.nextTick = nextTick;
10454
10555
  exports.normalizeClass = normalizeClass;
@@ -10507,6 +10608,7 @@ Component that was made reactive: `,
10507
10608
  exports.useAttrs = useAttrs;
10508
10609
  exports.useCssModule = useCssModule;
10509
10610
  exports.useCssVars = useCssVars;
10611
+ exports.useModel = useModel;
10510
10612
  exports.useSSRContext = useSSRContext;
10511
10613
  exports.useSlots = useSlots;
10512
10614
  exports.useTransitionState = useTransitionState;