@vueuse/firebase 11.0.3 → 11.1.0

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/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _firebase_auth from '@firebase/auth';
2
- import { ComputedRef, Ref } from 'vue-demi';
3
2
  import { User, Auth } from 'firebase/auth';
4
- import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
+ import { ComputedRef, Ref } from 'vue-demi';
5
4
  import { MaybeRef } from '@vueuse/shared';
5
+ import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
6
6
  import { DatabaseReference } from 'firebase/database';
7
7
 
8
8
  interface UseFirebaseAuthOptions {
@@ -44,6 +44,34 @@ declare function useAuth(auth: Auth): {
44
44
  readonly photoURL: string | null;
45
45
  readonly providerId: string;
46
46
  readonly uid: string;
47
+ } | null, User | {
48
+ readonly emailVerified: boolean;
49
+ readonly isAnonymous: boolean;
50
+ readonly metadata: {
51
+ readonly creationTime?: string | undefined;
52
+ readonly lastSignInTime?: string | undefined;
53
+ };
54
+ readonly providerData: {
55
+ readonly displayName: string | null;
56
+ readonly email: string | null;
57
+ readonly phoneNumber: string | null;
58
+ readonly photoURL: string | null;
59
+ readonly providerId: string;
60
+ readonly uid: string;
61
+ }[];
62
+ readonly refreshToken: string;
63
+ readonly tenantId: string | null;
64
+ delete: () => Promise<void>;
65
+ getIdToken: (forceRefresh?: boolean) => Promise<string>;
66
+ getIdTokenResult: (forceRefresh?: boolean) => Promise<_firebase_auth.IdTokenResult>;
67
+ reload: () => Promise<void>;
68
+ toJSON: () => object;
69
+ readonly displayName: string | null;
70
+ readonly email: string | null;
71
+ readonly phoneNumber: string | null;
72
+ readonly photoURL: string | null;
73
+ readonly providerId: string;
74
+ readonly uid: string;
47
75
  } | null>;
48
76
  };
49
77
 
@@ -67,6 +95,6 @@ interface UseRTDBOptions {
67
95
  *
68
96
  * @see https://vueuse.org/useRTDB
69
97
  */
70
- declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined>;
98
+ declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined, T | undefined>;
71
99
 
72
100
  export { type FirebaseDocRef, type UseFirebaseAuthOptions, type UseFirestoreOptions, type UseRTDBOptions, useAuth, useFirestore, useRTDB };
package/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _firebase_auth from '@firebase/auth';
2
- import { ComputedRef, Ref } from 'vue-demi';
3
2
  import { User, Auth } from 'firebase/auth';
4
- import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
+ import { ComputedRef, Ref } from 'vue-demi';
5
4
  import { MaybeRef } from '@vueuse/shared';
5
+ import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
6
6
  import { DatabaseReference } from 'firebase/database';
7
7
 
8
8
  interface UseFirebaseAuthOptions {
@@ -44,6 +44,34 @@ declare function useAuth(auth: Auth): {
44
44
  readonly photoURL: string | null;
45
45
  readonly providerId: string;
46
46
  readonly uid: string;
47
+ } | null, User | {
48
+ readonly emailVerified: boolean;
49
+ readonly isAnonymous: boolean;
50
+ readonly metadata: {
51
+ readonly creationTime?: string | undefined;
52
+ readonly lastSignInTime?: string | undefined;
53
+ };
54
+ readonly providerData: {
55
+ readonly displayName: string | null;
56
+ readonly email: string | null;
57
+ readonly phoneNumber: string | null;
58
+ readonly photoURL: string | null;
59
+ readonly providerId: string;
60
+ readonly uid: string;
61
+ }[];
62
+ readonly refreshToken: string;
63
+ readonly tenantId: string | null;
64
+ delete: () => Promise<void>;
65
+ getIdToken: (forceRefresh?: boolean) => Promise<string>;
66
+ getIdTokenResult: (forceRefresh?: boolean) => Promise<_firebase_auth.IdTokenResult>;
67
+ reload: () => Promise<void>;
68
+ toJSON: () => object;
69
+ readonly displayName: string | null;
70
+ readonly email: string | null;
71
+ readonly phoneNumber: string | null;
72
+ readonly photoURL: string | null;
73
+ readonly providerId: string;
74
+ readonly uid: string;
47
75
  } | null>;
48
76
  };
49
77
 
@@ -67,6 +95,6 @@ interface UseRTDBOptions {
67
95
  *
68
96
  * @see https://vueuse.org/useRTDB
69
97
  */
70
- declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined>;
98
+ declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined, T | undefined>;
71
99
 
72
100
  export { type FirebaseDocRef, type UseFirebaseAuthOptions, type UseFirestoreOptions, type UseRTDBOptions, useAuth, useFirestore, useRTDB };
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _firebase_auth from '@firebase/auth';
2
- import { ComputedRef, Ref } from 'vue-demi';
3
2
  import { User, Auth } from 'firebase/auth';
4
- import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
+ import { ComputedRef, Ref } from 'vue-demi';
5
4
  import { MaybeRef } from '@vueuse/shared';
5
+ import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
6
6
  import { DatabaseReference } from 'firebase/database';
7
7
 
8
8
  interface UseFirebaseAuthOptions {
@@ -44,6 +44,34 @@ declare function useAuth(auth: Auth): {
44
44
  readonly photoURL: string | null;
45
45
  readonly providerId: string;
46
46
  readonly uid: string;
47
+ } | null, User | {
48
+ readonly emailVerified: boolean;
49
+ readonly isAnonymous: boolean;
50
+ readonly metadata: {
51
+ readonly creationTime?: string | undefined;
52
+ readonly lastSignInTime?: string | undefined;
53
+ };
54
+ readonly providerData: {
55
+ readonly displayName: string | null;
56
+ readonly email: string | null;
57
+ readonly phoneNumber: string | null;
58
+ readonly photoURL: string | null;
59
+ readonly providerId: string;
60
+ readonly uid: string;
61
+ }[];
62
+ readonly refreshToken: string;
63
+ readonly tenantId: string | null;
64
+ delete: () => Promise<void>;
65
+ getIdToken: (forceRefresh?: boolean) => Promise<string>;
66
+ getIdTokenResult: (forceRefresh?: boolean) => Promise<_firebase_auth.IdTokenResult>;
67
+ reload: () => Promise<void>;
68
+ toJSON: () => object;
69
+ readonly displayName: string | null;
70
+ readonly email: string | null;
71
+ readonly phoneNumber: string | null;
72
+ readonly photoURL: string | null;
73
+ readonly providerId: string;
74
+ readonly uid: string;
47
75
  } | null>;
48
76
  };
49
77
 
@@ -67,6 +95,6 @@ interface UseRTDBOptions {
67
95
  *
68
96
  * @see https://vueuse.org/useRTDB
69
97
  */
70
- declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined>;
98
+ declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined, T | undefined>;
71
99
 
72
100
  export { type FirebaseDocRef, type UseFirebaseAuthOptions, type UseFirestoreOptions, type UseRTDBOptions, useAuth, useFirestore, useRTDB };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueuse/firebase",
3
- "version": "11.0.3",
3
+ "version": "11.1.0",
4
4
  "description": "Enables realtime bindings for Firebase",
5
5
  "author": "Anthony Fu <https://github.com/antfu>",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "firebase": ">=9.0.0"
51
51
  },
52
52
  "dependencies": {
53
- "@vueuse/shared": "11.0.3",
53
+ "@vueuse/shared": "11.1.0",
54
54
  "vue-demi": ">=0.14.10"
55
55
  }
56
56
  }
package/useAuth.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _firebase_auth from '@firebase/auth';
2
- import { ComputedRef, Ref } from 'vue-demi';
3
2
  import { User, Auth } from 'firebase/auth';
3
+ import { ComputedRef, Ref } from 'vue-demi';
4
4
 
5
5
  interface UseFirebaseAuthOptions {
6
6
  isAuthenticated: ComputedRef<boolean>;
@@ -41,6 +41,34 @@ declare function useAuth(auth: Auth): {
41
41
  readonly photoURL: string | null;
42
42
  readonly providerId: string;
43
43
  readonly uid: string;
44
+ } | null, User | {
45
+ readonly emailVerified: boolean;
46
+ readonly isAnonymous: boolean;
47
+ readonly metadata: {
48
+ readonly creationTime?: string | undefined;
49
+ readonly lastSignInTime?: string | undefined;
50
+ };
51
+ readonly providerData: {
52
+ readonly displayName: string | null;
53
+ readonly email: string | null;
54
+ readonly phoneNumber: string | null;
55
+ readonly photoURL: string | null;
56
+ readonly providerId: string;
57
+ readonly uid: string;
58
+ }[];
59
+ readonly refreshToken: string;
60
+ readonly tenantId: string | null;
61
+ delete: () => Promise<void>;
62
+ getIdToken: (forceRefresh?: boolean) => Promise<string>;
63
+ getIdTokenResult: (forceRefresh?: boolean) => Promise<_firebase_auth.IdTokenResult>;
64
+ reload: () => Promise<void>;
65
+ toJSON: () => object;
66
+ readonly displayName: string | null;
67
+ readonly email: string | null;
68
+ readonly phoneNumber: string | null;
69
+ readonly photoURL: string | null;
70
+ readonly providerId: string;
71
+ readonly uid: string;
44
72
  } | null>;
45
73
  };
46
74
 
package/useAuth.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _firebase_auth from '@firebase/auth';
2
- import { ComputedRef, Ref } from 'vue-demi';
3
2
  import { User, Auth } from 'firebase/auth';
3
+ import { ComputedRef, Ref } from 'vue-demi';
4
4
 
5
5
  interface UseFirebaseAuthOptions {
6
6
  isAuthenticated: ComputedRef<boolean>;
@@ -41,6 +41,34 @@ declare function useAuth(auth: Auth): {
41
41
  readonly photoURL: string | null;
42
42
  readonly providerId: string;
43
43
  readonly uid: string;
44
+ } | null, User | {
45
+ readonly emailVerified: boolean;
46
+ readonly isAnonymous: boolean;
47
+ readonly metadata: {
48
+ readonly creationTime?: string | undefined;
49
+ readonly lastSignInTime?: string | undefined;
50
+ };
51
+ readonly providerData: {
52
+ readonly displayName: string | null;
53
+ readonly email: string | null;
54
+ readonly phoneNumber: string | null;
55
+ readonly photoURL: string | null;
56
+ readonly providerId: string;
57
+ readonly uid: string;
58
+ }[];
59
+ readonly refreshToken: string;
60
+ readonly tenantId: string | null;
61
+ delete: () => Promise<void>;
62
+ getIdToken: (forceRefresh?: boolean) => Promise<string>;
63
+ getIdTokenResult: (forceRefresh?: boolean) => Promise<_firebase_auth.IdTokenResult>;
64
+ reload: () => Promise<void>;
65
+ toJSON: () => object;
66
+ readonly displayName: string | null;
67
+ readonly email: string | null;
68
+ readonly phoneNumber: string | null;
69
+ readonly photoURL: string | null;
70
+ readonly providerId: string;
71
+ readonly uid: string;
44
72
  } | null>;
45
73
  };
46
74
 
package/useAuth.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _firebase_auth from '@firebase/auth';
2
- import { ComputedRef, Ref } from 'vue-demi';
3
2
  import { User, Auth } from 'firebase/auth';
3
+ import { ComputedRef, Ref } from 'vue-demi';
4
4
 
5
5
  interface UseFirebaseAuthOptions {
6
6
  isAuthenticated: ComputedRef<boolean>;
@@ -41,6 +41,34 @@ declare function useAuth(auth: Auth): {
41
41
  readonly photoURL: string | null;
42
42
  readonly providerId: string;
43
43
  readonly uid: string;
44
+ } | null, User | {
45
+ readonly emailVerified: boolean;
46
+ readonly isAnonymous: boolean;
47
+ readonly metadata: {
48
+ readonly creationTime?: string | undefined;
49
+ readonly lastSignInTime?: string | undefined;
50
+ };
51
+ readonly providerData: {
52
+ readonly displayName: string | null;
53
+ readonly email: string | null;
54
+ readonly phoneNumber: string | null;
55
+ readonly photoURL: string | null;
56
+ readonly providerId: string;
57
+ readonly uid: string;
58
+ }[];
59
+ readonly refreshToken: string;
60
+ readonly tenantId: string | null;
61
+ delete: () => Promise<void>;
62
+ getIdToken: (forceRefresh?: boolean) => Promise<string>;
63
+ getIdTokenResult: (forceRefresh?: boolean) => Promise<_firebase_auth.IdTokenResult>;
64
+ reload: () => Promise<void>;
65
+ toJSON: () => object;
66
+ readonly displayName: string | null;
67
+ readonly email: string | null;
68
+ readonly phoneNumber: string | null;
69
+ readonly photoURL: string | null;
70
+ readonly providerId: string;
71
+ readonly uid: string;
44
72
  } | null>;
45
73
  };
46
74
 
package/useFirestore.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var vueDemi = require('vue-demi');
4
3
  var shared = require('@vueuse/shared');
5
4
  var firestore = require('firebase/firestore');
5
+ var vueDemi = require('vue-demi');
6
6
 
7
7
  function getData(docRef) {
8
8
  const data = docRef.data();
@@ -1,6 +1,6 @@
1
- import { Ref } from 'vue-demi';
2
- import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
1
  import { MaybeRef } from '@vueuse/shared';
2
+ import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
+ import { Ref } from 'vue-demi';
4
4
 
5
5
  interface UseFirestoreOptions {
6
6
  errorHandler?: (err: Error) => void;
@@ -1,6 +1,6 @@
1
- import { Ref } from 'vue-demi';
2
- import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
1
  import { MaybeRef } from '@vueuse/shared';
2
+ import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
+ import { Ref } from 'vue-demi';
4
4
 
5
5
  interface UseFirestoreOptions {
6
6
  errorHandler?: (err: Error) => void;
package/useFirestore.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Ref } from 'vue-demi';
2
- import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
1
  import { MaybeRef } from '@vueuse/shared';
2
+ import { Query, DocumentReference, DocumentData } from 'firebase/firestore';
3
+ import { Ref } from 'vue-demi';
4
4
 
5
5
  interface UseFirestoreOptions {
6
6
  errorHandler?: (err: Error) => void;
@@ -125,7 +125,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
125
125
  _VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
126
126
  );
127
127
  ;
128
- ;(function (exports, vueDemi, shared, firestore) {
128
+ ;(function (exports, shared, firestore, vueDemi) {
129
129
  'use strict';
130
130
 
131
131
  function getData(docRef) {
@@ -181,4 +181,4 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
181
181
 
182
182
  exports.useFirestore = useFirestore;
183
183
 
184
- })(this.VueUse = this.VueUse || {}, VueDemi, VueUse, firebase);
184
+ })(this.VueUse = this.VueUse || {}, VueUse, firebase, VueDemi);
@@ -1 +1 @@
1
- var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,VueDemi=function(n,e,c){if(n.install)return n;if(!e)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(e.version.slice(0,4)==="2.7."){let o=function(s,t){var r,d={},a={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(f,l){return d[f]=l,this},directive:function(f,l){return l?(e.directive(f,l),a):e.directive(f)},mount:function(f,l){return r||(r=new e(Object.assign({propsData:t},s,{provide:Object.assign(d,s.provide)})),r.$mount(f,l),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}};return a};var b=o;for(var i in e)n[i]=e[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.warn=e.util.warn,n.hasInjectionContext=function(){return!!n.getCurrentInstance()},n.createApp=o}else if(e.version.slice(0,2)==="2.")if(c){for(var i in c)n[i]=c[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.hasInjectionContext=function(){return!!n.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var i in e)n[i]=e[i];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(o,s,t){return Array.isArray(o)?(o.length=Math.max(o.length,s),o.splice(s,1,t),t):(o[s]=t,t)},n.del=function(o,s){if(Array.isArray(o)){o.splice(s,1);return}delete o[s]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");return n}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,e,c,i){"use strict";function b(t){const r=t.data();return r&&Object.defineProperty(r,"id",{value:t.id.toString(),writable:!1}),r}function o(t){var r;return(((r=t.path)==null?void 0:r.match(/\//g))||[]).length%2!==0}function s(t,r=void 0,d={}){const{errorHandler:a=v=>console.error(v),autoDispose:f=!0}=d,l=e.isRef(t)?t:e.computed(()=>t);let u=()=>{};const p=e.ref(r);return e.watch(l,v=>{u(),l.value?o(l.value)?u=i.onSnapshot(v,h=>{p.value=b(h)||null},a):u=i.onSnapshot(v,h=>{p.value=h.docs.map(b).filter(c.isDef)},a):p.value=r},{immediate:!0}),f===!0?c.tryOnScopeDispose(()=>{u()}):typeof f=="number"&&c.tryOnScopeDispose(()=>{c.useTimeoutFn(()=>{u()},f)}),p}n.useFirestore=s})(this.VueUse=this.VueUse||{},VueDemi,VueUse,firebase);
1
+ var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,VueDemi=function(n,e,c){if(n.install)return n;if(!e)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(e.version.slice(0,4)==="2.7."){let o=function(s,t){var r,d={},a={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(f,l){return d[f]=l,this},directive:function(f,l){return l?(e.directive(f,l),a):e.directive(f)},mount:function(f,l){return r||(r=new e(Object.assign({propsData:t},s,{provide:Object.assign(d,s.provide)})),r.$mount(f,l),r)},unmount:function(){r&&(r.$destroy(),r=void 0)}};return a};var b=o;for(var i in e)n[i]=e[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.warn=e.util.warn,n.hasInjectionContext=function(){return!!n.getCurrentInstance()},n.createApp=o}else if(e.version.slice(0,2)==="2.")if(c){for(var i in c)n[i]=c[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.hasInjectionContext=function(){return!!n.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var i in e)n[i]=e[i];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(o,s,t){return Array.isArray(o)?(o.length=Math.max(o.length,s),o.splice(s,1,t),t):(o[s]=t,t)},n.del=function(o,s){if(Array.isArray(o)){o.splice(s,1);return}delete o[s]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");return n}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,e,c,i){"use strict";function b(t){const r=t.data();return r&&Object.defineProperty(r,"id",{value:t.id.toString(),writable:!1}),r}function o(t){var r;return(((r=t.path)==null?void 0:r.match(/\//g))||[]).length%2!==0}function s(t,r=void 0,d={}){const{errorHandler:a=v=>console.error(v),autoDispose:f=!0}=d,l=i.isRef(t)?t:i.computed(()=>t);let u=()=>{};const p=i.ref(r);return i.watch(l,v=>{u(),l.value?o(l.value)?u=c.onSnapshot(v,h=>{p.value=b(h)||null},a):u=c.onSnapshot(v,h=>{p.value=h.docs.map(b).filter(e.isDef)},a):p.value=r},{immediate:!0}),f===!0?e.tryOnScopeDispose(()=>{u()}):typeof f=="number"&&e.tryOnScopeDispose(()=>{e.useTimeoutFn(()=>{u()},f)}),p}n.useFirestore=s})(this.VueUse=this.VueUse||{},VueUse,firebase,VueDemi);
package/useFirestore.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { isRef, computed, ref, watch } from 'vue-demi';
2
1
  import { isDef, tryOnScopeDispose, useTimeoutFn } from '@vueuse/shared';
3
2
  import { onSnapshot } from 'firebase/firestore';
3
+ import { isRef, computed, ref, watch } from 'vue-demi';
4
4
 
5
5
  function getData(docRef) {
6
6
  const data = docRef.data();
package/useRTDB.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ var shared = require('@vueuse/shared');
3
4
  var database = require('firebase/database');
4
5
  var vueDemi = require('vue-demi');
5
- var shared = require('@vueuse/shared');
6
6
 
7
7
  function useRTDB(docRef, options = {}) {
8
8
  const {
package/useRTDB.d.cts CHANGED
@@ -10,6 +10,6 @@ interface UseRTDBOptions {
10
10
  *
11
11
  * @see https://vueuse.org/useRTDB
12
12
  */
13
- declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined>;
13
+ declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined, T | undefined>;
14
14
 
15
15
  export { type UseRTDBOptions, useRTDB };
package/useRTDB.d.mts CHANGED
@@ -10,6 +10,6 @@ interface UseRTDBOptions {
10
10
  *
11
11
  * @see https://vueuse.org/useRTDB
12
12
  */
13
- declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined>;
13
+ declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined, T | undefined>;
14
14
 
15
15
  export { type UseRTDBOptions, useRTDB };
package/useRTDB.d.ts CHANGED
@@ -10,6 +10,6 @@ interface UseRTDBOptions {
10
10
  *
11
11
  * @see https://vueuse.org/useRTDB
12
12
  */
13
- declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined>;
13
+ declare function useRTDB<T = any>(docRef: DatabaseReference, options?: UseRTDBOptions): Ref<T | undefined, T | undefined>;
14
14
 
15
15
  export { type UseRTDBOptions, useRTDB };
package/useRTDB.iife.js CHANGED
@@ -125,7 +125,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
125
125
  _VueDemiGlobal.VueCompositionAPI || (typeof VueCompositionAPI !== 'undefined' ? VueCompositionAPI : undefined)
126
126
  );
127
127
  ;
128
- ;(function (exports, database, vueDemi, shared) {
128
+ ;(function (exports, shared, database, vueDemi) {
129
129
  'use strict';
130
130
 
131
131
  function useRTDB(docRef, options = {}) {
@@ -145,4 +145,4 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
145
145
 
146
146
  exports.useRTDB = useRTDB;
147
147
 
148
- })(this.VueUse = this.VueUse || {}, firebase, VueDemi, VueUse);
148
+ })(this.VueUse = this.VueUse || {}, VueUse, firebase, VueDemi);
@@ -1 +1 @@
1
- var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,VueDemi=function(n,o,l){if(n.install)return n;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(o.version.slice(0,4)==="2.7."){let r=function(e,f){var s,d={},a={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(c,t){return d[c]=t,this},directive:function(c,t){return t?(o.directive(c,t),a):o.directive(c)},mount:function(c,t){return s||(s=new o(Object.assign({propsData:f},e,{provide:Object.assign(d,e.provide)})),s.$mount(c,t),s)},unmount:function(){s&&(s.$destroy(),s=void 0)}};return a};var u=r;for(var i in o)n[i]=o[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=o,n.Vue2=o,n.version=o.version,n.warn=o.util.warn,n.hasInjectionContext=function(){return!!n.getCurrentInstance()},n.createApp=r}else if(o.version.slice(0,2)==="2.")if(l){for(var i in l)n[i]=l[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=o,n.Vue2=o,n.version=o.version,n.hasInjectionContext=function(){return!!n.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var i in o)n[i]=o[i];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=o,n.Vue2=void 0,n.version=o.version,n.set=function(r,e,f){return Array.isArray(r)?(r.length=Math.max(r.length,e),r.splice(e,1,f),f):(r[e]=f,f)},n.del=function(r,e){if(Array.isArray(r)){r.splice(e,1);return}delete r[e]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return n}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,o,l,i){"use strict";function u(r,e={}){const{errorHandler:f=t=>console.error(t),autoDispose:s=!0}=e,d=l.ref(void 0);function a(t){d.value=t.val()}const c=o.onValue(r,a,f);return s&&i.tryOnScopeDispose(()=>c()),d}n.useRTDB=u})(this.VueUse=this.VueUse||{},firebase,VueDemi,VueUse);
1
+ var _VueDemiGlobal=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this,VueDemi=function(n,o,l){if(n.install)return n;if(!o)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(o.version.slice(0,4)==="2.7."){let r=function(e,f){var s,d={},a={config:o.config,use:o.use.bind(o),mixin:o.mixin.bind(o),component:o.component.bind(o),provide:function(c,t){return d[c]=t,this},directive:function(c,t){return t?(o.directive(c,t),a):o.directive(c)},mount:function(c,t){return s||(s=new o(Object.assign({propsData:f},e,{provide:Object.assign(d,e.provide)})),s.$mount(c,t),s)},unmount:function(){s&&(s.$destroy(),s=void 0)}};return a};var u=r;for(var i in o)n[i]=o[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=o,n.Vue2=o,n.version=o.version,n.warn=o.util.warn,n.hasInjectionContext=function(){return!!n.getCurrentInstance()},n.createApp=r}else if(o.version.slice(0,2)==="2.")if(l){for(var i in l)n[i]=l[i];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=o,n.Vue2=o,n.version=o.version,n.hasInjectionContext=function(){return!!n.getCurrentInstance()}}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(o.version.slice(0,2)==="3."){for(var i in o)n[i]=o[i];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=o,n.Vue2=void 0,n.version=o.version,n.set=function(r,e,f){return Array.isArray(r)?(r.length=Math.max(r.length,e),r.splice(e,1,f),f):(r[e]=f,f)},n.del=function(r,e){if(Array.isArray(r)){r.splice(e,1);return}delete r[e]}}else console.error("[vue-demi] Vue version "+o.version+" is unsupported.");return n}(_VueDemiGlobal.VueDemi=_VueDemiGlobal.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),_VueDemiGlobal.Vue||(typeof Vue<"u"?Vue:void 0),_VueDemiGlobal.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,o,l,i){"use strict";function u(r,e={}){const{errorHandler:f=t=>console.error(t),autoDispose:s=!0}=e,d=i.ref(void 0);function a(t){d.value=t.val()}const c=l.onValue(r,a,f);return s&&o.tryOnScopeDispose(()=>c()),d}n.useRTDB=u})(this.VueUse=this.VueUse||{},VueUse,firebase,VueDemi);
package/useRTDB.mjs CHANGED
@@ -1,6 +1,6 @@
1
+ import { tryOnScopeDispose } from '@vueuse/shared';
1
2
  import { onValue } from 'firebase/database';
2
3
  import { ref } from 'vue-demi';
3
- import { tryOnScopeDispose } from '@vueuse/shared';
4
4
 
5
5
  function useRTDB(docRef, options = {}) {
6
6
  const {