@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.
@@ -100,7 +100,7 @@ var Vue = (function () {
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 Vue = (function () {
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);
@@ -3174,7 +3176,8 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3174
3176
  }
3175
3177
  }
3176
3178
  let hasWarned = false;
3177
- function createSuspenseBoundary(vnode, parent, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3179
+ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
3180
+ var _a;
3178
3181
  if (!hasWarned) {
3179
3182
  hasWarned = true;
3180
3183
  console[console.info ? "info" : "log"](
@@ -3188,13 +3191,21 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3188
3191
  n: next,
3189
3192
  o: { parentNode, remove }
3190
3193
  } = rendererInternals;
3194
+ let parentSuspenseId;
3195
+ const isSuspensible = ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
3196
+ if (isSuspensible) {
3197
+ if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
3198
+ parentSuspenseId = parentSuspense == null ? void 0 : parentSuspense.pendingId;
3199
+ parentSuspense.deps++;
3200
+ }
3201
+ }
3191
3202
  const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;
3192
3203
  {
3193
3204
  assertNumber(timeout, `Suspense timeout`);
3194
3205
  }
3195
3206
  const suspense = {
3196
3207
  vnode,
3197
- parent,
3208
+ parent: parentSuspense,
3198
3209
  parentComponent,
3199
3210
  isSVG,
3200
3211
  container,
@@ -3254,20 +3265,28 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3254
3265
  setActiveBranch(suspense, pendingBranch);
3255
3266
  suspense.pendingBranch = null;
3256
3267
  suspense.isInFallback = false;
3257
- let parent2 = suspense.parent;
3268
+ let parent = suspense.parent;
3258
3269
  let hasUnresolvedAncestor = false;
3259
- while (parent2) {
3260
- if (parent2.pendingBranch) {
3261
- parent2.effects.push(...effects);
3270
+ while (parent) {
3271
+ if (parent.pendingBranch) {
3272
+ parent.effects.push(...effects);
3262
3273
  hasUnresolvedAncestor = true;
3263
3274
  break;
3264
3275
  }
3265
- parent2 = parent2.parent;
3276
+ parent = parent.parent;
3266
3277
  }
3267
3278
  if (!hasUnresolvedAncestor) {
3268
3279
  queuePostFlushCb(effects);
3269
3280
  }
3270
3281
  suspense.effects = [];
3282
+ if (isSuspensible) {
3283
+ if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
3284
+ parentSuspense.deps--;
3285
+ if (parentSuspense.deps === 0) {
3286
+ parentSuspense.resolve();
3287
+ }
3288
+ }
3289
+ }
3271
3290
  triggerEvent(vnode2, "onResolve");
3272
3291
  },
3273
3292
  fallback(fallbackVNode) {
@@ -3367,13 +3386,13 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3367
3386
  }
3368
3387
  });
3369
3388
  },
3370
- unmount(parentSuspense, doRemove) {
3389
+ unmount(parentSuspense2, doRemove) {
3371
3390
  suspense.isUnmounted = true;
3372
3391
  if (suspense.activeBranch) {
3373
3392
  unmount(
3374
3393
  suspense.activeBranch,
3375
3394
  parentComponent,
3376
- parentSuspense,
3395
+ parentSuspense2,
3377
3396
  doRemove
3378
3397
  );
3379
3398
  }
@@ -3381,7 +3400,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3381
3400
  unmount(
3382
3401
  suspense.pendingBranch,
3383
3402
  parentComponent,
3384
- parentSuspense,
3403
+ parentSuspense2,
3385
3404
  doRemove
3386
3405
  );
3387
3406
  }
@@ -3474,33 +3493,41 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3474
3493
  }
3475
3494
  }
3476
3495
 
3477
- function provide(key, value) {
3478
- if (!currentInstance) {
3479
- {
3480
- warn(`provide() can only be used inside setup().`);
3481
- }
3482
- } else {
3483
- let provides = currentInstance.provides;
3484
- const parentProvides = currentInstance.parent && currentInstance.parent.provides;
3485
- if (parentProvides === provides) {
3486
- provides = currentInstance.provides = Object.create(parentProvides);
3487
- }
3488
- provides[key] = value;
3489
- }
3490
- }
3491
- function inject(key, defaultValue, treatDefaultAsFactory = false) {
3492
- const instance = currentInstance || currentRenderingInstance;
3493
- if (instance) {
3494
- const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
3495
- if (provides && key in provides) {
3496
- return provides[key];
3497
- } else if (arguments.length > 1) {
3498
- return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
3496
+ const legacyDirectiveHookMap = {
3497
+ beforeMount: "bind",
3498
+ mounted: "inserted",
3499
+ updated: ["update", "componentUpdated"],
3500
+ unmounted: "unbind"
3501
+ };
3502
+ function mapCompatDirectiveHook(name, dir, instance) {
3503
+ const mappedName = legacyDirectiveHookMap[name];
3504
+ if (mappedName) {
3505
+ if (isArray(mappedName)) {
3506
+ const hook = [];
3507
+ mappedName.forEach((mapped) => {
3508
+ const mappedHook = dir[mapped];
3509
+ if (mappedHook) {
3510
+ softAssertCompatEnabled(
3511
+ "CUSTOM_DIR",
3512
+ instance,
3513
+ mapped,
3514
+ name
3515
+ );
3516
+ hook.push(mappedHook);
3517
+ }
3518
+ });
3519
+ return hook.length ? hook : void 0;
3499
3520
  } else {
3500
- warn(`injection "${String(key)}" not found.`);
3521
+ if (dir[mappedName]) {
3522
+ softAssertCompatEnabled(
3523
+ "CUSTOM_DIR",
3524
+ instance,
3525
+ mappedName,
3526
+ name
3527
+ );
3528
+ }
3529
+ return dir[mappedName];
3501
3530
  }
3502
- } else {
3503
- warn(`inject() can only be used inside setup() or functional components.`);
3504
3531
  }
3505
3532
  }
3506
3533
 
@@ -3739,6 +3766,68 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3739
3766
  return value;
3740
3767
  }
3741
3768
 
3769
+ function validateDirectiveName(name) {
3770
+ if (isBuiltInDirective(name)) {
3771
+ warn("Do not use built-in directive ids as custom directive id: " + name);
3772
+ }
3773
+ }
3774
+ function withDirectives(vnode, directives) {
3775
+ const internalInstance = currentRenderingInstance;
3776
+ if (internalInstance === null) {
3777
+ warn(`withDirectives can only be used inside render functions.`);
3778
+ return vnode;
3779
+ }
3780
+ const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3781
+ const bindings = vnode.dirs || (vnode.dirs = []);
3782
+ for (let i = 0; i < directives.length; i++) {
3783
+ let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3784
+ if (dir) {
3785
+ if (isFunction(dir)) {
3786
+ dir = {
3787
+ mounted: dir,
3788
+ updated: dir
3789
+ };
3790
+ }
3791
+ if (dir.deep) {
3792
+ traverse(value);
3793
+ }
3794
+ bindings.push({
3795
+ dir,
3796
+ instance,
3797
+ value,
3798
+ oldValue: void 0,
3799
+ arg,
3800
+ modifiers
3801
+ });
3802
+ }
3803
+ }
3804
+ return vnode;
3805
+ }
3806
+ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
3807
+ const bindings = vnode.dirs;
3808
+ const oldBindings = prevVNode && prevVNode.dirs;
3809
+ for (let i = 0; i < bindings.length; i++) {
3810
+ const binding = bindings[i];
3811
+ if (oldBindings) {
3812
+ binding.oldValue = oldBindings[i].value;
3813
+ }
3814
+ let hook = binding.dir[name];
3815
+ if (!hook) {
3816
+ hook = mapCompatDirectiveHook(name, binding.dir, instance);
3817
+ }
3818
+ if (hook) {
3819
+ pauseTracking();
3820
+ callWithAsyncErrorHandling(hook, instance, 8, [
3821
+ vnode.el,
3822
+ binding,
3823
+ vnode,
3824
+ prevVNode
3825
+ ]);
3826
+ resetTracking();
3827
+ }
3828
+ }
3829
+ }
3830
+
3742
3831
  function useTransitionState() {
3743
3832
  const state = {
3744
3833
  isMounted: false,
@@ -4537,106 +4626,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4537
4626
  return listeners;
4538
4627
  }
4539
4628
 
4540
- const legacyDirectiveHookMap = {
4541
- beforeMount: "bind",
4542
- mounted: "inserted",
4543
- updated: ["update", "componentUpdated"],
4544
- unmounted: "unbind"
4545
- };
4546
- function mapCompatDirectiveHook(name, dir, instance) {
4547
- const mappedName = legacyDirectiveHookMap[name];
4548
- if (mappedName) {
4549
- if (isArray(mappedName)) {
4550
- const hook = [];
4551
- mappedName.forEach((mapped) => {
4552
- const mappedHook = dir[mapped];
4553
- if (mappedHook) {
4554
- softAssertCompatEnabled(
4555
- "CUSTOM_DIR",
4556
- instance,
4557
- mapped,
4558
- name
4559
- );
4560
- hook.push(mappedHook);
4561
- }
4562
- });
4563
- return hook.length ? hook : void 0;
4564
- } else {
4565
- if (dir[mappedName]) {
4566
- softAssertCompatEnabled(
4567
- "CUSTOM_DIR",
4568
- instance,
4569
- mappedName,
4570
- name
4571
- );
4572
- }
4573
- return dir[mappedName];
4574
- }
4575
- }
4576
- }
4577
-
4578
- function validateDirectiveName(name) {
4579
- if (isBuiltInDirective(name)) {
4580
- warn("Do not use built-in directive ids as custom directive id: " + name);
4581
- }
4582
- }
4583
- function withDirectives(vnode, directives) {
4584
- const internalInstance = currentRenderingInstance;
4585
- if (internalInstance === null) {
4586
- warn(`withDirectives can only be used inside render functions.`);
4587
- return vnode;
4588
- }
4589
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4590
- const bindings = vnode.dirs || (vnode.dirs = []);
4591
- for (let i = 0; i < directives.length; i++) {
4592
- let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
4593
- if (dir) {
4594
- if (isFunction(dir)) {
4595
- dir = {
4596
- mounted: dir,
4597
- updated: dir
4598
- };
4599
- }
4600
- if (dir.deep) {
4601
- traverse(value);
4602
- }
4603
- bindings.push({
4604
- dir,
4605
- instance,
4606
- value,
4607
- oldValue: void 0,
4608
- arg,
4609
- modifiers
4610
- });
4611
- }
4612
- }
4613
- return vnode;
4614
- }
4615
- function invokeDirectiveHook(vnode, prevVNode, instance, name) {
4616
- const bindings = vnode.dirs;
4617
- const oldBindings = prevVNode && prevVNode.dirs;
4618
- for (let i = 0; i < bindings.length; i++) {
4619
- const binding = bindings[i];
4620
- if (oldBindings) {
4621
- binding.oldValue = oldBindings[i].value;
4622
- }
4623
- let hook = binding.dir[name];
4624
- if (!hook) {
4625
- hook = mapCompatDirectiveHook(name, binding.dir, instance);
4626
- }
4627
- if (hook) {
4628
- pauseTracking();
4629
- callWithAsyncErrorHandling(hook, instance, 8, [
4630
- vnode.el,
4631
- binding,
4632
- vnode,
4633
- prevVNode
4634
- ]);
4635
- resetTracking();
4636
- }
4637
- }
4638
- }
4639
-
4640
4629
  const COMPONENTS = "components";
4641
4630
  const DIRECTIVES = "directives";
4642
4631
  const FILTERS = "filters";
@@ -5352,6 +5341,8 @@ If this is a native custom element, make sure to exclude it from component resol
5352
5341
  if (key === "$attrs") {
5353
5342
  track(instance, "get", key);
5354
5343
  markAttrsAccessed();
5344
+ } else if (key === "$slots") {
5345
+ track(instance, "get", key);
5355
5346
  }
5356
5347
  return publicGetter(instance);
5357
5348
  } else if (
@@ -5541,24 +5532,179 @@ If this is a native custom element, make sure to exclude it from component resol
5541
5532
  return to;
5542
5533
  }
5543
5534
 
5544
- function createDuplicateChecker() {
5545
- const cache = /* @__PURE__ */ Object.create(null);
5546
- return (type, key) => {
5547
- if (cache[key]) {
5548
- warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5549
- } else {
5550
- cache[key] = type;
5551
- }
5552
- };
5535
+ const warnRuntimeUsage = (method) => warn(
5536
+ `${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.`
5537
+ );
5538
+ function defineProps() {
5539
+ {
5540
+ warnRuntimeUsage(`defineProps`);
5541
+ }
5542
+ return null;
5553
5543
  }
5554
- let shouldCacheAccess = true;
5555
- function applyOptions(instance) {
5556
- const options = resolveMergedOptions(instance);
5557
- const publicThis = instance.proxy;
5558
- const ctx = instance.ctx;
5559
- shouldCacheAccess = false;
5560
- if (options.beforeCreate) {
5561
- callHook$1(options.beforeCreate, instance, "bc");
5544
+ function defineEmits() {
5545
+ {
5546
+ warnRuntimeUsage(`defineEmits`);
5547
+ }
5548
+ return null;
5549
+ }
5550
+ function defineExpose(exposed) {
5551
+ {
5552
+ warnRuntimeUsage(`defineExpose`);
5553
+ }
5554
+ }
5555
+ function defineOptions(options) {
5556
+ {
5557
+ warnRuntimeUsage(`defineOptions`);
5558
+ }
5559
+ }
5560
+ function defineSlots() {
5561
+ {
5562
+ warnRuntimeUsage(`defineSlots`);
5563
+ }
5564
+ return null;
5565
+ }
5566
+ function defineModel() {
5567
+ {
5568
+ warnRuntimeUsage("defineModel");
5569
+ }
5570
+ }
5571
+ function withDefaults(props, defaults) {
5572
+ {
5573
+ warnRuntimeUsage(`withDefaults`);
5574
+ }
5575
+ return null;
5576
+ }
5577
+ function useSlots() {
5578
+ return getContext().slots;
5579
+ }
5580
+ function useAttrs() {
5581
+ return getContext().attrs;
5582
+ }
5583
+ function useModel(props, name, options) {
5584
+ const i = getCurrentInstance();
5585
+ if (!i) {
5586
+ warn(`useModel() called without active instance.`);
5587
+ return ref();
5588
+ }
5589
+ if (!i.propsOptions[0][name]) {
5590
+ warn(`useModel() called with prop "${name}" which is not declared.`);
5591
+ return ref();
5592
+ }
5593
+ if (options && options.local) {
5594
+ const proxy = ref(props[name]);
5595
+ watch(
5596
+ () => props[name],
5597
+ (v) => proxy.value = v
5598
+ );
5599
+ watch(proxy, (value) => {
5600
+ if (value !== props[name]) {
5601
+ i.emit(`update:${name}`, value);
5602
+ }
5603
+ });
5604
+ return proxy;
5605
+ } else {
5606
+ return {
5607
+ __v_isRef: true,
5608
+ get value() {
5609
+ return props[name];
5610
+ },
5611
+ set value(value) {
5612
+ i.emit(`update:${name}`, value);
5613
+ }
5614
+ };
5615
+ }
5616
+ }
5617
+ function getContext() {
5618
+ const i = getCurrentInstance();
5619
+ if (!i) {
5620
+ warn(`useContext() called without active instance.`);
5621
+ }
5622
+ return i.setupContext || (i.setupContext = createSetupContext(i));
5623
+ }
5624
+ function normalizePropsOrEmits(props) {
5625
+ return isArray(props) ? props.reduce(
5626
+ (normalized, p) => (normalized[p] = null, normalized),
5627
+ {}
5628
+ ) : props;
5629
+ }
5630
+ function mergeDefaults(raw, defaults) {
5631
+ const props = normalizePropsOrEmits(raw);
5632
+ for (const key in defaults) {
5633
+ if (key.startsWith("__skip"))
5634
+ continue;
5635
+ let opt = props[key];
5636
+ if (opt) {
5637
+ if (isArray(opt) || isFunction(opt)) {
5638
+ opt = props[key] = { type: opt, default: defaults[key] };
5639
+ } else {
5640
+ opt.default = defaults[key];
5641
+ }
5642
+ } else if (opt === null) {
5643
+ opt = props[key] = { default: defaults[key] };
5644
+ } else {
5645
+ warn(`props default key "${key}" has no corresponding declaration.`);
5646
+ }
5647
+ if (opt && defaults[`__skip_${key}`]) {
5648
+ opt.skipFactory = true;
5649
+ }
5650
+ }
5651
+ return props;
5652
+ }
5653
+ function mergeModels(a, b) {
5654
+ if (!a || !b)
5655
+ return a || b;
5656
+ if (isArray(a) && isArray(b))
5657
+ return a.concat(b);
5658
+ return extend({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b));
5659
+ }
5660
+ function createPropsRestProxy(props, excludedKeys) {
5661
+ const ret = {};
5662
+ for (const key in props) {
5663
+ if (!excludedKeys.includes(key)) {
5664
+ Object.defineProperty(ret, key, {
5665
+ enumerable: true,
5666
+ get: () => props[key]
5667
+ });
5668
+ }
5669
+ }
5670
+ return ret;
5671
+ }
5672
+ function withAsyncContext(getAwaitable) {
5673
+ const ctx = getCurrentInstance();
5674
+ if (!ctx) {
5675
+ warn(
5676
+ `withAsyncContext called without active current instance. This is likely a bug.`
5677
+ );
5678
+ }
5679
+ let awaitable = getAwaitable();
5680
+ unsetCurrentInstance();
5681
+ if (isPromise(awaitable)) {
5682
+ awaitable = awaitable.catch((e) => {
5683
+ setCurrentInstance(ctx);
5684
+ throw e;
5685
+ });
5686
+ }
5687
+ return [awaitable, () => setCurrentInstance(ctx)];
5688
+ }
5689
+
5690
+ function createDuplicateChecker() {
5691
+ const cache = /* @__PURE__ */ Object.create(null);
5692
+ return (type, key) => {
5693
+ if (cache[key]) {
5694
+ warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
5695
+ } else {
5696
+ cache[key] = type;
5697
+ }
5698
+ };
5699
+ }
5700
+ let shouldCacheAccess = true;
5701
+ function applyOptions(instance) {
5702
+ const options = resolveMergedOptions(instance);
5703
+ const publicThis = instance.proxy;
5704
+ const ctx = instance.ctx;
5705
+ shouldCacheAccess = false;
5706
+ if (options.beforeCreate) {
5707
+ callHook$1(options.beforeCreate, instance, "bc");
5562
5708
  }
5563
5709
  const {
5564
5710
  // state
@@ -5603,12 +5749,7 @@ If this is a native custom element, make sure to exclude it from component resol
5603
5749
  }
5604
5750
  }
5605
5751
  if (injectOptions) {
5606
- resolveInjections(
5607
- injectOptions,
5608
- ctx,
5609
- checkDuplicateProperties,
5610
- instance.appContext.config.unwrapInjectedRef
5611
- );
5752
+ resolveInjections(injectOptions, ctx, checkDuplicateProperties);
5612
5753
  }
5613
5754
  if (methods) {
5614
5755
  for (const key in methods) {
@@ -5759,7 +5900,7 @@ If this is a native custom element, make sure to exclude it from component resol
5759
5900
  instance.filters = filters;
5760
5901
  }
5761
5902
  }
5762
- function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
5903
+ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) {
5763
5904
  if (isArray(injectOptions)) {
5764
5905
  injectOptions = normalizeInject(injectOptions);
5765
5906
  }
@@ -5781,21 +5922,12 @@ If this is a native custom element, make sure to exclude it from component resol
5781
5922
  injected = inject(opt);
5782
5923
  }
5783
5924
  if (isRef(injected)) {
5784
- if (unwrapRef) {
5785
- Object.defineProperty(ctx, key, {
5786
- enumerable: true,
5787
- configurable: true,
5788
- get: () => injected.value,
5789
- set: (v) => injected.value = v
5790
- });
5791
- } else {
5792
- {
5793
- warn(
5794
- `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.)`
5795
- );
5796
- }
5797
- ctx[key] = injected;
5798
- }
5925
+ Object.defineProperty(ctx, key, {
5926
+ enumerable: true,
5927
+ configurable: true,
5928
+ get: () => injected.value,
5929
+ set: (v) => injected.value = v
5930
+ });
5799
5931
  } else {
5800
5932
  ctx[key] = injected;
5801
5933
  }
@@ -5898,10 +6030,8 @@ If this is a native custom element, make sure to exclude it from component resol
5898
6030
  }
5899
6031
  const internalOptionMergeStrats = {
5900
6032
  data: mergeDataFn,
5901
- props: mergeObjectOptions,
5902
- // TODO
5903
- emits: mergeObjectOptions,
5904
- // TODO
6033
+ props: mergeEmitsOrPropsOptions,
6034
+ emits: mergeEmitsOrPropsOptions,
5905
6035
  // objects
5906
6036
  methods: mergeObjectOptions,
5907
6037
  computed: mergeObjectOptions,
@@ -5963,7 +6093,21 @@ If this is a native custom element, make sure to exclude it from component resol
5963
6093
  return to ? [...new Set([].concat(to, from))] : from;
5964
6094
  }
5965
6095
  function mergeObjectOptions(to, from) {
5966
- return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
6096
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
6097
+ }
6098
+ function mergeEmitsOrPropsOptions(to, from) {
6099
+ if (to) {
6100
+ if (isArray(to) && isArray(from)) {
6101
+ return [.../* @__PURE__ */ new Set([...to, ...from])];
6102
+ }
6103
+ return extend(
6104
+ /* @__PURE__ */ Object.create(null),
6105
+ normalizePropsOrEmits(to),
6106
+ normalizePropsOrEmits(from != null ? from : {})
6107
+ );
6108
+ } else {
6109
+ return from;
6110
+ }
5967
6111
  }
5968
6112
  function mergeWatchOptions(to, from) {
5969
6113
  if (!to)
@@ -5977,1179 +6121,1234 @@ If this is a native custom element, make sure to exclude it from component resol
5977
6121
  return merged;
5978
6122
  }
5979
6123
 
5980
- function createPropsDefaultThis(instance, rawProps, propKey) {
5981
- return new Proxy(
5982
- {},
5983
- {
5984
- get(_, key) {
5985
- warnDeprecation("PROPS_DEFAULT_THIS", null, propKey);
5986
- if (key === "$options") {
5987
- return resolveMergedOptions(instance);
5988
- }
5989
- if (key in rawProps) {
5990
- return rawProps[key];
5991
- }
5992
- const injections = instance.type.inject;
5993
- if (injections) {
5994
- if (isArray(injections)) {
5995
- if (injections.includes(key)) {
5996
- return inject(key);
5997
- }
5998
- } else if (key in injections) {
5999
- return inject(key);
6000
- }
6124
+ function installLegacyConfigWarnings(config) {
6125
+ const legacyConfigOptions = {
6126
+ silent: "CONFIG_SILENT",
6127
+ devtools: "CONFIG_DEVTOOLS",
6128
+ ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6129
+ keyCodes: "CONFIG_KEY_CODES",
6130
+ productionTip: "CONFIG_PRODUCTION_TIP"
6131
+ };
6132
+ Object.keys(legacyConfigOptions).forEach((key) => {
6133
+ let val = config[key];
6134
+ Object.defineProperty(config, key, {
6135
+ enumerable: true,
6136
+ get() {
6137
+ return val;
6138
+ },
6139
+ set(newVal) {
6140
+ if (!isCopyingConfig) {
6141
+ warnDeprecation(legacyConfigOptions[key], null);
6001
6142
  }
6143
+ val = newVal;
6002
6144
  }
6003
- }
6004
- );
6145
+ });
6146
+ });
6005
6147
  }
6006
-
6007
- function shouldSkipAttr(key, instance) {
6008
- if (key === "is") {
6009
- return true;
6010
- }
6011
- if ((key === "class" || key === "style") && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6012
- return true;
6013
- }
6014
- if (isOn(key) && isCompatEnabled("INSTANCE_LISTENERS", instance)) {
6015
- return true;
6016
- }
6017
- if (key.startsWith("routerView") || key === "registerRouteInstance") {
6018
- return true;
6019
- }
6020
- return false;
6148
+ function installLegacyOptionMergeStrats(config) {
6149
+ config.optionMergeStrategies = new Proxy({}, {
6150
+ get(target, key) {
6151
+ if (key in target) {
6152
+ return target[key];
6153
+ }
6154
+ if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6155
+ "CONFIG_OPTION_MERGE_STRATS",
6156
+ null
6157
+ )) {
6158
+ return internalOptionMergeStrats[key];
6159
+ }
6160
+ }
6161
+ });
6021
6162
  }
6022
6163
 
6023
- function initProps(instance, rawProps, isStateful, isSSR = false) {
6024
- const props = {};
6025
- const attrs = {};
6026
- def(attrs, InternalObjectKey, 1);
6027
- instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6028
- setFullProps(instance, rawProps, props, attrs);
6029
- for (const key in instance.propsOptions[0]) {
6030
- if (!(key in props)) {
6031
- props[key] = void 0;
6164
+ let isCopyingConfig = false;
6165
+ let singletonApp;
6166
+ let singletonCtor;
6167
+ function createCompatVue$1(createApp, createSingletonApp) {
6168
+ singletonApp = createSingletonApp({});
6169
+ const Vue = singletonCtor = function Vue2(options = {}) {
6170
+ return createCompatApp(options, Vue2);
6171
+ };
6172
+ function createCompatApp(options = {}, Ctor) {
6173
+ assertCompatEnabled("GLOBAL_MOUNT", null);
6174
+ const { data } = options;
6175
+ if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6176
+ options.data = () => data;
6177
+ }
6178
+ const app = createApp(options);
6179
+ if (Ctor !== Vue) {
6180
+ applySingletonPrototype(app, Ctor);
6181
+ }
6182
+ const vm = app._createRoot(options);
6183
+ if (options.el) {
6184
+ return vm.$mount(options.el);
6185
+ } else {
6186
+ return vm;
6032
6187
  }
6033
6188
  }
6034
- {
6035
- validateProps(rawProps || {}, props, instance);
6036
- }
6037
- if (isStateful) {
6038
- instance.props = isSSR ? props : shallowReactive(props);
6039
- } else {
6040
- if (!instance.type.props) {
6041
- instance.props = attrs;
6189
+ Vue.version = `2.6.14-compat:${"3.3.0-beta.1"}`;
6190
+ Vue.config = singletonApp.config;
6191
+ Vue.use = (p, ...options) => {
6192
+ if (p && isFunction(p.install)) {
6193
+ p.install(Vue, ...options);
6194
+ } else if (isFunction(p)) {
6195
+ p(Vue, ...options);
6196
+ }
6197
+ return Vue;
6198
+ };
6199
+ Vue.mixin = (m) => {
6200
+ singletonApp.mixin(m);
6201
+ return Vue;
6202
+ };
6203
+ Vue.component = (name, comp) => {
6204
+ if (comp) {
6205
+ singletonApp.component(name, comp);
6206
+ return Vue;
6042
6207
  } else {
6043
- instance.props = props;
6208
+ return singletonApp.component(name);
6209
+ }
6210
+ };
6211
+ Vue.directive = (name, dir) => {
6212
+ if (dir) {
6213
+ singletonApp.directive(name, dir);
6214
+ return Vue;
6215
+ } else {
6216
+ return singletonApp.directive(name);
6217
+ }
6218
+ };
6219
+ Vue.options = { _base: Vue };
6220
+ let cid = 1;
6221
+ Vue.cid = cid;
6222
+ Vue.nextTick = nextTick;
6223
+ const extendCache = /* @__PURE__ */ new WeakMap();
6224
+ function extendCtor(extendOptions = {}) {
6225
+ assertCompatEnabled("GLOBAL_EXTEND", null);
6226
+ if (isFunction(extendOptions)) {
6227
+ extendOptions = extendOptions.options;
6228
+ }
6229
+ if (extendCache.has(extendOptions)) {
6230
+ return extendCache.get(extendOptions);
6231
+ }
6232
+ const Super = this;
6233
+ function SubVue(inlineOptions) {
6234
+ if (!inlineOptions) {
6235
+ return createCompatApp(SubVue.options, SubVue);
6236
+ } else {
6237
+ return createCompatApp(
6238
+ mergeOptions(
6239
+ extend({}, SubVue.options),
6240
+ inlineOptions,
6241
+ internalOptionMergeStrats
6242
+ ),
6243
+ SubVue
6244
+ );
6245
+ }
6044
6246
  }
6247
+ SubVue.super = Super;
6248
+ SubVue.prototype = Object.create(Vue.prototype);
6249
+ SubVue.prototype.constructor = SubVue;
6250
+ const mergeBase = {};
6251
+ for (const key in Super.options) {
6252
+ const superValue = Super.options[key];
6253
+ mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
6254
+ }
6255
+ SubVue.options = mergeOptions(
6256
+ mergeBase,
6257
+ extendOptions,
6258
+ internalOptionMergeStrats
6259
+ );
6260
+ SubVue.options._base = SubVue;
6261
+ SubVue.extend = extendCtor.bind(SubVue);
6262
+ SubVue.mixin = Super.mixin;
6263
+ SubVue.use = Super.use;
6264
+ SubVue.cid = ++cid;
6265
+ extendCache.set(extendOptions, SubVue);
6266
+ return SubVue;
6045
6267
  }
6046
- instance.attrs = attrs;
6268
+ Vue.extend = extendCtor.bind(Vue);
6269
+ Vue.set = (target, key, value) => {
6270
+ assertCompatEnabled("GLOBAL_SET", null);
6271
+ target[key] = value;
6272
+ };
6273
+ Vue.delete = (target, key) => {
6274
+ assertCompatEnabled("GLOBAL_DELETE", null);
6275
+ delete target[key];
6276
+ };
6277
+ Vue.observable = (target) => {
6278
+ assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6279
+ return reactive(target);
6280
+ };
6281
+ Vue.filter = (name, filter) => {
6282
+ if (filter) {
6283
+ singletonApp.filter(name, filter);
6284
+ return Vue;
6285
+ } else {
6286
+ return singletonApp.filter(name);
6287
+ }
6288
+ };
6289
+ const util = {
6290
+ warn: warn ,
6291
+ extend,
6292
+ mergeOptions: (parent, child, vm) => mergeOptions(
6293
+ parent,
6294
+ child,
6295
+ vm ? void 0 : internalOptionMergeStrats
6296
+ ),
6297
+ defineReactive
6298
+ };
6299
+ Object.defineProperty(Vue, "util", {
6300
+ get() {
6301
+ assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6302
+ return util;
6303
+ }
6304
+ });
6305
+ Vue.configureCompat = configureCompat;
6306
+ return Vue;
6047
6307
  }
6048
- function isInHmrContext(instance) {
6049
- while (instance) {
6050
- if (instance.type.__hmrId)
6051
- return true;
6052
- instance = instance.parent;
6308
+ function installAppCompatProperties(app, context, render) {
6309
+ installFilterMethod(app, context);
6310
+ installLegacyOptionMergeStrats(app.config);
6311
+ if (!singletonApp) {
6312
+ return;
6053
6313
  }
6314
+ installCompatMount(app, context, render);
6315
+ installLegacyAPIs(app);
6316
+ applySingletonAppMutations(app);
6317
+ installLegacyConfigWarnings(app.config);
6054
6318
  }
6055
- function updateProps(instance, rawProps, rawPrevProps, optimized) {
6056
- const {
6057
- props,
6058
- attrs,
6059
- vnode: { patchFlag }
6060
- } = instance;
6061
- const rawCurrentProps = toRaw(props);
6062
- const [options] = instance.propsOptions;
6063
- let hasAttrsChanged = false;
6064
- if (
6065
- // always force full diff in dev
6066
- // - #1942 if hmr is enabled with sfc component
6067
- // - vite#872 non-sfc component used by sfc component
6068
- !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6069
- ) {
6070
- if (patchFlag & 8) {
6071
- const propsToUpdate = instance.vnode.dynamicProps;
6072
- for (let i = 0; i < propsToUpdate.length; i++) {
6073
- let key = propsToUpdate[i];
6074
- if (isEmitListener(instance.emitsOptions, key)) {
6075
- continue;
6076
- }
6077
- const value = rawProps[key];
6078
- if (options) {
6079
- if (hasOwn(attrs, key)) {
6080
- if (value !== attrs[key]) {
6081
- attrs[key] = value;
6082
- hasAttrsChanged = true;
6083
- }
6084
- } else {
6085
- const camelizedKey = camelize(key);
6086
- props[camelizedKey] = resolvePropValue(
6087
- options,
6088
- rawCurrentProps,
6089
- camelizedKey,
6090
- value,
6091
- instance,
6092
- false
6093
- /* isAbsent */
6094
- );
6095
- }
6096
- } else {
6097
- {
6098
- if (isOn(key) && key.endsWith("Native")) {
6099
- key = key.slice(0, -6);
6100
- } else if (shouldSkipAttr(key, instance)) {
6101
- continue;
6102
- }
6103
- }
6104
- if (value !== attrs[key]) {
6105
- attrs[key] = value;
6106
- hasAttrsChanged = true;
6107
- }
6108
- }
6109
- }
6319
+ function installFilterMethod(app, context) {
6320
+ context.filters = {};
6321
+ app.filter = (name, filter) => {
6322
+ assertCompatEnabled("FILTERS", null);
6323
+ if (!filter) {
6324
+ return context.filters[name];
6110
6325
  }
6111
- } else {
6112
- if (setFullProps(instance, rawProps, props, attrs)) {
6113
- hasAttrsChanged = true;
6326
+ if (context.filters[name]) {
6327
+ warn(`Filter "${name}" has already been registered.`);
6114
6328
  }
6115
- let kebabKey;
6116
- for (const key in rawCurrentProps) {
6117
- if (!rawProps || // for camelCase
6118
- !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6119
- // and converted to camelCase (#955)
6120
- ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6121
- if (options) {
6122
- if (rawPrevProps && // for camelCase
6123
- (rawPrevProps[key] !== void 0 || // for kebab-case
6124
- rawPrevProps[kebabKey] !== void 0)) {
6125
- props[key] = resolvePropValue(
6126
- options,
6127
- rawCurrentProps,
6128
- key,
6129
- void 0,
6130
- instance,
6131
- true
6132
- /* isAbsent */
6133
- );
6134
- }
6135
- } else {
6136
- delete props[key];
6137
- }
6329
+ context.filters[name] = filter;
6330
+ return app;
6331
+ };
6332
+ }
6333
+ function installLegacyAPIs(app) {
6334
+ Object.defineProperties(app, {
6335
+ // so that app.use() can work with legacy plugins that extend prototypes
6336
+ prototype: {
6337
+ get() {
6338
+ warnDeprecation("GLOBAL_PROTOTYPE", null);
6339
+ return app.config.globalProperties;
6138
6340
  }
6139
- }
6140
- if (attrs !== rawCurrentProps) {
6141
- for (const key in attrs) {
6142
- if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6143
- delete attrs[key];
6144
- hasAttrsChanged = true;
6145
- }
6341
+ },
6342
+ nextTick: { value: nextTick },
6343
+ extend: { value: singletonCtor.extend },
6344
+ set: { value: singletonCtor.set },
6345
+ delete: { value: singletonCtor.delete },
6346
+ observable: { value: singletonCtor.observable },
6347
+ util: {
6348
+ get() {
6349
+ return singletonCtor.util;
6146
6350
  }
6147
6351
  }
6352
+ });
6353
+ }
6354
+ function applySingletonAppMutations(app) {
6355
+ app._context.mixins = [...singletonApp._context.mixins];
6356
+ ["components", "directives", "filters"].forEach((key) => {
6357
+ app._context[key] = Object.create(singletonApp._context[key]);
6358
+ });
6359
+ isCopyingConfig = true;
6360
+ for (const key in singletonApp.config) {
6361
+ if (key === "isNativeTag")
6362
+ continue;
6363
+ if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6364
+ continue;
6365
+ }
6366
+ const val = singletonApp.config[key];
6367
+ app.config[key] = isObject(val) ? Object.create(val) : val;
6368
+ if (key === "ignoredElements" && isCompatEnabled("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6369
+ app.config.compilerOptions.isCustomElement = (tag) => {
6370
+ return val.some((v) => isString(v) ? v === tag : v.test(tag));
6371
+ };
6372
+ }
6148
6373
  }
6149
- if (hasAttrsChanged) {
6150
- trigger(instance, "set", "$attrs");
6151
- }
6152
- {
6153
- validateProps(rawProps || {}, props, instance);
6374
+ isCopyingConfig = false;
6375
+ applySingletonPrototype(app, singletonCtor);
6376
+ }
6377
+ function applySingletonPrototype(app, Ctor) {
6378
+ const enabled = isCompatEnabled("GLOBAL_PROTOTYPE", null);
6379
+ if (enabled) {
6380
+ app.config.globalProperties = Object.create(Ctor.prototype);
6381
+ }
6382
+ let hasPrototypeAugmentations = false;
6383
+ const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6384
+ for (const key in descriptors) {
6385
+ if (key !== "constructor") {
6386
+ hasPrototypeAugmentations = true;
6387
+ if (enabled) {
6388
+ Object.defineProperty(
6389
+ app.config.globalProperties,
6390
+ key,
6391
+ descriptors[key]
6392
+ );
6393
+ }
6394
+ }
6395
+ }
6396
+ if (hasPrototypeAugmentations) {
6397
+ warnDeprecation("GLOBAL_PROTOTYPE", null);
6154
6398
  }
6155
6399
  }
6156
- function setFullProps(instance, rawProps, props, attrs) {
6157
- const [options, needCastKeys] = instance.propsOptions;
6158
- let hasAttrsChanged = false;
6159
- let rawCastValues;
6160
- if (rawProps) {
6161
- for (let key in rawProps) {
6162
- if (isReservedProp(key)) {
6163
- continue;
6400
+ function installCompatMount(app, context, render) {
6401
+ let isMounted = false;
6402
+ app._createRoot = (options) => {
6403
+ const component = app._component;
6404
+ const vnode = createVNode(component, options.propsData || null);
6405
+ vnode.appContext = context;
6406
+ const hasNoRender = !isFunction(component) && !component.render && !component.template;
6407
+ const emptyRender = () => {
6408
+ };
6409
+ const instance = createComponentInstance(vnode, null, null);
6410
+ if (hasNoRender) {
6411
+ instance.render = emptyRender;
6412
+ }
6413
+ setupComponent(instance);
6414
+ vnode.component = instance;
6415
+ vnode.isCompatRoot = true;
6416
+ instance.ctx._compat_mount = (selectorOrEl) => {
6417
+ if (isMounted) {
6418
+ warn(`Root instance is already mounted.`);
6419
+ return;
6164
6420
  }
6165
- {
6166
- if (key.startsWith("onHook:")) {
6167
- softAssertCompatEnabled(
6168
- "INSTANCE_EVENT_HOOKS",
6169
- instance,
6170
- key.slice(2).toLowerCase()
6421
+ let container;
6422
+ if (typeof selectorOrEl === "string") {
6423
+ const result = document.querySelector(selectorOrEl);
6424
+ if (!result) {
6425
+ warn(
6426
+ `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6171
6427
  );
6428
+ return;
6172
6429
  }
6173
- if (key === "inline-template") {
6174
- continue;
6175
- }
6430
+ container = result;
6431
+ } else {
6432
+ container = selectorOrEl || document.createElement("div");
6176
6433
  }
6177
- const value = rawProps[key];
6178
- let camelKey;
6179
- if (options && hasOwn(options, camelKey = camelize(key))) {
6180
- if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6181
- props[camelKey] = value;
6182
- } else {
6183
- (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6184
- }
6185
- } else if (!isEmitListener(instance.emitsOptions, key)) {
6434
+ const isSVG = container instanceof SVGElement;
6435
+ {
6436
+ context.reload = () => {
6437
+ const cloned = cloneVNode(vnode);
6438
+ cloned.component = null;
6439
+ render(cloned, container, isSVG);
6440
+ };
6441
+ }
6442
+ if (hasNoRender && instance.render === emptyRender) {
6186
6443
  {
6187
- if (isOn(key) && key.endsWith("Native")) {
6188
- key = key.slice(0, -6);
6189
- } else if (shouldSkipAttr(key, instance)) {
6190
- continue;
6444
+ for (let i = 0; i < container.attributes.length; i++) {
6445
+ const attr = container.attributes[i];
6446
+ if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6447
+ warnDeprecation("GLOBAL_MOUNT_CONTAINER", null);
6448
+ break;
6449
+ }
6191
6450
  }
6192
6451
  }
6193
- if (!(key in attrs) || value !== attrs[key]) {
6194
- attrs[key] = value;
6195
- hasAttrsChanged = true;
6196
- }
6452
+ instance.render = null;
6453
+ component.template = container.innerHTML;
6454
+ finishComponentSetup(
6455
+ instance,
6456
+ false,
6457
+ true
6458
+ /* skip options */
6459
+ );
6197
6460
  }
6198
- }
6199
- }
6200
- if (needCastKeys) {
6201
- const rawCurrentProps = toRaw(props);
6202
- const castValues = rawCastValues || EMPTY_OBJ;
6203
- for (let i = 0; i < needCastKeys.length; i++) {
6204
- const key = needCastKeys[i];
6205
- props[key] = resolvePropValue(
6206
- options,
6207
- rawCurrentProps,
6208
- key,
6209
- castValues[key],
6210
- instance,
6211
- !hasOwn(castValues, key)
6212
- );
6213
- }
6214
- }
6215
- return hasAttrsChanged;
6216
- }
6217
- function resolvePropValue(options, props, key, value, instance, isAbsent) {
6218
- const opt = options[key];
6219
- if (opt != null) {
6220
- const hasDefault = hasOwn(opt, "default");
6221
- if (hasDefault && value === void 0) {
6222
- const defaultValue = opt.default;
6223
- if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
6224
- const { propsDefaults } = instance;
6225
- if (key in propsDefaults) {
6226
- value = propsDefaults[key];
6227
- } else {
6228
- setCurrentInstance(instance);
6229
- value = propsDefaults[key] = defaultValue.call(
6230
- isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
6231
- props
6232
- );
6233
- unsetCurrentInstance();
6461
+ container.innerHTML = "";
6462
+ render(vnode, container, isSVG);
6463
+ if (container instanceof Element) {
6464
+ container.removeAttribute("v-cloak");
6465
+ container.setAttribute("data-v-app", "");
6466
+ }
6467
+ isMounted = true;
6468
+ app._container = container;
6469
+ container.__vue_app__ = app;
6470
+ {
6471
+ devtoolsInitApp(app, version);
6472
+ }
6473
+ return instance.proxy;
6474
+ };
6475
+ instance.ctx._compat_destroy = () => {
6476
+ if (isMounted) {
6477
+ render(null, app._container);
6478
+ {
6479
+ devtoolsUnmountApp(app);
6234
6480
  }
6481
+ delete app._container.__vue_app__;
6235
6482
  } else {
6236
- value = defaultValue;
6237
- }
6238
- }
6239
- if (opt[0 /* shouldCast */]) {
6240
- if (isAbsent && !hasDefault) {
6241
- value = false;
6242
- } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
6243
- value = true;
6483
+ const { bum, scope, um } = instance;
6484
+ if (bum) {
6485
+ invokeArrayFns(bum);
6486
+ }
6487
+ if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6488
+ instance.emit("hook:beforeDestroy");
6489
+ }
6490
+ if (scope) {
6491
+ scope.stop();
6492
+ }
6493
+ if (um) {
6494
+ invokeArrayFns(um);
6495
+ }
6496
+ if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6497
+ instance.emit("hook:destroyed");
6498
+ }
6244
6499
  }
6500
+ };
6501
+ return instance.proxy;
6502
+ };
6503
+ }
6504
+ const methodsToPatch = [
6505
+ "push",
6506
+ "pop",
6507
+ "shift",
6508
+ "unshift",
6509
+ "splice",
6510
+ "sort",
6511
+ "reverse"
6512
+ ];
6513
+ const patched = /* @__PURE__ */ new WeakSet();
6514
+ function defineReactive(obj, key, val) {
6515
+ if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6516
+ const reactiveVal = reactive(val);
6517
+ if (isArray(val)) {
6518
+ methodsToPatch.forEach((m) => {
6519
+ val[m] = (...args) => {
6520
+ Array.prototype[m].call(reactiveVal, ...args);
6521
+ };
6522
+ });
6523
+ } else {
6524
+ Object.keys(val).forEach((key2) => {
6525
+ try {
6526
+ defineReactiveSimple(val, key2, val[key2]);
6527
+ } catch (e) {
6528
+ }
6529
+ });
6245
6530
  }
6246
6531
  }
6247
- return value;
6532
+ const i = obj.$;
6533
+ if (i && obj === i.proxy) {
6534
+ defineReactiveSimple(i.ctx, key, val);
6535
+ i.accessCache = /* @__PURE__ */ Object.create(null);
6536
+ } else if (isReactive(obj)) {
6537
+ obj[key] = val;
6538
+ } else {
6539
+ defineReactiveSimple(obj, key, val);
6540
+ }
6248
6541
  }
6249
- function normalizePropsOptions(comp, appContext, asMixin = false) {
6250
- const cache = appContext.propsCache;
6251
- const cached = cache.get(comp);
6252
- if (cached) {
6253
- return cached;
6254
- }
6255
- const raw = comp.props;
6256
- const normalized = {};
6257
- const needCastKeys = [];
6258
- let hasExtends = false;
6259
- if (!isFunction(comp)) {
6260
- const extendProps = (raw2) => {
6261
- if (isFunction(raw2)) {
6262
- raw2 = raw2.options;
6263
- }
6264
- hasExtends = true;
6265
- const [props, keys] = normalizePropsOptions(raw2, appContext, true);
6266
- extend(normalized, props);
6267
- if (keys)
6268
- needCastKeys.push(...keys);
6269
- };
6270
- if (!asMixin && appContext.mixins.length) {
6271
- appContext.mixins.forEach(extendProps);
6272
- }
6273
- if (comp.extends) {
6274
- extendProps(comp.extends);
6275
- }
6276
- if (comp.mixins) {
6277
- comp.mixins.forEach(extendProps);
6542
+ function defineReactiveSimple(obj, key, val) {
6543
+ val = isObject(val) ? reactive(val) : val;
6544
+ Object.defineProperty(obj, key, {
6545
+ enumerable: true,
6546
+ configurable: true,
6547
+ get() {
6548
+ track(obj, "get", key);
6549
+ return val;
6550
+ },
6551
+ set(newVal) {
6552
+ val = isObject(newVal) ? reactive(newVal) : newVal;
6553
+ trigger(obj, "set", key, newVal);
6278
6554
  }
6279
- }
6280
- if (!raw && !hasExtends) {
6281
- if (isObject(comp)) {
6282
- cache.set(comp, EMPTY_ARR);
6555
+ });
6556
+ }
6557
+
6558
+ function createAppContext() {
6559
+ return {
6560
+ app: null,
6561
+ config: {
6562
+ isNativeTag: NO,
6563
+ performance: false,
6564
+ globalProperties: {},
6565
+ optionMergeStrategies: {},
6566
+ errorHandler: void 0,
6567
+ warnHandler: void 0,
6568
+ compilerOptions: {}
6569
+ },
6570
+ mixins: [],
6571
+ components: {},
6572
+ directives: {},
6573
+ provides: /* @__PURE__ */ Object.create(null),
6574
+ optionsCache: /* @__PURE__ */ new WeakMap(),
6575
+ propsCache: /* @__PURE__ */ new WeakMap(),
6576
+ emitsCache: /* @__PURE__ */ new WeakMap()
6577
+ };
6578
+ }
6579
+ let uid$1 = 0;
6580
+ function createAppAPI(render, hydrate) {
6581
+ return function createApp(rootComponent, rootProps = null) {
6582
+ if (!isFunction(rootComponent)) {
6583
+ rootComponent = extend({}, rootComponent);
6283
6584
  }
6284
- return EMPTY_ARR;
6285
- }
6286
- if (isArray(raw)) {
6287
- for (let i = 0; i < raw.length; i++) {
6288
- if (!isString(raw[i])) {
6289
- warn(`props must be strings when using array syntax.`, raw[i]);
6290
- }
6291
- const normalizedKey = camelize(raw[i]);
6292
- if (validatePropName(normalizedKey)) {
6293
- normalized[normalizedKey] = EMPTY_OBJ;
6294
- }
6585
+ if (rootProps != null && !isObject(rootProps)) {
6586
+ warn(`root props passed to app.mount() must be an object.`);
6587
+ rootProps = null;
6295
6588
  }
6296
- } else if (raw) {
6297
- if (!isObject(raw)) {
6298
- warn(`invalid props options`, raw);
6589
+ const context = createAppContext();
6590
+ {
6591
+ Object.defineProperty(context.config, "unwrapInjectedRef", {
6592
+ get() {
6593
+ return true;
6594
+ },
6595
+ set() {
6596
+ warn(
6597
+ `app.config.unwrapInjectedRef has been deprecated. 3.3 now alawys unwraps injected refs in Options API.`
6598
+ );
6599
+ }
6600
+ });
6299
6601
  }
6300
- for (const key in raw) {
6301
- const normalizedKey = camelize(key);
6302
- if (validatePropName(normalizedKey)) {
6303
- const opt = raw[key];
6304
- const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
6305
- if (prop) {
6306
- const booleanIndex = getTypeIndex(Boolean, prop.type);
6307
- const stringIndex = getTypeIndex(String, prop.type);
6308
- prop[0 /* shouldCast */] = booleanIndex > -1;
6309
- prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
6310
- if (booleanIndex > -1 || hasOwn(prop, "default")) {
6311
- needCastKeys.push(normalizedKey);
6602
+ const installedPlugins = /* @__PURE__ */ new Set();
6603
+ let isMounted = false;
6604
+ const app = context.app = {
6605
+ _uid: uid$1++,
6606
+ _component: rootComponent,
6607
+ _props: rootProps,
6608
+ _container: null,
6609
+ _context: context,
6610
+ _instance: null,
6611
+ version,
6612
+ get config() {
6613
+ return context.config;
6614
+ },
6615
+ set config(v) {
6616
+ {
6617
+ warn(
6618
+ `app.config cannot be replaced. Modify individual options instead.`
6619
+ );
6620
+ }
6621
+ },
6622
+ use(plugin, ...options) {
6623
+ if (installedPlugins.has(plugin)) {
6624
+ warn(`Plugin has already been applied to target app.`);
6625
+ } else if (plugin && isFunction(plugin.install)) {
6626
+ installedPlugins.add(plugin);
6627
+ plugin.install(app, ...options);
6628
+ } else if (isFunction(plugin)) {
6629
+ installedPlugins.add(plugin);
6630
+ plugin(app, ...options);
6631
+ } else {
6632
+ warn(
6633
+ `A plugin must either be a function or an object with an "install" function.`
6634
+ );
6635
+ }
6636
+ return app;
6637
+ },
6638
+ mixin(mixin) {
6639
+ {
6640
+ if (!context.mixins.includes(mixin)) {
6641
+ context.mixins.push(mixin);
6642
+ } else {
6643
+ warn(
6644
+ "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
6645
+ );
6646
+ }
6647
+ }
6648
+ return app;
6649
+ },
6650
+ component(name, component) {
6651
+ {
6652
+ validateComponentName(name, context.config);
6653
+ }
6654
+ if (!component) {
6655
+ return context.components[name];
6656
+ }
6657
+ if (context.components[name]) {
6658
+ warn(`Component "${name}" has already been registered in target app.`);
6659
+ }
6660
+ context.components[name] = component;
6661
+ return app;
6662
+ },
6663
+ directive(name, directive) {
6664
+ {
6665
+ validateDirectiveName(name);
6666
+ }
6667
+ if (!directive) {
6668
+ return context.directives[name];
6669
+ }
6670
+ if (context.directives[name]) {
6671
+ warn(`Directive "${name}" has already been registered in target app.`);
6672
+ }
6673
+ context.directives[name] = directive;
6674
+ return app;
6675
+ },
6676
+ mount(rootContainer, isHydrate, isSVG) {
6677
+ if (!isMounted) {
6678
+ if (rootContainer.__vue_app__) {
6679
+ warn(
6680
+ `There is already an app instance mounted on the host container.
6681
+ If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
6682
+ );
6312
6683
  }
6684
+ const vnode = createVNode(
6685
+ rootComponent,
6686
+ rootProps
6687
+ );
6688
+ vnode.appContext = context;
6689
+ {
6690
+ context.reload = () => {
6691
+ render(cloneVNode(vnode), rootContainer, isSVG);
6692
+ };
6693
+ }
6694
+ if (isHydrate && hydrate) {
6695
+ hydrate(vnode, rootContainer);
6696
+ } else {
6697
+ render(vnode, rootContainer, isSVG);
6698
+ }
6699
+ isMounted = true;
6700
+ app._container = rootContainer;
6701
+ rootContainer.__vue_app__ = app;
6702
+ {
6703
+ app._instance = vnode.component;
6704
+ devtoolsInitApp(app, version);
6705
+ }
6706
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
6707
+ } else {
6708
+ warn(
6709
+ `App has already been mounted.
6710
+ 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)\``
6711
+ );
6712
+ }
6713
+ },
6714
+ unmount() {
6715
+ if (isMounted) {
6716
+ render(null, app._container);
6717
+ {
6718
+ app._instance = null;
6719
+ devtoolsUnmountApp(app);
6720
+ }
6721
+ delete app._container.__vue_app__;
6722
+ } else {
6723
+ warn(`Cannot unmount an app that is not mounted.`);
6724
+ }
6725
+ },
6726
+ provide(key, value) {
6727
+ if (key in context.provides) {
6728
+ warn(
6729
+ `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
6730
+ );
6731
+ }
6732
+ context.provides[key] = value;
6733
+ return app;
6734
+ },
6735
+ runWithContext(fn) {
6736
+ currentApp = app;
6737
+ try {
6738
+ return fn();
6739
+ } finally {
6740
+ currentApp = null;
6313
6741
  }
6314
6742
  }
6743
+ };
6744
+ {
6745
+ installAppCompatProperties(app, context, render);
6315
6746
  }
6316
- }
6317
- const res = [normalized, needCastKeys];
6318
- if (isObject(comp)) {
6319
- cache.set(comp, res);
6320
- }
6321
- return res;
6747
+ return app;
6748
+ };
6322
6749
  }
6323
- function validatePropName(key) {
6324
- if (key[0] !== "$") {
6325
- return true;
6750
+ let currentApp = null;
6751
+
6752
+ function provide(key, value) {
6753
+ if (!currentInstance) {
6754
+ {
6755
+ warn(`provide() can only be used inside setup().`);
6756
+ }
6326
6757
  } else {
6327
- warn(`Invalid prop name: "${key}" is a reserved property.`);
6758
+ let provides = currentInstance.provides;
6759
+ const parentProvides = currentInstance.parent && currentInstance.parent.provides;
6760
+ if (parentProvides === provides) {
6761
+ provides = currentInstance.provides = Object.create(parentProvides);
6762
+ }
6763
+ provides[key] = value;
6328
6764
  }
6329
- return false;
6330
6765
  }
6331
- function getType(ctor) {
6332
- const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
6333
- return match ? match[2] : ctor === null ? "null" : "";
6334
- }
6335
- function isSameType(a, b) {
6336
- return getType(a) === getType(b);
6337
- }
6338
- function getTypeIndex(type, expectedTypes) {
6339
- if (isArray(expectedTypes)) {
6340
- return expectedTypes.findIndex((t) => isSameType(t, type));
6341
- } else if (isFunction(expectedTypes)) {
6342
- return isSameType(expectedTypes, type) ? 0 : -1;
6766
+ function inject(key, defaultValue, treatDefaultAsFactory = false) {
6767
+ const instance = currentInstance || currentRenderingInstance;
6768
+ if (instance || currentApp) {
6769
+ const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
6770
+ if (provides && key in provides) {
6771
+ return provides[key];
6772
+ } else if (arguments.length > 1) {
6773
+ return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
6774
+ } else {
6775
+ warn(`injection "${String(key)}" not found.`);
6776
+ }
6777
+ } else {
6778
+ warn(`inject() can only be used inside setup() or functional components.`);
6343
6779
  }
6344
- return -1;
6345
6780
  }
6346
- function validateProps(rawProps, props, instance) {
6347
- const resolvedValues = toRaw(props);
6348
- const options = instance.propsOptions[0];
6349
- for (const key in options) {
6350
- let opt = options[key];
6351
- if (opt == null)
6352
- continue;
6353
- validateProp(
6354
- key,
6355
- resolvedValues[key],
6356
- opt,
6357
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6358
- );
6359
- }
6781
+ function hasInjectionContext() {
6782
+ return !!(currentInstance || currentRenderingInstance || currentApp);
6360
6783
  }
6361
- function validateProp(name, value, prop, isAbsent) {
6362
- const { type, required, validator, skipCheck } = prop;
6363
- if (required && isAbsent) {
6364
- warn('Missing required prop: "' + name + '"');
6365
- return;
6366
- }
6367
- if (value == null && !prop.required) {
6368
- return;
6369
- }
6370
- if (type != null && type !== true && !skipCheck) {
6371
- let isValid = false;
6372
- const types = isArray(type) ? type : [type];
6373
- const expectedTypes = [];
6374
- for (let i = 0; i < types.length && !isValid; i++) {
6375
- const { valid, expectedType } = assertType(value, types[i]);
6376
- expectedTypes.push(expectedType || "");
6377
- isValid = valid;
6378
- }
6379
- if (!isValid) {
6380
- warn(getInvalidTypeMessage(name, value, expectedTypes));
6381
- return;
6784
+
6785
+ function createPropsDefaultThis(instance, rawProps, propKey) {
6786
+ return new Proxy(
6787
+ {},
6788
+ {
6789
+ get(_, key) {
6790
+ warnDeprecation("PROPS_DEFAULT_THIS", null, propKey);
6791
+ if (key === "$options") {
6792
+ return resolveMergedOptions(instance);
6793
+ }
6794
+ if (key in rawProps) {
6795
+ return rawProps[key];
6796
+ }
6797
+ const injections = instance.type.inject;
6798
+ if (injections) {
6799
+ if (isArray(injections)) {
6800
+ if (injections.includes(key)) {
6801
+ return inject(key);
6802
+ }
6803
+ } else if (key in injections) {
6804
+ return inject(key);
6805
+ }
6806
+ }
6807
+ }
6382
6808
  }
6383
- }
6384
- if (validator && !validator(value)) {
6385
- warn('Invalid prop: custom validator check failed for prop "' + name + '".');
6386
- }
6809
+ );
6387
6810
  }
6388
- const isSimpleType = /* @__PURE__ */ makeMap(
6389
- "String,Number,Boolean,Function,Symbol,BigInt"
6390
- );
6391
- function assertType(value, type) {
6392
- let valid;
6393
- const expectedType = getType(type);
6394
- if (isSimpleType(expectedType)) {
6395
- const t = typeof value;
6396
- valid = t === expectedType.toLowerCase();
6397
- if (!valid && t === "object") {
6398
- valid = value instanceof type;
6399
- }
6400
- } else if (expectedType === "Object") {
6401
- valid = isObject(value);
6402
- } else if (expectedType === "Array") {
6403
- valid = isArray(value);
6404
- } else if (expectedType === "null") {
6405
- valid = value === null;
6406
- } else {
6407
- valid = value instanceof type;
6811
+
6812
+ function shouldSkipAttr(key, instance) {
6813
+ if (key === "is") {
6814
+ return true;
6408
6815
  }
6409
- return {
6410
- valid,
6411
- expectedType
6412
- };
6413
- }
6414
- function getInvalidTypeMessage(name, value, expectedTypes) {
6415
- let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
6416
- const expectedType = expectedTypes[0];
6417
- const receivedType = toRawType(value);
6418
- const expectedValue = styleValue(value, expectedType);
6419
- const receivedValue = styleValue(value, receivedType);
6420
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
6421
- message += ` with value ${expectedValue}`;
6816
+ if ((key === "class" || key === "style") && isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE", instance)) {
6817
+ return true;
6422
6818
  }
6423
- message += `, got ${receivedType} `;
6424
- if (isExplicable(receivedType)) {
6425
- message += `with value ${receivedValue}.`;
6819
+ if (isOn(key) && isCompatEnabled("INSTANCE_LISTENERS", instance)) {
6820
+ return true;
6426
6821
  }
6427
- return message;
6428
- }
6429
- function styleValue(value, type) {
6430
- if (type === "String") {
6431
- return `"${value}"`;
6432
- } else if (type === "Number") {
6433
- return `${Number(value)}`;
6434
- } else {
6435
- return `${value}`;
6822
+ if (key.startsWith("routerView") || key === "registerRouteInstance") {
6823
+ return true;
6436
6824
  }
6437
- }
6438
- function isExplicable(type) {
6439
- const explicitTypes = ["string", "number", "boolean"];
6440
- return explicitTypes.some((elem) => type.toLowerCase() === elem);
6441
- }
6442
- function isBoolean(...args) {
6443
- return args.some((elem) => elem.toLowerCase() === "boolean");
6825
+ return false;
6444
6826
  }
6445
6827
 
6446
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
6447
- const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6448
- const normalizeSlot = (key, rawSlot, ctx) => {
6449
- if (rawSlot._n) {
6450
- return rawSlot;
6451
- }
6452
- const normalized = withCtx((...args) => {
6453
- if (currentInstance) {
6454
- warn(
6455
- `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.`
6456
- );
6457
- }
6458
- return normalizeSlotValue(rawSlot(...args));
6459
- }, ctx);
6460
- normalized._c = false;
6461
- return normalized;
6462
- };
6463
- const normalizeObjectSlots = (rawSlots, slots, instance) => {
6464
- const ctx = rawSlots._ctx;
6465
- for (const key in rawSlots) {
6466
- if (isInternalKey(key))
6467
- continue;
6468
- const value = rawSlots[key];
6469
- if (isFunction(value)) {
6470
- slots[key] = normalizeSlot(key, value, ctx);
6471
- } else if (value != null) {
6472
- if (!isCompatEnabled("RENDER_FUNCTION", instance)) {
6473
- warn(
6474
- `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
6475
- );
6476
- }
6477
- const normalized = normalizeSlotValue(value);
6478
- slots[key] = () => normalized;
6828
+ function initProps(instance, rawProps, isStateful, isSSR = false) {
6829
+ const props = {};
6830
+ const attrs = {};
6831
+ def(attrs, InternalObjectKey, 1);
6832
+ instance.propsDefaults = /* @__PURE__ */ Object.create(null);
6833
+ setFullProps(instance, rawProps, props, attrs);
6834
+ for (const key in instance.propsOptions[0]) {
6835
+ if (!(key in props)) {
6836
+ props[key] = void 0;
6479
6837
  }
6480
6838
  }
6481
- };
6482
- const normalizeVNodeSlots = (instance, children) => {
6483
- if (!isKeepAlive(instance.vnode) && !isCompatEnabled("RENDER_FUNCTION", instance)) {
6484
- warn(
6485
- `Non-function value encountered for default slot. Prefer function slots for better performance.`
6486
- );
6839
+ {
6840
+ validateProps(rawProps || {}, props, instance);
6487
6841
  }
6488
- const normalized = normalizeSlotValue(children);
6489
- instance.slots.default = () => normalized;
6490
- };
6491
- const initSlots = (instance, children) => {
6492
- if (instance.vnode.shapeFlag & 32) {
6493
- const type = children._;
6494
- if (type) {
6495
- instance.slots = toRaw(children);
6496
- def(children, "_", type);
6497
- } else {
6498
- normalizeObjectSlots(
6499
- children,
6500
- instance.slots = {},
6501
- instance
6502
- );
6503
- }
6842
+ if (isStateful) {
6843
+ instance.props = isSSR ? props : shallowReactive(props);
6504
6844
  } else {
6505
- instance.slots = {};
6506
- if (children) {
6507
- normalizeVNodeSlots(instance, children);
6845
+ if (!instance.type.props) {
6846
+ instance.props = attrs;
6847
+ } else {
6848
+ instance.props = props;
6508
6849
  }
6509
6850
  }
6510
- def(instance.slots, InternalObjectKey, 1);
6511
- };
6512
- const updateSlots = (instance, children, optimized) => {
6513
- const { vnode, slots } = instance;
6514
- let needDeletionCheck = true;
6515
- let deletionComparisonTarget = EMPTY_OBJ;
6516
- if (vnode.shapeFlag & 32) {
6517
- const type = children._;
6518
- if (type) {
6519
- if (isHmrUpdating) {
6520
- extend(slots, children);
6521
- } else if (optimized && type === 1) {
6522
- needDeletionCheck = false;
6523
- } else {
6524
- extend(slots, children);
6525
- if (!optimized && type === 1) {
6526
- delete slots._;
6851
+ instance.attrs = attrs;
6852
+ }
6853
+ function isInHmrContext(instance) {
6854
+ while (instance) {
6855
+ if (instance.type.__hmrId)
6856
+ return true;
6857
+ instance = instance.parent;
6858
+ }
6859
+ }
6860
+ function updateProps(instance, rawProps, rawPrevProps, optimized) {
6861
+ const {
6862
+ props,
6863
+ attrs,
6864
+ vnode: { patchFlag }
6865
+ } = instance;
6866
+ const rawCurrentProps = toRaw(props);
6867
+ const [options] = instance.propsOptions;
6868
+ let hasAttrsChanged = false;
6869
+ if (
6870
+ // always force full diff in dev
6871
+ // - #1942 if hmr is enabled with sfc component
6872
+ // - vite#872 non-sfc component used by sfc component
6873
+ !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
6874
+ ) {
6875
+ if (patchFlag & 8) {
6876
+ const propsToUpdate = instance.vnode.dynamicProps;
6877
+ for (let i = 0; i < propsToUpdate.length; i++) {
6878
+ let key = propsToUpdate[i];
6879
+ if (isEmitListener(instance.emitsOptions, key)) {
6880
+ continue;
6881
+ }
6882
+ const value = rawProps[key];
6883
+ if (options) {
6884
+ if (hasOwn(attrs, key)) {
6885
+ if (value !== attrs[key]) {
6886
+ attrs[key] = value;
6887
+ hasAttrsChanged = true;
6888
+ }
6889
+ } else {
6890
+ const camelizedKey = camelize(key);
6891
+ props[camelizedKey] = resolvePropValue(
6892
+ options,
6893
+ rawCurrentProps,
6894
+ camelizedKey,
6895
+ value,
6896
+ instance,
6897
+ false
6898
+ /* isAbsent */
6899
+ );
6900
+ }
6901
+ } else {
6902
+ {
6903
+ if (isOn(key) && key.endsWith("Native")) {
6904
+ key = key.slice(0, -6);
6905
+ } else if (shouldSkipAttr(key, instance)) {
6906
+ continue;
6907
+ }
6908
+ }
6909
+ if (value !== attrs[key]) {
6910
+ attrs[key] = value;
6911
+ hasAttrsChanged = true;
6912
+ }
6527
6913
  }
6528
6914
  }
6529
- } else {
6530
- needDeletionCheck = !children.$stable;
6531
- normalizeObjectSlots(children, slots, instance);
6532
6915
  }
6533
- deletionComparisonTarget = children;
6534
- } else if (children) {
6535
- normalizeVNodeSlots(instance, children);
6536
- deletionComparisonTarget = { default: 1 };
6537
- }
6538
- if (needDeletionCheck) {
6539
- for (const key in slots) {
6540
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
6541
- delete slots[key];
6916
+ } else {
6917
+ if (setFullProps(instance, rawProps, props, attrs)) {
6918
+ hasAttrsChanged = true;
6919
+ }
6920
+ let kebabKey;
6921
+ for (const key in rawCurrentProps) {
6922
+ if (!rawProps || // for camelCase
6923
+ !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
6924
+ // and converted to camelCase (#955)
6925
+ ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
6926
+ if (options) {
6927
+ if (rawPrevProps && // for camelCase
6928
+ (rawPrevProps[key] !== void 0 || // for kebab-case
6929
+ rawPrevProps[kebabKey] !== void 0)) {
6930
+ props[key] = resolvePropValue(
6931
+ options,
6932
+ rawCurrentProps,
6933
+ key,
6934
+ void 0,
6935
+ instance,
6936
+ true
6937
+ /* isAbsent */
6938
+ );
6939
+ }
6940
+ } else {
6941
+ delete props[key];
6942
+ }
6542
6943
  }
6543
6944
  }
6544
- }
6545
- };
6546
-
6547
- function installLegacyConfigWarnings(config) {
6548
- const legacyConfigOptions = {
6549
- silent: "CONFIG_SILENT",
6550
- devtools: "CONFIG_DEVTOOLS",
6551
- ignoredElements: "CONFIG_IGNORED_ELEMENTS",
6552
- keyCodes: "CONFIG_KEY_CODES",
6553
- productionTip: "CONFIG_PRODUCTION_TIP"
6554
- };
6555
- Object.keys(legacyConfigOptions).forEach((key) => {
6556
- let val = config[key];
6557
- Object.defineProperty(config, key, {
6558
- enumerable: true,
6559
- get() {
6560
- return val;
6561
- },
6562
- set(newVal) {
6563
- if (!isCopyingConfig) {
6564
- warnDeprecation(legacyConfigOptions[key], null);
6945
+ if (attrs !== rawCurrentProps) {
6946
+ for (const key in attrs) {
6947
+ if (!rawProps || !hasOwn(rawProps, key) && !hasOwn(rawProps, key + "Native")) {
6948
+ delete attrs[key];
6949
+ hasAttrsChanged = true;
6565
6950
  }
6566
- val = newVal;
6567
6951
  }
6568
- });
6569
- });
6952
+ }
6953
+ }
6954
+ if (hasAttrsChanged) {
6955
+ trigger(instance, "set", "$attrs");
6956
+ }
6957
+ {
6958
+ validateProps(rawProps || {}, props, instance);
6959
+ }
6570
6960
  }
6571
- function installLegacyOptionMergeStrats(config) {
6572
- config.optionMergeStrategies = new Proxy({}, {
6573
- get(target, key) {
6574
- if (key in target) {
6575
- return target[key];
6961
+ function setFullProps(instance, rawProps, props, attrs) {
6962
+ const [options, needCastKeys] = instance.propsOptions;
6963
+ let hasAttrsChanged = false;
6964
+ let rawCastValues;
6965
+ if (rawProps) {
6966
+ for (let key in rawProps) {
6967
+ if (isReservedProp(key)) {
6968
+ continue;
6576
6969
  }
6577
- if (key in internalOptionMergeStrats && softAssertCompatEnabled(
6578
- "CONFIG_OPTION_MERGE_STRATS",
6579
- null
6580
- )) {
6581
- return internalOptionMergeStrats[key];
6970
+ {
6971
+ if (key.startsWith("onHook:")) {
6972
+ softAssertCompatEnabled(
6973
+ "INSTANCE_EVENT_HOOKS",
6974
+ instance,
6975
+ key.slice(2).toLowerCase()
6976
+ );
6977
+ }
6978
+ if (key === "inline-template") {
6979
+ continue;
6980
+ }
6981
+ }
6982
+ const value = rawProps[key];
6983
+ let camelKey;
6984
+ if (options && hasOwn(options, camelKey = camelize(key))) {
6985
+ if (!needCastKeys || !needCastKeys.includes(camelKey)) {
6986
+ props[camelKey] = value;
6987
+ } else {
6988
+ (rawCastValues || (rawCastValues = {}))[camelKey] = value;
6989
+ }
6990
+ } else if (!isEmitListener(instance.emitsOptions, key)) {
6991
+ {
6992
+ if (isOn(key) && key.endsWith("Native")) {
6993
+ key = key.slice(0, -6);
6994
+ } else if (shouldSkipAttr(key, instance)) {
6995
+ continue;
6996
+ }
6997
+ }
6998
+ if (!(key in attrs) || value !== attrs[key]) {
6999
+ attrs[key] = value;
7000
+ hasAttrsChanged = true;
7001
+ }
6582
7002
  }
6583
7003
  }
6584
- });
7004
+ }
7005
+ if (needCastKeys) {
7006
+ const rawCurrentProps = toRaw(props);
7007
+ const castValues = rawCastValues || EMPTY_OBJ;
7008
+ for (let i = 0; i < needCastKeys.length; i++) {
7009
+ const key = needCastKeys[i];
7010
+ props[key] = resolvePropValue(
7011
+ options,
7012
+ rawCurrentProps,
7013
+ key,
7014
+ castValues[key],
7015
+ instance,
7016
+ !hasOwn(castValues, key)
7017
+ );
7018
+ }
7019
+ }
7020
+ return hasAttrsChanged;
6585
7021
  }
6586
-
6587
- let isCopyingConfig = false;
6588
- let singletonApp;
6589
- let singletonCtor;
6590
- function createCompatVue$1(createApp, createSingletonApp) {
6591
- singletonApp = createSingletonApp({});
6592
- const Vue = singletonCtor = function Vue2(options = {}) {
6593
- return createCompatApp(options, Vue2);
6594
- };
6595
- function createCompatApp(options = {}, Ctor) {
6596
- assertCompatEnabled("GLOBAL_MOUNT", null);
6597
- const { data } = options;
6598
- if (data && !isFunction(data) && softAssertCompatEnabled("OPTIONS_DATA_FN", null)) {
6599
- options.data = () => data;
7022
+ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7023
+ const opt = options[key];
7024
+ if (opt != null) {
7025
+ const hasDefault = hasOwn(opt, "default");
7026
+ if (hasDefault && value === void 0) {
7027
+ const defaultValue = opt.default;
7028
+ if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
7029
+ const { propsDefaults } = instance;
7030
+ if (key in propsDefaults) {
7031
+ value = propsDefaults[key];
7032
+ } else {
7033
+ setCurrentInstance(instance);
7034
+ value = propsDefaults[key] = defaultValue.call(
7035
+ isCompatEnabled("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7036
+ props
7037
+ );
7038
+ unsetCurrentInstance();
7039
+ }
7040
+ } else {
7041
+ value = defaultValue;
7042
+ }
6600
7043
  }
6601
- const app = createApp(options);
6602
- if (Ctor !== Vue) {
6603
- applySingletonPrototype(app, Ctor);
6604
- }
6605
- const vm = app._createRoot(options);
6606
- if (options.el) {
6607
- return vm.$mount(options.el);
6608
- } else {
6609
- return vm;
7044
+ if (opt[0 /* shouldCast */]) {
7045
+ if (isAbsent && !hasDefault) {
7046
+ value = false;
7047
+ } else if (opt[1 /* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
7048
+ value = true;
7049
+ }
6610
7050
  }
6611
7051
  }
6612
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.8"}`;
6613
- Vue.config = singletonApp.config;
6614
- Vue.use = (p, ...options) => {
6615
- if (p && isFunction(p.install)) {
6616
- p.install(Vue, ...options);
6617
- } else if (isFunction(p)) {
6618
- p(Vue, ...options);
6619
- }
6620
- return Vue;
6621
- };
6622
- Vue.mixin = (m) => {
6623
- singletonApp.mixin(m);
6624
- return Vue;
6625
- };
6626
- Vue.component = (name, comp) => {
6627
- if (comp) {
6628
- singletonApp.component(name, comp);
6629
- return Vue;
6630
- } else {
6631
- return singletonApp.component(name);
7052
+ return value;
7053
+ }
7054
+ function normalizePropsOptions(comp, appContext, asMixin = false) {
7055
+ const cache = appContext.propsCache;
7056
+ const cached = cache.get(comp);
7057
+ if (cached) {
7058
+ return cached;
7059
+ }
7060
+ const raw = comp.props;
7061
+ const normalized = {};
7062
+ const needCastKeys = [];
7063
+ let hasExtends = false;
7064
+ if (!isFunction(comp)) {
7065
+ const extendProps = (raw2) => {
7066
+ if (isFunction(raw2)) {
7067
+ raw2 = raw2.options;
7068
+ }
7069
+ hasExtends = true;
7070
+ const [props, keys] = normalizePropsOptions(raw2, appContext, true);
7071
+ extend(normalized, props);
7072
+ if (keys)
7073
+ needCastKeys.push(...keys);
7074
+ };
7075
+ if (!asMixin && appContext.mixins.length) {
7076
+ appContext.mixins.forEach(extendProps);
6632
7077
  }
6633
- };
6634
- Vue.directive = (name, dir) => {
6635
- if (dir) {
6636
- singletonApp.directive(name, dir);
6637
- return Vue;
6638
- } else {
6639
- return singletonApp.directive(name);
7078
+ if (comp.extends) {
7079
+ extendProps(comp.extends);
6640
7080
  }
6641
- };
6642
- Vue.options = { _base: Vue };
6643
- let cid = 1;
6644
- Vue.cid = cid;
6645
- Vue.nextTick = nextTick;
6646
- const extendCache = /* @__PURE__ */ new WeakMap();
6647
- function extendCtor(extendOptions = {}) {
6648
- assertCompatEnabled("GLOBAL_EXTEND", null);
6649
- if (isFunction(extendOptions)) {
6650
- extendOptions = extendOptions.options;
7081
+ if (comp.mixins) {
7082
+ comp.mixins.forEach(extendProps);
6651
7083
  }
6652
- if (extendCache.has(extendOptions)) {
6653
- return extendCache.get(extendOptions);
7084
+ }
7085
+ if (!raw && !hasExtends) {
7086
+ if (isObject(comp)) {
7087
+ cache.set(comp, EMPTY_ARR);
6654
7088
  }
6655
- const Super = this;
6656
- function SubVue(inlineOptions) {
6657
- if (!inlineOptions) {
6658
- return createCompatApp(SubVue.options, SubVue);
6659
- } else {
6660
- return createCompatApp(
6661
- mergeOptions(
6662
- extend({}, SubVue.options),
6663
- inlineOptions,
6664
- internalOptionMergeStrats
6665
- ),
6666
- SubVue
6667
- );
7089
+ return EMPTY_ARR;
7090
+ }
7091
+ if (isArray(raw)) {
7092
+ for (let i = 0; i < raw.length; i++) {
7093
+ if (!isString(raw[i])) {
7094
+ warn(`props must be strings when using array syntax.`, raw[i]);
7095
+ }
7096
+ const normalizedKey = camelize(raw[i]);
7097
+ if (validatePropName(normalizedKey)) {
7098
+ normalized[normalizedKey] = EMPTY_OBJ;
6668
7099
  }
6669
7100
  }
6670
- SubVue.super = Super;
6671
- SubVue.prototype = Object.create(Vue.prototype);
6672
- SubVue.prototype.constructor = SubVue;
6673
- const mergeBase = {};
6674
- for (const key in Super.options) {
6675
- const superValue = Super.options[key];
6676
- mergeBase[key] = isArray(superValue) ? superValue.slice() : isObject(superValue) ? extend(/* @__PURE__ */ Object.create(null), superValue) : superValue;
7101
+ } else if (raw) {
7102
+ if (!isObject(raw)) {
7103
+ warn(`invalid props options`, raw);
6677
7104
  }
6678
- SubVue.options = mergeOptions(
6679
- mergeBase,
6680
- extendOptions,
6681
- internalOptionMergeStrats
7105
+ for (const key in raw) {
7106
+ const normalizedKey = camelize(key);
7107
+ if (validatePropName(normalizedKey)) {
7108
+ const opt = raw[key];
7109
+ const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : extend({}, opt);
7110
+ if (prop) {
7111
+ const booleanIndex = getTypeIndex(Boolean, prop.type);
7112
+ const stringIndex = getTypeIndex(String, prop.type);
7113
+ prop[0 /* shouldCast */] = booleanIndex > -1;
7114
+ prop[1 /* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
7115
+ if (booleanIndex > -1 || hasOwn(prop, "default")) {
7116
+ needCastKeys.push(normalizedKey);
7117
+ }
7118
+ }
7119
+ }
7120
+ }
7121
+ }
7122
+ const res = [normalized, needCastKeys];
7123
+ if (isObject(comp)) {
7124
+ cache.set(comp, res);
7125
+ }
7126
+ return res;
7127
+ }
7128
+ function validatePropName(key) {
7129
+ if (key[0] !== "$") {
7130
+ return true;
7131
+ } else {
7132
+ warn(`Invalid prop name: "${key}" is a reserved property.`);
7133
+ }
7134
+ return false;
7135
+ }
7136
+ function getType(ctor) {
7137
+ const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
7138
+ return match ? match[2] : ctor === null ? "null" : "";
7139
+ }
7140
+ function isSameType(a, b) {
7141
+ return getType(a) === getType(b);
7142
+ }
7143
+ function getTypeIndex(type, expectedTypes) {
7144
+ if (isArray(expectedTypes)) {
7145
+ return expectedTypes.findIndex((t) => isSameType(t, type));
7146
+ } else if (isFunction(expectedTypes)) {
7147
+ return isSameType(expectedTypes, type) ? 0 : -1;
7148
+ }
7149
+ return -1;
7150
+ }
7151
+ function validateProps(rawProps, props, instance) {
7152
+ const resolvedValues = toRaw(props);
7153
+ const options = instance.propsOptions[0];
7154
+ for (const key in options) {
7155
+ let opt = options[key];
7156
+ if (opt == null)
7157
+ continue;
7158
+ validateProp(
7159
+ key,
7160
+ resolvedValues[key],
7161
+ opt,
7162
+ !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key))
6682
7163
  );
6683
- SubVue.options._base = SubVue;
6684
- SubVue.extend = extendCtor.bind(SubVue);
6685
- SubVue.mixin = Super.mixin;
6686
- SubVue.use = Super.use;
6687
- SubVue.cid = ++cid;
6688
- extendCache.set(extendOptions, SubVue);
6689
- return SubVue;
6690
7164
  }
6691
- Vue.extend = extendCtor.bind(Vue);
6692
- Vue.set = (target, key, value) => {
6693
- assertCompatEnabled("GLOBAL_SET", null);
6694
- target[key] = value;
6695
- };
6696
- Vue.delete = (target, key) => {
6697
- assertCompatEnabled("GLOBAL_DELETE", null);
6698
- delete target[key];
6699
- };
6700
- Vue.observable = (target) => {
6701
- assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6702
- return reactive(target);
6703
- };
6704
- Vue.filter = (name, filter) => {
6705
- if (filter) {
6706
- singletonApp.filter(name, filter);
6707
- return Vue;
6708
- } else {
6709
- return singletonApp.filter(name);
6710
- }
6711
- };
6712
- const util = {
6713
- warn: warn ,
6714
- extend,
6715
- mergeOptions: (parent, child, vm) => mergeOptions(
6716
- parent,
6717
- child,
6718
- vm ? void 0 : internalOptionMergeStrats
6719
- ),
6720
- defineReactive
6721
- };
6722
- Object.defineProperty(Vue, "util", {
6723
- get() {
6724
- assertCompatEnabled("GLOBAL_PRIVATE_UTIL", null);
6725
- return util;
6726
- }
6727
- });
6728
- Vue.configureCompat = configureCompat;
6729
- return Vue;
6730
7165
  }
6731
- function installAppCompatProperties(app, context, render) {
6732
- installFilterMethod(app, context);
6733
- installLegacyOptionMergeStrats(app.config);
6734
- if (!singletonApp) {
7166
+ function validateProp(name, value, prop, isAbsent) {
7167
+ const { type, required, validator, skipCheck } = prop;
7168
+ if (required && isAbsent) {
7169
+ warn('Missing required prop: "' + name + '"');
6735
7170
  return;
6736
7171
  }
6737
- installCompatMount(app, context, render);
6738
- installLegacyAPIs(app);
6739
- applySingletonAppMutations(app);
6740
- installLegacyConfigWarnings(app.config);
6741
- }
6742
- function installFilterMethod(app, context) {
6743
- context.filters = {};
6744
- app.filter = (name, filter) => {
6745
- assertCompatEnabled("FILTERS", null);
6746
- if (!filter) {
6747
- return context.filters[name];
7172
+ if (value == null && !required) {
7173
+ return;
7174
+ }
7175
+ if (type != null && type !== true && !skipCheck) {
7176
+ let isValid = false;
7177
+ const types = isArray(type) ? type : [type];
7178
+ const expectedTypes = [];
7179
+ for (let i = 0; i < types.length && !isValid; i++) {
7180
+ const { valid, expectedType } = assertType(value, types[i]);
7181
+ expectedTypes.push(expectedType || "");
7182
+ isValid = valid;
6748
7183
  }
6749
- if (context.filters[name]) {
6750
- warn(`Filter "${name}" has already been registered.`);
7184
+ if (!isValid) {
7185
+ warn(getInvalidTypeMessage(name, value, expectedTypes));
7186
+ return;
6751
7187
  }
6752
- context.filters[name] = filter;
6753
- return app;
6754
- };
7188
+ }
7189
+ if (validator && !validator(value)) {
7190
+ warn('Invalid prop: custom validator check failed for prop "' + name + '".');
7191
+ }
6755
7192
  }
6756
- function installLegacyAPIs(app) {
6757
- Object.defineProperties(app, {
6758
- // so that app.use() can work with legacy plugins that extend prototypes
6759
- prototype: {
6760
- get() {
6761
- warnDeprecation("GLOBAL_PROTOTYPE", null);
6762
- return app.config.globalProperties;
6763
- }
6764
- },
6765
- nextTick: { value: nextTick },
6766
- extend: { value: singletonCtor.extend },
6767
- set: { value: singletonCtor.set },
6768
- delete: { value: singletonCtor.delete },
6769
- observable: { value: singletonCtor.observable },
6770
- util: {
6771
- get() {
6772
- return singletonCtor.util;
6773
- }
6774
- }
6775
- });
6776
- }
6777
- function applySingletonAppMutations(app) {
6778
- app._context.mixins = [...singletonApp._context.mixins];
6779
- ["components", "directives", "filters"].forEach((key) => {
6780
- app._context[key] = Object.create(singletonApp._context[key]);
6781
- });
6782
- isCopyingConfig = true;
6783
- for (const key in singletonApp.config) {
6784
- if (key === "isNativeTag")
6785
- continue;
6786
- if (isRuntimeOnly() && (key === "isCustomElement" || key === "compilerOptions")) {
6787
- continue;
6788
- }
6789
- const val = singletonApp.config[key];
6790
- app.config[key] = isObject(val) ? Object.create(val) : val;
6791
- if (key === "ignoredElements" && isCompatEnabled("CONFIG_IGNORED_ELEMENTS", null) && !isRuntimeOnly() && isArray(val)) {
6792
- app.config.compilerOptions.isCustomElement = (tag) => {
6793
- return val.some((v) => isString(v) ? v === tag : v.test(tag));
6794
- };
6795
- }
6796
- }
6797
- isCopyingConfig = false;
6798
- applySingletonPrototype(app, singletonCtor);
6799
- }
6800
- function applySingletonPrototype(app, Ctor) {
6801
- const enabled = isCompatEnabled("GLOBAL_PROTOTYPE", null);
6802
- if (enabled) {
6803
- app.config.globalProperties = Object.create(Ctor.prototype);
6804
- }
6805
- let hasPrototypeAugmentations = false;
6806
- const descriptors = Object.getOwnPropertyDescriptors(Ctor.prototype);
6807
- for (const key in descriptors) {
6808
- if (key !== "constructor") {
6809
- hasPrototypeAugmentations = true;
6810
- if (enabled) {
6811
- Object.defineProperty(
6812
- app.config.globalProperties,
6813
- key,
6814
- descriptors[key]
6815
- );
6816
- }
6817
- }
6818
- }
6819
- if (hasPrototypeAugmentations) {
6820
- warnDeprecation("GLOBAL_PROTOTYPE", null);
6821
- }
6822
- }
6823
- function installCompatMount(app, context, render) {
6824
- let isMounted = false;
6825
- app._createRoot = (options) => {
6826
- const component = app._component;
6827
- const vnode = createVNode(component, options.propsData || null);
6828
- vnode.appContext = context;
6829
- const hasNoRender = !isFunction(component) && !component.render && !component.template;
6830
- const emptyRender = () => {
6831
- };
6832
- const instance = createComponentInstance(vnode, null, null);
6833
- if (hasNoRender) {
6834
- instance.render = emptyRender;
6835
- }
6836
- setupComponent(instance);
6837
- vnode.component = instance;
6838
- vnode.isCompatRoot = true;
6839
- instance.ctx._compat_mount = (selectorOrEl) => {
6840
- if (isMounted) {
6841
- warn(`Root instance is already mounted.`);
6842
- return;
6843
- }
6844
- let container;
6845
- if (typeof selectorOrEl === "string") {
6846
- const result = document.querySelector(selectorOrEl);
6847
- if (!result) {
6848
- warn(
6849
- `Failed to mount root instance: selector "${selectorOrEl}" returned null.`
6850
- );
6851
- return;
6852
- }
6853
- container = result;
6854
- } else {
6855
- container = selectorOrEl || document.createElement("div");
6856
- }
6857
- const isSVG = container instanceof SVGElement;
6858
- {
6859
- context.reload = () => {
6860
- const cloned = cloneVNode(vnode);
6861
- cloned.component = null;
6862
- render(cloned, container, isSVG);
6863
- };
6864
- }
6865
- if (hasNoRender && instance.render === emptyRender) {
6866
- {
6867
- for (let i = 0; i < container.attributes.length; i++) {
6868
- const attr = container.attributes[i];
6869
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
6870
- warnDeprecation("GLOBAL_MOUNT_CONTAINER", null);
6871
- break;
6872
- }
6873
- }
6874
- }
6875
- instance.render = null;
6876
- component.template = container.innerHTML;
6877
- finishComponentSetup(
6878
- instance,
6879
- false,
6880
- true
6881
- /* skip options */
6882
- );
6883
- }
6884
- container.innerHTML = "";
6885
- render(vnode, container, isSVG);
6886
- if (container instanceof Element) {
6887
- container.removeAttribute("v-cloak");
6888
- container.setAttribute("data-v-app", "");
6889
- }
6890
- isMounted = true;
6891
- app._container = container;
6892
- container.__vue_app__ = app;
6893
- {
6894
- devtoolsInitApp(app, version);
6895
- }
6896
- return instance.proxy;
6897
- };
6898
- instance.ctx._compat_destroy = () => {
6899
- if (isMounted) {
6900
- render(null, app._container);
6901
- {
6902
- devtoolsUnmountApp(app);
6903
- }
6904
- delete app._container.__vue_app__;
6905
- } else {
6906
- const { bum, scope, um } = instance;
6907
- if (bum) {
6908
- invokeArrayFns(bum);
6909
- }
6910
- if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6911
- instance.emit("hook:beforeDestroy");
6912
- }
6913
- if (scope) {
6914
- scope.stop();
6915
- }
6916
- if (um) {
6917
- invokeArrayFns(um);
6918
- }
6919
- if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
6920
- instance.emit("hook:destroyed");
6921
- }
6922
- }
6923
- };
6924
- return instance.proxy;
6925
- };
6926
- }
6927
- const methodsToPatch = [
6928
- "push",
6929
- "pop",
6930
- "shift",
6931
- "unshift",
6932
- "splice",
6933
- "sort",
6934
- "reverse"
6935
- ];
6936
- const patched = /* @__PURE__ */ new WeakSet();
6937
- function defineReactive(obj, key, val) {
6938
- if (isObject(val) && !isReactive(val) && !patched.has(val)) {
6939
- const reactiveVal = reactive(val);
6940
- if (isArray(val)) {
6941
- methodsToPatch.forEach((m) => {
6942
- val[m] = (...args) => {
6943
- Array.prototype[m].call(reactiveVal, ...args);
6944
- };
6945
- });
6946
- } else {
6947
- Object.keys(val).forEach((key2) => {
6948
- try {
6949
- defineReactiveSimple(val, key2, val[key2]);
6950
- } catch (e) {
6951
- }
6952
- });
7193
+ const isSimpleType = /* @__PURE__ */ makeMap(
7194
+ "String,Number,Boolean,Function,Symbol,BigInt"
7195
+ );
7196
+ function assertType(value, type) {
7197
+ let valid;
7198
+ const expectedType = getType(type);
7199
+ if (isSimpleType(expectedType)) {
7200
+ const t = typeof value;
7201
+ valid = t === expectedType.toLowerCase();
7202
+ if (!valid && t === "object") {
7203
+ valid = value instanceof type;
6953
7204
  }
6954
- }
6955
- const i = obj.$;
6956
- if (i && obj === i.proxy) {
6957
- defineReactiveSimple(i.ctx, key, val);
6958
- i.accessCache = /* @__PURE__ */ Object.create(null);
6959
- } else if (isReactive(obj)) {
6960
- obj[key] = val;
7205
+ } else if (expectedType === "Object") {
7206
+ valid = isObject(value);
7207
+ } else if (expectedType === "Array") {
7208
+ valid = isArray(value);
7209
+ } else if (expectedType === "null") {
7210
+ valid = value === null;
6961
7211
  } else {
6962
- defineReactiveSimple(obj, key, val);
7212
+ valid = value instanceof type;
6963
7213
  }
6964
- }
6965
- function defineReactiveSimple(obj, key, val) {
6966
- val = isObject(val) ? reactive(val) : val;
6967
- Object.defineProperty(obj, key, {
6968
- enumerable: true,
6969
- configurable: true,
6970
- get() {
6971
- track(obj, "get", key);
6972
- return val;
6973
- },
6974
- set(newVal) {
6975
- val = isObject(newVal) ? reactive(newVal) : newVal;
6976
- trigger(obj, "set", key, newVal);
6977
- }
6978
- });
6979
- }
6980
-
6981
- function createAppContext() {
6982
7214
  return {
6983
- app: null,
6984
- config: {
6985
- isNativeTag: NO,
6986
- performance: false,
6987
- globalProperties: {},
6988
- optionMergeStrategies: {},
6989
- errorHandler: void 0,
6990
- warnHandler: void 0,
6991
- compilerOptions: {}
6992
- },
6993
- mixins: [],
6994
- components: {},
6995
- directives: {},
6996
- provides: /* @__PURE__ */ Object.create(null),
6997
- optionsCache: /* @__PURE__ */ new WeakMap(),
6998
- propsCache: /* @__PURE__ */ new WeakMap(),
6999
- emitsCache: /* @__PURE__ */ new WeakMap()
7000
- };
7001
- }
7002
- let uid$1 = 0;
7003
- function createAppAPI(render, hydrate) {
7004
- return function createApp(rootComponent, rootProps = null) {
7005
- if (!isFunction(rootComponent)) {
7006
- rootComponent = extend({}, rootComponent);
7007
- }
7008
- if (rootProps != null && !isObject(rootProps)) {
7009
- warn(`root props passed to app.mount() must be an object.`);
7010
- rootProps = null;
7011
- }
7012
- const context = createAppContext();
7013
- const installedPlugins = /* @__PURE__ */ new Set();
7014
- let isMounted = false;
7015
- const app = context.app = {
7016
- _uid: uid$1++,
7017
- _component: rootComponent,
7018
- _props: rootProps,
7019
- _container: null,
7020
- _context: context,
7021
- _instance: null,
7022
- version,
7023
- get config() {
7024
- return context.config;
7025
- },
7026
- set config(v) {
7027
- {
7028
- warn(
7029
- `app.config cannot be replaced. Modify individual options instead.`
7030
- );
7031
- }
7032
- },
7033
- use(plugin, ...options) {
7034
- if (installedPlugins.has(plugin)) {
7035
- warn(`Plugin has already been applied to target app.`);
7036
- } else if (plugin && isFunction(plugin.install)) {
7037
- installedPlugins.add(plugin);
7038
- plugin.install(app, ...options);
7039
- } else if (isFunction(plugin)) {
7040
- installedPlugins.add(plugin);
7041
- plugin(app, ...options);
7042
- } else {
7043
- warn(
7044
- `A plugin must either be a function or an object with an "install" function.`
7045
- );
7046
- }
7047
- return app;
7048
- },
7049
- mixin(mixin) {
7050
- {
7051
- if (!context.mixins.includes(mixin)) {
7052
- context.mixins.push(mixin);
7053
- } else {
7054
- warn(
7055
- "Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : "")
7056
- );
7057
- }
7058
- }
7059
- return app;
7060
- },
7061
- component(name, component) {
7062
- {
7063
- validateComponentName(name, context.config);
7064
- }
7065
- if (!component) {
7066
- return context.components[name];
7067
- }
7068
- if (context.components[name]) {
7069
- warn(`Component "${name}" has already been registered in target app.`);
7070
- }
7071
- context.components[name] = component;
7072
- return app;
7073
- },
7074
- directive(name, directive) {
7075
- {
7076
- validateDirectiveName(name);
7077
- }
7078
- if (!directive) {
7079
- return context.directives[name];
7080
- }
7081
- if (context.directives[name]) {
7082
- warn(`Directive "${name}" has already been registered in target app.`);
7083
- }
7084
- context.directives[name] = directive;
7085
- return app;
7086
- },
7087
- mount(rootContainer, isHydrate, isSVG) {
7088
- if (!isMounted) {
7089
- if (rootContainer.__vue_app__) {
7090
- warn(
7091
- `There is already an app instance mounted on the host container.
7092
- If you want to mount another app on the same host container, you need to unmount the previous app by calling \`app.unmount()\` first.`
7093
- );
7094
- }
7095
- const vnode = createVNode(
7096
- rootComponent,
7097
- rootProps
7098
- );
7099
- vnode.appContext = context;
7100
- {
7101
- context.reload = () => {
7102
- render(cloneVNode(vnode), rootContainer, isSVG);
7103
- };
7104
- }
7105
- if (isHydrate && hydrate) {
7106
- hydrate(vnode, rootContainer);
7107
- } else {
7108
- render(vnode, rootContainer, isSVG);
7109
- }
7110
- isMounted = true;
7111
- app._container = rootContainer;
7112
- rootContainer.__vue_app__ = app;
7113
- {
7114
- app._instance = vnode.component;
7115
- devtoolsInitApp(app, version);
7116
- }
7117
- return getExposeProxy(vnode.component) || vnode.component.proxy;
7118
- } else {
7119
- warn(
7120
- `App has already been mounted.
7121
- 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)\``
7122
- );
7123
- }
7124
- },
7125
- unmount() {
7126
- if (isMounted) {
7127
- render(null, app._container);
7128
- {
7129
- app._instance = null;
7130
- devtoolsUnmountApp(app);
7131
- }
7132
- delete app._container.__vue_app__;
7133
- } else {
7134
- warn(`Cannot unmount an app that is not mounted.`);
7135
- }
7136
- },
7137
- provide(key, value) {
7138
- if (key in context.provides) {
7139
- warn(
7140
- `App already provides property with key "${String(key)}". It will be overwritten with the new value.`
7141
- );
7215
+ valid,
7216
+ expectedType
7217
+ };
7218
+ }
7219
+ function getInvalidTypeMessage(name, value, expectedTypes) {
7220
+ let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7221
+ const expectedType = expectedTypes[0];
7222
+ const receivedType = toRawType(value);
7223
+ const expectedValue = styleValue(value, expectedType);
7224
+ const receivedValue = styleValue(value, receivedType);
7225
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
7226
+ message += ` with value ${expectedValue}`;
7227
+ }
7228
+ message += `, got ${receivedType} `;
7229
+ if (isExplicable(receivedType)) {
7230
+ message += `with value ${receivedValue}.`;
7231
+ }
7232
+ return message;
7233
+ }
7234
+ function styleValue(value, type) {
7235
+ if (type === "String") {
7236
+ return `"${value}"`;
7237
+ } else if (type === "Number") {
7238
+ return `${Number(value)}`;
7239
+ } else {
7240
+ return `${value}`;
7241
+ }
7242
+ }
7243
+ function isExplicable(type) {
7244
+ const explicitTypes = ["string", "number", "boolean"];
7245
+ return explicitTypes.some((elem) => type.toLowerCase() === elem);
7246
+ }
7247
+ function isBoolean(...args) {
7248
+ return args.some((elem) => elem.toLowerCase() === "boolean");
7249
+ }
7250
+
7251
+ const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7252
+ const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
7253
+ const normalizeSlot = (key, rawSlot, ctx) => {
7254
+ if (rawSlot._n) {
7255
+ return rawSlot;
7256
+ }
7257
+ const normalized = withCtx((...args) => {
7258
+ if (currentInstance) {
7259
+ warn(
7260
+ `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.`
7261
+ );
7262
+ }
7263
+ return normalizeSlotValue(rawSlot(...args));
7264
+ }, ctx);
7265
+ normalized._c = false;
7266
+ return normalized;
7267
+ };
7268
+ const normalizeObjectSlots = (rawSlots, slots, instance) => {
7269
+ const ctx = rawSlots._ctx;
7270
+ for (const key in rawSlots) {
7271
+ if (isInternalKey(key))
7272
+ continue;
7273
+ const value = rawSlots[key];
7274
+ if (isFunction(value)) {
7275
+ slots[key] = normalizeSlot(key, value, ctx);
7276
+ } else if (value != null) {
7277
+ if (!isCompatEnabled("RENDER_FUNCTION", instance)) {
7278
+ warn(
7279
+ `Non-function value encountered for slot "${key}". Prefer function slots for better performance.`
7280
+ );
7281
+ }
7282
+ const normalized = normalizeSlotValue(value);
7283
+ slots[key] = () => normalized;
7284
+ }
7285
+ }
7286
+ };
7287
+ const normalizeVNodeSlots = (instance, children) => {
7288
+ if (!isKeepAlive(instance.vnode) && !isCompatEnabled("RENDER_FUNCTION", instance)) {
7289
+ warn(
7290
+ `Non-function value encountered for default slot. Prefer function slots for better performance.`
7291
+ );
7292
+ }
7293
+ const normalized = normalizeSlotValue(children);
7294
+ instance.slots.default = () => normalized;
7295
+ };
7296
+ const initSlots = (instance, children) => {
7297
+ if (instance.vnode.shapeFlag & 32) {
7298
+ const type = children._;
7299
+ if (type) {
7300
+ instance.slots = toRaw(children);
7301
+ def(children, "_", type);
7302
+ } else {
7303
+ normalizeObjectSlots(
7304
+ children,
7305
+ instance.slots = {},
7306
+ instance
7307
+ );
7308
+ }
7309
+ } else {
7310
+ instance.slots = {};
7311
+ if (children) {
7312
+ normalizeVNodeSlots(instance, children);
7313
+ }
7314
+ }
7315
+ def(instance.slots, InternalObjectKey, 1);
7316
+ };
7317
+ const updateSlots = (instance, children, optimized) => {
7318
+ const { vnode, slots } = instance;
7319
+ let needDeletionCheck = true;
7320
+ let deletionComparisonTarget = EMPTY_OBJ;
7321
+ if (vnode.shapeFlag & 32) {
7322
+ const type = children._;
7323
+ if (type) {
7324
+ if (isHmrUpdating) {
7325
+ extend(slots, children);
7326
+ trigger(instance, "set", "$slots");
7327
+ } else if (optimized && type === 1) {
7328
+ needDeletionCheck = false;
7329
+ } else {
7330
+ extend(slots, children);
7331
+ if (!optimized && type === 1) {
7332
+ delete slots._;
7142
7333
  }
7143
- context.provides[key] = value;
7144
- return app;
7145
7334
  }
7146
- };
7147
- {
7148
- installAppCompatProperties(app, context, render);
7335
+ } else {
7336
+ needDeletionCheck = !children.$stable;
7337
+ normalizeObjectSlots(children, slots, instance);
7149
7338
  }
7150
- return app;
7151
- };
7152
- }
7339
+ deletionComparisonTarget = children;
7340
+ } else if (children) {
7341
+ normalizeVNodeSlots(instance, children);
7342
+ deletionComparisonTarget = { default: 1 };
7343
+ }
7344
+ if (needDeletionCheck) {
7345
+ for (const key in slots) {
7346
+ if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7347
+ delete slots[key];
7348
+ }
7349
+ }
7350
+ }
7351
+ };
7153
7352
 
7154
7353
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
7155
7354
  if (isArray(rawRef)) {
@@ -8053,7 +8252,7 @@ If you want to remount the same app, move your app creation logic into a factory
8053
8252
  areChildrenSVG,
8054
8253
  slotScopeIds
8055
8254
  );
8056
- if (parentComponent && parentComponent.type.__hmrId) {
8255
+ {
8057
8256
  traverseStaticChildren(n1, n2);
8058
8257
  }
8059
8258
  } else if (!optimized) {
@@ -8249,21 +8448,8 @@ If you want to remount the same app, move your app creation logic into a factory
8249
8448
  isSVG,
8250
8449
  slotScopeIds
8251
8450
  );
8252
- if (parentComponent && parentComponent.type.__hmrId) {
8451
+ {
8253
8452
  traverseStaticChildren(n1, n2);
8254
- } else if (
8255
- // #2080 if the stable fragment has a key, it's a <template v-for> that may
8256
- // get moved around. Make sure all root level vnodes inherit el.
8257
- // #2134 or if it's a component root, it may also get moved around
8258
- // as the component is being moved.
8259
- n2.key != null || parentComponent && n2 === parentComponent.subTree
8260
- ) {
8261
- traverseStaticChildren(
8262
- n1,
8263
- n2,
8264
- true
8265
- /* shallow */
8266
- );
8267
8453
  }
8268
8454
  } else {
8269
8455
  patchChildren(
@@ -9932,6 +10118,8 @@ Component that was made reactive: `,
9932
10118
  refs: EMPTY_OBJ,
9933
10119
  setupState: EMPTY_OBJ,
9934
10120
  setupContext: null,
10121
+ attrsProxy: null,
10122
+ slotsProxy: null,
9935
10123
  // suspense related
9936
10124
  suspense,
9937
10125
  suspenseId: suspense ? suspense.pendingId : 0,
@@ -10171,8 +10359,8 @@ Component that was made reactive: `,
10171
10359
  }
10172
10360
  }
10173
10361
  }
10174
- function createAttrsProxy(instance) {
10175
- return new Proxy(
10362
+ function getAttrsProxy(instance) {
10363
+ return instance.attrsProxy || (instance.attrsProxy = new Proxy(
10176
10364
  instance.attrs,
10177
10365
  {
10178
10366
  get(target, key) {
@@ -10189,7 +10377,23 @@ Component that was made reactive: `,
10189
10377
  return false;
10190
10378
  }
10191
10379
  }
10192
- );
10380
+ ));
10381
+ }
10382
+ function getSlotsProxy(instance) {
10383
+ return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
10384
+ get(target, key) {
10385
+ track(instance, "get", "$slots");
10386
+ return target[key];
10387
+ },
10388
+ set() {
10389
+ warn(`setupContext.slots is readonly.`);
10390
+ return false;
10391
+ },
10392
+ deleteProperty() {
10393
+ warn(`setupContext.slots is readonly.`);
10394
+ return false;
10395
+ }
10396
+ }));
10193
10397
  }
10194
10398
  function createSetupContext(instance) {
10195
10399
  const expose = (exposed) => {
@@ -10215,14 +10419,13 @@ Component that was made reactive: `,
10215
10419
  }
10216
10420
  instance.exposed = exposed || {};
10217
10421
  };
10218
- let attrs;
10219
10422
  {
10220
10423
  return Object.freeze({
10221
10424
  get attrs() {
10222
- return attrs || (attrs = createAttrsProxy(instance));
10425
+ return getAttrsProxy(instance);
10223
10426
  },
10224
10427
  get slots() {
10225
- return shallowReadonly(instance.slots);
10428
+ return getSlotsProxy(instance);
10226
10429
  },
10227
10430
  get emit() {
10228
10431
  return (event, ...args) => instance.emit(event, ...args);
@@ -10282,111 +10485,6 @@ Component that was made reactive: `,
10282
10485
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
10283
10486
  };
10284
10487
 
10285
- const warnRuntimeUsage = (method) => warn(
10286
- `${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.`
10287
- );
10288
- function defineProps() {
10289
- {
10290
- warnRuntimeUsage(`defineProps`);
10291
- }
10292
- return null;
10293
- }
10294
- function defineEmits() {
10295
- {
10296
- warnRuntimeUsage(`defineEmits`);
10297
- }
10298
- return null;
10299
- }
10300
- function defineExpose(exposed) {
10301
- {
10302
- warnRuntimeUsage(`defineExpose`);
10303
- }
10304
- }
10305
- function defineOptions(options) {
10306
- {
10307
- warnRuntimeUsage(`defineOptions`);
10308
- }
10309
- }
10310
- function defineSlots() {
10311
- {
10312
- warnRuntimeUsage(`defineSlots`);
10313
- }
10314
- }
10315
- function withDefaults(props, defaults) {
10316
- {
10317
- warnRuntimeUsage(`withDefaults`);
10318
- }
10319
- return null;
10320
- }
10321
- function useSlots() {
10322
- return getContext().slots;
10323
- }
10324
- function useAttrs() {
10325
- return getContext().attrs;
10326
- }
10327
- function getContext() {
10328
- const i = getCurrentInstance();
10329
- if (!i) {
10330
- warn(`useContext() called without active instance.`);
10331
- }
10332
- return i.setupContext || (i.setupContext = createSetupContext(i));
10333
- }
10334
- function mergeDefaults(raw, defaults) {
10335
- const props = isArray(raw) ? raw.reduce(
10336
- (normalized, p) => (normalized[p] = {}, normalized),
10337
- {}
10338
- ) : raw;
10339
- for (const key in defaults) {
10340
- if (key.startsWith("__skip"))
10341
- continue;
10342
- let opt = props[key];
10343
- if (opt) {
10344
- if (isArray(opt) || isFunction(opt)) {
10345
- opt = props[key] = { type: opt, default: defaults[key] };
10346
- } else {
10347
- opt.default = defaults[key];
10348
- }
10349
- } else if (opt === null) {
10350
- opt = props[key] = { default: defaults[key] };
10351
- } else {
10352
- warn(`props default key "${key}" has no corresponding declaration.`);
10353
- }
10354
- if (opt && defaults[`__skip_${key}`]) {
10355
- opt.skipFactory = true;
10356
- }
10357
- }
10358
- return props;
10359
- }
10360
- function createPropsRestProxy(props, excludedKeys) {
10361
- const ret = {};
10362
- for (const key in props) {
10363
- if (!excludedKeys.includes(key)) {
10364
- Object.defineProperty(ret, key, {
10365
- enumerable: true,
10366
- get: () => props[key]
10367
- });
10368
- }
10369
- }
10370
- return ret;
10371
- }
10372
- function withAsyncContext(getAwaitable) {
10373
- const ctx = getCurrentInstance();
10374
- if (!ctx) {
10375
- warn(
10376
- `withAsyncContext called without active current instance. This is likely a bug.`
10377
- );
10378
- }
10379
- let awaitable = getAwaitable();
10380
- unsetCurrentInstance();
10381
- if (isPromise(awaitable)) {
10382
- awaitable = awaitable.catch((e) => {
10383
- setCurrentInstance(ctx);
10384
- throw e;
10385
- });
10386
- }
10387
- return [awaitable, () => setCurrentInstance(ctx)];
10388
- }
10389
-
10390
10488
  function h(type, propsOrChildren, children) {
10391
10489
  const l = arguments.length;
10392
10490
  if (l === 2) {
@@ -10616,7 +10714,7 @@ Component that was made reactive: `,
10616
10714
  return true;
10617
10715
  }
10618
10716
 
10619
- const version = "3.3.0-alpha.8";
10717
+ const version = "3.3.0-beta.1";
10620
10718
  const ssrUtils = null;
10621
10719
  const resolveFilter = resolveFilter$1 ;
10622
10720
  const _compatUtils = {
@@ -12260,6 +12358,7 @@ Component that was made reactive: `,
12260
12358
  defineCustomElement: defineCustomElement,
12261
12359
  defineEmits: defineEmits,
12262
12360
  defineExpose: defineExpose,
12361
+ defineModel: defineModel,
12263
12362
  defineOptions: defineOptions,
12264
12363
  defineProps: defineProps,
12265
12364
  defineSSRCustomElement: defineSSRCustomElement,
@@ -12273,6 +12372,7 @@ Component that was made reactive: `,
12273
12372
  guardReactiveProps: guardReactiveProps,
12274
12373
  h: h,
12275
12374
  handleError: handleError,
12375
+ hasInjectionContext: hasInjectionContext,
12276
12376
  hydrate: hydrate,
12277
12377
  initCustomFormatter: initCustomFormatter,
12278
12378
  initDirectivesForSSR: initDirectivesForSSR,
@@ -12287,6 +12387,7 @@ Component that was made reactive: `,
12287
12387
  isVNode: isVNode,
12288
12388
  markRaw: markRaw,
12289
12389
  mergeDefaults: mergeDefaults,
12390
+ mergeModels: mergeModels,
12290
12391
  mergeProps: mergeProps,
12291
12392
  nextTick: nextTick,
12292
12393
  normalizeClass: normalizeClass,
@@ -12345,6 +12446,7 @@ Component that was made reactive: `,
12345
12446
  useAttrs: useAttrs,
12346
12447
  useCssModule: useCssModule,
12347
12448
  useCssVars: useCssVars,
12449
+ useModel: useModel,
12348
12450
  useSSRContext: useSSRContext,
12349
12451
  useSlots: useSlots,
12350
12452
  useTransitionState: useTransitionState,