@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.
@@ -1272,6 +1272,9 @@ function triggerRef(ref2) {
1272
1272
  function unref(ref2) {
1273
1273
  return isRef(ref2) ? ref2.value : ref2;
1274
1274
  }
1275
+ function toValue(source) {
1276
+ return isFunction(source) ? source() : unref(source);
1277
+ }
1275
1278
  const shallowUnwrapHandlers = {
1276
1279
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1277
1280
  set: (target, key, value, receiver) => {
@@ -1314,7 +1317,7 @@ function toRefs(object) {
1314
1317
  }
1315
1318
  const ret = isArray(object) ? new Array(object.length) : {};
1316
1319
  for (const key in object) {
1317
- ret[key] = toRef(object, key);
1320
+ ret[key] = propertyToRef(object, key);
1318
1321
  }
1319
1322
  return ret;
1320
1323
  }
@@ -1336,9 +1339,34 @@ class ObjectRefImpl {
1336
1339
  return getDepFromReactive(toRaw(this._object), this._key);
1337
1340
  }
1338
1341
  }
1339
- function toRef(object, key, defaultValue) {
1340
- const val = object[key];
1341
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1342
+ class GetterRefImpl {
1343
+ constructor(_getter) {
1344
+ this._getter = _getter;
1345
+ this.__v_isRef = true;
1346
+ this.__v_isReadonly = true;
1347
+ }
1348
+ get value() {
1349
+ return this._getter();
1350
+ }
1351
+ }
1352
+ function toRef(source, key, defaultValue) {
1353
+ if (isRef(source)) {
1354
+ return source;
1355
+ } else if (isFunction(source)) {
1356
+ return new GetterRefImpl(source);
1357
+ } else if (isObject(source) && arguments.length > 1) {
1358
+ return propertyToRef(source, key, defaultValue);
1359
+ } else {
1360
+ return ref(source);
1361
+ }
1362
+ }
1363
+ function propertyToRef(source, key, defaultValue) {
1364
+ const val = source[key];
1365
+ return isRef(val) ? val : new ObjectRefImpl(
1366
+ source,
1367
+ key,
1368
+ defaultValue
1369
+ );
1342
1370
  }
1343
1371
 
1344
1372
  class ComputedRefImpl {
@@ -6626,7 +6654,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6626
6654
  return vm;
6627
6655
  }
6628
6656
  }
6629
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6657
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6630
6658
  Vue.config = singletonApp.config;
6631
6659
  Vue.use = (p, ...options) => {
6632
6660
  if (p && isFunction(p.install)) {
@@ -10376,6 +10404,11 @@ function defineOptions(options) {
10376
10404
  warnRuntimeUsage(`defineOptions`);
10377
10405
  }
10378
10406
  }
10407
+ function defineSlots() {
10408
+ if (process.env.NODE_ENV !== "production") {
10409
+ warnRuntimeUsage(`defineSlots`);
10410
+ }
10411
+ }
10379
10412
  function withDefaults(props, defaults) {
10380
10413
  if (process.env.NODE_ENV !== "production") {
10381
10414
  warnRuntimeUsage(`withDefaults`);
@@ -10686,7 +10719,7 @@ function isMemoSame(cached, memo) {
10686
10719
  return true;
10687
10720
  }
10688
10721
 
10689
- const version = "3.3.0-alpha.6";
10722
+ const version = "3.3.0-alpha.7";
10690
10723
  const _ssrUtils = {
10691
10724
  createComponentInstance,
10692
10725
  setupComponent,
@@ -12401,6 +12434,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12401
12434
  defineOptions: defineOptions,
12402
12435
  defineProps: defineProps,
12403
12436
  defineSSRCustomElement: defineSSRCustomElement,
12437
+ defineSlots: defineSlots,
12404
12438
  get devtools () { return devtools; },
12405
12439
  effect: effect,
12406
12440
  effectScope: effectScope,
@@ -12475,6 +12509,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12475
12509
  toRaw: toRaw,
12476
12510
  toRef: toRef,
12477
12511
  toRefs: toRefs,
12512
+ toValue: toValue,
12478
12513
  transformVNodeArgs: transformVNodeArgs,
12479
12514
  triggerRef: triggerRef,
12480
12515
  unref: unref,
@@ -12545,4 +12580,4 @@ var Vue$1 = Vue;
12545
12580
 
12546
12581
  const { configureCompat } = Vue$1;
12547
12582
 
12548
- 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 };
12583
+ 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 };
@@ -1267,6 +1267,9 @@ var Vue = (function () {
1267
1267
  function unref(ref2) {
1268
1268
  return isRef(ref2) ? ref2.value : ref2;
1269
1269
  }
1270
+ function toValue(source) {
1271
+ return isFunction(source) ? source() : unref(source);
1272
+ }
1270
1273
  const shallowUnwrapHandlers = {
1271
1274
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1272
1275
  set: (target, key, value, receiver) => {
@@ -1309,7 +1312,7 @@ var Vue = (function () {
1309
1312
  }
1310
1313
  const ret = isArray(object) ? new Array(object.length) : {};
1311
1314
  for (const key in object) {
1312
- ret[key] = toRef(object, key);
1315
+ ret[key] = propertyToRef(object, key);
1313
1316
  }
1314
1317
  return ret;
1315
1318
  }
@@ -1331,9 +1334,34 @@ var Vue = (function () {
1331
1334
  return getDepFromReactive(toRaw(this._object), this._key);
1332
1335
  }
1333
1336
  }
1334
- function toRef(object, key, defaultValue) {
1335
- const val = object[key];
1336
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1337
+ class GetterRefImpl {
1338
+ constructor(_getter) {
1339
+ this._getter = _getter;
1340
+ this.__v_isRef = true;
1341
+ this.__v_isReadonly = true;
1342
+ }
1343
+ get value() {
1344
+ return this._getter();
1345
+ }
1346
+ }
1347
+ function toRef(source, key, defaultValue) {
1348
+ if (isRef(source)) {
1349
+ return source;
1350
+ } else if (isFunction(source)) {
1351
+ return new GetterRefImpl(source);
1352
+ } else if (isObject(source) && arguments.length > 1) {
1353
+ return propertyToRef(source, key, defaultValue);
1354
+ } else {
1355
+ return ref(source);
1356
+ }
1357
+ }
1358
+ function propertyToRef(source, key, defaultValue) {
1359
+ const val = source[key];
1360
+ return isRef(val) ? val : new ObjectRefImpl(
1361
+ source,
1362
+ key,
1363
+ defaultValue
1364
+ );
1337
1365
  }
1338
1366
 
1339
1367
  class ComputedRefImpl {
@@ -6581,7 +6609,7 @@ If this is a native custom element, make sure to exclude it from component resol
6581
6609
  return vm;
6582
6610
  }
6583
6611
  }
6584
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6612
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6585
6613
  Vue.config = singletonApp.config;
6586
6614
  Vue.use = (p, ...options) => {
6587
6615
  if (p && isFunction(p.install)) {
@@ -10279,6 +10307,11 @@ Component that was made reactive: `,
10279
10307
  warnRuntimeUsage(`defineOptions`);
10280
10308
  }
10281
10309
  }
10310
+ function defineSlots() {
10311
+ {
10312
+ warnRuntimeUsage(`defineSlots`);
10313
+ }
10314
+ }
10282
10315
  function withDefaults(props, defaults) {
10283
10316
  {
10284
10317
  warnRuntimeUsage(`withDefaults`);
@@ -10583,7 +10616,7 @@ Component that was made reactive: `,
10583
10616
  return true;
10584
10617
  }
10585
10618
 
10586
- const version = "3.3.0-alpha.6";
10619
+ const version = "3.3.0-alpha.7";
10587
10620
  const ssrUtils = null;
10588
10621
  const resolveFilter = resolveFilter$1 ;
10589
10622
  const _compatUtils = {
@@ -12230,6 +12263,7 @@ Component that was made reactive: `,
12230
12263
  defineOptions: defineOptions,
12231
12264
  defineProps: defineProps,
12232
12265
  defineSSRCustomElement: defineSSRCustomElement,
12266
+ defineSlots: defineSlots,
12233
12267
  get devtools () { return devtools; },
12234
12268
  effect: effect,
12235
12269
  effectScope: effectScope,
@@ -12304,6 +12338,7 @@ Component that was made reactive: `,
12304
12338
  toRaw: toRaw,
12305
12339
  toRef: toRef,
12306
12340
  toRefs: toRefs,
12341
+ toValue: toValue,
12307
12342
  transformVNodeArgs: transformVNodeArgs,
12308
12343
  triggerRef: triggerRef,
12309
12344
  unref: unref,