@vue/runtime-core 3.1.0 → 3.1.4

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.
@@ -1,6 +1,6 @@
1
- import { pauseTracking, resetTracking, isRef, toRaw, isReactive, effect, stop, ref, reactive, proxyRefs, toRef, shallowReactive, trigger, isProxy, shallowReadonly, track, computed as computed$1, isReadonly } from '@vue/reactivity';
1
+ import { pauseTracking, resetTracking, isRef, toRaw, isReactive, effect, stop, ref, reactive, shallowReactive, trigger, isProxy, shallowReadonly, track, markRaw, proxyRefs, computed as computed$1, isReadonly } from '@vue/reactivity';
2
2
  export { customRef, isProxy, isReactive, isReadonly, isRef, markRaw, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref } from '@vue/reactivity';
3
- import { isString, isFunction, isPromise, isArray, extend, hasOwn, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, isModelListener, remove, NOOP, hasChanged, isObject, isSet, isMap, isPlainObject, invokeArrayFns, def, isReservedProp, EMPTY_ARR, capitalize, toRawType, makeMap, NO, getGlobalThis, normalizeClass, normalizeStyle, isGloballyWhitelisted } from '@vue/shared';
3
+ import { isString, isFunction as isFunction$1, isPromise as isPromise$1, isArray, extend, hasOwn, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, isModelListener, remove, NOOP, hasChanged, isObject as isObject$1, isSet, isMap, isPlainObject, invokeArrayFns, def, isReservedProp, EMPTY_ARR, capitalize, toRawType, makeMap, NO, getGlobalThis, normalizeClass, normalizeStyle, isGloballyWhitelisted } from '@vue/shared';
4
4
  export { camelize, capitalize, toDisplayString, toHandlerKey } from '@vue/shared';
5
5
 
6
6
  const stack = [];
@@ -108,7 +108,7 @@ function formatProp(key, value, raw) {
108
108
  value = formatProp(key, toRaw(value.value), true);
109
109
  return raw ? value : [`${key}=Ref<`, value, `>`];
110
110
  }
111
- else if (isFunction(value)) {
111
+ else if (isFunction$1(value)) {
112
112
  return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
113
113
  }
114
114
  else {
@@ -118,6 +118,7 @@ function formatProp(key, value, raw) {
118
118
  }
119
119
 
120
120
  const ErrorTypeStrings = {
121
+ ["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
121
122
  ["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
122
123
  ["c" /* CREATED */]: 'created hook',
123
124
  ["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
@@ -159,9 +160,9 @@ function callWithErrorHandling(fn, instance, type, args) {
159
160
  return res;
160
161
  }
161
162
  function callWithAsyncErrorHandling(fn, instance, type, args) {
162
- if (isFunction(fn)) {
163
+ if (isFunction$1(fn)) {
163
164
  const res = callWithErrorHandling(fn, instance, type, args);
164
- if (res && isPromise(res)) {
165
+ if (res && isPromise$1(res)) {
165
166
  res.catch(err => {
166
167
  handleError(err, instance, type);
167
168
  });
@@ -917,7 +918,7 @@ function isCompatEnabled(key, instance, enableForBuiltIn = false) {
917
918
  }
918
919
  const rawMode = getCompatConfigForKey('MODE', instance) || 2;
919
920
  const val = getCompatConfigForKey(key, instance);
920
- const mode = isFunction(rawMode)
921
+ const mode = isFunction$1(rawMode)
921
922
  ? rawMode(instance && instance.type)
922
923
  : rawMode;
923
924
  if (mode === 2) {
@@ -942,7 +943,7 @@ function emit(instance, event, ...rawArgs) {
942
943
  }
943
944
  else {
944
945
  const validator = emitsOptions[event];
945
- if (isFunction(validator)) {
946
+ if (isFunction$1(validator)) {
946
947
  const isValid = validator(...rawArgs);
947
948
  if (!isValid) {
948
949
  warn(`Invalid event arguments: event validation failed for event "${event}".`);
@@ -993,11 +994,12 @@ function emit(instance, event, ...rawArgs) {
993
994
  const onceHandler = props[handlerName + `Once`];
994
995
  if (onceHandler) {
995
996
  if (!instance.emitted) {
996
- (instance.emitted = {})[handlerName] = true;
997
+ instance.emitted = {};
997
998
  }
998
999
  else if (instance.emitted[handlerName]) {
999
1000
  return;
1000
1001
  }
1002
+ instance.emitted[handlerName] = true;
1001
1003
  callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
1002
1004
  }
1003
1005
  }
@@ -1011,7 +1013,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1011
1013
  let normalized = {};
1012
1014
  // apply mixin/extends props
1013
1015
  let hasExtends = false;
1014
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
1016
+ if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
1015
1017
  const extendEmits = (raw) => {
1016
1018
  const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
1017
1019
  if (normalizedFromExtend) {
@@ -1468,6 +1470,12 @@ const SuspenseImpl = {
1468
1470
  // Force-casted public typing for h and TSX props inference
1469
1471
  const Suspense = (SuspenseImpl
1470
1472
  );
1473
+ function triggerEvent(vnode, name) {
1474
+ const eventListener = vnode.props && vnode.props[name];
1475
+ if (isFunction$1(eventListener)) {
1476
+ eventListener();
1477
+ }
1478
+ }
1471
1479
  function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
1472
1480
  const { p: patch, o: { createElement } } = rendererInternals;
1473
1481
  const hiddenContainer = createElement('div');
@@ -1477,6 +1485,9 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
1477
1485
  // now check if we have encountered any async deps
1478
1486
  if (suspense.deps > 0) {
1479
1487
  // has async
1488
+ // invoke @fallback event
1489
+ triggerEvent(vnode, 'onPending');
1490
+ triggerEvent(vnode, 'onFallback');
1480
1491
  // mount the fallback tree
1481
1492
  patch(null, vnode.ssFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context
1482
1493
  isSVG, slotScopeIds);
@@ -1564,10 +1575,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
1564
1575
  else {
1565
1576
  // root node toggled
1566
1577
  // invoke @pending event
1567
- const onPending = n2.props && n2.props.onPending;
1568
- if (isFunction(onPending)) {
1569
- onPending();
1570
- }
1578
+ triggerEvent(n2, 'onPending');
1571
1579
  // mount pending branch in off-dom container
1572
1580
  suspense.pendingBranch = newBranch;
1573
1581
  suspense.pendingId++;
@@ -1680,10 +1688,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
1680
1688
  }
1681
1689
  suspense.effects = [];
1682
1690
  // invoke @resolve event
1683
- const onResolve = vnode.props && vnode.props.onResolve;
1684
- if (isFunction(onResolve)) {
1685
- onResolve();
1686
- }
1691
+ triggerEvent(vnode, 'onResolve');
1687
1692
  },
1688
1693
  fallback(fallbackVNode) {
1689
1694
  if (!suspense.pendingBranch) {
@@ -1691,10 +1696,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
1691
1696
  }
1692
1697
  const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;
1693
1698
  // invoke @fallback event
1694
- const onFallback = vnode.props && vnode.props.onFallback;
1695
- if (isFunction(onFallback)) {
1696
- onFallback();
1697
- }
1699
+ triggerEvent(vnode, 'onFallback');
1698
1700
  const anchor = next(activeBranch);
1699
1701
  const mountFallback = () => {
1700
1702
  if (!suspense.isInFallback) {
@@ -1709,11 +1711,11 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
1709
1711
  if (delayEnter) {
1710
1712
  activeBranch.transition.afterLeave = mountFallback;
1711
1713
  }
1714
+ suspense.isInFallback = true;
1712
1715
  // unmount current active branch
1713
1716
  unmount(activeBranch, parentComponent, null, // no suspense so unmount hooks fire now
1714
1717
  true // shouldRemove
1715
1718
  );
1716
- suspense.isInFallback = true;
1717
1719
  if (!delayEnter) {
1718
1720
  mountFallback();
1719
1721
  }
@@ -1816,7 +1818,7 @@ function normalizeSuspenseChildren(vnode) {
1816
1818
  }
1817
1819
  function normalizeSuspenseSlot(s) {
1818
1820
  let block;
1819
- if (isFunction(s)) {
1821
+ if (isFunction$1(s)) {
1820
1822
  const isCompiledSlot = s._c;
1821
1823
  if (isCompiledSlot) {
1822
1824
  // disableTracking: false
@@ -1907,8 +1909,8 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
1907
1909
  return provides[key];
1908
1910
  }
1909
1911
  else if (arguments.length > 1) {
1910
- return treatDefaultAsFactory && isFunction(defaultValue)
1911
- ? defaultValue()
1912
+ return treatDefaultAsFactory && isFunction$1(defaultValue)
1913
+ ? defaultValue.call(instance.proxy)
1912
1914
  : defaultValue;
1913
1915
  }
1914
1916
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -1928,7 +1930,7 @@ function watchEffect(effect, options) {
1928
1930
  const INITIAL_WATCHER_VALUE = {};
1929
1931
  // implementation
1930
1932
  function watch(source, cb, options) {
1931
- if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {
1933
+ if ((process.env.NODE_ENV !== 'production') && !isFunction$1(cb)) {
1932
1934
  warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
1933
1935
  `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
1934
1936
  `supports \`watch(source, cb, options?) signature.`);
@@ -1971,7 +1973,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1971
1973
  else if (isReactive(s)) {
1972
1974
  return traverse(s);
1973
1975
  }
1974
- else if (isFunction(s)) {
1976
+ else if (isFunction$1(s)) {
1975
1977
  return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
1976
1978
  }
1977
1979
  else {
@@ -1979,7 +1981,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1979
1981
  }
1980
1982
  });
1981
1983
  }
1982
- else if (isFunction(source)) {
1984
+ else if (isFunction$1(source)) {
1983
1985
  if (cb) {
1984
1986
  // getter with cb
1985
1987
  getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
@@ -2104,7 +2106,7 @@ function instanceWatch(source, value, options) {
2104
2106
  : () => publicThis[source]
2105
2107
  : source.bind(publicThis, publicThis);
2106
2108
  let cb;
2107
- if (isFunction(value)) {
2109
+ if (isFunction$1(value)) {
2108
2110
  cb = value;
2109
2111
  }
2110
2112
  else {
@@ -2124,7 +2126,7 @@ function createPathGetter(ctx, path) {
2124
2126
  };
2125
2127
  }
2126
2128
  function traverse(value, seen = new Set()) {
2127
- if (!isObject(value) ||
2129
+ if (!isObject$1(value) ||
2128
2130
  seen.has(value) ||
2129
2131
  value["__v_skip" /* SKIP */]) {
2130
2132
  return value;
@@ -2465,12 +2467,12 @@ function getTransitionRawChildren(children, keepComment = false) {
2465
2467
 
2466
2468
  // implementation, close to no-op
2467
2469
  function defineComponent(options) {
2468
- return isFunction(options) ? { setup: options, name: options.name } : options;
2470
+ return isFunction$1(options) ? { setup: options, name: options.name } : options;
2469
2471
  }
2470
2472
 
2471
2473
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2472
2474
  function defineAsyncComponent(source) {
2473
- if (isFunction(source)) {
2475
+ if (isFunction$1(source)) {
2474
2476
  source = { loader: source };
2475
2477
  }
2476
2478
  const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
@@ -2513,7 +2515,7 @@ function defineAsyncComponent(source) {
2513
2515
  (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
2514
2516
  comp = comp.default;
2515
2517
  }
2516
- if ((process.env.NODE_ENV !== 'production') && comp && !isObject(comp) && !isFunction(comp)) {
2518
+ if ((process.env.NODE_ENV !== 'production') && comp && !isObject$1(comp) && !isFunction$1(comp)) {
2517
2519
  throw new Error(`Invalid async component load result: ${comp}`);
2518
2520
  }
2519
2521
  resolvedComp = comp;
@@ -2999,7 +3001,7 @@ function applyOptions(instance) {
2999
3001
  if (methods) {
3000
3002
  for (const key in methods) {
3001
3003
  const methodHandler = methods[key];
3002
- if (isFunction(methodHandler)) {
3004
+ if (isFunction$1(methodHandler)) {
3003
3005
  // In dev mode, we use the `createRenderContext` function to define methods to the proxy target,
3004
3006
  // and those are read-only but reconfigurable, so it needs to be redefined here
3005
3007
  if ((process.env.NODE_ENV !== 'production')) {
@@ -3024,17 +3026,17 @@ function applyOptions(instance) {
3024
3026
  }
3025
3027
  }
3026
3028
  if (dataOptions) {
3027
- if ((process.env.NODE_ENV !== 'production') && !isFunction(dataOptions)) {
3029
+ if ((process.env.NODE_ENV !== 'production') && !isFunction$1(dataOptions)) {
3028
3030
  warn(`The data option must be a function. ` +
3029
3031
  `Plain object usage is no longer supported.`);
3030
3032
  }
3031
3033
  const data = dataOptions.call(publicThis, publicThis);
3032
- if ((process.env.NODE_ENV !== 'production') && isPromise(data)) {
3034
+ if ((process.env.NODE_ENV !== 'production') && isPromise$1(data)) {
3033
3035
  warn(`data() returned a Promise - note data() cannot be async; If you ` +
3034
3036
  `intend to perform data fetching before component renders, use ` +
3035
3037
  `async setup() + <Suspense>.`);
3036
3038
  }
3037
- if (!isObject(data)) {
3039
+ if (!isObject$1(data)) {
3038
3040
  (process.env.NODE_ENV !== 'production') && warn(`data() should return an object.`);
3039
3041
  }
3040
3042
  else {
@@ -3060,15 +3062,15 @@ function applyOptions(instance) {
3060
3062
  if (computedOptions) {
3061
3063
  for (const key in computedOptions) {
3062
3064
  const opt = computedOptions[key];
3063
- const get = isFunction(opt)
3065
+ const get = isFunction$1(opt)
3064
3066
  ? opt.bind(publicThis, publicThis)
3065
- : isFunction(opt.get)
3067
+ : isFunction$1(opt.get)
3066
3068
  ? opt.get.bind(publicThis, publicThis)
3067
3069
  : NOOP;
3068
3070
  if ((process.env.NODE_ENV !== 'production') && get === NOOP) {
3069
3071
  warn(`Computed property "${key}" has no getter.`);
3070
3072
  }
3071
- const set = !isFunction(opt) && isFunction(opt.set)
3073
+ const set = !isFunction$1(opt) && isFunction$1(opt.set)
3072
3074
  ? opt.set.bind(publicThis)
3073
3075
  : (process.env.NODE_ENV !== 'production')
3074
3076
  ? () => {
@@ -3096,7 +3098,7 @@ function applyOptions(instance) {
3096
3098
  }
3097
3099
  }
3098
3100
  if (provideOptions) {
3099
- const provides = isFunction(provideOptions)
3101
+ const provides = isFunction$1(provideOptions)
3100
3102
  ? provideOptions.call(publicThis)
3101
3103
  : provideOptions;
3102
3104
  Reflect.ownKeys(provides).forEach(key => {
@@ -3128,13 +3130,16 @@ function applyOptions(instance) {
3128
3130
  registerLifecycleHook(onServerPrefetch, serverPrefetch);
3129
3131
  if (isArray(expose)) {
3130
3132
  if (expose.length) {
3131
- const exposed = instance.exposed || (instance.exposed = proxyRefs({}));
3133
+ const exposed = instance.exposed || (instance.exposed = {});
3132
3134
  expose.forEach(key => {
3133
- exposed[key] = toRef(publicThis, key);
3135
+ Object.defineProperty(exposed, key, {
3136
+ get: () => publicThis[key],
3137
+ set: val => (publicThis[key] = val)
3138
+ });
3134
3139
  });
3135
3140
  }
3136
3141
  else if (!instance.exposed) {
3137
- instance.exposed = EMPTY_OBJ;
3142
+ instance.exposed = {};
3138
3143
  }
3139
3144
  }
3140
3145
  // options that are handled when creating the instance but also need to be
@@ -3157,7 +3162,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
3157
3162
  }
3158
3163
  for (const key in injectOptions) {
3159
3164
  const opt = injectOptions[key];
3160
- if (isObject(opt)) {
3165
+ if (isObject$1(opt)) {
3161
3166
  if ('default' in opt) {
3162
3167
  ctx[key] = inject(opt.from || key, opt.default, true /* treat default function as factory */);
3163
3168
  }
@@ -3184,25 +3189,25 @@ function createWatcher(raw, ctx, publicThis, key) {
3184
3189
  : () => publicThis[key];
3185
3190
  if (isString(raw)) {
3186
3191
  const handler = ctx[raw];
3187
- if (isFunction(handler)) {
3192
+ if (isFunction$1(handler)) {
3188
3193
  watch(getter, handler);
3189
3194
  }
3190
3195
  else if ((process.env.NODE_ENV !== 'production')) {
3191
3196
  warn(`Invalid watch handler specified by key "${raw}"`, handler);
3192
3197
  }
3193
3198
  }
3194
- else if (isFunction(raw)) {
3199
+ else if (isFunction$1(raw)) {
3195
3200
  watch(getter, raw.bind(publicThis));
3196
3201
  }
3197
- else if (isObject(raw)) {
3202
+ else if (isObject$1(raw)) {
3198
3203
  if (isArray(raw)) {
3199
3204
  raw.forEach(r => createWatcher(r, ctx, publicThis, key));
3200
3205
  }
3201
3206
  else {
3202
- const handler = isFunction(raw.handler)
3207
+ const handler = isFunction$1(raw.handler)
3203
3208
  ? raw.handler.bind(publicThis)
3204
3209
  : ctx[raw.handler];
3205
- if (isFunction(handler)) {
3210
+ if (isFunction$1(handler)) {
3206
3211
  watch(getter, handler, raw);
3207
3212
  }
3208
3213
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -3272,25 +3277,23 @@ const internalOptionMergeStrats = {
3272
3277
  methods: mergeObjectOptions,
3273
3278
  computed: mergeObjectOptions,
3274
3279
  // lifecycle
3275
- beforeCreate: mergeHook,
3276
- created: mergeHook,
3277
- beforeMount: mergeHook,
3278
- mounted: mergeHook,
3279
- beforeUpdate: mergeHook,
3280
- updated: mergeHook,
3281
- beforeDestroy: mergeHook,
3282
- destroyed: mergeHook,
3283
- activated: mergeHook,
3284
- deactivated: mergeHook,
3285
- errorCaptured: mergeHook,
3286
- serverPrefetch: mergeHook,
3280
+ beforeCreate: mergeAsArray,
3281
+ created: mergeAsArray,
3282
+ beforeMount: mergeAsArray,
3283
+ mounted: mergeAsArray,
3284
+ beforeUpdate: mergeAsArray,
3285
+ updated: mergeAsArray,
3286
+ beforeDestroy: mergeAsArray,
3287
+ destroyed: mergeAsArray,
3288
+ activated: mergeAsArray,
3289
+ deactivated: mergeAsArray,
3290
+ errorCaptured: mergeAsArray,
3291
+ serverPrefetch: mergeAsArray,
3287
3292
  // assets
3288
3293
  components: mergeObjectOptions,
3289
3294
  directives: mergeObjectOptions,
3290
- // watch has special merge behavior in v2, but isn't actually needed in v3.
3291
- // since we are only exposing these for compat and nobody should be relying
3292
- // on the watch-specific behavior, just expose the object merge strat.
3293
- watch: mergeObjectOptions,
3295
+ // watch
3296
+ watch: mergeWatchOptions,
3294
3297
  // provide / inject
3295
3298
  provide: mergeDataFn,
3296
3299
  inject: mergeInject
@@ -3303,7 +3306,7 @@ function mergeDataFn(to, from) {
3303
3306
  return from;
3304
3307
  }
3305
3308
  return function mergedDataFn() {
3306
- return (extend)(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
3309
+ return (extend)(isFunction$1(to) ? to.call(this, this) : to, isFunction$1(from) ? from.call(this, this) : from);
3307
3310
  };
3308
3311
  }
3309
3312
  function mergeInject(to, from) {
@@ -3319,11 +3322,22 @@ function normalizeInject(raw) {
3319
3322
  }
3320
3323
  return raw;
3321
3324
  }
3322
- function mergeHook(to, from) {
3325
+ function mergeAsArray(to, from) {
3323
3326
  return to ? [...new Set([].concat(to, from))] : from;
3324
3327
  }
3325
3328
  function mergeObjectOptions(to, from) {
3326
3329
  return to ? extend(extend(Object.create(null), to), from) : from;
3330
+ }
3331
+ function mergeWatchOptions(to, from) {
3332
+ if (!to)
3333
+ return from;
3334
+ if (!from)
3335
+ return to;
3336
+ const merged = extend(Object.create(null), to);
3337
+ for (const key in from) {
3338
+ merged[key] = mergeAsArray(to[key], from[key]);
3339
+ }
3340
+ return merged;
3327
3341
  }
3328
3342
 
3329
3343
  function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
@@ -3499,7 +3513,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3499
3513
  // default values
3500
3514
  if (hasDefault && value === undefined) {
3501
3515
  const defaultValue = opt.default;
3502
- if (opt.type !== Function && isFunction(defaultValue)) {
3516
+ if (opt.type !== Function && isFunction$1(defaultValue)) {
3503
3517
  const { propsDefaults } = instance;
3504
3518
  if (key in propsDefaults) {
3505
3519
  value = propsDefaults[key];
@@ -3538,7 +3552,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3538
3552
  const needCastKeys = [];
3539
3553
  // apply mixin/extends props
3540
3554
  let hasExtends = false;
3541
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
3555
+ if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
3542
3556
  const extendProps = (raw) => {
3543
3557
  hasExtends = true;
3544
3558
  const [props, keys] = normalizePropsOptions(raw, appContext, true);
@@ -3572,7 +3586,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3572
3586
  }
3573
3587
  }
3574
3588
  else if (raw) {
3575
- if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
3589
+ if ((process.env.NODE_ENV !== 'production') && !isObject$1(raw)) {
3576
3590
  warn(`invalid props options`, raw);
3577
3591
  }
3578
3592
  for (const key in raw) {
@@ -3580,7 +3594,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3580
3594
  if (validatePropName(normalizedKey)) {
3581
3595
  const opt = raw[key];
3582
3596
  const prop = (normalized[normalizedKey] =
3583
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
3597
+ isArray(opt) || isFunction$1(opt) ? { type: opt } : opt);
3584
3598
  if (prop) {
3585
3599
  const booleanIndex = getTypeIndex(Boolean, prop.type);
3586
3600
  const stringIndex = getTypeIndex(String, prop.type);
@@ -3621,7 +3635,7 @@ function getTypeIndex(type, expectedTypes) {
3621
3635
  if (isArray(expectedTypes)) {
3622
3636
  return expectedTypes.findIndex(t => isSameType(t, type));
3623
3637
  }
3624
- else if (isFunction(expectedTypes)) {
3638
+ else if (isFunction$1(expectedTypes)) {
3625
3639
  return isSameType(expectedTypes, type) ? 0 : -1;
3626
3640
  }
3627
3641
  return -1;
@@ -3690,7 +3704,7 @@ function assertType(value, type) {
3690
3704
  }
3691
3705
  }
3692
3706
  else if (expectedType === 'Object') {
3693
- valid = isObject(value);
3707
+ valid = isObject$1(value);
3694
3708
  }
3695
3709
  else if (expectedType === 'Array') {
3696
3710
  valid = isArray(value);
@@ -3776,7 +3790,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
3776
3790
  if (isInternalKey(key))
3777
3791
  continue;
3778
3792
  const value = rawSlots[key];
3779
- if (isFunction(value)) {
3793
+ if (isFunction$1(value)) {
3780
3794
  slots[key] = normalizeSlot(key, value, ctx);
3781
3795
  }
3782
3796
  else if (value != null) {
@@ -3905,7 +3919,7 @@ function withDirectives(vnode, directives) {
3905
3919
  const bindings = vnode.dirs || (vnode.dirs = []);
3906
3920
  for (let i = 0; i < directives.length; i++) {
3907
3921
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3908
- if (isFunction(dir)) {
3922
+ if (isFunction$1(dir)) {
3909
3923
  dir = {
3910
3924
  mounted: dir,
3911
3925
  updated: dir
@@ -3970,7 +3984,7 @@ function createAppContext() {
3970
3984
  let uid = 0;
3971
3985
  function createAppAPI(render, hydrate) {
3972
3986
  return function createApp(rootComponent, rootProps = null) {
3973
- if (rootProps != null && !isObject(rootProps)) {
3987
+ if (rootProps != null && !isObject$1(rootProps)) {
3974
3988
  (process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
3975
3989
  rootProps = null;
3976
3990
  }
@@ -3983,6 +3997,7 @@ function createAppAPI(render, hydrate) {
3983
3997
  _props: rootProps,
3984
3998
  _container: null,
3985
3999
  _context: context,
4000
+ _instance: null,
3986
4001
  version,
3987
4002
  get config() {
3988
4003
  return context.config;
@@ -3996,11 +4011,11 @@ function createAppAPI(render, hydrate) {
3996
4011
  if (installedPlugins.has(plugin)) {
3997
4012
  (process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);
3998
4013
  }
3999
- else if (plugin && isFunction(plugin.install)) {
4014
+ else if (plugin && isFunction$1(plugin.install)) {
4000
4015
  installedPlugins.add(plugin);
4001
4016
  plugin.install(app, ...options);
4002
4017
  }
4003
- else if (isFunction(plugin)) {
4018
+ else if (isFunction$1(plugin)) {
4004
4019
  installedPlugins.add(plugin);
4005
4020
  plugin(app, ...options);
4006
4021
  }
@@ -4073,6 +4088,7 @@ function createAppAPI(render, hydrate) {
4073
4088
  app._container = rootContainer;
4074
4089
  rootContainer.__vue_app__ = app;
4075
4090
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
4091
+ app._instance = vnode.component;
4076
4092
  devtoolsInitApp(app, version);
4077
4093
  }
4078
4094
  return vnode.component.proxy;
@@ -4088,6 +4104,7 @@ function createAppAPI(render, hydrate) {
4088
4104
  if (isMounted) {
4089
4105
  render(null, app._container);
4090
4106
  if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
4107
+ app._instance = null;
4091
4108
  devtoolsUnmountApp(app);
4092
4109
  }
4093
4110
  delete app._container.__vue_app__;
@@ -4122,10 +4139,12 @@ const isComment = (node) => node.nodeType === 8 /* COMMENT */;
4122
4139
  function createHydrationFunctions(rendererInternals) {
4123
4140
  const { mt: mountComponent, p: patch, o: { patchProp, nextSibling, parentNode, remove, insert, createComment } } = rendererInternals;
4124
4141
  const hydrate = (vnode, container) => {
4125
- if ((process.env.NODE_ENV !== 'production') && !container.hasChildNodes()) {
4126
- warn(`Attempting to hydrate existing markup but container is empty. ` +
4127
- `Performing full mount instead.`);
4142
+ if (!container.hasChildNodes()) {
4143
+ (process.env.NODE_ENV !== 'production') &&
4144
+ warn(`Attempting to hydrate existing markup but container is empty. ` +
4145
+ `Performing full mount instead.`);
4128
4146
  patch(null, vnode, container);
4147
+ flushPostFlushCbs();
4129
4148
  return;
4130
4149
  }
4131
4150
  hasMismatch = false;
@@ -4263,19 +4282,24 @@ function createHydrationFunctions(rendererInternals) {
4263
4282
  };
4264
4283
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
4265
4284
  optimized = optimized || !!vnode.dynamicChildren;
4266
- const { props, patchFlag, shapeFlag, dirs } = vnode;
4285
+ const { type, props, patchFlag, shapeFlag, dirs } = vnode;
4286
+ // #4006 for form elements with non-string v-model value bindings
4287
+ // e.g. <option :value="obj">, <input type="checkbox" :true-value="1">
4288
+ const forcePatchValue = (type === 'input' && dirs) || type === 'option';
4267
4289
  // skip props & children if this is hoisted static nodes
4268
- if (patchFlag !== -1 /* HOISTED */) {
4290
+ if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
4269
4291
  if (dirs) {
4270
4292
  invokeDirectiveHook(vnode, null, parentComponent, 'created');
4271
4293
  }
4272
4294
  // props
4273
4295
  if (props) {
4274
- if (!optimized ||
4296
+ if (forcePatchValue ||
4297
+ !optimized ||
4275
4298
  (patchFlag & 16 /* FULL_PROPS */ ||
4276
4299
  patchFlag & 32 /* HYDRATE_EVENTS */)) {
4277
4300
  for (const key in props) {
4278
- if (!isReservedProp(key) && isOn(key)) {
4301
+ if ((forcePatchValue && key.endsWith('value')) ||
4302
+ (isOn(key) && !isReservedProp(key))) {
4279
4303
  patchProp(el, key, null, props[key]);
4280
4304
  }
4281
4305
  }
@@ -4521,7 +4545,7 @@ const setRef = (rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) =>
4521
4545
  return;
4522
4546
  }
4523
4547
  const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
4524
- ? vnode.component.exposed || vnode.component.proxy
4548
+ ? getExposeProxy(vnode.component) || vnode.component.proxy
4525
4549
  : vnode.el;
4526
4550
  const value = isUnmount ? null : refValue;
4527
4551
  const { i: owner, r: ref } = rawRef;
@@ -4577,7 +4601,7 @@ const setRef = (rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) =>
4577
4601
  doSet();
4578
4602
  }
4579
4603
  }
4580
- else if (isFunction(ref)) {
4604
+ else if (isFunction$1(ref)) {
4581
4605
  callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
4582
4606
  }
4583
4607
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -4695,7 +4719,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4695
4719
  }
4696
4720
  };
4697
4721
  const mountStaticNode = (n2, container, anchor, isSVG) => {
4698
- [n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
4722
+ // static nodes are only present when used with compiler-dom/runtime-dom
4723
+ // which guarantees presence of hostInsertStaticContent.
4724
+ const nodes = hostInsertStaticContent(n2.children, container, anchor, isSVG,
4725
+ // pass cached nodes if the static node is being mounted multiple times
4726
+ // so that runtime-dom can simply cloneNode() instead of inserting new
4727
+ // HTML
4728
+ n2.staticCache);
4729
+ // first mount - this is the orignal hoisted vnode. cache nodes.
4730
+ if (!n2.el) {
4731
+ n2.staticCache = nodes;
4732
+ }
4733
+ n2.el = nodes[0];
4734
+ n2.anchor = nodes[nodes.length - 1];
4699
4735
  };
4700
4736
  /**
4701
4737
  * Dev / HMR only
@@ -6257,7 +6293,7 @@ const InternalObjectKey = `__vInternal`;
6257
6293
  const normalizeKey = ({ key }) => key != null ? key : null;
6258
6294
  const normalizeRef = ({ ref }) => {
6259
6295
  return (ref != null
6260
- ? isString(ref) || isRef(ref) || isFunction(ref)
6296
+ ? isString(ref) || isRef(ref) || isFunction$1(ref)
6261
6297
  ? { i: currentRenderingInstance, r: ref }
6262
6298
  : ref
6263
6299
  : null);
@@ -6296,7 +6332,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6296
6332
  if (klass && !isString(klass)) {
6297
6333
  props.class = normalizeClass(klass);
6298
6334
  }
6299
- if (isObject(style)) {
6335
+ if (isObject$1(style)) {
6300
6336
  // reactive state objects need to be cloned since they are likely to be
6301
6337
  // mutated
6302
6338
  if (isProxy(style) && !isArray(style)) {
@@ -6312,9 +6348,9 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6312
6348
  ? 128 /* SUSPENSE */
6313
6349
  : isTeleport(type)
6314
6350
  ? 64 /* TELEPORT */
6315
- : isObject(type)
6351
+ : isObject$1(type)
6316
6352
  ? 4 /* STATEFUL_COMPONENT */
6317
- : isFunction(type)
6353
+ : isFunction$1(type)
6318
6354
  ? 2 /* FUNCTIONAL_COMPONENT */
6319
6355
  : 0;
6320
6356
  if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
@@ -6344,7 +6380,6 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6344
6380
  anchor: null,
6345
6381
  target: null,
6346
6382
  targetAnchor: null,
6347
- staticCount: 0,
6348
6383
  shapeFlag,
6349
6384
  patchFlag,
6350
6385
  dynamicProps,
@@ -6406,6 +6441,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
6406
6441
  target: vnode.target,
6407
6442
  targetAnchor: vnode.targetAnchor,
6408
6443
  staticCount: vnode.staticCount,
6444
+ staticCache: vnode.staticCache,
6409
6445
  shapeFlag: vnode.shapeFlag,
6410
6446
  // if the vnode is cloned with extra props, we can no longer assume its
6411
6447
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
@@ -6537,7 +6573,7 @@ function normalizeChildren(vnode, children) {
6537
6573
  }
6538
6574
  }
6539
6575
  }
6540
- else if (isFunction(children)) {
6576
+ else if (isFunction$1(children)) {
6541
6577
  children = { default: children, _ctx: currentRenderingInstance };
6542
6578
  type = 32 /* SLOTS_CHILDREN */;
6543
6579
  }
@@ -6606,7 +6642,7 @@ function renderList(source, renderItem) {
6606
6642
  ret[i] = renderItem(i + 1, i);
6607
6643
  }
6608
6644
  }
6609
- else if (isObject(source)) {
6645
+ else if (isObject$1(source)) {
6610
6646
  if (source[Symbol.iterator]) {
6611
6647
  ret = Array.from(source, renderItem);
6612
6648
  }
@@ -6702,7 +6738,7 @@ function ensureValidVNode(vnodes) {
6702
6738
  */
6703
6739
  function toHandlers(obj) {
6704
6740
  const ret = {};
6705
- if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
6741
+ if ((process.env.NODE_ENV !== 'production') && !isObject$1(obj)) {
6706
6742
  warn(`v-on with no argument expects an object value.`);
6707
6743
  return ret;
6708
6744
  }
@@ -6721,7 +6757,7 @@ const getPublicInstance = (i) => {
6721
6757
  if (!i)
6722
6758
  return null;
6723
6759
  if (isStatefulComponent(i))
6724
- return i.exposed ? i.exposed : i.proxy;
6760
+ return getExposeProxy(i) || i.proxy;
6725
6761
  return getPublicInstance(i.parent);
6726
6762
  };
6727
6763
  const publicPropertiesMap = extend(Object.create(null), {
@@ -6743,14 +6779,20 @@ const publicPropertiesMap = extend(Object.create(null), {
6743
6779
  const PublicInstanceProxyHandlers = {
6744
6780
  get({ _: instance }, key) {
6745
6781
  const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
6746
- // let @vue/reactivity know it should never observe Vue public instances.
6747
- if (key === "__v_skip" /* SKIP */) {
6748
- return true;
6749
- }
6750
6782
  // for internal formatters to know that this is a Vue instance
6751
6783
  if ((process.env.NODE_ENV !== 'production') && key === '__isVue') {
6752
6784
  return true;
6753
6785
  }
6786
+ // prioritize <script setup> bindings during dev.
6787
+ // this allows even properties that start with _ or $ to be used - so that
6788
+ // it aligns with the production behavior where the render fn is inlined and
6789
+ // indeed has access to all declared variables.
6790
+ if ((process.env.NODE_ENV !== 'production') &&
6791
+ setupState !== EMPTY_OBJ &&
6792
+ setupState.__isScriptSetup &&
6793
+ hasOwn(setupState, key)) {
6794
+ return setupState[key];
6795
+ }
6754
6796
  // data / props / ctx
6755
6797
  // This getter gets called for every property access on the render context
6756
6798
  // during render and is a major hotspot. The most expensive part of this
@@ -6953,7 +6995,7 @@ function exposePropsOnRenderContext(instance) {
6953
6995
  function exposeSetupStateOnRenderContext(instance) {
6954
6996
  const { ctx, setupState } = instance;
6955
6997
  Object.keys(toRaw(setupState)).forEach(key => {
6956
- if (key[0] === '$' || key[0] === '_') {
6998
+ if (!setupState.__isScriptSetup && (key[0] === '$' || key[0] === '_')) {
6957
6999
  warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
6958
7000
  `which are reserved prefixes for Vue internals.`);
6959
7001
  return;
@@ -6986,6 +7028,7 @@ function createComponentInstance(vnode, parent, suspense) {
6986
7028
  render: null,
6987
7029
  proxy: null,
6988
7030
  exposed: null,
7031
+ exposeProxy: null,
6989
7032
  withProxy: null,
6990
7033
  effects: null,
6991
7034
  provides: parent ? parent.provides : Object.create(appContext.provides),
@@ -7104,7 +7147,7 @@ function setupStatefulComponent(instance, isSSR) {
7104
7147
  instance.accessCache = Object.create(null);
7105
7148
  // 1. create public instance / render proxy
7106
7149
  // also mark it raw so it's never observed
7107
- instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
7150
+ instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
7108
7151
  if ((process.env.NODE_ENV !== 'production')) {
7109
7152
  exposePropsOnRenderContext(instance);
7110
7153
  }
@@ -7118,7 +7161,11 @@ function setupStatefulComponent(instance, isSSR) {
7118
7161
  const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
7119
7162
  resetTracking();
7120
7163
  currentInstance = null;
7121
- if (isPromise(setupResult)) {
7164
+ if (isPromise$1(setupResult)) {
7165
+ const unsetInstance = () => {
7166
+ currentInstance = null;
7167
+ };
7168
+ setupResult.then(unsetInstance, unsetInstance);
7122
7169
  if (isSSR) {
7123
7170
  // return the promise so server-renderer can wait on it
7124
7171
  return setupResult
@@ -7144,13 +7191,13 @@ function setupStatefulComponent(instance, isSSR) {
7144
7191
  }
7145
7192
  }
7146
7193
  function handleSetupResult(instance, setupResult, isSSR) {
7147
- if (isFunction(setupResult)) {
7194
+ if (isFunction$1(setupResult)) {
7148
7195
  // setup returned an inline render function
7149
7196
  {
7150
7197
  instance.render = setupResult;
7151
7198
  }
7152
7199
  }
7153
- else if (isObject(setupResult)) {
7200
+ else if (isObject$1(setupResult)) {
7154
7201
  if ((process.env.NODE_ENV !== 'production') && isVNode(setupResult)) {
7155
7202
  warn(`setup() should not return VNodes directly - ` +
7156
7203
  `return a render function instead.`);
@@ -7234,11 +7281,9 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
7234
7281
  }
7235
7282
  }
7236
7283
  }
7237
- const attrHandlers = {
7284
+ const attrDevProxyHandlers = {
7238
7285
  get: (target, key) => {
7239
- if ((process.env.NODE_ENV !== 'production')) {
7240
- markAttrsAccessed();
7241
- }
7286
+ markAttrsAccessed();
7242
7287
  return target[key];
7243
7288
  },
7244
7289
  set: () => {
@@ -7255,14 +7300,15 @@ function createSetupContext(instance) {
7255
7300
  if ((process.env.NODE_ENV !== 'production') && instance.exposed) {
7256
7301
  warn(`expose() should be called only once per setup().`);
7257
7302
  }
7258
- instance.exposed = proxyRefs(exposed);
7303
+ instance.exposed = exposed || {};
7259
7304
  };
7260
7305
  if ((process.env.NODE_ENV !== 'production')) {
7306
+ let attrs;
7261
7307
  // We use getters in dev in case libs like test-utils overwrite instance
7262
7308
  // properties (overwrites should not be done in prod)
7263
7309
  return Object.freeze({
7264
7310
  get attrs() {
7265
- return new Proxy(instance.attrs, attrHandlers);
7311
+ return (attrs || (attrs = new Proxy(instance.attrs, attrDevProxyHandlers)));
7266
7312
  },
7267
7313
  get slots() {
7268
7314
  return shallowReadonly(instance.slots);
@@ -7282,6 +7328,21 @@ function createSetupContext(instance) {
7282
7328
  };
7283
7329
  }
7284
7330
  }
7331
+ function getExposeProxy(instance) {
7332
+ if (instance.exposed) {
7333
+ return (instance.exposeProxy ||
7334
+ (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
7335
+ get(target, key) {
7336
+ if (key in target) {
7337
+ return target[key];
7338
+ }
7339
+ else if (key in publicPropertiesMap) {
7340
+ return publicPropertiesMap[key](instance);
7341
+ }
7342
+ }
7343
+ })));
7344
+ }
7345
+ }
7285
7346
  // record effects created during a component's setup() so that they can be
7286
7347
  // stopped when the component unmounts
7287
7348
  function recordInstanceBoundEffect(effect, instance = currentInstance) {
@@ -7292,7 +7353,7 @@ function recordInstanceBoundEffect(effect, instance = currentInstance) {
7292
7353
  const classifyRE = /(?:^|[-_])(\w)/g;
7293
7354
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
7294
7355
  function getComponentName(Component) {
7295
- return isFunction(Component)
7356
+ return isFunction$1(Component)
7296
7357
  ? Component.displayName || Component.name
7297
7358
  : Component.name;
7298
7359
  }
@@ -7321,7 +7382,7 @@ function formatComponentName(instance, Component, isRoot = false) {
7321
7382
  return name ? classify(name) : isRoot ? `App` : `Anonymous`;
7322
7383
  }
7323
7384
  function isClassComponent(value) {
7324
- return isFunction(value) && '__vccOpts' in value;
7385
+ return isFunction$1(value) && '__vccOpts' in value;
7325
7386
  }
7326
7387
 
7327
7388
  function computed(getterOrOptions) {
@@ -7330,37 +7391,150 @@ function computed(getterOrOptions) {
7330
7391
  return c;
7331
7392
  }
7332
7393
 
7394
+ (process.env.NODE_ENV !== 'production')
7395
+ ? Object.freeze({})
7396
+ : {};
7397
+ (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
7398
+ const isFunction = (val) => typeof val === 'function';
7399
+ const isObject = (val) => val !== null && typeof val === 'object';
7400
+ const isPromise = (val) => {
7401
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
7402
+ };
7403
+
7404
+ // dev only
7405
+ const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7406
+ `<script setup> of a single file component. Its arguments should be ` +
7407
+ `compiled away and passing it at runtime has no effect.`);
7333
7408
  // implementation
7334
7409
  function defineProps() {
7335
7410
  if ((process.env.NODE_ENV !== 'production')) {
7336
- warn(`defineProps() is a compiler-hint helper that is only usable inside ` +
7337
- `<script setup> of a single file component. Its arguments should be ` +
7338
- `compiled away and passing it at runtime has no effect.`);
7411
+ warnRuntimeUsage(`defineProps`);
7339
7412
  }
7340
7413
  return null;
7341
7414
  }
7342
7415
  // implementation
7343
- function defineEmit() {
7416
+ function defineEmits() {
7344
7417
  if ((process.env.NODE_ENV !== 'production')) {
7345
- warn(`defineEmit() is a compiler-hint helper that is only usable inside ` +
7346
- `<script setup> of a single file component. Its arguments should be ` +
7347
- `compiled away and passing it at runtime has no effect.`);
7418
+ warnRuntimeUsage(`defineEmits`);
7348
7419
  }
7349
7420
  return null;
7350
7421
  }
7422
+ /**
7423
+ * @deprecated use `defineEmits` instead.
7424
+ */
7425
+ const defineEmit = defineEmits;
7426
+ /**
7427
+ * Vue `<script setup>` compiler macro for declaring a component's exposed
7428
+ * instance properties when it is accessed by a parent component via template
7429
+ * refs.
7430
+ *
7431
+ * `<script setup>` components are closed by default - i.e. varaibles inside
7432
+ * the `<script setup>` scope is not exposed to parent unless explicitly exposed
7433
+ * via `defineExpose`.
7434
+ *
7435
+ * This is only usable inside `<script setup>`, is compiled away in the
7436
+ * output and should **not** be actually called at runtime.
7437
+ */
7438
+ function defineExpose(exposed) {
7439
+ if ((process.env.NODE_ENV !== 'production')) {
7440
+ warnRuntimeUsage(`defineExpose`);
7441
+ }
7442
+ }
7443
+ /**
7444
+ * Vue `<script setup>` compiler macro for providing props default values when
7445
+ * using type-based `defineProps` decalration.
7446
+ *
7447
+ * Example usage:
7448
+ * ```ts
7449
+ * withDefaults(defineProps<{
7450
+ * size?: number
7451
+ * labels?: string[]
7452
+ * }>(), {
7453
+ * size: 3,
7454
+ * labels: () => ['default label']
7455
+ * })
7456
+ * ```
7457
+ *
7458
+ * This is only usable inside `<script setup>`, is compiled away in the output
7459
+ * and should **not** be actually called at runtime.
7460
+ */
7461
+ function withDefaults(props, defaults) {
7462
+ if ((process.env.NODE_ENV !== 'production')) {
7463
+ warnRuntimeUsage(`withDefaults`);
7464
+ }
7465
+ return null;
7466
+ }
7467
+ /**
7468
+ * @deprecated use `useSlots` and `useAttrs` instead.
7469
+ */
7351
7470
  function useContext() {
7471
+ if ((process.env.NODE_ENV !== 'production')) {
7472
+ warn(`\`useContext()\` has been deprecated and will be removed in the ` +
7473
+ `next minor release. Use \`useSlots()\` and \`useAttrs()\` instead.`);
7474
+ }
7475
+ return getContext();
7476
+ }
7477
+ function useSlots() {
7478
+ return getContext().slots;
7479
+ }
7480
+ function useAttrs() {
7481
+ return getContext().attrs;
7482
+ }
7483
+ function getContext() {
7352
7484
  const i = getCurrentInstance();
7353
7485
  if ((process.env.NODE_ENV !== 'production') && !i) {
7354
7486
  warn(`useContext() called without active instance.`);
7355
7487
  }
7356
7488
  return i.setupContext || (i.setupContext = createSetupContext(i));
7489
+ }
7490
+ /**
7491
+ * Runtime helper for merging default declarations. Imported by compiled code
7492
+ * only.
7493
+ * @internal
7494
+ */
7495
+ function mergeDefaults(
7496
+ // the base props is compiler-generated and guaranteed to be in this shape.
7497
+ props, defaults) {
7498
+ for (const key in defaults) {
7499
+ const val = props[key];
7500
+ if (val) {
7501
+ val.default = defaults[key];
7502
+ }
7503
+ else if (val === null) {
7504
+ props[key] = { default: defaults[key] };
7505
+ }
7506
+ else if ((process.env.NODE_ENV !== 'production')) {
7507
+ warn(`props default key "${key}" has no corresponding declaration.`);
7508
+ }
7509
+ }
7510
+ return props;
7511
+ }
7512
+ /**
7513
+ * Runtime helper for storing and resuming current instance context in
7514
+ * async setup().
7515
+ */
7516
+ function withAsyncContext(awaitable) {
7517
+ const ctx = getCurrentInstance();
7518
+ setCurrentInstance(null); // unset after storing instance
7519
+ if ((process.env.NODE_ENV !== 'production') && !ctx) {
7520
+ warn(`withAsyncContext() called when there is no active context instance.`);
7521
+ }
7522
+ return isPromise(awaitable)
7523
+ ? awaitable.then(res => {
7524
+ setCurrentInstance(ctx);
7525
+ return res;
7526
+ }, err => {
7527
+ setCurrentInstance(ctx);
7528
+ throw err;
7529
+ })
7530
+ : awaitable;
7357
7531
  }
7358
7532
 
7359
7533
  // Actual implementation
7360
7534
  function h(type, propsOrChildren, children) {
7361
7535
  const l = arguments.length;
7362
7536
  if (l === 2) {
7363
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
7537
+ if (isObject$1(propsOrChildren) && !isArray(propsOrChildren)) {
7364
7538
  // single vnode without props
7365
7539
  if (isVNode(propsOrChildren)) {
7366
7540
  return createVNode(type, null, [propsOrChildren]);
@@ -7410,7 +7584,7 @@ function initCustomFormatter() {
7410
7584
  const formatter = {
7411
7585
  header(obj) {
7412
7586
  // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
7413
- if (!isObject(obj)) {
7587
+ if (!isObject$1(obj)) {
7414
7588
  return null;
7415
7589
  }
7416
7590
  if (obj.__isVue) {
@@ -7535,7 +7709,7 @@ function initCustomFormatter() {
7535
7709
  else if (typeof v === 'boolean') {
7536
7710
  return ['span', keywordStyle, v];
7537
7711
  }
7538
- else if (isObject(v)) {
7712
+ else if (isObject$1(v)) {
7539
7713
  return ['object', { object: asRaw ? toRaw(v) : v }];
7540
7714
  }
7541
7715
  else {
@@ -7544,7 +7718,7 @@ function initCustomFormatter() {
7544
7718
  }
7545
7719
  function extractKeys(instance, type) {
7546
7720
  const Comp = instance.type;
7547
- if (isFunction(Comp)) {
7721
+ if (isFunction$1(Comp)) {
7548
7722
  return;
7549
7723
  }
7550
7724
  const extracted = {};
@@ -7558,7 +7732,7 @@ function initCustomFormatter() {
7558
7732
  function isKeyOfType(Comp, key, type) {
7559
7733
  const opts = Comp[type];
7560
7734
  if ((isArray(opts) && opts.includes(key)) ||
7561
- (isObject(opts) && key in opts)) {
7735
+ (isObject$1(opts) && key in opts)) {
7562
7736
  return true;
7563
7737
  }
7564
7738
  if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
@@ -7586,7 +7760,7 @@ function initCustomFormatter() {
7586
7760
  }
7587
7761
 
7588
7762
  // Core API ------------------------------------------------------------------
7589
- const version = "3.1.0";
7763
+ const version = "3.1.4";
7590
7764
  /**
7591
7765
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
7592
7766
  * @internal
@@ -7601,4 +7775,4 @@ const resolveFilter = null;
7601
7775
  */
7602
7776
  const compatUtils = (null);
7603
7777
 
7604
- export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, initCustomFormatter, inject, isRuntimeOnly, isVNode, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useContext, useSSRContext, useTransitionState, version, warn, watch, watchEffect, withCtx, withDirectives, withScopeId };
7778
+ export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, initCustomFormatter, inject, isRuntimeOnly, isVNode, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, pushScopeId, queuePostFlushCb, registerRuntimeCompiler, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, ssrContextKey, ssrUtils, toHandlers, transformVNodeArgs, useAttrs, useContext, useSSRContext, useSlots, useTransitionState, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withScopeId };