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.
@@ -1127,13 +1127,10 @@ var Vue = (function (exports) {
1127
1127
  return createRef(value, true);
1128
1128
  }
1129
1129
  class RefImpl {
1130
- _rawValue;
1131
- _shallow;
1132
- _value;
1133
- __v_isRef = true;
1134
1130
  constructor(_rawValue, _shallow) {
1135
1131
  this._rawValue = _rawValue;
1136
1132
  this._shallow = _shallow;
1133
+ this.__v_isRef = true;
1137
1134
  this._value = _shallow ? _rawValue : convert(_rawValue);
1138
1135
  }
1139
1136
  get value() {
@@ -1179,10 +1176,8 @@ var Vue = (function (exports) {
1179
1176
  : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1180
1177
  }
1181
1178
  class CustomRefImpl {
1182
- _get;
1183
- _set;
1184
- __v_isRef = true;
1185
1179
  constructor(factory) {
1180
+ this.__v_isRef = true;
1186
1181
  const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
1187
1182
  this._get = get;
1188
1183
  this._set = set;
@@ -1208,12 +1203,10 @@ var Vue = (function (exports) {
1208
1203
  return ret;
1209
1204
  }
1210
1205
  class ObjectRefImpl {
1211
- _object;
1212
- _key;
1213
- __v_isRef = true;
1214
1206
  constructor(_object, _key) {
1215
1207
  this._object = _object;
1216
1208
  this._key = _key;
1209
+ this.__v_isRef = true;
1217
1210
  }
1218
1211
  get value() {
1219
1212
  return this._object[this._key];
@@ -1229,14 +1222,10 @@ var Vue = (function (exports) {
1229
1222
  }
1230
1223
 
1231
1224
  class ComputedRefImpl {
1232
- _setter;
1233
- _value;
1234
- _dirty = true;
1235
- effect;
1236
- __v_isRef = true;
1237
- ["__v_isReadonly" /* IS_READONLY */];
1238
1225
  constructor(getter, _setter, isReadonly) {
1239
1226
  this._setter = _setter;
1227
+ this._dirty = true;
1228
+ this.__v_isRef = true;
1240
1229
  this.effect = effect(getter, {
1241
1230
  lazy: true,
1242
1231
  scheduler: () => {
@@ -7957,7 +7946,7 @@ var Vue = (function (exports) {
7957
7946
  if (!i)
7958
7947
  return null;
7959
7948
  if (isStatefulComponent(i))
7960
- return i.exposed ? i.exposed : i.proxy;
7949
+ return getExposeProxy(i) || i.proxy;
7961
7950
  return getPublicInstance(i.parent);
7962
7951
  };
7963
7952
  const publicPropertiesMap = extend(Object.create(null), {
@@ -8649,6 +8638,12 @@ var Vue = (function (exports) {
8649
8638
  }
8650
8639
  return getContext();
8651
8640
  }
8641
+ function useSlots() {
8642
+ return getContext().slots;
8643
+ }
8644
+ function useAttrs() {
8645
+ return getContext().attrs;
8646
+ }
8652
8647
  function getContext() {
8653
8648
  const i = getCurrentInstance();
8654
8649
  if (!i) {
@@ -8682,20 +8677,21 @@ var Vue = (function (exports) {
8682
8677
  * Runtime helper for storing and resuming current instance context in
8683
8678
  * async setup().
8684
8679
  */
8685
- async function withAsyncContext(awaitable) {
8680
+ function withAsyncContext(awaitable) {
8686
8681
  const ctx = getCurrentInstance();
8687
8682
  setCurrentInstance(null); // unset after storing instance
8688
8683
  if (!ctx) {
8689
8684
  warn(`withAsyncContext() called when there is no active context instance.`);
8690
8685
  }
8691
- let res;
8692
- try {
8693
- res = await awaitable;
8694
- }
8695
- finally {
8696
- setCurrentInstance(ctx);
8697
- }
8698
- return res;
8686
+ return isPromise(awaitable)
8687
+ ? awaitable.then(res => {
8688
+ setCurrentInstance(ctx);
8689
+ return res;
8690
+ }, err => {
8691
+ setCurrentInstance(ctx);
8692
+ throw err;
8693
+ })
8694
+ : awaitable;
8699
8695
  }
8700
8696
 
8701
8697
  // Actual implementation
@@ -8923,7 +8919,7 @@ var Vue = (function (exports) {
8923
8919
  }
8924
8920
 
8925
8921
  // Core API ------------------------------------------------------------------
8926
- const version = "3.1.3";
8922
+ const version = "3.1.4";
8927
8923
  /**
8928
8924
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8929
8925
  * @internal
@@ -12182,7 +12178,7 @@ var Vue = (function (exports) {
12182
12178
  }
12183
12179
 
12184
12180
  const PURE_ANNOTATION = `/*#__PURE__*/`;
12185
- function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false }) {
12181
+ 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 }) {
12186
12182
  const context = {
12187
12183
  mode,
12188
12184
  prefixIdentifiers,
@@ -12193,6 +12189,7 @@ var Vue = (function (exports) {
12193
12189
  runtimeGlobalName,
12194
12190
  runtimeModuleName,
12195
12191
  ssr,
12192
+ isTS,
12196
12193
  source: ast.loc.source,
12197
12194
  code: ``,
12198
12195
  column: 1,
@@ -12343,7 +12340,7 @@ var Vue = (function (exports) {
12343
12340
  newline();
12344
12341
  push(`return `);
12345
12342
  }
12346
- function genAssets(assets, type, { helper, push, newline }) {
12343
+ function genAssets(assets, type, { helper, push, newline, isTS }) {
12347
12344
  const resolver = helper(type === 'component'
12348
12345
  ? RESOLVE_COMPONENT
12349
12346
  : RESOLVE_DIRECTIVE);
@@ -12354,7 +12351,7 @@ var Vue = (function (exports) {
12354
12351
  if (maybeSelfReference) {
12355
12352
  id = id.slice(0, -6);
12356
12353
  }
12357
- push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})`);
12354
+ push(`const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}`);
12358
12355
  if (i < assets.length - 1) {
12359
12356
  newline();
12360
12357
  }
@@ -14933,10 +14930,12 @@ var Vue = (function (exports) {
14933
14930
  exports.transformVNodeArgs = transformVNodeArgs;
14934
14931
  exports.triggerRef = triggerRef;
14935
14932
  exports.unref = unref;
14933
+ exports.useAttrs = useAttrs;
14936
14934
  exports.useContext = useContext;
14937
14935
  exports.useCssModule = useCssModule;
14938
14936
  exports.useCssVars = useCssVars;
14939
14937
  exports.useSSRContext = useSSRContext;
14938
+ exports.useSlots = useSlots;
14940
14939
  exports.useTransitionState = useTransitionState;
14941
14940
  exports.vModelCheckbox = vModelCheckbox;
14942
14941
  exports.vModelDynamic = vModelDynamic;