@vue/runtime-core 3.1.3 → 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.
@@ -6700,7 +6700,7 @@ const getPublicInstance = (i) => {
6700
6700
  if (!i)
6701
6701
  return null;
6702
6702
  if (isStatefulComponent(i))
6703
- return i.exposed ? i.exposed : i.proxy;
6703
+ return getExposeProxy(i) || i.proxy;
6704
6704
  return getPublicInstance(i.parent);
6705
6705
  };
6706
6706
  const publicPropertiesMap = shared.extend(Object.create(null), {
@@ -7333,6 +7333,15 @@ function computed(getterOrOptions) {
7333
7333
  return c;
7334
7334
  }
7335
7335
 
7336
+ Object.freeze({})
7337
+ ;
7338
+ Object.freeze([]) ;
7339
+ const isFunction = (val) => typeof val === 'function';
7340
+ const isObject = (val) => val !== null && typeof val === 'object';
7341
+ const isPromise = (val) => {
7342
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
7343
+ };
7344
+
7336
7345
  // dev only
7337
7346
  const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7338
7347
  `<script setup> of a single file component. Its arguments should be ` +
@@ -7406,6 +7415,12 @@ function useContext() {
7406
7415
  }
7407
7416
  return getContext();
7408
7417
  }
7418
+ function useSlots() {
7419
+ return getContext().slots;
7420
+ }
7421
+ function useAttrs() {
7422
+ return getContext().attrs;
7423
+ }
7409
7424
  function getContext() {
7410
7425
  const i = getCurrentInstance();
7411
7426
  if (!i) {
@@ -7439,20 +7454,21 @@ props, defaults) {
7439
7454
  * Runtime helper for storing and resuming current instance context in
7440
7455
  * async setup().
7441
7456
  */
7442
- async function withAsyncContext(awaitable) {
7457
+ function withAsyncContext(awaitable) {
7443
7458
  const ctx = getCurrentInstance();
7444
7459
  setCurrentInstance(null); // unset after storing instance
7445
7460
  if (!ctx) {
7446
7461
  warn(`withAsyncContext() called when there is no active context instance.`);
7447
7462
  }
7448
- let res;
7449
- try {
7450
- res = await awaitable;
7451
- }
7452
- finally {
7453
- setCurrentInstance(ctx);
7454
- }
7455
- return res;
7463
+ return isPromise(awaitable)
7464
+ ? awaitable.then(res => {
7465
+ setCurrentInstance(ctx);
7466
+ return res;
7467
+ }, err => {
7468
+ setCurrentInstance(ctx);
7469
+ throw err;
7470
+ })
7471
+ : awaitable;
7456
7472
  }
7457
7473
 
7458
7474
  // Actual implementation
@@ -7685,7 +7701,7 @@ function initCustomFormatter() {
7685
7701
  }
7686
7702
 
7687
7703
  // Core API ------------------------------------------------------------------
7688
- const version = "3.1.3";
7704
+ const version = "3.1.4";
7689
7705
  const _ssrUtils = {
7690
7706
  createComponentInstance,
7691
7707
  setupComponent,
@@ -7800,8 +7816,10 @@ exports.ssrContextKey = ssrContextKey;
7800
7816
  exports.ssrUtils = ssrUtils;
7801
7817
  exports.toHandlers = toHandlers;
7802
7818
  exports.transformVNodeArgs = transformVNodeArgs;
7819
+ exports.useAttrs = useAttrs;
7803
7820
  exports.useContext = useContext;
7804
7821
  exports.useSSRContext = useSSRContext;
7822
+ exports.useSlots = useSlots;
7805
7823
  exports.useTransitionState = useTransitionState;
7806
7824
  exports.version = version;
7807
7825
  exports.warn = warn;
@@ -5378,7 +5378,7 @@ const getPublicInstance = (i) => {
5378
5378
  if (!i)
5379
5379
  return null;
5380
5380
  if (isStatefulComponent(i))
5381
- return i.exposed ? i.exposed : i.proxy;
5381
+ return getExposeProxy(i) || i.proxy;
5382
5382
  return getPublicInstance(i.parent);
5383
5383
  };
5384
5384
  const publicPropertiesMap = shared.extend(Object.create(null), {
@@ -5816,6 +5816,12 @@ function computed(getterOrOptions) {
5816
5816
  return c;
5817
5817
  }
5818
5818
 
5819
+ const isFunction = (val) => typeof val === 'function';
5820
+ const isObject = (val) => val !== null && typeof val === 'object';
5821
+ const isPromise = (val) => {
5822
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
5823
+ };
5824
+
5819
5825
  // implementation
5820
5826
  function defineProps() {
5821
5827
  return null;
@@ -5869,6 +5875,12 @@ function withDefaults(props, defaults) {
5869
5875
  function useContext() {
5870
5876
  return getContext();
5871
5877
  }
5878
+ function useSlots() {
5879
+ return getContext().slots;
5880
+ }
5881
+ function useAttrs() {
5882
+ return getContext().attrs;
5883
+ }
5872
5884
  function getContext() {
5873
5885
  const i = getCurrentInstance();
5874
5886
  return i.setupContext || (i.setupContext = createSetupContext(i));
@@ -5897,17 +5909,18 @@ props, defaults) {
5897
5909
  * Runtime helper for storing and resuming current instance context in
5898
5910
  * async setup().
5899
5911
  */
5900
- async function withAsyncContext(awaitable) {
5912
+ function withAsyncContext(awaitable) {
5901
5913
  const ctx = getCurrentInstance();
5902
5914
  setCurrentInstance(null); // unset after storing instance
5903
- let res;
5904
- try {
5905
- res = await awaitable;
5906
- }
5907
- finally {
5908
- setCurrentInstance(ctx);
5909
- }
5910
- return res;
5915
+ return isPromise(awaitable)
5916
+ ? awaitable.then(res => {
5917
+ setCurrentInstance(ctx);
5918
+ return res;
5919
+ }, err => {
5920
+ setCurrentInstance(ctx);
5921
+ throw err;
5922
+ })
5923
+ : awaitable;
5911
5924
  }
5912
5925
 
5913
5926
  // Actual implementation
@@ -5958,7 +5971,7 @@ function initCustomFormatter() {
5958
5971
  }
5959
5972
 
5960
5973
  // Core API ------------------------------------------------------------------
5961
- const version = "3.1.3";
5974
+ const version = "3.1.4";
5962
5975
  const _ssrUtils = {
5963
5976
  createComponentInstance,
5964
5977
  setupComponent,
@@ -6073,8 +6086,10 @@ exports.ssrContextKey = ssrContextKey;
6073
6086
  exports.ssrUtils = ssrUtils;
6074
6087
  exports.toHandlers = toHandlers;
6075
6088
  exports.transformVNodeArgs = transformVNodeArgs;
6089
+ exports.useAttrs = useAttrs;
6076
6090
  exports.useContext = useContext;
6077
6091
  exports.useSSRContext = useSSRContext;
6092
+ exports.useSlots = useSlots;
6078
6093
  exports.useTransitionState = useTransitionState;
6079
6094
  exports.version = version;
6080
6095
  exports.warn = warn;
@@ -1631,11 +1631,15 @@ export { unref }
1631
1631
  declare type UnwrapMixinsType<T, Type extends OptionTypesKeys> = T extends OptionTypesType ? T[Type] : never;
1632
1632
  export { UnwrapRef }
1633
1633
 
1634
+ export declare function useAttrs(): SetupContext['attrs'];
1635
+
1634
1636
  /**
1635
1637
  * @deprecated use `useSlots` and `useAttrs` instead.
1636
1638
  */
1637
1639
  export declare function useContext(): SetupContext;
1638
1640
 
1641
+ export declare function useSlots(): SetupContext['slots'];
1642
+
1639
1643
  export declare const useSSRContext: <T = Record<string, any>>() => T | undefined;
1640
1644
 
1641
1645
  export declare function useTransitionState(): TransitionState;
@@ -1,6 +1,6 @@
1
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 {
@@ -160,9 +160,9 @@ function callWithErrorHandling(fn, instance, type, args) {
160
160
  return res;
161
161
  }
162
162
  function callWithAsyncErrorHandling(fn, instance, type, args) {
163
- if (isFunction(fn)) {
163
+ if (isFunction$1(fn)) {
164
164
  const res = callWithErrorHandling(fn, instance, type, args);
165
- if (res && isPromise(res)) {
165
+ if (res && isPromise$1(res)) {
166
166
  res.catch(err => {
167
167
  handleError(err, instance, type);
168
168
  });
@@ -918,7 +918,7 @@ function isCompatEnabled(key, instance, enableForBuiltIn = false) {
918
918
  }
919
919
  const rawMode = getCompatConfigForKey('MODE', instance) || 2;
920
920
  const val = getCompatConfigForKey(key, instance);
921
- const mode = isFunction(rawMode)
921
+ const mode = isFunction$1(rawMode)
922
922
  ? rawMode(instance && instance.type)
923
923
  : rawMode;
924
924
  if (mode === 2) {
@@ -943,7 +943,7 @@ function emit(instance, event, ...rawArgs) {
943
943
  }
944
944
  else {
945
945
  const validator = emitsOptions[event];
946
- if (isFunction(validator)) {
946
+ if (isFunction$1(validator)) {
947
947
  const isValid = validator(...rawArgs);
948
948
  if (!isValid) {
949
949
  warn(`Invalid event arguments: event validation failed for event "${event}".`);
@@ -1013,7 +1013,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
1013
1013
  let normalized = {};
1014
1014
  // apply mixin/extends props
1015
1015
  let hasExtends = false;
1016
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
1016
+ if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
1017
1017
  const extendEmits = (raw) => {
1018
1018
  const normalizedFromExtend = normalizeEmitsOptions(raw, appContext, true);
1019
1019
  if (normalizedFromExtend) {
@@ -1472,7 +1472,7 @@ const Suspense = (SuspenseImpl
1472
1472
  );
1473
1473
  function triggerEvent(vnode, name) {
1474
1474
  const eventListener = vnode.props && vnode.props[name];
1475
- if (isFunction(eventListener)) {
1475
+ if (isFunction$1(eventListener)) {
1476
1476
  eventListener();
1477
1477
  }
1478
1478
  }
@@ -1818,7 +1818,7 @@ function normalizeSuspenseChildren(vnode) {
1818
1818
  }
1819
1819
  function normalizeSuspenseSlot(s) {
1820
1820
  let block;
1821
- if (isFunction(s)) {
1821
+ if (isFunction$1(s)) {
1822
1822
  const isCompiledSlot = s._c;
1823
1823
  if (isCompiledSlot) {
1824
1824
  // disableTracking: false
@@ -1909,7 +1909,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
1909
1909
  return provides[key];
1910
1910
  }
1911
1911
  else if (arguments.length > 1) {
1912
- return treatDefaultAsFactory && isFunction(defaultValue)
1912
+ return treatDefaultAsFactory && isFunction$1(defaultValue)
1913
1913
  ? defaultValue.call(instance.proxy)
1914
1914
  : defaultValue;
1915
1915
  }
@@ -1930,7 +1930,7 @@ function watchEffect(effect, options) {
1930
1930
  const INITIAL_WATCHER_VALUE = {};
1931
1931
  // implementation
1932
1932
  function watch(source, cb, options) {
1933
- if ((process.env.NODE_ENV !== 'production') && !isFunction(cb)) {
1933
+ if ((process.env.NODE_ENV !== 'production') && !isFunction$1(cb)) {
1934
1934
  warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
1935
1935
  `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
1936
1936
  `supports \`watch(source, cb, options?) signature.`);
@@ -1973,7 +1973,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1973
1973
  else if (isReactive(s)) {
1974
1974
  return traverse(s);
1975
1975
  }
1976
- else if (isFunction(s)) {
1976
+ else if (isFunction$1(s)) {
1977
1977
  return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
1978
1978
  }
1979
1979
  else {
@@ -1981,7 +1981,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
1981
1981
  }
1982
1982
  });
1983
1983
  }
1984
- else if (isFunction(source)) {
1984
+ else if (isFunction$1(source)) {
1985
1985
  if (cb) {
1986
1986
  // getter with cb
1987
1987
  getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
@@ -2106,7 +2106,7 @@ function instanceWatch(source, value, options) {
2106
2106
  : () => publicThis[source]
2107
2107
  : source.bind(publicThis, publicThis);
2108
2108
  let cb;
2109
- if (isFunction(value)) {
2109
+ if (isFunction$1(value)) {
2110
2110
  cb = value;
2111
2111
  }
2112
2112
  else {
@@ -2126,7 +2126,7 @@ function createPathGetter(ctx, path) {
2126
2126
  };
2127
2127
  }
2128
2128
  function traverse(value, seen = new Set()) {
2129
- if (!isObject(value) ||
2129
+ if (!isObject$1(value) ||
2130
2130
  seen.has(value) ||
2131
2131
  value["__v_skip" /* SKIP */]) {
2132
2132
  return value;
@@ -2467,12 +2467,12 @@ function getTransitionRawChildren(children, keepComment = false) {
2467
2467
 
2468
2468
  // implementation, close to no-op
2469
2469
  function defineComponent(options) {
2470
- return isFunction(options) ? { setup: options, name: options.name } : options;
2470
+ return isFunction$1(options) ? { setup: options, name: options.name } : options;
2471
2471
  }
2472
2472
 
2473
2473
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2474
2474
  function defineAsyncComponent(source) {
2475
- if (isFunction(source)) {
2475
+ if (isFunction$1(source)) {
2476
2476
  source = { loader: source };
2477
2477
  }
2478
2478
  const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out
@@ -2515,7 +2515,7 @@ function defineAsyncComponent(source) {
2515
2515
  (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
2516
2516
  comp = comp.default;
2517
2517
  }
2518
- 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)) {
2519
2519
  throw new Error(`Invalid async component load result: ${comp}`);
2520
2520
  }
2521
2521
  resolvedComp = comp;
@@ -3001,7 +3001,7 @@ function applyOptions(instance) {
3001
3001
  if (methods) {
3002
3002
  for (const key in methods) {
3003
3003
  const methodHandler = methods[key];
3004
- if (isFunction(methodHandler)) {
3004
+ if (isFunction$1(methodHandler)) {
3005
3005
  // In dev mode, we use the `createRenderContext` function to define methods to the proxy target,
3006
3006
  // and those are read-only but reconfigurable, so it needs to be redefined here
3007
3007
  if ((process.env.NODE_ENV !== 'production')) {
@@ -3026,17 +3026,17 @@ function applyOptions(instance) {
3026
3026
  }
3027
3027
  }
3028
3028
  if (dataOptions) {
3029
- if ((process.env.NODE_ENV !== 'production') && !isFunction(dataOptions)) {
3029
+ if ((process.env.NODE_ENV !== 'production') && !isFunction$1(dataOptions)) {
3030
3030
  warn(`The data option must be a function. ` +
3031
3031
  `Plain object usage is no longer supported.`);
3032
3032
  }
3033
3033
  const data = dataOptions.call(publicThis, publicThis);
3034
- if ((process.env.NODE_ENV !== 'production') && isPromise(data)) {
3034
+ if ((process.env.NODE_ENV !== 'production') && isPromise$1(data)) {
3035
3035
  warn(`data() returned a Promise - note data() cannot be async; If you ` +
3036
3036
  `intend to perform data fetching before component renders, use ` +
3037
3037
  `async setup() + <Suspense>.`);
3038
3038
  }
3039
- if (!isObject(data)) {
3039
+ if (!isObject$1(data)) {
3040
3040
  (process.env.NODE_ENV !== 'production') && warn(`data() should return an object.`);
3041
3041
  }
3042
3042
  else {
@@ -3062,15 +3062,15 @@ function applyOptions(instance) {
3062
3062
  if (computedOptions) {
3063
3063
  for (const key in computedOptions) {
3064
3064
  const opt = computedOptions[key];
3065
- const get = isFunction(opt)
3065
+ const get = isFunction$1(opt)
3066
3066
  ? opt.bind(publicThis, publicThis)
3067
- : isFunction(opt.get)
3067
+ : isFunction$1(opt.get)
3068
3068
  ? opt.get.bind(publicThis, publicThis)
3069
3069
  : NOOP;
3070
3070
  if ((process.env.NODE_ENV !== 'production') && get === NOOP) {
3071
3071
  warn(`Computed property "${key}" has no getter.`);
3072
3072
  }
3073
- const set = !isFunction(opt) && isFunction(opt.set)
3073
+ const set = !isFunction$1(opt) && isFunction$1(opt.set)
3074
3074
  ? opt.set.bind(publicThis)
3075
3075
  : (process.env.NODE_ENV !== 'production')
3076
3076
  ? () => {
@@ -3098,7 +3098,7 @@ function applyOptions(instance) {
3098
3098
  }
3099
3099
  }
3100
3100
  if (provideOptions) {
3101
- const provides = isFunction(provideOptions)
3101
+ const provides = isFunction$1(provideOptions)
3102
3102
  ? provideOptions.call(publicThis)
3103
3103
  : provideOptions;
3104
3104
  Reflect.ownKeys(provides).forEach(key => {
@@ -3162,7 +3162,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP)
3162
3162
  }
3163
3163
  for (const key in injectOptions) {
3164
3164
  const opt = injectOptions[key];
3165
- if (isObject(opt)) {
3165
+ if (isObject$1(opt)) {
3166
3166
  if ('default' in opt) {
3167
3167
  ctx[key] = inject(opt.from || key, opt.default, true /* treat default function as factory */);
3168
3168
  }
@@ -3189,25 +3189,25 @@ function createWatcher(raw, ctx, publicThis, key) {
3189
3189
  : () => publicThis[key];
3190
3190
  if (isString(raw)) {
3191
3191
  const handler = ctx[raw];
3192
- if (isFunction(handler)) {
3192
+ if (isFunction$1(handler)) {
3193
3193
  watch(getter, handler);
3194
3194
  }
3195
3195
  else if ((process.env.NODE_ENV !== 'production')) {
3196
3196
  warn(`Invalid watch handler specified by key "${raw}"`, handler);
3197
3197
  }
3198
3198
  }
3199
- else if (isFunction(raw)) {
3199
+ else if (isFunction$1(raw)) {
3200
3200
  watch(getter, raw.bind(publicThis));
3201
3201
  }
3202
- else if (isObject(raw)) {
3202
+ else if (isObject$1(raw)) {
3203
3203
  if (isArray(raw)) {
3204
3204
  raw.forEach(r => createWatcher(r, ctx, publicThis, key));
3205
3205
  }
3206
3206
  else {
3207
- const handler = isFunction(raw.handler)
3207
+ const handler = isFunction$1(raw.handler)
3208
3208
  ? raw.handler.bind(publicThis)
3209
3209
  : ctx[raw.handler];
3210
- if (isFunction(handler)) {
3210
+ if (isFunction$1(handler)) {
3211
3211
  watch(getter, handler, raw);
3212
3212
  }
3213
3213
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -3306,7 +3306,7 @@ function mergeDataFn(to, from) {
3306
3306
  return from;
3307
3307
  }
3308
3308
  return function mergedDataFn() {
3309
- 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);
3310
3310
  };
3311
3311
  }
3312
3312
  function mergeInject(to, from) {
@@ -3513,7 +3513,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
3513
3513
  // default values
3514
3514
  if (hasDefault && value === undefined) {
3515
3515
  const defaultValue = opt.default;
3516
- if (opt.type !== Function && isFunction(defaultValue)) {
3516
+ if (opt.type !== Function && isFunction$1(defaultValue)) {
3517
3517
  const { propsDefaults } = instance;
3518
3518
  if (key in propsDefaults) {
3519
3519
  value = propsDefaults[key];
@@ -3552,7 +3552,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3552
3552
  const needCastKeys = [];
3553
3553
  // apply mixin/extends props
3554
3554
  let hasExtends = false;
3555
- if (__VUE_OPTIONS_API__ && !isFunction(comp)) {
3555
+ if (__VUE_OPTIONS_API__ && !isFunction$1(comp)) {
3556
3556
  const extendProps = (raw) => {
3557
3557
  hasExtends = true;
3558
3558
  const [props, keys] = normalizePropsOptions(raw, appContext, true);
@@ -3586,7 +3586,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3586
3586
  }
3587
3587
  }
3588
3588
  else if (raw) {
3589
- if ((process.env.NODE_ENV !== 'production') && !isObject(raw)) {
3589
+ if ((process.env.NODE_ENV !== 'production') && !isObject$1(raw)) {
3590
3590
  warn(`invalid props options`, raw);
3591
3591
  }
3592
3592
  for (const key in raw) {
@@ -3594,7 +3594,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
3594
3594
  if (validatePropName(normalizedKey)) {
3595
3595
  const opt = raw[key];
3596
3596
  const prop = (normalized[normalizedKey] =
3597
- isArray(opt) || isFunction(opt) ? { type: opt } : opt);
3597
+ isArray(opt) || isFunction$1(opt) ? { type: opt } : opt);
3598
3598
  if (prop) {
3599
3599
  const booleanIndex = getTypeIndex(Boolean, prop.type);
3600
3600
  const stringIndex = getTypeIndex(String, prop.type);
@@ -3635,7 +3635,7 @@ function getTypeIndex(type, expectedTypes) {
3635
3635
  if (isArray(expectedTypes)) {
3636
3636
  return expectedTypes.findIndex(t => isSameType(t, type));
3637
3637
  }
3638
- else if (isFunction(expectedTypes)) {
3638
+ else if (isFunction$1(expectedTypes)) {
3639
3639
  return isSameType(expectedTypes, type) ? 0 : -1;
3640
3640
  }
3641
3641
  return -1;
@@ -3704,7 +3704,7 @@ function assertType(value, type) {
3704
3704
  }
3705
3705
  }
3706
3706
  else if (expectedType === 'Object') {
3707
- valid = isObject(value);
3707
+ valid = isObject$1(value);
3708
3708
  }
3709
3709
  else if (expectedType === 'Array') {
3710
3710
  valid = isArray(value);
@@ -3790,7 +3790,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
3790
3790
  if (isInternalKey(key))
3791
3791
  continue;
3792
3792
  const value = rawSlots[key];
3793
- if (isFunction(value)) {
3793
+ if (isFunction$1(value)) {
3794
3794
  slots[key] = normalizeSlot(key, value, ctx);
3795
3795
  }
3796
3796
  else if (value != null) {
@@ -3919,7 +3919,7 @@ function withDirectives(vnode, directives) {
3919
3919
  const bindings = vnode.dirs || (vnode.dirs = []);
3920
3920
  for (let i = 0; i < directives.length; i++) {
3921
3921
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
3922
- if (isFunction(dir)) {
3922
+ if (isFunction$1(dir)) {
3923
3923
  dir = {
3924
3924
  mounted: dir,
3925
3925
  updated: dir
@@ -3984,7 +3984,7 @@ function createAppContext() {
3984
3984
  let uid = 0;
3985
3985
  function createAppAPI(render, hydrate) {
3986
3986
  return function createApp(rootComponent, rootProps = null) {
3987
- if (rootProps != null && !isObject(rootProps)) {
3987
+ if (rootProps != null && !isObject$1(rootProps)) {
3988
3988
  (process.env.NODE_ENV !== 'production') && warn(`root props passed to app.mount() must be an object.`);
3989
3989
  rootProps = null;
3990
3990
  }
@@ -4011,11 +4011,11 @@ function createAppAPI(render, hydrate) {
4011
4011
  if (installedPlugins.has(plugin)) {
4012
4012
  (process.env.NODE_ENV !== 'production') && warn(`Plugin has already been applied to target app.`);
4013
4013
  }
4014
- else if (plugin && isFunction(plugin.install)) {
4014
+ else if (plugin && isFunction$1(plugin.install)) {
4015
4015
  installedPlugins.add(plugin);
4016
4016
  plugin.install(app, ...options);
4017
4017
  }
4018
- else if (isFunction(plugin)) {
4018
+ else if (isFunction$1(plugin)) {
4019
4019
  installedPlugins.add(plugin);
4020
4020
  plugin(app, ...options);
4021
4021
  }
@@ -4601,7 +4601,7 @@ const setRef = (rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) =>
4601
4601
  doSet();
4602
4602
  }
4603
4603
  }
4604
- else if (isFunction(ref)) {
4604
+ else if (isFunction$1(ref)) {
4605
4605
  callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
4606
4606
  }
4607
4607
  else if ((process.env.NODE_ENV !== 'production')) {
@@ -6293,7 +6293,7 @@ const InternalObjectKey = `__vInternal`;
6293
6293
  const normalizeKey = ({ key }) => key != null ? key : null;
6294
6294
  const normalizeRef = ({ ref }) => {
6295
6295
  return (ref != null
6296
- ? isString(ref) || isRef(ref) || isFunction(ref)
6296
+ ? isString(ref) || isRef(ref) || isFunction$1(ref)
6297
6297
  ? { i: currentRenderingInstance, r: ref }
6298
6298
  : ref
6299
6299
  : null);
@@ -6332,7 +6332,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6332
6332
  if (klass && !isString(klass)) {
6333
6333
  props.class = normalizeClass(klass);
6334
6334
  }
6335
- if (isObject(style)) {
6335
+ if (isObject$1(style)) {
6336
6336
  // reactive state objects need to be cloned since they are likely to be
6337
6337
  // mutated
6338
6338
  if (isProxy(style) && !isArray(style)) {
@@ -6348,9 +6348,9 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
6348
6348
  ? 128 /* SUSPENSE */
6349
6349
  : isTeleport(type)
6350
6350
  ? 64 /* TELEPORT */
6351
- : isObject(type)
6351
+ : isObject$1(type)
6352
6352
  ? 4 /* STATEFUL_COMPONENT */
6353
- : isFunction(type)
6353
+ : isFunction$1(type)
6354
6354
  ? 2 /* FUNCTIONAL_COMPONENT */
6355
6355
  : 0;
6356
6356
  if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
@@ -6573,7 +6573,7 @@ function normalizeChildren(vnode, children) {
6573
6573
  }
6574
6574
  }
6575
6575
  }
6576
- else if (isFunction(children)) {
6576
+ else if (isFunction$1(children)) {
6577
6577
  children = { default: children, _ctx: currentRenderingInstance };
6578
6578
  type = 32 /* SLOTS_CHILDREN */;
6579
6579
  }
@@ -6642,7 +6642,7 @@ function renderList(source, renderItem) {
6642
6642
  ret[i] = renderItem(i + 1, i);
6643
6643
  }
6644
6644
  }
6645
- else if (isObject(source)) {
6645
+ else if (isObject$1(source)) {
6646
6646
  if (source[Symbol.iterator]) {
6647
6647
  ret = Array.from(source, renderItem);
6648
6648
  }
@@ -6738,7 +6738,7 @@ function ensureValidVNode(vnodes) {
6738
6738
  */
6739
6739
  function toHandlers(obj) {
6740
6740
  const ret = {};
6741
- if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
6741
+ if ((process.env.NODE_ENV !== 'production') && !isObject$1(obj)) {
6742
6742
  warn(`v-on with no argument expects an object value.`);
6743
6743
  return ret;
6744
6744
  }
@@ -6757,7 +6757,7 @@ const getPublicInstance = (i) => {
6757
6757
  if (!i)
6758
6758
  return null;
6759
6759
  if (isStatefulComponent(i))
6760
- return i.exposed ? i.exposed : i.proxy;
6760
+ return getExposeProxy(i) || i.proxy;
6761
6761
  return getPublicInstance(i.parent);
6762
6762
  };
6763
6763
  const publicPropertiesMap = extend(Object.create(null), {
@@ -7161,7 +7161,7 @@ function setupStatefulComponent(instance, isSSR) {
7161
7161
  const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
7162
7162
  resetTracking();
7163
7163
  currentInstance = null;
7164
- if (isPromise(setupResult)) {
7164
+ if (isPromise$1(setupResult)) {
7165
7165
  const unsetInstance = () => {
7166
7166
  currentInstance = null;
7167
7167
  };
@@ -7191,13 +7191,13 @@ function setupStatefulComponent(instance, isSSR) {
7191
7191
  }
7192
7192
  }
7193
7193
  function handleSetupResult(instance, setupResult, isSSR) {
7194
- if (isFunction(setupResult)) {
7194
+ if (isFunction$1(setupResult)) {
7195
7195
  // setup returned an inline render function
7196
7196
  {
7197
7197
  instance.render = setupResult;
7198
7198
  }
7199
7199
  }
7200
- else if (isObject(setupResult)) {
7200
+ else if (isObject$1(setupResult)) {
7201
7201
  if ((process.env.NODE_ENV !== 'production') && isVNode(setupResult)) {
7202
7202
  warn(`setup() should not return VNodes directly - ` +
7203
7203
  `return a render function instead.`);
@@ -7353,7 +7353,7 @@ function recordInstanceBoundEffect(effect, instance = currentInstance) {
7353
7353
  const classifyRE = /(?:^|[-_])(\w)/g;
7354
7354
  const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
7355
7355
  function getComponentName(Component) {
7356
- return isFunction(Component)
7356
+ return isFunction$1(Component)
7357
7357
  ? Component.displayName || Component.name
7358
7358
  : Component.name;
7359
7359
  }
@@ -7382,7 +7382,7 @@ function formatComponentName(instance, Component, isRoot = false) {
7382
7382
  return name ? classify(name) : isRoot ? `App` : `Anonymous`;
7383
7383
  }
7384
7384
  function isClassComponent(value) {
7385
- return isFunction(value) && '__vccOpts' in value;
7385
+ return isFunction$1(value) && '__vccOpts' in value;
7386
7386
  }
7387
7387
 
7388
7388
  function computed(getterOrOptions) {
@@ -7391,6 +7391,16 @@ function computed(getterOrOptions) {
7391
7391
  return c;
7392
7392
  }
7393
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
+
7394
7404
  // dev only
7395
7405
  const warnRuntimeUsage = (method) => warn(`${method}() is a compiler-hint helper that is only usable inside ` +
7396
7406
  `<script setup> of a single file component. Its arguments should be ` +
@@ -7464,6 +7474,12 @@ function useContext() {
7464
7474
  }
7465
7475
  return getContext();
7466
7476
  }
7477
+ function useSlots() {
7478
+ return getContext().slots;
7479
+ }
7480
+ function useAttrs() {
7481
+ return getContext().attrs;
7482
+ }
7467
7483
  function getContext() {
7468
7484
  const i = getCurrentInstance();
7469
7485
  if ((process.env.NODE_ENV !== 'production') && !i) {
@@ -7497,27 +7513,28 @@ props, defaults) {
7497
7513
  * Runtime helper for storing and resuming current instance context in
7498
7514
  * async setup().
7499
7515
  */
7500
- async function withAsyncContext(awaitable) {
7516
+ function withAsyncContext(awaitable) {
7501
7517
  const ctx = getCurrentInstance();
7502
7518
  setCurrentInstance(null); // unset after storing instance
7503
7519
  if ((process.env.NODE_ENV !== 'production') && !ctx) {
7504
7520
  warn(`withAsyncContext() called when there is no active context instance.`);
7505
7521
  }
7506
- let res;
7507
- try {
7508
- res = await awaitable;
7509
- }
7510
- finally {
7511
- setCurrentInstance(ctx);
7512
- }
7513
- return res;
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;
7514
7531
  }
7515
7532
 
7516
7533
  // Actual implementation
7517
7534
  function h(type, propsOrChildren, children) {
7518
7535
  const l = arguments.length;
7519
7536
  if (l === 2) {
7520
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
7537
+ if (isObject$1(propsOrChildren) && !isArray(propsOrChildren)) {
7521
7538
  // single vnode without props
7522
7539
  if (isVNode(propsOrChildren)) {
7523
7540
  return createVNode(type, null, [propsOrChildren]);
@@ -7567,7 +7584,7 @@ function initCustomFormatter() {
7567
7584
  const formatter = {
7568
7585
  header(obj) {
7569
7586
  // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
7570
- if (!isObject(obj)) {
7587
+ if (!isObject$1(obj)) {
7571
7588
  return null;
7572
7589
  }
7573
7590
  if (obj.__isVue) {
@@ -7692,7 +7709,7 @@ function initCustomFormatter() {
7692
7709
  else if (typeof v === 'boolean') {
7693
7710
  return ['span', keywordStyle, v];
7694
7711
  }
7695
- else if (isObject(v)) {
7712
+ else if (isObject$1(v)) {
7696
7713
  return ['object', { object: asRaw ? toRaw(v) : v }];
7697
7714
  }
7698
7715
  else {
@@ -7701,7 +7718,7 @@ function initCustomFormatter() {
7701
7718
  }
7702
7719
  function extractKeys(instance, type) {
7703
7720
  const Comp = instance.type;
7704
- if (isFunction(Comp)) {
7721
+ if (isFunction$1(Comp)) {
7705
7722
  return;
7706
7723
  }
7707
7724
  const extracted = {};
@@ -7715,7 +7732,7 @@ function initCustomFormatter() {
7715
7732
  function isKeyOfType(Comp, key, type) {
7716
7733
  const opts = Comp[type];
7717
7734
  if ((isArray(opts) && opts.includes(key)) ||
7718
- (isObject(opts) && key in opts)) {
7735
+ (isObject$1(opts) && key in opts)) {
7719
7736
  return true;
7720
7737
  }
7721
7738
  if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
@@ -7743,7 +7760,7 @@ function initCustomFormatter() {
7743
7760
  }
7744
7761
 
7745
7762
  // Core API ------------------------------------------------------------------
7746
- const version = "3.1.3";
7763
+ const version = "3.1.4";
7747
7764
  /**
7748
7765
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
7749
7766
  * @internal
@@ -7758,4 +7775,4 @@ const resolveFilter = null;
7758
7775
  */
7759
7776
  const compatUtils = (null);
7760
7777
 
7761
- 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, useContext, useSSRContext, useTransitionState, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/runtime-core",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "@vue/runtime-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/runtime-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.1.3",
36
- "@vue/reactivity": "3.1.3"
35
+ "@vue/shared": "3.1.4",
36
+ "@vue/reactivity": "3.1.4"
37
37
  }
38
38
  }