@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.
@@ -1337,6 +1337,9 @@ function triggerRef(ref2) {
1337
1337
  function unref(ref2) {
1338
1338
  return isRef(ref2) ? ref2.value : ref2;
1339
1339
  }
1340
+ function toValue(source) {
1341
+ return isFunction(source) ? source() : unref(source);
1342
+ }
1340
1343
  const shallowUnwrapHandlers = {
1341
1344
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1342
1345
  set: (target, key, value, receiver) => {
@@ -1379,7 +1382,7 @@ function toRefs(object) {
1379
1382
  }
1380
1383
  const ret = isArray(object) ? new Array(object.length) : {};
1381
1384
  for (const key in object) {
1382
- ret[key] = toRef(object, key);
1385
+ ret[key] = propertyToRef(object, key);
1383
1386
  }
1384
1387
  return ret;
1385
1388
  }
@@ -1401,9 +1404,34 @@ class ObjectRefImpl {
1401
1404
  return getDepFromReactive(toRaw(this._object), this._key);
1402
1405
  }
1403
1406
  }
1404
- function toRef(object, key, defaultValue) {
1405
- const val = object[key];
1406
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1407
+ class GetterRefImpl {
1408
+ constructor(_getter) {
1409
+ this._getter = _getter;
1410
+ this.__v_isRef = true;
1411
+ this.__v_isReadonly = true;
1412
+ }
1413
+ get value() {
1414
+ return this._getter();
1415
+ }
1416
+ }
1417
+ function toRef(source, key, defaultValue) {
1418
+ if (isRef(source)) {
1419
+ return source;
1420
+ } else if (isFunction(source)) {
1421
+ return new GetterRefImpl(source);
1422
+ } else if (isObject(source) && arguments.length > 1) {
1423
+ return propertyToRef(source, key, defaultValue);
1424
+ } else {
1425
+ return ref(source);
1426
+ }
1427
+ }
1428
+ function propertyToRef(source, key, defaultValue) {
1429
+ const val = source[key];
1430
+ return isRef(val) ? val : new ObjectRefImpl(
1431
+ source,
1432
+ key,
1433
+ defaultValue
1434
+ );
1407
1435
  }
1408
1436
 
1409
1437
  class ComputedRefImpl {
@@ -6691,7 +6719,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6691
6719
  return vm;
6692
6720
  }
6693
6721
  }
6694
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6722
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6695
6723
  Vue.config = singletonApp.config;
6696
6724
  Vue.use = (p, ...options) => {
6697
6725
  if (p && isFunction(p.install)) {
@@ -10441,6 +10469,11 @@ function defineOptions(options) {
10441
10469
  warnRuntimeUsage(`defineOptions`);
10442
10470
  }
10443
10471
  }
10472
+ function defineSlots() {
10473
+ if (process.env.NODE_ENV !== "production") {
10474
+ warnRuntimeUsage(`defineSlots`);
10475
+ }
10476
+ }
10444
10477
  function withDefaults(props, defaults) {
10445
10478
  if (process.env.NODE_ENV !== "production") {
10446
10479
  warnRuntimeUsage(`withDefaults`);
@@ -10751,7 +10784,7 @@ function isMemoSame(cached, memo) {
10751
10784
  return true;
10752
10785
  }
10753
10786
 
10754
- const version = "3.3.0-alpha.6";
10787
+ const version = "3.3.0-alpha.7";
10755
10788
  const _ssrUtils = {
10756
10789
  createComponentInstance,
10757
10790
  setupComponent,
@@ -12466,6 +12499,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12466
12499
  defineOptions: defineOptions,
12467
12500
  defineProps: defineProps,
12468
12501
  defineSSRCustomElement: defineSSRCustomElement,
12502
+ defineSlots: defineSlots,
12469
12503
  get devtools () { return devtools; },
12470
12504
  effect: effect,
12471
12505
  effectScope: effectScope,
@@ -12540,6 +12574,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12540
12574
  toRaw: toRaw,
12541
12575
  toRef: toRef,
12542
12576
  toRefs: toRefs,
12577
+ toValue: toValue,
12543
12578
  transformVNodeArgs: transformVNodeArgs,
12544
12579
  triggerRef: triggerRef,
12545
12580
  unref: unref,
@@ -17593,4 +17628,4 @@ var Vue$1 = Vue;
17593
17628
 
17594
17629
  const { configureCompat } = Vue$1;
17595
17630
 
17596
- 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 };
17631
+ 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 };
@@ -1332,6 +1332,9 @@ var Vue = (function () {
1332
1332
  function unref(ref2) {
1333
1333
  return isRef(ref2) ? ref2.value : ref2;
1334
1334
  }
1335
+ function toValue(source) {
1336
+ return isFunction(source) ? source() : unref(source);
1337
+ }
1335
1338
  const shallowUnwrapHandlers = {
1336
1339
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1337
1340
  set: (target, key, value, receiver) => {
@@ -1374,7 +1377,7 @@ var Vue = (function () {
1374
1377
  }
1375
1378
  const ret = isArray(object) ? new Array(object.length) : {};
1376
1379
  for (const key in object) {
1377
- ret[key] = toRef(object, key);
1380
+ ret[key] = propertyToRef(object, key);
1378
1381
  }
1379
1382
  return ret;
1380
1383
  }
@@ -1396,9 +1399,34 @@ var Vue = (function () {
1396
1399
  return getDepFromReactive(toRaw(this._object), this._key);
1397
1400
  }
1398
1401
  }
1399
- function toRef(object, key, defaultValue) {
1400
- const val = object[key];
1401
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1402
+ class GetterRefImpl {
1403
+ constructor(_getter) {
1404
+ this._getter = _getter;
1405
+ this.__v_isRef = true;
1406
+ this.__v_isReadonly = true;
1407
+ }
1408
+ get value() {
1409
+ return this._getter();
1410
+ }
1411
+ }
1412
+ function toRef(source, key, defaultValue) {
1413
+ if (isRef(source)) {
1414
+ return source;
1415
+ } else if (isFunction(source)) {
1416
+ return new GetterRefImpl(source);
1417
+ } else if (isObject(source) && arguments.length > 1) {
1418
+ return propertyToRef(source, key, defaultValue);
1419
+ } else {
1420
+ return ref(source);
1421
+ }
1422
+ }
1423
+ function propertyToRef(source, key, defaultValue) {
1424
+ const val = source[key];
1425
+ return isRef(val) ? val : new ObjectRefImpl(
1426
+ source,
1427
+ key,
1428
+ defaultValue
1429
+ );
1402
1430
  }
1403
1431
 
1404
1432
  class ComputedRefImpl {
@@ -6646,7 +6674,7 @@ If this is a native custom element, make sure to exclude it from component resol
6646
6674
  return vm;
6647
6675
  }
6648
6676
  }
6649
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6677
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6650
6678
  Vue.config = singletonApp.config;
6651
6679
  Vue.use = (p, ...options) => {
6652
6680
  if (p && isFunction(p.install)) {
@@ -10344,6 +10372,11 @@ Component that was made reactive: `,
10344
10372
  warnRuntimeUsage(`defineOptions`);
10345
10373
  }
10346
10374
  }
10375
+ function defineSlots() {
10376
+ {
10377
+ warnRuntimeUsage(`defineSlots`);
10378
+ }
10379
+ }
10347
10380
  function withDefaults(props, defaults) {
10348
10381
  {
10349
10382
  warnRuntimeUsage(`withDefaults`);
@@ -10648,7 +10681,7 @@ Component that was made reactive: `,
10648
10681
  return true;
10649
10682
  }
10650
10683
 
10651
- const version = "3.3.0-alpha.6";
10684
+ const version = "3.3.0-alpha.7";
10652
10685
  const ssrUtils = null;
10653
10686
  const resolveFilter = resolveFilter$1 ;
10654
10687
  const _compatUtils = {
@@ -12295,6 +12328,7 @@ Component that was made reactive: `,
12295
12328
  defineOptions: defineOptions,
12296
12329
  defineProps: defineProps,
12297
12330
  defineSSRCustomElement: defineSSRCustomElement,
12331
+ defineSlots: defineSlots,
12298
12332
  get devtools () { return devtools; },
12299
12333
  effect: effect,
12300
12334
  effectScope: effectScope,
@@ -12369,6 +12403,7 @@ Component that was made reactive: `,
12369
12403
  toRaw: toRaw,
12370
12404
  toRef: toRef,
12371
12405
  toRefs: toRefs,
12406
+ toValue: toValue,
12372
12407
  transformVNodeArgs: transformVNodeArgs,
12373
12408
  triggerRef: triggerRef,
12374
12409
  unref: unref,