craft-native 0.0.37

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.
Files changed (117) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +424 -0
  3. package/bin/cli.ts +937 -0
  4. package/dist/api/android-advanced.d.ts +737 -0
  5. package/dist/api/android-advanced.d.ts.map +1 -0
  6. package/dist/api/app.d.ts +432 -0
  7. package/dist/api/app.d.ts.map +1 -0
  8. package/dist/api/clipboard.d.ts +85 -0
  9. package/dist/api/clipboard.d.ts.map +1 -0
  10. package/dist/api/crypto.d.ts +79 -0
  11. package/dist/api/crypto.d.ts.map +1 -0
  12. package/dist/api/db.d.ts +427 -0
  13. package/dist/api/db.d.ts.map +1 -0
  14. package/dist/api/dialog.d.ts +141 -0
  15. package/dist/api/dialog.d.ts.map +1 -0
  16. package/dist/api/fs.d.ts +131 -0
  17. package/dist/api/fs.d.ts.map +1 -0
  18. package/dist/api/http.d.ts +196 -0
  19. package/dist/api/http.d.ts.map +1 -0
  20. package/dist/api/index.d.ts +38 -0
  21. package/dist/api/index.d.ts.map +1 -0
  22. package/dist/api/ios-advanced.d.ts +833 -0
  23. package/dist/api/ios-advanced.d.ts.map +1 -0
  24. package/dist/api/macos-advanced.d.ts +721 -0
  25. package/dist/api/macos-advanced.d.ts.map +1 -0
  26. package/dist/api/media.d.ts +233 -0
  27. package/dist/api/media.d.ts.map +1 -0
  28. package/dist/api/mobile.d.ts +658 -0
  29. package/dist/api/mobile.d.ts.map +1 -0
  30. package/dist/api/process.d.ts +168 -0
  31. package/dist/api/process.d.ts.map +1 -0
  32. package/dist/api/sidebar.d.ts +125 -0
  33. package/dist/api/sidebar.d.ts.map +1 -0
  34. package/dist/api/tray.d.ts +410 -0
  35. package/dist/api/tray.d.ts.map +1 -0
  36. package/dist/api/window.d.ts +462 -0
  37. package/dist/api/window.d.ts.map +1 -0
  38. package/dist/api/windows-advanced.d.ts +719 -0
  39. package/dist/api/windows-advanced.d.ts.map +1 -0
  40. package/dist/assets/index.d.ts +69 -0
  41. package/dist/assets/index.d.ts.map +1 -0
  42. package/dist/binary-resolver.d.ts +39 -0
  43. package/dist/binary-resolver.d.ts.map +1 -0
  44. package/dist/bridge/android.d.ts +574 -0
  45. package/dist/bridge/android.d.ts.map +1 -0
  46. package/dist/bridge/core.d.ts +474 -0
  47. package/dist/bridge/core.d.ts.map +1 -0
  48. package/dist/bridge/ids.d.ts +18 -0
  49. package/dist/bridge/ids.d.ts.map +1 -0
  50. package/dist/bridge/ios.d.ts +528 -0
  51. package/dist/bridge/ios.d.ts.map +1 -0
  52. package/dist/bridge/webkit-pending.d.ts +50 -0
  53. package/dist/bridge/webkit-pending.d.ts.map +1 -0
  54. package/dist/build/bundle-optimizer.d.ts +69 -0
  55. package/dist/build/bundle-optimizer.d.ts.map +1 -0
  56. package/dist/components/index.d.ts +719 -0
  57. package/dist/components/index.d.ts.map +1 -0
  58. package/dist/components/native.d.ts +728 -0
  59. package/dist/components/native.d.ts.map +1 -0
  60. package/dist/components/sidebar.d.ts +458 -0
  61. package/dist/components/sidebar.d.ts.map +1 -0
  62. package/dist/dev/devtools.d.ts +118 -0
  63. package/dist/dev/devtools.d.ts.map +1 -0
  64. package/dist/dev/error-overlay.d.ts +73 -0
  65. package/dist/dev/error-overlay.d.ts.map +1 -0
  66. package/dist/dev/hot-reload.d.ts +127 -0
  67. package/dist/dev/hot-reload.d.ts.map +1 -0
  68. package/dist/index.cjs +10253 -0
  69. package/dist/index.d.cts +59 -0
  70. package/dist/index.d.ts +59 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +10240 -0
  73. package/dist/logging/index.d.ts +152 -0
  74. package/dist/logging/index.d.ts.map +1 -0
  75. package/dist/optimizations/index.d.ts +232 -0
  76. package/dist/optimizations/index.d.ts.map +1 -0
  77. package/dist/package.d.ts +90 -0
  78. package/dist/package.d.ts.map +1 -0
  79. package/dist/performance/runtime.d.ts +230 -0
  80. package/dist/performance/runtime.d.ts.map +1 -0
  81. package/dist/performance/startup.d.ts +223 -0
  82. package/dist/performance/startup.d.ts.map +1 -0
  83. package/dist/plugins/index.d.ts +114 -0
  84. package/dist/plugins/index.d.ts.map +1 -0
  85. package/dist/security/index.d.ts +268 -0
  86. package/dist/security/index.d.ts.map +1 -0
  87. package/dist/signing/index.d.ts +104 -0
  88. package/dist/signing/index.d.ts.map +1 -0
  89. package/dist/styles/headwind.d.ts +222 -0
  90. package/dist/styles/headwind.d.ts.map +1 -0
  91. package/dist/styles/index.d.ts +31 -0
  92. package/dist/styles/index.d.ts.map +1 -0
  93. package/dist/styles/sidebar-templates.d.ts +77 -0
  94. package/dist/styles/sidebar-templates.d.ts.map +1 -0
  95. package/dist/styles/sidebars.d.ts +194 -0
  96. package/dist/styles/sidebars.d.ts.map +1 -0
  97. package/dist/types.d.ts +1555 -0
  98. package/dist/types.d.ts.map +1 -0
  99. package/dist/updater/index.d.ts +164 -0
  100. package/dist/updater/index.d.ts.map +1 -0
  101. package/dist/utils/audio.d.ts +40 -0
  102. package/dist/utils/audio.d.ts.map +1 -0
  103. package/dist/utils/index.d.ts +9 -0
  104. package/dist/utils/index.d.ts.map +1 -0
  105. package/dist/utils/native.d.ts +27 -0
  106. package/dist/utils/native.d.ts.map +1 -0
  107. package/dist/utils/react.d.ts +157 -0
  108. package/dist/utils/react.d.ts.map +1 -0
  109. package/dist/utils/storage.d.ts +35 -0
  110. package/dist/utils/storage.d.ts.map +1 -0
  111. package/dist/utils/svelte.d.ts +187 -0
  112. package/dist/utils/svelte.d.ts.map +1 -0
  113. package/dist/utils/timer.d.ts +57 -0
  114. package/dist/utils/timer.d.ts.map +1 -0
  115. package/dist/utils/vue.d.ts +157 -0
  116. package/dist/utils/vue.d.ts.map +1 -0
  117. package/package.json +78 -0
@@ -0,0 +1,131 @@
1
+ /**
2
+ * @fileoverview Craft File System API
3
+ * @description Provides native file system access through the Craft bridge.
4
+ * Works in both browser (via native bridge) and Node.js environments.
5
+ * @module @craft-native/api/fs
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { fs, readBinaryFile, stat, watch } from '@craft-native/api/fs'
10
+ *
11
+ * // Read a text file
12
+ * const content = await fs.readFile('/path/to/file.txt')
13
+ *
14
+ * // Write to a file
15
+ * await fs.writeFile('/path/to/output.txt', 'Hello, World!')
16
+ *
17
+ * // List directory contents
18
+ * const files = await fs.readDir('/path/to/directory')
19
+ *
20
+ * // Watch for changes (returns a Promise<() => void>)
21
+ * const unwatch = await watch('/path/to/watch', (event, filename) => {
22
+ * console.log(`${event}: ${filename}`)
23
+ * })
24
+ * ```
25
+ */
26
+ import type { CraftFileSystemAPI } from '../types';
27
+ /**
28
+ * Validate a file path to prevent directory traversal attacks.
29
+ *
30
+ * Rejects:
31
+ * - Any `..` segment (including after URL-decoding, since the host bridge may
32
+ * percent-decode before opening the file)
33
+ * - Embedded NULs (truncate filenames in C APIs)
34
+ * - Empty/whitespace-only paths
35
+ *
36
+ * When a `root` is provided, additionally asserts that the resolved absolute
37
+ * path is contained within `root` (best-effort — symlinks are still resolved
38
+ * by the OS at open time).
39
+ */
40
+ export declare function validatePath(path: string, root?: string): void;
41
+ /**
42
+ * Encode a Uint8Array as base64 in chunks. Avoids `String.fromCharCode(...big)`
43
+ * blowing up on large buffers and produces a far more compact wire payload
44
+ * than `Array.from(uint8)` (which JSON-encodes ~5 bytes per byte).
45
+ */
46
+ export declare function uint8ToBase64(bytes: Uint8Array): string;
47
+ /**
48
+ * Decode a base64 string into a Uint8Array. Mirrors {@link uint8ToBase64}.
49
+ */
50
+ export declare function base64ToUint8(base64: string): Uint8Array;
51
+ /**
52
+ * File system API implementation.
53
+ * Uses the native Craft bridge for file operations when running in a Craft app,
54
+ * with automatic fallback to Node.js APIs when running in a Node environment.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * import { fs } from '@craft-native/api/fs'
59
+ *
60
+ * // Check if a file exists before reading
61
+ * if (await fs.exists('/config.json')) {
62
+ * const config = JSON.parse(await fs.readFile('/config.json'))
63
+ * }
64
+ * ```
65
+ */
66
+ export declare const fs: CraftFileSystemAPI;
67
+ /**
68
+ * Read file as binary data (Uint8Array).
69
+ * Use this for non-text files like images, PDFs, or other binary formats.
70
+ */
71
+ export declare function readBinaryFile(path: string): Promise<Uint8Array>;
72
+ /**
73
+ * Write binary data to a file.
74
+ * Sends the bytes as base64 (with an `_binary: true` marker) so the wire
75
+ * payload is ~33% overhead instead of the ~5x-10x overhead of JSON-encoded
76
+ * `Array.from(uint8)`.
77
+ */
78
+ export declare function writeBinaryFile(path: string, data: Uint8Array): Promise<void>;
79
+ /**
80
+ * File statistics information.
81
+ */
82
+ export interface FileStats {
83
+ /** File size in bytes */
84
+ size: number;
85
+ /** True if this is a regular file */
86
+ isFile: boolean;
87
+ /** True if this is a directory */
88
+ isDirectory: boolean;
89
+ /** Date when the file was last modified */
90
+ modifiedAt: Date;
91
+ /** Date when the file was created */
92
+ createdAt: Date;
93
+ }
94
+ /**
95
+ * Get file or directory statistics.
96
+ */
97
+ export declare function stat(path: string): Promise<FileStats>;
98
+ /**
99
+ * Copy a file or directory to a new location.
100
+ */
101
+ export declare function copy(src: string, dest: string): Promise<void>;
102
+ /**
103
+ * Move or rename a file or directory.
104
+ */
105
+ export declare function move(src: string, dest: string): Promise<void>;
106
+ /**
107
+ * Watch options. `recursive` recurses into subdirectories — supported by
108
+ * the Craft bridge always, by Node.js's `fs.watch` only on macOS/Windows.
109
+ * Linux falls back to a non-recursive watch and logs a one-time warning.
110
+ */
111
+ export interface WatchOptions {
112
+ recursive?: boolean;
113
+ }
114
+ /**
115
+ * Test-only: clear the once-per-process recursive-watch warning flag so
116
+ * tests that exercise the warning path can do so deterministically.
117
+ */
118
+ export declare function _resetWatchWarningForTests(): void;
119
+ /**
120
+ * Watch a file or directory for changes.
121
+ *
122
+ * Returns a Promise that resolves with an unwatch function once the watcher
123
+ * is fully initialized.
124
+ *
125
+ * Important: the returned unwatch function MUST be called when the watcher
126
+ * is no longer needed. Forgotten watchers leak both the underlying OS handle
127
+ * and the JS-side event listener.
128
+ */
129
+ export declare function watch(path: string, callback: (event: string, filename: string) => void, options?: WatchOptions): Promise<() => void>;
130
+ export default fs;
131
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/api/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAwBlD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAsC9D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQvD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAQxD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,EAAE,EAAE,kBAkFhB,CAAA;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAWtE;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAYnF;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAA;IACf,kCAAkC;IAClC,WAAW,EAAE,OAAO,CAAA;IACpB,2CAA2C;IAC3C,UAAU,EAAE,IAAI,CAAA;IAChB,qCAAqC;IACrC,SAAS,EAAE,IAAI,CAAA;CAChB;AAED;;GAEG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CA2B3D;AAED;;GAEG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnE;AAED;;GAEG;AACH,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASnE;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAID;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,EACnD,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,MAAM,IAAI,CAAC,CA0CrB;AAED,eAAe,EAAE,CAAA"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Craft HTTP Client API
3
+ * Provides native HTTP client through the Craft bridge
4
+ * Bypasses CORS restrictions when running in Craft
5
+ */
6
+ import type { CraftHttpAPI } from '../types';
7
+ /**
8
+ * Result of {@link encodeRequestBody}. `kind` lets the caller decide
9
+ * whether to default a `Content-Type: application/json` header.
10
+ */
11
+ type EncodedBody = {
12
+ kind: 'none';
13
+ value: undefined;
14
+ } | {
15
+ kind: 'string';
16
+ value: string;
17
+ } | {
18
+ kind: 'binary';
19
+ value: BodyInit;
20
+ } | {
21
+ kind: 'form';
22
+ value: BodyInit;
23
+ } | {
24
+ kind: 'json';
25
+ value: string;
26
+ };
27
+ /**
28
+ * Translate a user-supplied body into something `fetch()` knows how to
29
+ * send, without losing fidelity. The previous implementation collapsed
30
+ * everything object-shaped through `JSON.stringify`, which produced
31
+ * `"[object FormData]"` for FormData/URLSearchParams/Blob/Uint8Array.
32
+ *
33
+ * The mapping:
34
+ * - `undefined` / `null` → `{ kind: 'none' }`
35
+ * - `string` → `{ kind: 'string' }` (no auto C-T)
36
+ * - `ArrayBuffer` / TypedArray → `{ kind: 'binary' }`
37
+ * - `Blob` / `File` → `{ kind: 'binary' }` (preserves type)
38
+ * - `FormData` → `{ kind: 'form' }` (browser sets boundary)
39
+ * - `URLSearchParams` → `{ kind: 'form' }` (forces x-www-form-urlencoded)
40
+ * - `ReadableStream` → `{ kind: 'binary' }`
41
+ * - everything else → JSON.stringify
42
+ */
43
+ export declare function encodeRequestBody(body: unknown): EncodedBody;
44
+ /**
45
+ * Case-insensitive lookup against an HTTP header object. Returns true when
46
+ * any key with the same lowercased name is present. Does NOT use the
47
+ * `Headers` global directly because callers pass plain objects.
48
+ */
49
+ export declare function hasHeader(headers: Record<string, string>, name: string): boolean;
50
+ /**
51
+ * HTTP API implementation
52
+ * Uses native HTTP client through the Craft bridge
53
+ */
54
+ export declare const http: CraftHttpAPI;
55
+ /**
56
+ * Extended HTTP client with additional features
57
+ */
58
+ export declare class HttpClient {
59
+ private baseUrl;
60
+ private defaultHeaders;
61
+ private timeout;
62
+ constructor(options?: HttpClientOptions);
63
+ /**
64
+ * Make GET request
65
+ */
66
+ get<T = unknown>(path: string, options?: RequestOptions): Promise<HttpResponse<T>>;
67
+ /**
68
+ * Make POST request
69
+ */
70
+ post<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse<T>>;
71
+ /**
72
+ * Make PUT request
73
+ */
74
+ put<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse<T>>;
75
+ /**
76
+ * Make PATCH request
77
+ */
78
+ patch<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<HttpResponse<T>>;
79
+ /**
80
+ * Make DELETE request
81
+ */
82
+ delete<T = unknown>(path: string, options?: RequestOptions): Promise<HttpResponse<T>>;
83
+ /**
84
+ * Make HEAD request
85
+ */
86
+ head(path: string, options?: RequestOptions): Promise<HttpResponse<void>>;
87
+ /**
88
+ * General request method
89
+ */
90
+ private request;
91
+ /**
92
+ * Build URL with query parameters
93
+ */
94
+ private buildUrl;
95
+ /**
96
+ * Set default header
97
+ */
98
+ setHeader(key: string, value: string): void;
99
+ /**
100
+ * Remove default header
101
+ */
102
+ removeHeader(key: string): void;
103
+ /**
104
+ * Set bearer token
105
+ */
106
+ setBearerToken(token: string): void;
107
+ }
108
+ /**
109
+ * HTTP client options
110
+ */
111
+ export interface HttpClientOptions {
112
+ baseUrl?: string;
113
+ headers?: Record<string, string>;
114
+ timeout?: number;
115
+ }
116
+ /**
117
+ * Request options
118
+ */
119
+ export interface RequestOptions {
120
+ headers?: Record<string, string>;
121
+ params?: Record<string, string | number | boolean>;
122
+ body?: unknown;
123
+ timeout?: number;
124
+ }
125
+ /**
126
+ * HTTP response
127
+ */
128
+ export interface HttpResponse<T> {
129
+ data: T;
130
+ status: number;
131
+ statusText: string;
132
+ headers: Record<string, string>;
133
+ ok: boolean;
134
+ }
135
+ /**
136
+ * HTTP error class
137
+ */
138
+ export declare class HttpError extends Error {
139
+ status: number;
140
+ code: string;
141
+ constructor(message: string, status: number, code?: string);
142
+ }
143
+ /**
144
+ * WebSocket client wrapper
145
+ */
146
+ export declare class WebSocketClient {
147
+ private ws;
148
+ private url;
149
+ private reconnectAttempts;
150
+ private maxReconnectAttempts;
151
+ private reconnectDelay;
152
+ private handlers;
153
+ private messageHandler;
154
+ constructor(url: string, options?: WebSocketOptions);
155
+ /**
156
+ * Connect to WebSocket server
157
+ */
158
+ connect(): Promise<void>;
159
+ /**
160
+ * Disconnect from WebSocket server
161
+ */
162
+ disconnect(): void;
163
+ /**
164
+ * Send message
165
+ */
166
+ send(type: string, payload?: unknown): void;
167
+ /**
168
+ * Send raw data
169
+ */
170
+ sendRaw(data: string | ArrayBuffer): void;
171
+ /**
172
+ * Subscribe to message type
173
+ */
174
+ on(type: string, handler: (data: unknown) => void): () => void;
175
+ /**
176
+ * Attempt to reconnect
177
+ */
178
+ private attemptReconnect;
179
+ /**
180
+ * Check if connected
181
+ */
182
+ get connected(): boolean;
183
+ }
184
+ /**
185
+ * WebSocket options
186
+ */
187
+ export interface WebSocketOptions {
188
+ maxReconnectAttempts?: number;
189
+ reconnectDelay?: number;
190
+ }
191
+ /**
192
+ * Create a pre-configured HTTP client
193
+ */
194
+ export declare function createClient(options?: HttpClientOptions): HttpClient;
195
+ export default http;
196
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C;;;GAGG;AACH,KAAK,WAAW,GACZ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,CAgC5D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMhF;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,YA4DlB,CAAA;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,OAAO,CAAQ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IAMvD;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAuCxB;;OAEG;IACH,UAAU,IAAI,IAAI;IAQlB;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAO3C;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAOzC;;OAEG;IACH,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;IAW9D;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAexB;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,UAAU,CAEpE;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Craft API Modules
3
+ * Native APIs available in Craft applications
4
+ */
5
+ export { windowManager, win, window, createWindow, Window } from './window';
6
+ export type { WindowPosition, WindowSize, WindowBounds, WindowState, WindowCreateOptions, WindowEventType, WindowEventMap, WindowEventHandler } from './window';
7
+ export { trayManager, tray, SystemTray, MenubarApp, createMenubarApp, buildMenu, separator, menuItem, checkbox, submenu } from './tray';
8
+ export type { MenuItem, TrayClickEvent, TrayOptions, MenubarAppConfig, TrayEventType, TrayEventMap, TrayEventHandler } from './tray';
9
+ export { appManager, app, quit, hide, show, focus, hideDockIcon, showDockIcon, setBadge, getInfo, getVersion, getName, getPath, isDarkMode, getLocale, notify, registerShortcut, unregisterShortcut } from './app';
10
+ export type { AppInfo, SystemPreferences, DisplayInfo, BadgeOptions, NotificationOptions, AppEventType, AppEventMap, AppEventHandler, ShortcutHandler } from './app';
11
+ export { fs, readBinaryFile, writeBinaryFile, stat, copy, move, watch } from './fs';
12
+ export type { FileStats } from './fs';
13
+ export { db, openDatabase, Database, KeyValueStore } from './db';
14
+ export type { ExecuteResult, TableColumn } from './db';
15
+ export { http, HttpClient, WebSocketClient, createClient, HttpError } from './http';
16
+ export type { HttpClientOptions, RequestOptions, HttpResponse, WebSocketOptions } from './http';
17
+ export { crypto, uuid, randomString, hmac, timingSafeEqual, hashPassword, verifyPassword } from './crypto';
18
+ export { env, getPlatform, isDesktop, isMobile, isCraft, getSystemInfo, exec, spawn, ChildProcess, cwd, homeDir, tempDir, exit, argv, open } from './process';
19
+ export type { Platform, SystemInfo, ExecOptions, ExecResult, SpawnOptions } from './process';
20
+ export { device, haptics, permissions, camera, biometrics, secureStorage, location, share, lifecycle, notifications, notifications as notification } from './mobile';
21
+ export type { DeviceInfo, DeviceCapabilities, HapticStyle, HapticNotificationType, PermissionType, PermissionStatus, CameraOptions as MobileCameraOptions, PhotoResult, BiometricType, Location, LocationOptions, ShareOptions, AppState, NotificationOptions as MobileNotificationOptions } from './mobile';
22
+ export { carplay, appClips, liveActivities, sharePlay, storeKit, appIntents, tipKit, focusFilters } from './ios-advanced';
23
+ export type { CarPlayTemplateType, CarPlayListItem, CarPlayGridItem, CarPlayTemplate, AppClipInvocation, LiveActivityContentState, LiveActivityAttributes, LiveActivityConfig, SharePlaySessionState, SharePlayParticipant, SharePlayActivity, ProductType, Product, Transaction, IntentParameterType, IntentParameter, AppIntent, TipDisplayFrequency, Tip, FocusStatus, FocusFilter } from './ios-advanced';
24
+ export { materialYou, photoPicker, workManager, foregroundService, predictiveBack, appLanguage, widgets as androidWidgets, playBilling } from './android-advanced';
25
+ export type { MaterialYouColors, PhotoPickerMediaType, PhotoPickerResult, WorkConstraints, WorkRequest, WorkInfo, ForegroundServiceType, ForegroundNotification, BackEvent, WidgetSizeClass, WidgetConfig, WidgetData, PlayProduct, PlayPurchase } from './android-advanced';
26
+ export { touchBar, desktopWidgets, stageManager, handoff, sidecar, spotlight, quickActions, shareExtension, windowManagement } from './macos-advanced';
27
+ export type { TouchBarItemType, TouchBarButton, TouchBarLabel, TouchBarSlider, TouchBarColorPicker, TouchBarScrubber, TouchBarSegmentedControl, TouchBarPopover, TouchBarSpacer, TouchBarGroup, TouchBarItem, WidgetFamily, WidgetTimelineEntry, WidgetConfiguration, UserActivity, SidecarDevice, SpotlightItem, QuickAction, WindowTabGroup } from './macos-advanced';
28
+ export { jumpList, taskbarProgress, toastNotifications, windowsHello, windowsWidgets, msixUpdate, shareTarget, startupTask, secondaryTiles } from './windows-advanced';
29
+ export type { JumpListTask, JumpListCategory, TaskbarProgressState, ToastAction, ToastInput, ToastContent, WindowsHelloAvailability, WidgetTemplateType, WindowsWidgetContent, PackageVersion, UpdateInfo, SharedDataItem, SecondaryTile } from './windows-advanced';
30
+ export { dialog, openFile, openFolder, saveFile, showAlert, showConfirm, showPrompt } from './dialog';
31
+ export type { FileFilter, OpenDialogOptions, SaveDialogOptions, AlertStyle, AlertOptions, ConfirmOptions, OpenDialogResult, SaveDialogResult } from './dialog';
32
+ export { clipboard, writeText, readText, writeHTML, readHTML } from './clipboard';
33
+ export type { ClipboardFormat, ClipboardData } from './clipboard';
34
+ export { media } from './media';
35
+ export type { MediaDeviceInfo, CameraOptions as MediaCameraOptions, MicrophoneOptions, MediaStreamOptions } from './media';
36
+ export { Sidebar, createSidebar, createFileSidebar, createSettingsSidebar, sidebar } from './sidebar';
37
+ export type { SidebarItem, SidebarSection, SidebarConfig, MacOSSidebarConfig, WindowsSidebarConfig, LinuxSidebarConfig, SidebarSelectEvent, SidebarSearchEvent } from './sidebar';
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,aAAa,EACb,GAAG,EACH,MAAM,EACN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