@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.
package/dist/vue.cjs.js CHANGED
@@ -1402,6 +1402,9 @@ function triggerRef(ref2) {
1402
1402
  function unref(ref2) {
1403
1403
  return isRef(ref2) ? ref2.value : ref2;
1404
1404
  }
1405
+ function toValue(source) {
1406
+ return isFunction(source) ? source() : unref(source);
1407
+ }
1405
1408
  const shallowUnwrapHandlers = {
1406
1409
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1407
1410
  set: (target, key, value, receiver) => {
@@ -1444,7 +1447,7 @@ function toRefs(object) {
1444
1447
  }
1445
1448
  const ret = isArray(object) ? new Array(object.length) : {};
1446
1449
  for (const key in object) {
1447
- ret[key] = toRef(object, key);
1450
+ ret[key] = propertyToRef(object, key);
1448
1451
  }
1449
1452
  return ret;
1450
1453
  }
@@ -1466,9 +1469,34 @@ class ObjectRefImpl {
1466
1469
  return getDepFromReactive(toRaw(this._object), this._key);
1467
1470
  }
1468
1471
  }
1469
- function toRef(object, key, defaultValue) {
1470
- const val = object[key];
1471
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1472
+ class GetterRefImpl {
1473
+ constructor(_getter) {
1474
+ this._getter = _getter;
1475
+ this.__v_isRef = true;
1476
+ this.__v_isReadonly = true;
1477
+ }
1478
+ get value() {
1479
+ return this._getter();
1480
+ }
1481
+ }
1482
+ function toRef(source, key, defaultValue) {
1483
+ if (isRef(source)) {
1484
+ return source;
1485
+ } else if (isFunction(source)) {
1486
+ return new GetterRefImpl(source);
1487
+ } else if (isObject(source) && arguments.length > 1) {
1488
+ return propertyToRef(source, key, defaultValue);
1489
+ } else {
1490
+ return ref(source);
1491
+ }
1492
+ }
1493
+ function propertyToRef(source, key, defaultValue) {
1494
+ const val = source[key];
1495
+ return isRef(val) ? val : new ObjectRefImpl(
1496
+ source,
1497
+ key,
1498
+ defaultValue
1499
+ );
1472
1500
  }
1473
1501
 
1474
1502
  class ComputedRefImpl {
@@ -6743,7 +6771,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6743
6771
  return vm;
6744
6772
  }
6745
6773
  }
6746
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6774
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6747
6775
  Vue.config = singletonApp.config;
6748
6776
  Vue.use = (p, ...options) => {
6749
6777
  if (p && isFunction(p.install)) {
@@ -10453,6 +10481,11 @@ function defineOptions(options) {
10453
10481
  warnRuntimeUsage(`defineOptions`);
10454
10482
  }
10455
10483
  }
10484
+ function defineSlots() {
10485
+ {
10486
+ warnRuntimeUsage(`defineSlots`);
10487
+ }
10488
+ }
10456
10489
  function withDefaults(props, defaults) {
10457
10490
  {
10458
10491
  warnRuntimeUsage(`withDefaults`);
@@ -10763,7 +10796,7 @@ function isMemoSame(cached, memo) {
10763
10796
  return true;
10764
10797
  }
10765
10798
 
10766
- const version = "3.3.0-alpha.6";
10799
+ const version = "3.3.0-alpha.7";
10767
10800
  const _ssrUtils = {
10768
10801
  createComponentInstance,
10769
10802
  setupComponent,
@@ -12423,6 +12456,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12423
12456
  defineOptions: defineOptions,
12424
12457
  defineProps: defineProps,
12425
12458
  defineSSRCustomElement: defineSSRCustomElement,
12459
+ defineSlots: defineSlots,
12426
12460
  get devtools () { return devtools; },
12427
12461
  effect: effect,
12428
12462
  effectScope: effectScope,
@@ -12497,6 +12531,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12497
12531
  toRaw: toRaw,
12498
12532
  toRef: toRef,
12499
12533
  toRefs: toRefs,
12534
+ toValue: toValue,
12500
12535
  transformVNodeArgs: transformVNodeArgs,
12501
12536
  triggerRef: triggerRef,
12502
12537
  unref: unref,
@@ -20719,7 +20754,7 @@ function stringifyElement(node, context) {
20719
20754
  }
20720
20755
  function evaluateConstant(exp) {
20721
20756
  if (exp.type === 4) {
20722
- return new Function(`return ${exp.content}`)();
20757
+ return new Function(`return (${exp.content})`)();
20723
20758
  } else {
20724
20759
  let res = ``;
20725
20760
  exp.children.forEach((c) => {
@@ -1269,6 +1269,9 @@ function triggerRef(ref2) {
1269
1269
  function unref(ref2) {
1270
1270
  return isRef(ref2) ? ref2.value : ref2;
1271
1271
  }
1272
+ function toValue(source) {
1273
+ return isFunction(source) ? source() : unref(source);
1274
+ }
1272
1275
  const shallowUnwrapHandlers = {
1273
1276
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1274
1277
  set: (target, key, value, receiver) => {
@@ -1308,7 +1311,7 @@ function customRef(factory) {
1308
1311
  function toRefs(object) {
1309
1312
  const ret = isArray(object) ? new Array(object.length) : {};
1310
1313
  for (const key in object) {
1311
- ret[key] = toRef(object, key);
1314
+ ret[key] = propertyToRef(object, key);
1312
1315
  }
1313
1316
  return ret;
1314
1317
  }
@@ -1330,9 +1333,34 @@ class ObjectRefImpl {
1330
1333
  return getDepFromReactive(toRaw(this._object), this._key);
1331
1334
  }
1332
1335
  }
1333
- function toRef(object, key, defaultValue) {
1334
- const val = object[key];
1335
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1336
+ class GetterRefImpl {
1337
+ constructor(_getter) {
1338
+ this._getter = _getter;
1339
+ this.__v_isRef = true;
1340
+ this.__v_isReadonly = true;
1341
+ }
1342
+ get value() {
1343
+ return this._getter();
1344
+ }
1345
+ }
1346
+ function toRef(source, key, defaultValue) {
1347
+ if (isRef(source)) {
1348
+ return source;
1349
+ } else if (isFunction(source)) {
1350
+ return new GetterRefImpl(source);
1351
+ } else if (isObject(source) && arguments.length > 1) {
1352
+ return propertyToRef(source, key, defaultValue);
1353
+ } else {
1354
+ return ref(source);
1355
+ }
1356
+ }
1357
+ function propertyToRef(source, key, defaultValue) {
1358
+ const val = source[key];
1359
+ return isRef(val) ? val : new ObjectRefImpl(
1360
+ source,
1361
+ key,
1362
+ defaultValue
1363
+ );
1336
1364
  }
1337
1365
 
1338
1366
  class ComputedRefImpl {
@@ -5355,7 +5383,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5355
5383
  return vm;
5356
5384
  }
5357
5385
  }
5358
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
5386
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
5359
5387
  Vue.config = singletonApp.config;
5360
5388
  Vue.use = (p, ...options) => {
5361
5389
  if (p && isFunction(p.install)) {
@@ -8523,6 +8551,8 @@ function defineExpose(exposed) {
8523
8551
  }
8524
8552
  function defineOptions(options) {
8525
8553
  }
8554
+ function defineSlots() {
8555
+ }
8526
8556
  function withDefaults(props, defaults) {
8527
8557
  return null;
8528
8558
  }
@@ -8645,7 +8675,7 @@ function isMemoSame(cached, memo) {
8645
8675
  return true;
8646
8676
  }
8647
8677
 
8648
- const version = "3.3.0-alpha.6";
8678
+ const version = "3.3.0-alpha.7";
8649
8679
  const _ssrUtils = {
8650
8680
  createComponentInstance,
8651
8681
  setupComponent,
@@ -10185,6 +10215,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10185
10215
  defineOptions: defineOptions,
10186
10216
  defineProps: defineProps,
10187
10217
  defineSSRCustomElement: defineSSRCustomElement,
10218
+ defineSlots: defineSlots,
10188
10219
  get devtools () { return devtools; },
10189
10220
  effect: effect,
10190
10221
  effectScope: effectScope,
@@ -10259,6 +10290,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10259
10290
  toRaw: toRaw,
10260
10291
  toRef: toRef,
10261
10292
  toRefs: toRefs,
10293
+ toValue: toValue,
10262
10294
  transformVNodeArgs: transformVNodeArgs,
10263
10295
  triggerRef: triggerRef,
10264
10296
  unref: unref,
@@ -18238,7 +18270,7 @@ function stringifyElement(node, context) {
18238
18270
  }
18239
18271
  function evaluateConstant(exp) {
18240
18272
  if (exp.type === 4) {
18241
- return new Function(`return ${exp.content}`)();
18273
+ return new Function(`return (${exp.content})`)();
18242
18274
  } else {
18243
18275
  let res = ``;
18244
18276
  exp.children.forEach((c) => {
@@ -1329,6 +1329,9 @@ function triggerRef(ref2) {
1329
1329
  function unref(ref2) {
1330
1330
  return isRef(ref2) ? ref2.value : ref2;
1331
1331
  }
1332
+ function toValue(source) {
1333
+ return isFunction(source) ? source() : unref(source);
1334
+ }
1332
1335
  const shallowUnwrapHandlers = {
1333
1336
  get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
1334
1337
  set: (target, key, value, receiver) => {
@@ -1371,7 +1374,7 @@ function toRefs(object) {
1371
1374
  }
1372
1375
  const ret = isArray(object) ? new Array(object.length) : {};
1373
1376
  for (const key in object) {
1374
- ret[key] = toRef(object, key);
1377
+ ret[key] = propertyToRef(object, key);
1375
1378
  }
1376
1379
  return ret;
1377
1380
  }
@@ -1393,9 +1396,34 @@ class ObjectRefImpl {
1393
1396
  return getDepFromReactive(toRaw(this._object), this._key);
1394
1397
  }
1395
1398
  }
1396
- function toRef(object, key, defaultValue) {
1397
- const val = object[key];
1398
- return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
1399
+ class GetterRefImpl {
1400
+ constructor(_getter) {
1401
+ this._getter = _getter;
1402
+ this.__v_isRef = true;
1403
+ this.__v_isReadonly = true;
1404
+ }
1405
+ get value() {
1406
+ return this._getter();
1407
+ }
1408
+ }
1409
+ function toRef(source, key, defaultValue) {
1410
+ if (isRef(source)) {
1411
+ return source;
1412
+ } else if (isFunction(source)) {
1413
+ return new GetterRefImpl(source);
1414
+ } else if (isObject(source) && arguments.length > 1) {
1415
+ return propertyToRef(source, key, defaultValue);
1416
+ } else {
1417
+ return ref(source);
1418
+ }
1419
+ }
1420
+ function propertyToRef(source, key, defaultValue) {
1421
+ const val = source[key];
1422
+ return isRef(val) ? val : new ObjectRefImpl(
1423
+ source,
1424
+ key,
1425
+ defaultValue
1426
+ );
1399
1427
  }
1400
1428
 
1401
1429
  class ComputedRefImpl {
@@ -6643,7 +6671,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6643
6671
  return vm;
6644
6672
  }
6645
6673
  }
6646
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
6674
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.7"}`;
6647
6675
  Vue.config = singletonApp.config;
6648
6676
  Vue.use = (p, ...options) => {
6649
6677
  if (p && isFunction(p.install)) {
@@ -10341,6 +10369,11 @@ function defineOptions(options) {
10341
10369
  warnRuntimeUsage(`defineOptions`);
10342
10370
  }
10343
10371
  }
10372
+ function defineSlots() {
10373
+ {
10374
+ warnRuntimeUsage(`defineSlots`);
10375
+ }
10376
+ }
10344
10377
  function withDefaults(props, defaults) {
10345
10378
  {
10346
10379
  warnRuntimeUsage(`withDefaults`);
@@ -10651,7 +10684,7 @@ function isMemoSame(cached, memo) {
10651
10684
  return true;
10652
10685
  }
10653
10686
 
10654
- const version = "3.3.0-alpha.6";
10687
+ const version = "3.3.0-alpha.7";
10655
10688
  const ssrUtils = null;
10656
10689
  const resolveFilter = resolveFilter$1 ;
10657
10690
  const _compatUtils = {
@@ -12310,6 +12343,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12310
12343
  defineOptions: defineOptions,
12311
12344
  defineProps: defineProps,
12312
12345
  defineSSRCustomElement: defineSSRCustomElement,
12346
+ defineSlots: defineSlots,
12313
12347
  get devtools () { return devtools; },
12314
12348
  effect: effect,
12315
12349
  effectScope: effectScope,
@@ -12384,6 +12418,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12384
12418
  toRaw: toRaw,
12385
12419
  toRef: toRef,
12386
12420
  toRefs: toRefs,
12421
+ toValue: toValue,
12387
12422
  transformVNodeArgs: transformVNodeArgs,
12388
12423
  triggerRef: triggerRef,
12389
12424
  unref: unref,
@@ -17440,4 +17475,4 @@ var Vue$1 = Vue;
17440
17475
 
17441
17476
  const { configureCompat } = Vue$1;
17442
17477
 
17443
- 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 };
17478
+ 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 };