@zveltio/vue 1.0.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/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # @zveltio/vue
2
+
3
+ Official Vue 3 SDK for [Zveltio](https://zveltio.com) — composables for collections, real-time, auth, storage, and offline sync.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @zveltio/vue @zveltio/sdk
9
+ # or
10
+ bun add @zveltio/vue @zveltio/sdk
11
+ ```
12
+
13
+ ## Setup
14
+
15
+ Register the plugin in your Vue app:
16
+
17
+ ```ts
18
+ import { createApp } from 'vue';
19
+ import { ZveltioPlugin } from '@zveltio/vue';
20
+ import App from './App.vue';
21
+
22
+ createApp(App)
23
+ .use(ZveltioPlugin, { url: 'https://your-engine.example.com' })
24
+ .mount('#app');
25
+ ```
26
+
27
+ ## Composables
28
+
29
+ ### Data
30
+
31
+ ```vue
32
+ <script setup lang="ts">
33
+ import { useCollection, useRecord } from '@zveltio/vue';
34
+
35
+ const { data, loading, error, refresh } = useCollection('products', {
36
+ filter: { status: 'active' },
37
+ sort: '-createdAt',
38
+ limit: 20,
39
+ });
40
+
41
+ const { data: product } = useRecord('products', 'id-123');
42
+ </script>
43
+
44
+ <template>
45
+ <div v-if="loading">Loading...</div>
46
+ <ProductCard v-for="p in data" :key="p.id" :product="p" />
47
+ </template>
48
+ ```
49
+
50
+ ### Real-time
51
+
52
+ ```vue
53
+ <script setup lang="ts">
54
+ import { useRealtime } from '@zveltio/vue';
55
+
56
+ const event = useRealtime('orders');
57
+ // event.value: { action: 'create'|'update'|'delete', record: {...} } | null
58
+ </script>
59
+
60
+ <template>
61
+ <div>Last event: {{ event?.action }}</div>
62
+ </template>
63
+ ```
64
+
65
+ ### Offline Sync
66
+
67
+ ```vue
68
+ <script setup lang="ts">
69
+ import { useSyncCollection, useSyncStatus } from '@zveltio/vue';
70
+
71
+ const { records, pending, conflicts } = useSyncCollection('products');
72
+ const { isOnline } = useSyncStatus();
73
+ </script>
74
+
75
+ <template>
76
+ <Banner v-if="!isOnline">Offline — syncing when reconnected</Banner>
77
+ <div
78
+ v-for="p in records"
79
+ :key="p.id"
80
+ :style="{ opacity: p._syncStatus === 'pending' ? 0.6 : 1 }"
81
+ >
82
+ {{ p.name }}
83
+ </div>
84
+ </template>
85
+ ```
86
+
87
+ ### Auth
88
+
89
+ ```vue
90
+ <script setup lang="ts">
91
+ import { useAuth } from '@zveltio/vue';
92
+
93
+ const { user, signIn, signOut, loading } = useAuth();
94
+ </script>
95
+
96
+ <template>
97
+ <div v-if="loading" />
98
+ <button v-else-if="!user" @click="signIn({ email, password })">Sign In</button>
99
+ <div v-else>
100
+ {{ user.email }}
101
+ <button @click="signOut">Sign Out</button>
102
+ </div>
103
+ </template>
104
+ ```
105
+
106
+ ### Storage
107
+
108
+ ```vue
109
+ <script setup lang="ts">
110
+ import { useStorage } from '@zveltio/vue';
111
+
112
+ const { upload, uploading, progress } = useStorage();
113
+
114
+ async function handleFile(e: Event) {
115
+ const file = (e.target as HTMLInputElement).files?.[0];
116
+ if (file) {
117
+ const url = await upload(file);
118
+ console.log('Uploaded:', url);
119
+ }
120
+ }
121
+ </script>
122
+
123
+ <template>
124
+ <input type="file" @change="handleFile" :disabled="uploading" />
125
+ <progress v-if="uploading" :value="progress" max="100" />
126
+ </template>
127
+ ```
128
+
129
+ ## Links
130
+
131
+ - [Documentation](https://zveltio.com/docs)
132
+ - [GitHub](https://github.com/zveltio-devs/zveltio)
133
+ - [Core SDK](https://www.npmjs.com/package/@zveltio/sdk)
134
+ - [React SDK](https://www.npmjs.com/package/@zveltio/react)
@@ -0,0 +1,11 @@
1
+ import { type Ref } from 'vue';
2
+ export declare function useAuth(): {
3
+ user: Ref<any | null>;
4
+ session: Ref<any | null>;
5
+ loading: Ref<boolean>;
6
+ error: Ref<Error | null>;
7
+ login: (email: string, password: string) => Promise<void>;
8
+ logout: () => Promise<void>;
9
+ signup: (email: string, password: string, name: string) => Promise<void>;
10
+ };
11
+ //# sourceMappingURL=useAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/composables/useAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAM/C,wBAAgB,OAAO,IAAI;IACzB,IAAI,EAAE,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACzB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACtB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IACzB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E,CAmEA"}
@@ -0,0 +1,73 @@
1
+ import { ref, onMounted } from 'vue';
2
+ import { inject } from 'vue';
3
+ import { fetchSession, loginUser, logoutUser, signupUser } from '@zveltio/sdk';
4
+ import { ZVELTIO_CLIENT_KEY } from '../plugin.js';
5
+ export function useAuth() {
6
+ const client = inject(ZVELTIO_CLIENT_KEY);
7
+ if (!client)
8
+ throw new Error('useAuth must be used within ZveltioPlugin');
9
+ const user = ref(null);
10
+ const session = ref(null);
11
+ const loading = ref(true);
12
+ const error = ref(null);
13
+ const loadSession = async () => {
14
+ try {
15
+ const state = await fetchSession(client);
16
+ session.value = state.session;
17
+ user.value = state.user;
18
+ }
19
+ finally {
20
+ loading.value = false;
21
+ }
22
+ };
23
+ onMounted(loadSession);
24
+ const login = async (email, password) => {
25
+ loading.value = true;
26
+ error.value = null;
27
+ try {
28
+ const state = await loginUser(client, email, password);
29
+ user.value = state.user;
30
+ session.value = state.session;
31
+ }
32
+ catch (err) {
33
+ error.value = err instanceof Error ? err : new Error(String(err));
34
+ throw err;
35
+ }
36
+ finally {
37
+ loading.value = false;
38
+ }
39
+ };
40
+ const logout = async () => {
41
+ loading.value = true;
42
+ error.value = null;
43
+ try {
44
+ const state = await logoutUser(client);
45
+ user.value = state.user;
46
+ session.value = state.session;
47
+ }
48
+ catch (err) {
49
+ error.value = err instanceof Error ? err : new Error(String(err));
50
+ throw err;
51
+ }
52
+ finally {
53
+ loading.value = false;
54
+ }
55
+ };
56
+ const signup = async (email, password, name) => {
57
+ loading.value = true;
58
+ error.value = null;
59
+ try {
60
+ const state = await signupUser(client, email, password, name);
61
+ user.value = state.user;
62
+ session.value = state.session;
63
+ }
64
+ catch (err) {
65
+ error.value = err instanceof Error ? err : new Error(String(err));
66
+ throw err;
67
+ }
68
+ finally {
69
+ loading.value = false;
70
+ }
71
+ };
72
+ return { user, session, loading, error, login, logout, signup };
73
+ }
@@ -0,0 +1,9 @@
1
+ import { type Ref } from 'vue';
2
+ import { type CollectionOptions } from '@zveltio/sdk';
3
+ export declare function useCollection<T = any>(collectionName: string, options?: CollectionOptions): {
4
+ data: Ref<T[] | null>;
5
+ loading: Ref<boolean>;
6
+ error: Ref<Error | null>;
7
+ refetch: () => Promise<void>;
8
+ };
9
+ //# sourceMappingURL=useCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCollection.d.ts","sourceRoot":"","sources":["../../src/composables/useCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/C,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIvE,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EACnC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,iBAAiB,GAC1B;IAAE,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAuB1G"}
@@ -0,0 +1,27 @@
1
+ import { ref, onMounted } from 'vue';
2
+ import { inject } from 'vue';
3
+ import { fetchCollection } from '@zveltio/sdk';
4
+ import { ZVELTIO_CLIENT_KEY } from '../plugin.js';
5
+ export function useCollection(collectionName, options) {
6
+ const client = inject(ZVELTIO_CLIENT_KEY);
7
+ if (!client)
8
+ throw new Error('useCollection must be used within ZveltioPlugin');
9
+ const data = ref(null);
10
+ const loading = ref(true);
11
+ const error = ref(null);
12
+ const load = async () => {
13
+ loading.value = true;
14
+ error.value = null;
15
+ try {
16
+ data.value = await fetchCollection(client, collectionName, options);
17
+ }
18
+ catch (err) {
19
+ error.value = err instanceof Error ? err : new Error(String(err));
20
+ }
21
+ finally {
22
+ loading.value = false;
23
+ }
24
+ };
25
+ onMounted(load);
26
+ return { data, loading, error, refetch: load };
27
+ }
@@ -0,0 +1,2 @@
1
+ export declare function useRealtime(baseUrl: string, collection: string, event: string | null, callback: (data: any) => void): void;
2
+ //# sourceMappingURL=useRealtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRealtime.d.ts","sourceRoot":"","sources":["../../src/composables/useRealtime.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAC5B,IAAI,CAoBN"}
@@ -0,0 +1,22 @@
1
+ import { onMounted, onUnmounted } from 'vue';
2
+ import { ZveltioRealtime } from '@zveltio/sdk';
3
+ export function useRealtime(baseUrl, collection, event, callback) {
4
+ let realtime = null;
5
+ let unsub = null;
6
+ onMounted(() => {
7
+ if (!baseUrl || !collection)
8
+ return;
9
+ realtime = new ZveltioRealtime(baseUrl);
10
+ realtime.connect();
11
+ unsub = realtime.subscribe(collection, (data) => {
12
+ if (!event || data.event === event) {
13
+ callback(data);
14
+ }
15
+ });
16
+ });
17
+ onUnmounted(() => {
18
+ unsub?.();
19
+ realtime?.disconnect();
20
+ realtime = null;
21
+ });
22
+ }
@@ -0,0 +1,8 @@
1
+ import { type Ref } from 'vue';
2
+ export declare function useRecord<T = any>(collectionName: string, id: string | null | undefined): {
3
+ data: Ref<T | null>;
4
+ loading: Ref<boolean>;
5
+ error: Ref<Error | null>;
6
+ refetch: () => Promise<void>;
7
+ };
8
+ //# sourceMappingURL=useRecord.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRecord.d.ts","sourceRoot":"","sources":["../../src/composables/useRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAMtD,wBAAgB,SAAS,CAAC,CAAC,GAAG,GAAG,EAC/B,cAAc,EAAE,MAAM,EACtB,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC5B;IAAE,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAyBxG"}
@@ -0,0 +1,33 @@
1
+ import { ref, onMounted, watch } from 'vue';
2
+ import { inject } from 'vue';
3
+ import { fetchRecord } from '@zveltio/sdk';
4
+ import { ZVELTIO_CLIENT_KEY } from '../plugin.js';
5
+ export function useRecord(collectionName, id) {
6
+ const client = inject(ZVELTIO_CLIENT_KEY);
7
+ if (!client)
8
+ throw new Error('useRecord must be used within ZveltioPlugin');
9
+ const data = ref(null);
10
+ const loading = ref(!!id);
11
+ const error = ref(null);
12
+ const load = async () => {
13
+ if (!id) {
14
+ data.value = null;
15
+ loading.value = false;
16
+ return;
17
+ }
18
+ loading.value = true;
19
+ error.value = null;
20
+ try {
21
+ data.value = await fetchRecord(client, collectionName, id);
22
+ }
23
+ catch (err) {
24
+ error.value = err instanceof Error ? err : new Error(String(err));
25
+ }
26
+ finally {
27
+ loading.value = false;
28
+ }
29
+ };
30
+ onMounted(load);
31
+ watch(() => id, load);
32
+ return { data, loading, error, refetch: load };
33
+ }
@@ -0,0 +1,10 @@
1
+ import { type Ref } from 'vue';
2
+ import { type StorageFile } from '@zveltio/sdk';
3
+ export declare function useStorage(): {
4
+ upload: (file: File, folder?: string) => Promise<StorageFile>;
5
+ list: (folder?: string) => Promise<StorageFile[]>;
6
+ remove: (fileId: string) => Promise<void>;
7
+ uploading: Ref<boolean>;
8
+ error: Ref<Error | null>;
9
+ };
10
+ //# sourceMappingURL=useStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStorage.d.ts","sourceRoot":"","sources":["../../src/composables/useStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAqC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAInF,wBAAgB,UAAU,IAAI;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9D,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAClD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;CAC1B,CAwBA"}
@@ -0,0 +1,28 @@
1
+ import { ref } from 'vue';
2
+ import { inject } from 'vue';
3
+ import { uploadFile, listFiles, removeFile } from '@zveltio/sdk';
4
+ import { ZVELTIO_CLIENT_KEY } from '../plugin.js';
5
+ export function useStorage() {
6
+ const client = inject(ZVELTIO_CLIENT_KEY);
7
+ if (!client)
8
+ throw new Error('useStorage must be used within ZveltioPlugin');
9
+ const uploading = ref(false);
10
+ const error = ref(null);
11
+ const upload = async (file, folder) => {
12
+ uploading.value = true;
13
+ error.value = null;
14
+ try {
15
+ return await uploadFile(client, file, folder);
16
+ }
17
+ catch (err) {
18
+ error.value = err instanceof Error ? err : new Error(String(err));
19
+ throw error.value;
20
+ }
21
+ finally {
22
+ uploading.value = false;
23
+ }
24
+ };
25
+ const list = (folder) => listFiles(client, folder);
26
+ const remove = (fileId) => removeFile(client, fileId);
27
+ return { upload, list, remove, uploading, error };
28
+ }
@@ -0,0 +1,11 @@
1
+ import { type Ref } from 'vue';
2
+ export interface UseSyncCollectionOptions {
3
+ realtimeUrl?: string;
4
+ syncInterval?: number;
5
+ }
6
+ export declare function useSyncCollection<T = any>(collectionName: string, options?: UseSyncCollectionOptions): {
7
+ data: Ref<T[] | null>;
8
+ loading: Ref<boolean>;
9
+ error: Ref<Error | null>;
10
+ };
11
+ //# sourceMappingURL=useSyncCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSyncCollection.d.ts","sourceRoot":"","sources":["../../src/composables/useSyncCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAM5D,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAAC,CAAC,GAAG,GAAG,EACvC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,wBAAwB,GACjC;IAAE,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;CAAE,CAgC5E"}
@@ -0,0 +1,34 @@
1
+ import { ref, onMounted, onUnmounted } from 'vue';
2
+ import { SyncManager } from '@zveltio/sdk';
3
+ import { inject } from 'vue';
4
+ import { ZVELTIO_CLIENT_KEY } from '../plugin.js';
5
+ export function useSyncCollection(collectionName, options) {
6
+ const client = inject(ZVELTIO_CLIENT_KEY);
7
+ if (!client)
8
+ throw new Error('useSyncCollection must be used within ZveltioPlugin');
9
+ const data = ref(null);
10
+ const loading = ref(true);
11
+ const error = ref(null);
12
+ let sync = null;
13
+ let unsub = null;
14
+ onMounted(async () => {
15
+ sync = new SyncManager(client, { syncInterval: options?.syncInterval });
16
+ try {
17
+ await sync.start(options?.realtimeUrl);
18
+ unsub = sync.collection(collectionName).subscribe((records) => {
19
+ data.value = records;
20
+ loading.value = false;
21
+ });
22
+ }
23
+ catch (err) {
24
+ error.value = err instanceof Error ? err : new Error(String(err));
25
+ loading.value = false;
26
+ }
27
+ });
28
+ onUnmounted(() => {
29
+ unsub?.();
30
+ sync?.stop();
31
+ sync = null;
32
+ });
33
+ return { data, loading, error };
34
+ }
@@ -0,0 +1,7 @@
1
+ import { type Ref } from 'vue';
2
+ import type { SyncManager } from '@zveltio/sdk';
3
+ import type { SyncStatus } from '../types.js';
4
+ export declare function useSyncStatus(syncManager?: SyncManager, pollIntervalMs?: number): {
5
+ status: Ref<SyncStatus>;
6
+ };
7
+ //# sourceMappingURL=useSyncStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSyncStatus.d.ts","sourceRoot":"","sources":["../../src/composables/useSyncStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAAgB,aAAa,CAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,cAAc,SAAO,GACpB;IAAE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,CAAA;CAAE,CAgD7B"}
@@ -0,0 +1,46 @@
1
+ import { ref, onMounted, onUnmounted } from 'vue';
2
+ export function useSyncStatus(syncManager, pollIntervalMs = 2000) {
3
+ const status = ref({ status: 'online', pendingCount: 0 });
4
+ let timer = null;
5
+ const updateOnline = () => {
6
+ if (typeof navigator !== 'undefined') {
7
+ status.value = {
8
+ ...status.value,
9
+ status: navigator.onLine ? 'online' : 'offline',
10
+ };
11
+ }
12
+ };
13
+ onMounted(() => {
14
+ if (!syncManager) {
15
+ if (typeof window !== 'undefined') {
16
+ window.addEventListener('online', updateOnline);
17
+ window.addEventListener('offline', updateOnline);
18
+ updateOnline();
19
+ }
20
+ return;
21
+ }
22
+ const poll = async () => {
23
+ try {
24
+ const s = await syncManager.getStatus();
25
+ status.value = {
26
+ status: s.isOnline ? (s.pending > 0 ? 'syncing' : 'online') : 'offline',
27
+ pendingCount: s.pending,
28
+ };
29
+ }
30
+ catch {
31
+ /* ignore */
32
+ }
33
+ };
34
+ poll();
35
+ timer = setInterval(poll, pollIntervalMs);
36
+ });
37
+ onUnmounted(() => {
38
+ if (timer)
39
+ clearInterval(timer);
40
+ if (typeof window !== 'undefined') {
41
+ window.removeEventListener('online', updateOnline);
42
+ window.removeEventListener('offline', updateOnline);
43
+ }
44
+ });
45
+ return { status };
46
+ }
@@ -0,0 +1,13 @@
1
+ export { ZveltioPlugin, ZVELTIO_CLIENT_KEY } from './plugin.js';
2
+ export type { ZveltioPluginOptions } from './plugin.js';
3
+ export { useCollection } from './composables/useCollection.js';
4
+ export { useRecord } from './composables/useRecord.js';
5
+ export { useSyncCollection } from './composables/useSyncCollection.js';
6
+ export type { UseSyncCollectionOptions } from './composables/useSyncCollection.js';
7
+ export { useSyncStatus } from './composables/useSyncStatus.js';
8
+ export { useRealtime } from './composables/useRealtime.js';
9
+ export { useAuth } from './composables/useAuth.js';
10
+ export { useStorage } from './composables/useStorage.js';
11
+ export type { CollectionOptions, SyncStatus } from './types.js';
12
+ export { ZveltioClient, createZveltioClient } from '@zveltio/sdk';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { ZveltioPlugin, ZVELTIO_CLIENT_KEY } from './plugin.js';
2
+ export { useCollection } from './composables/useCollection.js';
3
+ export { useRecord } from './composables/useRecord.js';
4
+ export { useSyncCollection } from './composables/useSyncCollection.js';
5
+ export { useSyncStatus } from './composables/useSyncStatus.js';
6
+ export { useRealtime } from './composables/useRealtime.js';
7
+ export { useAuth } from './composables/useAuth.js';
8
+ export { useStorage } from './composables/useStorage.js';
9
+ // Re-export core client for convenience
10
+ export { ZveltioClient, createZveltioClient } from '@zveltio/sdk';
@@ -0,0 +1,10 @@
1
+ import type { App } from 'vue';
2
+ import type { ZveltioClient } from '@zveltio/sdk';
3
+ export declare const ZVELTIO_CLIENT_KEY = "zveltio-client";
4
+ export interface ZveltioPluginOptions {
5
+ client: ZveltioClient;
6
+ }
7
+ export declare const ZveltioPlugin: {
8
+ install(app: App, options: ZveltioPluginOptions): void;
9
+ };
10
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,eAAO,MAAM,aAAa;iBACX,GAAG,WAAW,oBAAoB;CAMhD,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,9 @@
1
+ export const ZVELTIO_CLIENT_KEY = 'zveltio-client';
2
+ export const ZveltioPlugin = {
3
+ install(app, options) {
4
+ if (!options?.client) {
5
+ throw new Error('[ZveltioPlugin] options.client is required');
6
+ }
7
+ app.provide(ZVELTIO_CLIENT_KEY, options.client);
8
+ },
9
+ };
@@ -0,0 +1,13 @@
1
+ export interface CollectionOptions {
2
+ filter?: Record<string, any>;
3
+ sort?: string;
4
+ order?: 'asc' | 'desc';
5
+ limit?: number;
6
+ page?: number;
7
+ search?: string;
8
+ }
9
+ export interface SyncStatus {
10
+ status: 'online' | 'offline' | 'syncing';
11
+ pendingCount: number;
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@zveltio/vue",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "dev": "tsc --watch",
20
+ "typecheck": "tsc --noEmit"
21
+ },
22
+ "dependencies": {
23
+ "@zveltio/sdk": "1.0.0"
24
+ },
25
+ "peerDependencies": {
26
+ "vue": ">=3.3"
27
+ },
28
+ "devDependencies": {
29
+ "vue": "^3.3.0",
30
+ "typescript": "^5.4.0"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/zveltio-devs/zveltio.git"
35
+ }
36
+ }