@vue/compat 3.3.0-alpha.6 → 3.3.0-alpha.7

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.
@@ -1264,6 +1264,9 @@ function triggerRef(ref2) {
1264
1264
  function unref(ref2) {
1265
1265
  return isRef(ref2) ? ref2.value : ref2;
1266
1266
  }
1267
+ function toValue(source) {
1268
+ return isFunction(source) ? source() : unref(source);
1269
+ }
1267
1270
  const shallowUnwrapHandlers = {
1268
1271
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1269
1272
  set: (target, key, value, receiver) => {
@@ -1306,7 +1309,7 @@ function toRefs(object) {
1306
1309
  }
1307
1310
  const ret = isArray(object) ? new Array(object.length) : {};
1308
1311
  for (const key in object) {
1309
- ret[key] = toRef(object, key);
1312
+ ret[key] = propertyToRef(object, key);
1310
1313
  }
1311
1314
  return ret;
1312
1315
  }
@@ -1328,9 +1331,34 @@ class ObjectRefImpl {
1328
1331
  return getDepFromReactive(toRaw(this._object), this._key);
1329
1332
  }
1330
1333
  }
1331
- function toRef(object, key, defaultValue) {
1332
- const val = object[key];
1333
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1334
+ class GetterRefImpl {
1335
+ constructor(_getter) {
1336
+ this._getter = _getter;
1337
+ this.__v_isRef = true;
1338
+ this.__v_isReadonly = true;
1339
+ }
1340
+ get value() {
1341
+ return this._getter();
1342
+ }
1343
+ }
1344
+ function toRef(source, key, defaultValue) {
1345
+ if (isRef(source)) {
1346
+ return source;
1347
+ } else if (isFunction(source)) {
1348
+ return new GetterRefImpl(source);
1349
+ } else if (isObject(source) && arguments.length > 1) {
1350
+ return propertyToRef(source, key, defaultValue);
1351
+ } else {
1352
+ return ref(source);
1353
+ }
1354
+ }
1355
+ function propertyToRef(source, key, defaultValue) {
1356
+ const val = source[key];
1357
+ return isRef(val) ? val : new ObjectRefImpl(
1358
+ source,
1359
+ key,
1360
+ defaultValue
1361
+ );
1334
1362
  }
1335
1363
 
1336
1364
  class ComputedRefImpl {
@@ -6578,7 +6606,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6578
6606
  return vm;
6579
6607
  }
6580
6608
  }
6581
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6609
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6582
6610
  Vue.config = singletonApp.config;
6583
6611
  Vue.use = (p, ...options) => {
6584
6612
  if (p && isFunction(p.install)) {
@@ -10276,6 +10304,11 @@ function defineOptions(options) {
10276
10304
  warnRuntimeUsage(`defineOptions`);
10277
10305
  }
10278
10306
  }
10307
+ function defineSlots() {
10308
+ {
10309
+ warnRuntimeUsage(`defineSlots`);
10310
+ }
10311
+ }
10279
10312
  function withDefaults(props, defaults) {
10280
10313
  {
10281
10314
  warnRuntimeUsage(`withDefaults`);
@@ -10586,7 +10619,7 @@ function isMemoSame(cached, memo) {
10586
10619
  return true;
10587
10620
  }
10588
10621
 
10589
- const version = "3.3.0-alpha.6";
10622
+ const version = "3.3.0-alpha.7";
10590
10623
  const ssrUtils = null;
10591
10624
  const resolveFilter = resolveFilter$1 ;
10592
10625
  const _compatUtils = {
@@ -12245,6 +12278,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12245
12278
  defineOptions: defineOptions,
12246
12279
  defineProps: defineProps,
12247
12280
  defineSSRCustomElement: defineSSRCustomElement,
12281
+ defineSlots: defineSlots,
12248
12282
  get devtools () { return devtools; },
12249
12283
  effect: effect,
12250
12284
  effectScope: effectScope,
@@ -12319,6 +12353,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12319
12353
  toRaw: toRaw,
12320
12354
  toRef: toRef,
12321
12355
  toRefs: toRefs,
12356
+ toValue: toValue,
12322
12357
  transformVNodeArgs: transformVNodeArgs,
12323
12358
  triggerRef: triggerRef,
12324
12359
  unref: unref,
@@ -12395,4 +12430,4 @@ var Vue$1 = Vue;
12395
12430
 
12396
12431
  const { configureCompat } = Vue$1;
12397
12432
 
12398
- export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, 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, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12433
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, 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, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };