@craft-native/vue 0.0.72
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 +209 -0
- package/dist/composables/useDatabase.d.ts +10 -0
- package/dist/composables/useDatabase.d.ts.map +1 -0
- package/dist/composables/useFileSystem.d.ts +12 -0
- package/dist/composables/useFileSystem.d.ts.map +1 -0
- package/dist/composables/useHttp.d.ts +18 -0
- package/dist/composables/useHttp.d.ts.map +1 -0
- package/dist/composables/useNotification.d.ts +17 -0
- package/dist/composables/useNotification.d.ts.map +1 -0
- package/dist/composables/useTray.d.ts +19 -0
- package/dist/composables/useTray.d.ts.map +1 -0
- package/dist/composables/useWindow.d.ts +16 -0
- package/dist/composables/useWindow.d.ts.map +1 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +577 -0
- package/dist/index.mjs +537 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# @craft-native/vue
|
|
2
|
+
|
|
3
|
+
Vue 3 Composition API bindings for the Craft framework.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @craft-native/vue
|
|
9
|
+
# or
|
|
10
|
+
yarn add @craft-native/vue
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @craft-native/vue
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Core Composables
|
|
18
|
+
|
|
19
|
+
#### useCraft
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup>
|
|
23
|
+
import { useCraft } from '@craft-native/vue';
|
|
24
|
+
|
|
25
|
+
const { craft, isReady } = useCraft();
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div v-if="isReady">Craft is ready!</div>
|
|
30
|
+
</template>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### usePlatform
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<script setup>
|
|
37
|
+
import { usePlatform } from '@craft-native/vue';
|
|
38
|
+
|
|
39
|
+
const { platform, loading } = usePlatform();
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div v-if="!loading">
|
|
44
|
+
<p>Platform: {{ platform?.platform }}</p>
|
|
45
|
+
<p>Version: {{ platform?.version }}</p>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### useToast
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<script setup>
|
|
54
|
+
import { useToast } from '@craft-native/vue';
|
|
55
|
+
|
|
56
|
+
const { showToast } = useToast();
|
|
57
|
+
|
|
58
|
+
const handleClick = () => {
|
|
59
|
+
showToast('Hello from Vue!', 'short');
|
|
60
|
+
};
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<button @click="handleClick">Show Toast</button>
|
|
65
|
+
</template>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Window Management
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<script setup>
|
|
72
|
+
import { useWindow } from '@craft-native/vue';
|
|
73
|
+
|
|
74
|
+
const { maximize, minimize, toggleFullscreen, isFullscreen } = useWindow();
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<div>
|
|
79
|
+
<button @click="maximize">Maximize</button>
|
|
80
|
+
<button @click="minimize">Minimize</button>
|
|
81
|
+
<button @click="toggleFullscreen">
|
|
82
|
+
{{ isFullscreen ? 'Exit' : 'Enter' }} Fullscreen
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### File System
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
<script setup>
|
|
92
|
+
import { ref } from 'vue';
|
|
93
|
+
import { useFileSystem } from '@craft-native/vue';
|
|
94
|
+
|
|
95
|
+
const { readFile, writeFile, loading } = useFileSystem();
|
|
96
|
+
const content = ref('');
|
|
97
|
+
|
|
98
|
+
const load = async () => {
|
|
99
|
+
content.value = await readFile('/path/to/file.txt');
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const save = async () => {
|
|
103
|
+
await writeFile('/path/to/file.txt', content.value);
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<div>
|
|
109
|
+
<textarea v-model="content" />
|
|
110
|
+
<button @click="load">Load</button>
|
|
111
|
+
<button @click="save">Save</button>
|
|
112
|
+
<div v-if="loading">Loading...</div>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Database
|
|
118
|
+
|
|
119
|
+
```vue
|
|
120
|
+
<script setup>
|
|
121
|
+
import { ref, onMounted } from 'vue';
|
|
122
|
+
import { useDatabase } from '@craft-native/vue';
|
|
123
|
+
|
|
124
|
+
const { query, execute } = useDatabase('/path/to/db.sqlite');
|
|
125
|
+
const todos = ref([]);
|
|
126
|
+
|
|
127
|
+
onMounted(async () => {
|
|
128
|
+
todos.value = await query('SELECT * FROM todos');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const addTodo = async (title) => {
|
|
132
|
+
await execute('INSERT INTO todos (title) VALUES (?)', [title]);
|
|
133
|
+
todos.value = await query('SELECT * FROM todos');
|
|
134
|
+
};
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<template>
|
|
138
|
+
<ul>
|
|
139
|
+
<li v-for="todo in todos" :key="todo.id">{{ todo.title }}</li>
|
|
140
|
+
</ul>
|
|
141
|
+
</template>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### HTTP Requests
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<script setup>
|
|
148
|
+
import { ref } from 'vue';
|
|
149
|
+
import { useHttp } from '@craft-native/vue';
|
|
150
|
+
|
|
151
|
+
const { fetch: httpFetch, loading } = useHttp();
|
|
152
|
+
const data = ref(null);
|
|
153
|
+
|
|
154
|
+
const loadData = async () => {
|
|
155
|
+
data.value = await httpFetch('https://api.example.com/data');
|
|
156
|
+
};
|
|
157
|
+
</script>
|
|
158
|
+
|
|
159
|
+
<template>
|
|
160
|
+
<div>
|
|
161
|
+
<button @click="loadData" :disabled="loading">Load Data</button>
|
|
162
|
+
<pre v-if="data">{{ JSON.stringify(data, null, 2) }}</pre>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Events
|
|
168
|
+
|
|
169
|
+
```vue
|
|
170
|
+
<script setup>
|
|
171
|
+
import { useCraftEvent } from '@craft-native/vue';
|
|
172
|
+
|
|
173
|
+
useCraftEvent('app.ready', () => {
|
|
174
|
+
console.log('App is ready!');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
useCraftEvent('window.close', () => {
|
|
178
|
+
console.log('Window is closing');
|
|
179
|
+
});
|
|
180
|
+
</script>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Utilities
|
|
184
|
+
|
|
185
|
+
```vue
|
|
186
|
+
<script setup>
|
|
187
|
+
import { useIsMobile, useIsDesktop } from '@craft-native/vue';
|
|
188
|
+
|
|
189
|
+
const isMobile = useIsMobile();
|
|
190
|
+
const isDesktop = useIsDesktop();
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<template>
|
|
194
|
+
<div>
|
|
195
|
+
<div v-if="isMobile">Mobile View</div>
|
|
196
|
+
<div v-if="isDesktop">Desktop View</div>
|
|
197
|
+
</div>
|
|
198
|
+
</template>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## API Reference
|
|
202
|
+
|
|
203
|
+
All composables are built using Vue 3's Composition API. They return reactive refs and can be used in any Vue 3 component.
|
|
204
|
+
|
|
205
|
+
See the [TypeScript definitions](./dist/index.d.ts) for complete API documentation.
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function useDatabase(dbPath: string): {
|
|
2
|
+
execute: (sql: string, params?: any[]) => Promise<any>;
|
|
3
|
+
query: <T = any>(sql: string, params?: any[]) => Promise<T[]>;
|
|
4
|
+
transaction: (callback: (tx: {
|
|
5
|
+
execute: (sql: string, params?: any[]) => Promise<any>;
|
|
6
|
+
}) => Promise<void>) => Promise<void>;
|
|
7
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
8
|
+
error: import("vue").Ref<Error | null, Error | null>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useDatabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDatabase.d.ts","sourceRoot":"","sources":["../../src/composables/useDatabase.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM;mBAKZ,MAAM,WAAU,GAAG,EAAE;YAiB5B,CAAC,aAAa,MAAM,WAAU,GAAG,EAAE,KAAQ,OAAO,CAAC,CAAC,EAAE,CAAC;4BAiBvC,CAAC,EAAE,EAAE;QAAE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC;;;EAmCvH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function useFileSystem(): {
|
|
2
|
+
readFile: (path: string, encoding?: "utf8" | "binary") => Promise<any>;
|
|
3
|
+
writeFile: (path: string, data: string | Uint8Array, encoding?: "utf8" | "binary") => Promise<void>;
|
|
4
|
+
readDir: (path: string) => Promise<any>;
|
|
5
|
+
mkdir: (path: string, recursive?: boolean) => Promise<void>;
|
|
6
|
+
remove: (path: string, recursive?: boolean) => Promise<void>;
|
|
7
|
+
exists: (path: string) => Promise<any>;
|
|
8
|
+
stat: (path: string) => Promise<any>;
|
|
9
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
10
|
+
error: import("vue").Ref<Error | null, Error | null>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useFileSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileSystem.d.ts","sourceRoot":"","sources":["../../src/composables/useFileSystem.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa;qBAKG,MAAM,aAAY,MAAM,GAAG,QAAQ;sBAiBlC,MAAM,QAAQ,MAAM,GAAG,UAAU,aAAY,MAAM,GAAG,QAAQ;oBAgBhE,MAAM;kBAiBR,MAAM;mBAgBL,MAAM;mBAgBN,MAAM;iBAYR,MAAM;;;EA4BjC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface HttpOptions {
|
|
2
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
3
|
+
headers?: Record<string, string>;
|
|
4
|
+
body?: any;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
}
|
|
7
|
+
interface DownloadOptions {
|
|
8
|
+
onProgress?: (progress: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function useHttp(): {
|
|
11
|
+
fetch: <T = any>(url: string, options?: HttpOptions) => Promise<T>;
|
|
12
|
+
download: (url: string, path: string, options?: DownloadOptions) => Promise<void>;
|
|
13
|
+
upload: (url: string, filePath: string, options?: HttpOptions & DownloadOptions) => Promise<any>;
|
|
14
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
15
|
+
error: import("vue").Ref<Error | null, Error | null>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=useHttp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHttp.d.ts","sourceRoot":"","sources":["../../src/composables/useHttp.ts"],"names":[],"mappings":"AAGA,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,eAAe;IACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,wBAAgB,OAAO;YAKA,CAAC,aAAa,MAAM,YAAW,WAAW,KAAQ,OAAO,CAAC,CAAC,CAAC;oBAiBpD,MAAM,QAAQ,MAAM,YAAW,eAAe;kBAwBhD,MAAM,YAAY,MAAM,YAAW,WAAW,GAAG,eAAe;;;EAgC5F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface NotificationOptions {
|
|
2
|
+
title: string;
|
|
3
|
+
body?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
silent?: boolean;
|
|
6
|
+
tag?: string;
|
|
7
|
+
actions?: Array<{
|
|
8
|
+
action: string;
|
|
9
|
+
title: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useNotification(): {
|
|
13
|
+
send: (options: NotificationOptions) => Promise<void>;
|
|
14
|
+
requestPermission: () => Promise<boolean>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotification.d.ts","sourceRoot":"","sources":["../../src/composables/useNotification.ts"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED,wBAAgB,eAAe;oBAGA,mBAAmB;;EAejD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface TrayMenuItem {
|
|
2
|
+
label: string;
|
|
3
|
+
id: string;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
type?: 'normal' | 'separator' | 'checkbox';
|
|
7
|
+
submenu?: TrayMenuItem[];
|
|
8
|
+
}
|
|
9
|
+
export declare function useTray(): {
|
|
10
|
+
isVisible: import("vue").Ref<boolean, boolean>;
|
|
11
|
+
create: (icon?: string, tooltip?: string) => Promise<void>;
|
|
12
|
+
destroy: () => Promise<void>;
|
|
13
|
+
setIcon: (icon: string) => Promise<void>;
|
|
14
|
+
setTooltip: (tooltip: string) => Promise<void>;
|
|
15
|
+
setMenu: (menu: TrayMenuItem[]) => Promise<void>;
|
|
16
|
+
setTitle: (title: string) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=useTray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTray.d.ts","sourceRoot":"","sources":["../../src/composables/useTray.ts"],"names":[],"mappings":"AAGA,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;IAC3C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,wBAAgB,OAAO;;oBAIQ,MAAM,YAAY,MAAM;;oBAYxB,MAAM;0BAKA,MAAM;oBAKZ,YAAY,EAAE;sBAKZ,MAAM;EActC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function useWindow(): {
|
|
2
|
+
isFullscreen: import("vue").Ref<boolean, boolean>;
|
|
3
|
+
isMaximized: import("vue").Ref<boolean, boolean>;
|
|
4
|
+
isMinimized: import("vue").Ref<boolean, boolean>;
|
|
5
|
+
setTitle: (title: string) => Promise<void>;
|
|
6
|
+
setSize: (width: number, height: number) => Promise<void>;
|
|
7
|
+
setPosition: (x: number, y: number) => Promise<void>;
|
|
8
|
+
maximize: () => Promise<void>;
|
|
9
|
+
minimize: () => Promise<void>;
|
|
10
|
+
restore: () => Promise<void>;
|
|
11
|
+
toggleFullscreen: () => Promise<void>;
|
|
12
|
+
close: () => Promise<void>;
|
|
13
|
+
center: () => Promise<void>;
|
|
14
|
+
setAlwaysOnTop: (alwaysOnTop: boolean) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useWindow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWindow.d.ts","sourceRoot":"","sources":["../../src/composables/useWindow.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS;;;;sBAMQ,MAAM;qBAKP,MAAM,UAAU,MAAM;qBAKtB,MAAM,KAAK,MAAM;;;;;;;kCAwCJ,OAAO;EAoBnD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
interface CraftAPI {
|
|
2
|
+
getPlatform(): Promise<{
|
|
3
|
+
platform: string;
|
|
4
|
+
version: string;
|
|
5
|
+
}>;
|
|
6
|
+
getDeviceInfo(): Promise<{
|
|
7
|
+
platform: string;
|
|
8
|
+
model: string;
|
|
9
|
+
os_version: string;
|
|
10
|
+
}>;
|
|
11
|
+
showToast(message: string, duration: 'short' | 'long'): Promise<void>;
|
|
12
|
+
haptic(type: string): Promise<void>;
|
|
13
|
+
requestPermission(permission: string): Promise<{
|
|
14
|
+
granted: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
on(event: string, callback: (...args: any[]) => void): void;
|
|
18
|
+
off(event: string, callback: (...args: any[]) => void): void;
|
|
19
|
+
emit(event: string, data?: any): void;
|
|
20
|
+
invoke(method: string, params?: any): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
interface Window {
|
|
24
|
+
craft?: CraftAPI;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Composable to access the Craft API
|
|
29
|
+
*/
|
|
30
|
+
export declare function useCraft(): {
|
|
31
|
+
craft: import("vue").Ref<{
|
|
32
|
+
getPlatform: () => Promise<{
|
|
33
|
+
platform: string;
|
|
34
|
+
version: string;
|
|
35
|
+
}>;
|
|
36
|
+
getDeviceInfo: () => Promise<{
|
|
37
|
+
platform: string;
|
|
38
|
+
model: string;
|
|
39
|
+
os_version: string;
|
|
40
|
+
}>;
|
|
41
|
+
showToast: (message: string, duration: "short" | "long") => Promise<void>;
|
|
42
|
+
haptic: (type: string) => Promise<void>;
|
|
43
|
+
requestPermission: (permission: string) => Promise<{
|
|
44
|
+
granted: boolean;
|
|
45
|
+
message: string;
|
|
46
|
+
}>;
|
|
47
|
+
on: (event: string, callback: (...args: any[]) => void) => void;
|
|
48
|
+
off: (event: string, callback: (...args: any[]) => void) => void;
|
|
49
|
+
emit: (event: string, data?: any) => void;
|
|
50
|
+
invoke: (method: string, params?: any) => Promise<any>;
|
|
51
|
+
} | null, CraftAPI | {
|
|
52
|
+
getPlatform: () => Promise<{
|
|
53
|
+
platform: string;
|
|
54
|
+
version: string;
|
|
55
|
+
}>;
|
|
56
|
+
getDeviceInfo: () => Promise<{
|
|
57
|
+
platform: string;
|
|
58
|
+
model: string;
|
|
59
|
+
os_version: string;
|
|
60
|
+
}>;
|
|
61
|
+
showToast: (message: string, duration: "short" | "long") => Promise<void>;
|
|
62
|
+
haptic: (type: string) => Promise<void>;
|
|
63
|
+
requestPermission: (permission: string) => Promise<{
|
|
64
|
+
granted: boolean;
|
|
65
|
+
message: string;
|
|
66
|
+
}>;
|
|
67
|
+
on: (event: string, callback: (...args: any[]) => void) => void;
|
|
68
|
+
off: (event: string, callback: (...args: any[]) => void) => void;
|
|
69
|
+
emit: (event: string, data?: any) => void;
|
|
70
|
+
invoke: (method: string, params?: any) => Promise<any>;
|
|
71
|
+
} | null>;
|
|
72
|
+
isReady: import("vue").Ref<boolean, boolean>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Composable to get platform information
|
|
76
|
+
*/
|
|
77
|
+
export declare function usePlatform(): {
|
|
78
|
+
platform: import("vue").Ref<{
|
|
79
|
+
platform: string;
|
|
80
|
+
version: string;
|
|
81
|
+
} | null, {
|
|
82
|
+
platform: string;
|
|
83
|
+
version: string;
|
|
84
|
+
} | {
|
|
85
|
+
platform: string;
|
|
86
|
+
version: string;
|
|
87
|
+
} | null>;
|
|
88
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
89
|
+
error: import("vue").Ref<Error | null, Error | null>;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Composable to get device information
|
|
93
|
+
*/
|
|
94
|
+
export declare function useDeviceInfo(): {
|
|
95
|
+
deviceInfo: import("vue").Ref<{
|
|
96
|
+
platform: string;
|
|
97
|
+
model: string;
|
|
98
|
+
os_version: string;
|
|
99
|
+
} | null, {
|
|
100
|
+
platform: string;
|
|
101
|
+
model: string;
|
|
102
|
+
os_version: string;
|
|
103
|
+
} | {
|
|
104
|
+
platform: string;
|
|
105
|
+
model: string;
|
|
106
|
+
os_version: string;
|
|
107
|
+
} | null>;
|
|
108
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
109
|
+
error: import("vue").Ref<Error | null, Error | null>;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Composable to show toast notifications
|
|
113
|
+
*/
|
|
114
|
+
export declare function useToast(): {
|
|
115
|
+
showToast: (message: string, duration?: "short" | "long") => Promise<void>;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Composable to trigger haptic feedback
|
|
119
|
+
*/
|
|
120
|
+
export declare function useHaptic(): {
|
|
121
|
+
haptic: (type?: string) => Promise<void>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Composable to request permissions
|
|
125
|
+
*/
|
|
126
|
+
export declare function usePermission(permission: string): {
|
|
127
|
+
granted: import("vue").Ref<boolean | null, boolean | null>;
|
|
128
|
+
request: () => Promise<void>;
|
|
129
|
+
loading: import("vue").Ref<boolean, boolean>;
|
|
130
|
+
error: import("vue").Ref<Error | null, Error | null>;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Composable to listen to Craft events
|
|
134
|
+
*/
|
|
135
|
+
export declare function useCraftEvent(event: string, callback: (...args: any[]) => void): {
|
|
136
|
+
unsubscribe: () => void;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Composable to invoke Craft methods
|
|
140
|
+
*/
|
|
141
|
+
export declare function useCraftInvoke(): {
|
|
142
|
+
invoke: (method: string, params?: any) => Promise<any>;
|
|
143
|
+
isReady: import("vue").Ref<boolean, boolean>;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Composable to check if running on mobile
|
|
147
|
+
*/
|
|
148
|
+
export declare function useIsMobile(): import("vue").ComputedRef<boolean>;
|
|
149
|
+
/**
|
|
150
|
+
* Composable to check if running on desktop
|
|
151
|
+
*/
|
|
152
|
+
export declare function useIsDesktop(): import("vue").ComputedRef<boolean>;
|
|
153
|
+
export * from './composables/useWindow';
|
|
154
|
+
export * from './composables/useTray';
|
|
155
|
+
export * from './composables/useNotification';
|
|
156
|
+
export * from './composables/useFileSystem';
|
|
157
|
+
export * from './composables/useDatabase';
|
|
158
|
+
export * from './composables/useHttp';
|
|
159
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","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