vue 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.
@@ -1124,13 +1124,10 @@ function shallowRef(value) {
1124
1124
  return createRef(value, true);
1125
1125
  }
1126
1126
  class RefImpl {
1127
- _rawValue;
1128
- _shallow;
1129
- _value;
1130
- __v_isRef = true;
1131
1127
  constructor(_rawValue, _shallow) {
1132
1128
  this._rawValue = _rawValue;
1133
1129
  this._shallow = _shallow;
1130
+ this.__v_isRef = true;
1134
1131
  this._value = _shallow ? _rawValue : convert(_rawValue);
1135
1132
  }
1136
1133
  get value() {
@@ -1176,10 +1173,8 @@ function proxyRefs(objectWithRefs) {
1176
1173
  : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1177
1174
  }
1178
1175
  class CustomRefImpl {
1179
- _get;
1180
- _set;
1181
- __v_isRef = true;
1182
1176
  constructor(factory) {
1177
+ this.__v_isRef = true;
1183
1178
  const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
1184
1179
  this._get = get;
1185
1180
  this._set = set;
@@ -1205,12 +1200,10 @@ function toRefs(object) {
1205
1200
  return ret;
1206
1201
  }
1207
1202
  class ObjectRefImpl {
1208
- _object;
1209
- _key;
1210
- __v_isRef = true;
1211
1203
  constructor(_object, _key) {
1212
1204
  this._object = _object;
1213
1205
  this._key = _key;
1206
+ this.__v_isRef = true;
1214
1207
  }
1215
1208
  get value() {
1216
1209
  return this._object[this._key];
@@ -1226,14 +1219,10 @@ function toRef(object, key) {
1226
1219
  }
1227
1220
 
1228
1221
  class ComputedRefImpl {
1229
- _setter;
1230
- _value;
1231
- _dirty = true;
1232
- effect;
1233
- __v_isRef = true;
1234
- ["__v_isReadonly" /* IS_READONLY */];
1235
1222
  constructor(getter, _setter, isReadonly) {
1236
1223
  this._setter = _setter;
1224
+ this._dirty = true;
1225
+ this.__v_isRef = true;
1237
1226
  this.effect = effect(getter, {
1238
1227
  lazy: true,
1239
1228
  scheduler: () => {
@@ -7955,7 +7944,7 @@ const getPublicInstance = (i) => {
7955
7944
  if (!i)
7956
7945
  return null;
7957
7946
  if (isStatefulComponent(i))
7958
- return i.exposed ? i.exposed : i.proxy;
7947
+ return getExposeProxy(i) || i.proxy;
7959
7948
  return getPublicInstance(i.parent);
7960
7949
  };
7961
7950
  const publicPropertiesMap = extend(Object.create(null), {
@@ -8647,6 +8636,12 @@ function useContext() {
8647
8636
  }
8648
8637
  return getContext();
8649
8638
  }
8639
+ function useSlots() {
8640
+ return getContext().slots;
8641
+ }
8642
+ function useAttrs() {
8643
+ return getContext().attrs;
8644
+ }
8650
8645
  function getContext() {
8651
8646
  const i = getCurrentInstance();
8652
8647
  if (!i) {
@@ -8680,20 +8675,21 @@ props, defaults) {
8680
8675
  * Runtime helper for storing and resuming current instance context in
8681
8676
  * async setup().
8682
8677
  */
8683
- async function withAsyncContext(awaitable) {
8678
+ function withAsyncContext(awaitable) {
8684
8679
  const ctx = getCurrentInstance();
8685
8680
  setCurrentInstance(null); // unset after storing instance
8686
8681
  if (!ctx) {
8687
8682
  warn(`withAsyncContext() called when there is no active context instance.`);
8688
8683
  }
8689
- let res;
8690
- try {
8691
- res = await awaitable;
8692
- }
8693
- finally {
8694
- setCurrentInstance(ctx);
8695
- }
8696
- return res;
8684
+ return isPromise(awaitable)
8685
+ ? awaitable.then(res => {
8686
+ setCurrentInstance(ctx);
8687
+ return res;
8688
+ }, err => {
8689
+ setCurrentInstance(ctx);
8690
+ throw err;
8691
+ })
8692
+ : awaitable;
8697
8693
  }
8698
8694
 
8699
8695
  // Actual implementation
@@ -8926,7 +8922,7 @@ function initCustomFormatter() {
8926
8922
  }
8927
8923
 
8928
8924
  // Core API ------------------------------------------------------------------
8929
- const version = "3.1.3";
8925
+ const version = "3.1.4";
8930
8926
  /**
8931
8927
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8932
8928
  * @internal
@@ -10397,6 +10393,8 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10397
10393
  withAsyncContext: withAsyncContext,
10398
10394
  defineEmit: defineEmit,
10399
10395
  useContext: useContext,
10396
+ useAttrs: useAttrs,
10397
+ useSlots: useSlots,
10400
10398
  getCurrentInstance: getCurrentInstance,
10401
10399
  h: h,
10402
10400
  createVNode: createVNode,
@@ -12322,7 +12320,7 @@ function createStructuralDirectiveTransform(name, fn) {
12322
12320
  }
12323
12321
 
12324
12322
  const PURE_ANNOTATION = `/*#__PURE__*/`;
12325
- function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false }) {
12323
+ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false, isTS = false }) {
12326
12324
  const context = {
12327
12325
  mode,
12328
12326
  prefixIdentifiers,
@@ -12333,6 +12331,7 @@ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode
12333
12331
  runtimeGlobalName,
12334
12332
  runtimeModuleName,
12335
12333
  ssr,
12334
+ isTS,
12336
12335
  source: ast.loc.source,
12337
12336
  code: ``,
12338
12337
  column: 1,
@@ -12483,7 +12482,7 @@ function genFunctionPreamble(ast, context) {
12483
12482
  newline();
12484
12483
  push(`return `);
12485
12484
  }
12486
- function genAssets(assets, type, { helper, push, newline }) {
12485
+ function genAssets(assets, type, { helper, push, newline, isTS }) {
12487
12486
  const resolver = helper(type === 'component'
12488
12487
  ? RESOLVE_COMPONENT
12489
12488
  : RESOLVE_DIRECTIVE);
@@ -12494,7 +12493,7 @@ function genAssets(assets, type, { helper, push, newline }) {
12494
12493
  if (maybeSelfReference) {
12495
12494
  id = id.slice(0, -6);
12496
12495
  }
12497
- push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})`);
12496
+ push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`);
12498
12497
  if (i < assets.length - 1) {
12499
12498
  newline();
12500
12499
  }
@@ -14973,4 +14972,4 @@ function compileToFunction(template, options) {
14973
14972
  }
14974
14973
  registerRuntimeCompiler(compileToFunction);
14975
14974
 
14976
- export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withModifiers, withScopeId };
14975
+ export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useContext, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withModifiers, withScopeId };