voltkit 0.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.
Files changed (117) hide show
  1. package/dist/app.d.ts +61 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/app.js +98 -0
  4. package/dist/app.js.map +1 -0
  5. package/dist/clipboard.d.ts +38 -0
  6. package/dist/clipboard.d.ts.map +1 -0
  7. package/dist/clipboard.js +64 -0
  8. package/dist/clipboard.js.map +1 -0
  9. package/dist/dialog.d.ts +95 -0
  10. package/dist/dialog.d.ts.map +1 -0
  11. package/dist/dialog.js +70 -0
  12. package/dist/dialog.js.map +1 -0
  13. package/dist/fs.d.ts +62 -0
  14. package/dist/fs.d.ts.map +1 -0
  15. package/dist/fs.js +110 -0
  16. package/dist/fs.js.map +1 -0
  17. package/dist/globalShortcut.d.ts +32 -0
  18. package/dist/globalShortcut.d.ts.map +1 -0
  19. package/dist/globalShortcut.js +103 -0
  20. package/dist/globalShortcut.js.map +1 -0
  21. package/dist/index.d.ts +26 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +16 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/internal.d.ts +6 -0
  26. package/dist/internal.d.ts.map +1 -0
  27. package/dist/internal.js +6 -0
  28. package/dist/internal.js.map +1 -0
  29. package/dist/ipc-contract/aliases.d.ts +4 -0
  30. package/dist/ipc-contract/aliases.d.ts.map +1 -0
  31. package/dist/ipc-contract/aliases.js +38 -0
  32. package/dist/ipc-contract/aliases.js.map +1 -0
  33. package/dist/ipc-contract/define.d.ts +3 -0
  34. package/dist/ipc-contract/define.d.ts.map +1 -0
  35. package/dist/ipc-contract/define.js +7 -0
  36. package/dist/ipc-contract/define.js.map +1 -0
  37. package/dist/ipc-contract/handlers.d.ts +3 -0
  38. package/dist/ipc-contract/handlers.d.ts.map +1 -0
  39. package/dist/ipc-contract/handlers.js +26 -0
  40. package/dist/ipc-contract/handlers.js.map +1 -0
  41. package/dist/ipc-contract/invoker.d.ts +4 -0
  42. package/dist/ipc-contract/invoker.d.ts.map +1 -0
  43. package/dist/ipc-contract/invoker.js +32 -0
  44. package/dist/ipc-contract/invoker.js.map +1 -0
  45. package/dist/ipc-contract/schema.d.ts +17 -0
  46. package/dist/ipc-contract/schema.d.ts.map +1 -0
  47. package/dist/ipc-contract/schema.js +78 -0
  48. package/dist/ipc-contract/schema.js.map +1 -0
  49. package/dist/ipc-contract/types.d.ts +45 -0
  50. package/dist/ipc-contract/types.d.ts.map +1 -0
  51. package/dist/ipc-contract/types.js +17 -0
  52. package/dist/ipc-contract/types.js.map +1 -0
  53. package/dist/ipc-contract/validation.d.ts +4 -0
  54. package/dist/ipc-contract/validation.d.ts.map +1 -0
  55. package/dist/ipc-contract/validation.js +24 -0
  56. package/dist/ipc-contract/validation.js.map +1 -0
  57. package/dist/ipc-contract.d.ts +25 -0
  58. package/dist/ipc-contract.d.ts.map +1 -0
  59. package/dist/ipc-contract.js +9 -0
  60. package/dist/ipc-contract.js.map +1 -0
  61. package/dist/ipc.d.ts +85 -0
  62. package/dist/ipc.d.ts.map +1 -0
  63. package/dist/ipc.js +196 -0
  64. package/dist/ipc.js.map +1 -0
  65. package/dist/menu.d.ts +72 -0
  66. package/dist/menu.d.ts.map +1 -0
  67. package/dist/menu.js +179 -0
  68. package/dist/menu.js.map +1 -0
  69. package/dist/notification.d.ts +34 -0
  70. package/dist/notification.d.ts.map +1 -0
  71. package/dist/notification.js +42 -0
  72. package/dist/notification.js.map +1 -0
  73. package/dist/renderer.d.ts +9 -0
  74. package/dist/renderer.d.ts.map +1 -0
  75. package/dist/renderer.js +7 -0
  76. package/dist/renderer.js.map +1 -0
  77. package/dist/runtime-modules.d.ts +161 -0
  78. package/dist/runtime-modules.d.ts.map +1 -0
  79. package/dist/runtime-modules.js +2 -0
  80. package/dist/runtime-modules.js.map +1 -0
  81. package/dist/shell.d.ts +22 -0
  82. package/dist/shell.d.ts.map +1 -0
  83. package/dist/shell.js +36 -0
  84. package/dist/shell.js.map +1 -0
  85. package/dist/tray.d.ts +59 -0
  86. package/dist/tray.d.ts.map +1 -0
  87. package/dist/tray.js +114 -0
  88. package/dist/tray.js.map +1 -0
  89. package/dist/types.d.ts +200 -0
  90. package/dist/types.d.ts.map +1 -0
  91. package/dist/types.js +5 -0
  92. package/dist/types.js.map +1 -0
  93. package/dist/updater.d.ts +61 -0
  94. package/dist/updater.d.ts.map +1 -0
  95. package/dist/updater.js +128 -0
  96. package/dist/updater.js.map +1 -0
  97. package/dist/window/browser-window.d.ts +41 -0
  98. package/dist/window/browser-window.d.ts.map +1 -0
  99. package/dist/window/browser-window.js +219 -0
  100. package/dist/window/browser-window.js.map +1 -0
  101. package/dist/window/native-bridge.d.ts +13 -0
  102. package/dist/window/native-bridge.d.ts.map +1 -0
  103. package/dist/window/native-bridge.js +44 -0
  104. package/dist/window/native-bridge.js.map +1 -0
  105. package/dist/window/registry.d.ts +9 -0
  106. package/dist/window/registry.d.ts.map +1 -0
  107. package/dist/window/registry.js +32 -0
  108. package/dist/window/registry.js.map +1 -0
  109. package/dist/window/types.d.ts +23 -0
  110. package/dist/window/types.d.ts.map +1 -0
  111. package/dist/window/types.js +2 -0
  112. package/dist/window/types.js.map +1 -0
  113. package/dist/window.d.ts +3 -0
  114. package/dist/window.d.ts.map +1 -0
  115. package/dist/window.js +2 -0
  116. package/dist/window.js.map +1 -0
  117. package/package.json +51 -0
package/dist/app.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import type { VoltConfig } from './types.js';
3
+ /** Events emitted by the VoltApp. */
4
+ export interface AppEvents {
5
+ ready: [];
6
+ 'window-all-closed': [];
7
+ 'before-quit': [];
8
+ quit: [];
9
+ }
10
+ /**
11
+ * Main application class managing the lifecycle of a Volt desktop app.
12
+ * Follows Electron's `app` event pattern for familiar DX.
13
+ */
14
+ export declare class VoltApp extends EventEmitter {
15
+ private config;
16
+ private isReady;
17
+ private nativeApp;
18
+ constructor(config: VoltConfig);
19
+ /** Get the application name. */
20
+ getName(): string;
21
+ /** Get the application version. */
22
+ getVersion(): string;
23
+ /** Check if the app has finished initializing. */
24
+ get ready(): boolean;
25
+ /** Get the full application config. */
26
+ getConfig(): VoltConfig;
27
+ /**
28
+ * Get the native app instance. Used internally by BrowserWindow and other APIs.
29
+ * @internal
30
+ */
31
+ getNativeApp(): unknown;
32
+ /**
33
+ * Set the native app instance. Called by the CLI when initializing the native layer.
34
+ * @internal
35
+ */
36
+ setNativeApp(native: unknown): void;
37
+ /**
38
+ * Mark the app as ready and emit the 'ready' event.
39
+ * Called internally after native initialization completes.
40
+ * @internal
41
+ */
42
+ markReady(): void;
43
+ /**
44
+ * Request the application to quit.
45
+ */
46
+ quit(): void;
47
+ /**
48
+ * Convenience method: returns a promise that resolves when the app is ready.
49
+ */
50
+ whenReady(): Promise<void>;
51
+ }
52
+ /** Get or create the global VoltApp instance. */
53
+ export declare function getApp(): VoltApp;
54
+ /** Create and return the global VoltApp instance. */
55
+ export declare function createApp(config: VoltConfig): VoltApp;
56
+ /**
57
+ * Reset the app instance (used for testing).
58
+ * @internal
59
+ */
60
+ export declare function resetApp(): void;
61
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,EAAE,CAAC;IACV,mBAAmB,EAAE,EAAE,CAAC;IACxB,aAAa,EAAE,EAAE,CAAC;IAClB,IAAI,EAAE,EAAE,CAAC;CACV;AAED;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,YAAY;IACvC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAiB;gBAEtB,MAAM,EAAE,UAAU;IAK9B,gCAAgC;IAChC,OAAO,IAAI,MAAM;IAIjB,mCAAmC;IACnC,UAAU,IAAI,MAAM;IAIpB,kDAAkD;IAClD,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,uCAAuC;IACvC,SAAS,IAAI,UAAU;IAIvB;;;OAGG;IACH,YAAY,IAAI,OAAO;IAIvB;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAInC;;;;OAIG;IACH,SAAS,IAAI,IAAI;IAOjB;;OAEG;IACH,IAAI,IAAI,IAAI;IAKZ;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ3B;AAKD,iDAAiD;AACjD,wBAAgB,MAAM,IAAI,OAAO,CAOhC;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAMrD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,IAAI,CAE/B"}
package/dist/app.js ADDED
@@ -0,0 +1,98 @@
1
+ import { EventEmitter } from 'node:events';
2
+ /**
3
+ * Main application class managing the lifecycle of a Volt desktop app.
4
+ * Follows Electron's `app` event pattern for familiar DX.
5
+ */
6
+ export class VoltApp extends EventEmitter {
7
+ config;
8
+ isReady = false;
9
+ nativeApp = null;
10
+ constructor(config) {
11
+ super();
12
+ this.config = config;
13
+ }
14
+ /** Get the application name. */
15
+ getName() {
16
+ return this.config.name;
17
+ }
18
+ /** Get the application version. */
19
+ getVersion() {
20
+ return this.config.version ?? '0.0.0';
21
+ }
22
+ /** Check if the app has finished initializing. */
23
+ get ready() {
24
+ return this.isReady;
25
+ }
26
+ /** Get the full application config. */
27
+ getConfig() {
28
+ return structuredClone(this.config);
29
+ }
30
+ /**
31
+ * Get the native app instance. Used internally by BrowserWindow and other APIs.
32
+ * @internal
33
+ */
34
+ getNativeApp() {
35
+ return this.nativeApp;
36
+ }
37
+ /**
38
+ * Set the native app instance. Called by the CLI when initializing the native layer.
39
+ * @internal
40
+ */
41
+ setNativeApp(native) {
42
+ this.nativeApp = native;
43
+ }
44
+ /**
45
+ * Mark the app as ready and emit the 'ready' event.
46
+ * Called internally after native initialization completes.
47
+ * @internal
48
+ */
49
+ markReady() {
50
+ if (!this.isReady) {
51
+ this.isReady = true;
52
+ this.emit('ready');
53
+ }
54
+ }
55
+ /**
56
+ * Request the application to quit.
57
+ */
58
+ quit() {
59
+ this.emit('before-quit');
60
+ this.emit('quit');
61
+ }
62
+ /**
63
+ * Convenience method: returns a promise that resolves when the app is ready.
64
+ */
65
+ whenReady() {
66
+ if (this.isReady) {
67
+ return Promise.resolve();
68
+ }
69
+ return new Promise((resolve) => {
70
+ this.once('ready', resolve);
71
+ });
72
+ }
73
+ }
74
+ /** Singleton application instance. */
75
+ let appInstance = null;
76
+ /** Get or create the global VoltApp instance. */
77
+ export function getApp() {
78
+ if (!appInstance) {
79
+ throw new Error('VoltApp not initialized. Call createApp(config) first.');
80
+ }
81
+ return appInstance;
82
+ }
83
+ /** Create and return the global VoltApp instance. */
84
+ export function createApp(config) {
85
+ if (appInstance) {
86
+ throw new Error('VoltApp already initialized. Only one app instance is allowed.');
87
+ }
88
+ appInstance = new VoltApp(config);
89
+ return appInstance;
90
+ }
91
+ /**
92
+ * Reset the app instance (used for testing).
93
+ * @internal
94
+ */
95
+ export function resetApp() {
96
+ appInstance = null;
97
+ }
98
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAW3C;;;GAGG;AACH,MAAM,OAAO,OAAQ,SAAQ,YAAY;IAC/B,MAAM,CAAa;IACnB,OAAO,GAAG,KAAK,CAAC;IAChB,SAAS,GAAY,IAAI,CAAC;IAElC,YAAY,MAAkB;QAC5B,KAAK,EAAE,CAAC;QACR,IAAI,C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M;IACpB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,wDAAwD,CACzD,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,SAAS,CAAC,MAAkB;IAC1C,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IACD,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ;IACtB,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Clipboard module.
3
+ * Provides read/write access to the system clipboard.
4
+ * Requires `permissions: ['clipboard']` in volt.config.ts.
5
+ */
6
+ /** Image data from the clipboard. */
7
+ export interface ClipboardImage {
8
+ /** RGBA pixel bytes. */
9
+ rgba: Uint8Array;
10
+ /** Image width in pixels. */
11
+ width: number;
12
+ /** Image height in pixels. */
13
+ height: number;
14
+ }
15
+ /**
16
+ * Read text from the system clipboard.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const text = clipboard.readText();
21
+ * ```
22
+ */
23
+ declare function readText(): string;
24
+ /** Write text to the system clipboard. */
25
+ declare function writeText(text: string): void;
26
+ /** Read an image from the system clipboard. Returns null if no image. */
27
+ declare function readImage(): ClipboardImage | null;
28
+ /** Write an image to the system clipboard. */
29
+ declare function writeImage(image: ClipboardImage): void;
30
+ /** Clipboard APIs. Requires `permissions: ['clipboard']` in volt.config.ts. */
31
+ export declare const clipboard: {
32
+ readText: typeof readText;
33
+ writeText: typeof writeText;
34
+ readImage: typeof readImage;
35
+ writeImage: typeof writeImage;
36
+ };
37
+ export {};
38
+ //# sourceMappingURL=clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,iBAAS,QAAQ,IAAI,MAAM,CAE1B;AAED,0CAA0C;AAC1C,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAErC;AAED,yEAAyE;AACzE,iBAAS,SAAS,IAAI,cAAc,GAAG,IAAI,CAc1C;AAED,8CAA8C;AAC9C,iBAAS,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAM/C;AAaD,+EAA+E;AAC/E,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Clipboard module.
3
+ * Provides read/write access to the system clipboard.
4
+ * Requires `permissions: ['clipboard']` in volt.config.ts.
5
+ */
6
+ import { clipboardReadText, clipboardWriteText, clipboardReadImage, clipboardWriteImage, } from '@voltkit/volt-native';
7
+ /**
8
+ * Read text from the system clipboard.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const text = clipboard.readText();
13
+ * ```
14
+ */
15
+ function readText() {
16
+ return clipboardReadText();
17
+ }
18
+ /** Write text to the system clipboard. */
19
+ function writeText(text) {
20
+ clipboardWriteText(text);
21
+ }
22
+ /** Read an image from the system clipboard. Returns null if no image. */
23
+ function readImage() {
24
+ try {
25
+ const img = clipboardReadImage();
26
+ return {
27
+ rgba: new Uint8Array(img.rgba),
28
+ width: img.width,
29
+ height: img.height,
30
+ };
31
+ }
32
+ catch (err) {
33
+ if (isNoImageError(err)) {
34
+ return null;
35
+ }
36
+ throw err;
37
+ }
38
+ }
39
+ /** Write an image to the system clipboard. */
40
+ function writeImage(image) {
41
+ clipboardWriteImage({
42
+ rgba: Buffer.from(image.rgba),
43
+ width: image.width,
44
+ height: image.height,
45
+ });
46
+ }
47
+ function isNoImageError(err) {
48
+ if (!(err instanceof Error)) {
49
+ return false;
50
+ }
51
+ const message = err.message.toLowerCase();
52
+ return message.includes('no image')
53
+ || message.includes('content not available')
54
+ || message.includes('contentnotavailable')
55
+ || message.includes('clipboard is empty');
56
+ }
57
+ /** Clipboard APIs. Requires `permissions: ['clipboard']` in volt.config.ts. */
58
+ export const clipboard = {
59
+ readText,
60
+ writeText,
61
+ readImage,
62
+ writeImage,
63
+ };
64
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAY9B;;;;;;;GAOG;AACH,SAAS,QAAQ;IACf,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC;AAED,0CAA0C;AAC1C,SAAS,SAAS,CAAC,IAAY;IAC7B,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,yEAAyE;AACzE,SAAS,SAAS;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;QACjC,OAAO;YACL,IAAI,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;YAC9B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,8CAA8C;AAC9C,SAAS,UAAU,CAAC,KAAqB;IACvC,mBAAmB,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAC7B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC1C,OAAO,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;WAC9B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC;WACzC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC;WACvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAC9C,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;CACX,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Native dialog module.
3
+ * Provides file open/save dialogs and message boxes.
4
+ * API methods return Promises for compatibility, but underlying native calls are synchronous
5
+ * and block until the OS dialog closes.
6
+ * Requires `permissions: ['dialog']` in volt.config.ts.
7
+ */
8
+ /** File type filter for open/save dialogs. */
9
+ export interface FileFilter {
10
+ /** Display name for this filter (e.g., 'Images'). */
11
+ name: string;
12
+ /** File extensions without dots (e.g., ['png', 'jpg']). */
13
+ extensions: string[];
14
+ }
15
+ /** Options for the open file dialog. */
16
+ export interface OpenDialogOptions {
17
+ /** Dialog window title. */
18
+ title?: string;
19
+ /** Default starting directory. */
20
+ defaultPath?: string;
21
+ /** File type filters. */
22
+ filters?: FileFilter[];
23
+ /** Allow selecting multiple files. Default: false. */
24
+ multiSelections?: boolean;
25
+ /** Allow selecting directories instead of files. Default: false. */
26
+ directory?: boolean;
27
+ }
28
+ /** Result from showOpenDialog. */
29
+ export interface OpenDialogResult {
30
+ /** Whether the dialog was cancelled. */
31
+ canceled: boolean;
32
+ /** Selected file paths (empty if cancelled). */
33
+ filePaths: string[];
34
+ }
35
+ /** Options for the save file dialog. */
36
+ export interface SaveDialogOptions {
37
+ /** Dialog window title. */
38
+ title?: string;
39
+ /** Default file path/name. */
40
+ defaultPath?: string;
41
+ /** File type filters. */
42
+ filters?: FileFilter[];
43
+ }
44
+ /** Result from showSaveDialog. */
45
+ export interface SaveDialogResult {
46
+ /** Whether the dialog was cancelled. */
47
+ canceled: boolean;
48
+ /** Selected file path (empty string if cancelled). */
49
+ filePath: string;
50
+ }
51
+ /** Options for message box dialogs. */
52
+ export interface MessageBoxOptions {
53
+ /** Message box type. Default: 'info'. */
54
+ type?: 'info' | 'warning' | 'error';
55
+ /** Dialog title. */
56
+ title?: string;
57
+ /** Dialog message. */
58
+ message: string;
59
+ /** Button labels. */
60
+ buttons?: string[];
61
+ }
62
+ /** Result from showMessageBox. */
63
+ export interface MessageBoxResult {
64
+ /** Whether the user confirmed (clicked OK/Yes). */
65
+ confirmed: boolean;
66
+ }
67
+ /**
68
+ * Show a native open file dialog.
69
+ * Electron-compatible API.
70
+ * Note: this call blocks the current thread in native code.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const result = await dialog.showOpenDialog({
75
+ * title: 'Select Image',
76
+ * filters: [{ name: 'Images', extensions: ['png', 'jpg'] }],
77
+ * });
78
+ * if (!result.canceled) {
79
+ * console.log(result.filePaths);
80
+ * }
81
+ * ```
82
+ */
83
+ declare function showOpenDialog(options?: OpenDialogOptions): Promise<OpenDialogResult>;
84
+ /** Show a native save file dialog. Note: this call blocks the current thread in native code. */
85
+ declare function showSaveDialog(options?: SaveDialogOptions): Promise<SaveDialogResult>;
86
+ /** Show a native message box dialog. Note: this call blocks the current thread in native code. */
87
+ declare function showMessageBox(options: MessageBoxOptions): Promise<MessageBoxResult>;
88
+ /** Native dialog APIs. Requires `permissions: ['dialog']` in volt.config.ts. */
89
+ export declare const dialog: {
90
+ showOpenDialog: typeof showOpenDialog;
91
+ showSaveDialog: typeof showSaveDialog;
92
+ showMessageBox: typeof showMessageBox;
93
+ };
94
+ export {};
95
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../src/dialog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;CACxB;AAED,kCAAkC;AAClC,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACpC,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,kCAAkC;AAClC,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,iBAAe,cAAc,CAC3B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAe3B;AAED,gGAAgG;AAChG,iBAAe,cAAc,CAC3B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED,kGAAkG;AAClG,iBAAe,cAAc,CAC3B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAU3B;AAED,gFAAgF;AAChF,eAAO,MAAM,MAAM;;;;CAIlB,CAAC"}
package/dist/dialog.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Native dialog module.
3
+ * Provides file open/save dialogs and message boxes.
4
+ * API methods return Promises for compatibility, but underlying native calls are synchronous
5
+ * and block until the OS dialog closes.
6
+ * Requires `permissions: ['dialog']` in volt.config.ts.
7
+ */
8
+ import { dialogShowOpen, dialogShowSave, dialogShowMessage, } from '@voltkit/volt-native';
9
+ /**
10
+ * Show a native open file dialog.
11
+ * Electron-compatible API.
12
+ * Note: this call blocks the current thread in native code.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const result = await dialog.showOpenDialog({
17
+ * title: 'Select Image',
18
+ * filters: [{ name: 'Images', extensions: ['png', 'jpg'] }],
19
+ * });
20
+ * if (!result.canceled) {
21
+ * console.log(result.filePaths);
22
+ * }
23
+ * ```
24
+ */
25
+ async function showOpenDialog(options = {}) {
26
+ // Map camelCase TS options to snake_case for Rust serde
27
+ const nativeOpts = {
28
+ title: options.title,
29
+ default_path: options.defaultPath,
30
+ filters: options.filters,
31
+ multiple: options.multiSelections ?? false,
32
+ directory: options.directory ?? false,
33
+ };
34
+ const filePaths = dialogShowOpen(nativeOpts);
35
+ return {
36
+ canceled: filePaths.length === 0,
37
+ filePaths,
38
+ };
39
+ }
40
+ /** Show a native save file dialog. Note: this call blocks the current thread in native code. */
41
+ async function showSaveDialog(options = {}) {
42
+ const nativeOpts = {
43
+ title: options.title,
44
+ default_path: options.defaultPath,
45
+ filters: options.filters,
46
+ };
47
+ const filePath = dialogShowSave(nativeOpts);
48
+ return {
49
+ canceled: filePath === null,
50
+ filePath: filePath ?? '',
51
+ };
52
+ }
53
+ /** Show a native message box dialog. Note: this call blocks the current thread in native code. */
54
+ async function showMessageBox(options) {
55
+ const nativeOpts = {
56
+ dialog_type: options.type ?? 'info',
57
+ title: options.title ?? '',
58
+ message: options.message,
59
+ buttons: options.buttons ?? [],
60
+ };
61
+ const confirmed = dialogShowMessage(nativeOpts);
62
+ return { confirmed };
63
+ }
64
+ /** Native dialog APIs. Requires `permissions: ['dialog']` in volt.config.ts. */
65
+ export const dialog = {
66
+ showOpenDialog,
67
+ showSaveDialog,
68
+ showMessageBox,
69
+ };
70
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../src/dialog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAIL,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAoE9B;;;;;;;;;;;;;;;GAeG;AACH,KAAK,UAAU,cAAc,CAC3B,UAA6B,EAAE;IAE/B,wDAAwD;IACxD,MAAM,UAAU,GAA4B;QAC1C,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,YAAY,EAAE,OAAO,CAAC,WAAW;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's allowed scope.
4
+ * No absolute paths are accepted from the frontend.
5
+ * API methods return Promises for compatibility, but native fs operations are synchronous
6
+ * and execute on the calling thread.
7
+ * Requires `permissions: ['fs']` in volt.config.ts.
8
+ */
9
+ /** File metadata returned by stat(). */
10
+ export interface FileInfo {
11
+ /** File size in bytes. */
12
+ size: number;
13
+ /** Whether the path is a file. */
14
+ isFile: boolean;
15
+ /** Whether the path is a directory. */
16
+ isDir: boolean;
17
+ /** Whether the file is read-only. */
18
+ readonly: boolean;
19
+ }
20
+ /**
21
+ * Set the base directory for all sandboxed file operations.
22
+ * Called internally during app initialization based on volt.config.ts scope.
23
+ * @internal
24
+ */
25
+ export declare function setBaseDir(dir: string): void;
26
+ /**
27
+ * Read a file as a UTF-8 string.
28
+ * Path must be relative to the app scope.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const content = await fs.readFile('data/config.json');
33
+ * ```
34
+ */
35
+ declare function readFile(path: string): Promise<string>;
36
+ /** Read a file as raw bytes. */
37
+ declare function readFileBinary(path: string): Promise<Uint8Array>;
38
+ /** Write a string to a file, creating it if it doesn't exist. */
39
+ declare function writeFile(path: string, data: string): Promise<void>;
40
+ /** Write raw bytes to a file. */
41
+ declare function writeFileBinary(path: string, data: Uint8Array): Promise<void>;
42
+ /** List entries in a directory. Returns an array of file/directory names. */
43
+ declare function readDir(path: string): Promise<string[]>;
44
+ /** Get metadata for a file or directory. */
45
+ declare function stat(path: string): Promise<FileInfo>;
46
+ /** Create a directory (and parent directories if needed). */
47
+ declare function mkdir(path: string): Promise<void>;
48
+ /** Remove a file or directory (directories are removed recursively by native layer). */
49
+ declare function remove(path: string): Promise<void>;
50
+ /** Sandboxed file system APIs. Requires `permissions: ['fs']` in volt.config.ts. */
51
+ export declare const fs: {
52
+ readFile: typeof readFile;
53
+ readFileBinary: typeof readFileBinary;
54
+ writeFile: typeof writeFile;
55
+ writeFileBinary: typeof writeFileBinary;
56
+ readDir: typeof readDir;
57
+ stat: typeof stat;
58
+ mkdir: typeof mkdir;
59
+ remove: typeof remove;
60
+ };
61
+ export {};
62
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,wCAAwC;AACxC,MAAM,WAAW,QAAQ;IACvB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,uCAAuC;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAQD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED;;;;;;;;GAQG;AACH,iBAAe,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGrD;AAED,gCAAgC;AAChC,iBAAe,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAI/D;AAED,iEAAiE;AACjE,iBAAe,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlE;AAED,iCAAiC;AACjC,iBAAe,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5E;AAED,6EAA6E;AAC7E,iBAAe,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGtD;AAED,4CAA4C;AAC5C,iBAAe,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CASnD;AAED,6DAA6D;AAC7D,iBAAe,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhD;AAED,wFAAwF;AACxF,iBAAe,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGjD;AA6BD,oFAAoF;AACpF,eAAO,MAAM,EAAE;;;;;;;;;CASd,CAAC"}
package/dist/fs.js ADDED
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Sandboxed file system module.
3
+ * All paths are relative to the application's allowed scope.
4
+ * No absolute paths are accepted from the frontend.
5
+ * API methods return Promises for compatibility, but native fs operations are synchronous
6
+ * and execute on the calling thread.
7
+ * Requires `permissions: ['fs']` in volt.config.ts.
8
+ */
9
+ import { fsReadFile, fsReadFileText, fsWriteFile, fsReadDir, fsStat, fsMkdir, fsRemove, } from '@voltkit/volt-native';
10
+ /**
11
+ * The base directory for sandboxed file operations.
12
+ * Defaults to process.cwd(). Set via {@link setBaseDir} during app initialization.
13
+ */
14
+ let baseDir = process.cwd();
15
+ /**
16
+ * Set the base directory for all sandboxed file operations.
17
+ * Called internally during app initialization based on volt.config.ts scope.
18
+ * @internal
19
+ */
20
+ export function setBaseDir(dir) {
21
+ baseDir = dir;
22
+ }
23
+ /**
24
+ * Read a file as a UTF-8 string.
25
+ * Path must be relative to the app scope.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const content = await fs.readFile('data/config.json');
30
+ * ```
31
+ */
32
+ async function readFile(path) {
33
+ validatePath(path);
34
+ return fsReadFileText(baseDir, path);
35
+ }
36
+ /** Read a file as raw bytes. */
37
+ async function readFileBinary(path) {
38
+ validatePath(path);
39
+ const buf = fsReadFile(baseDir, path);
40
+ return new Uint8Array(buf);
41
+ }
42
+ /** Write a string to a file, creating it if it doesn't exist. */
43
+ async function writeFile(path, data) {
44
+ validatePath(path);
45
+ fsWriteFile(baseDir, path, Buffer.from(data, 'utf-8'));
46
+ }
47
+ /** Write raw bytes to a file. */
48
+ async function writeFileBinary(path, data) {
49
+ validatePath(path);
50
+ fsWriteFile(baseDir, path, Buffer.from(data));
51
+ }
52
+ /** List entries in a directory. Returns an array of file/directory names. */
53
+ async function readDir(path) {
54
+ validatePath(path);
55
+ return fsReadDir(baseDir, path);
56
+ }
57
+ /** Get metadata for a file or directory. */
58
+ async function stat(path) {
59
+ validatePath(path);
60
+ const info = fsStat(baseDir, path);
61
+ return {
62
+ size: info.size,
63
+ isFile: info.isFile,
64
+ isDir: info.isDir,
65
+ readonly: info.readonly,
66
+ };
67
+ }
68
+ /** Create a directory (and parent directories if needed). */
69
+ async function mkdir(path) {
70
+ validatePath(path);
71
+ fsMkdir(baseDir, path);
72
+ }
73
+ /** Remove a file or directory (directories are removed recursively by native layer). */
74
+ async function remove(path) {
75
+ validatePath(path);
76
+ fsRemove(baseDir, path);
77
+ }
78
+ /**
79
+ * Validate that a path is safe (no absolute paths, no traversal).
80
+ * This is a TypeScript-side guard; the Rust side also validates.
81
+ */
82
+ function validatePath(path) {
83
+ if (path === '') {
84
+ throw new Error('Path cannot be empty.');
85
+ }
86
+ if (path.includes('\0')) {
87
+ throw new Error(`Null bytes are not allowed in paths: "${path}".`);
88
+ }
89
+ // Reject absolute paths
90
+ if (path.startsWith('/') || path.startsWith('\\') || /^[a-zA-Z]:/.test(path)) {
91
+ throw new Error(`Absolute paths are not allowed: "${path}". Use paths relative to the app scope.`);
92
+ }
93
+ // Reject path traversal by segments only.
94
+ const segments = path.split(/[\\/]+/).filter(Boolean);
95
+ if (segments.includes('..')) {
96
+ throw new Error(`Path traversal is not allowed: "${path}".`);
97
+ }
98
+ }
99
+ /** Sandboxed file system APIs. Requires `permissions: ['fs']` in volt.config.ts. */
100
+ export const fs = {
101
+ readFile,
102
+ readFileBinary,
103
+ writeFile,
104
+ writeFileBinary,
105
+ readDir,
106
+ stat,
107
+ mkdir,
108
+ remove,
109
+ };
110
+ //# sourceMappingURL=fs.js.map
package/dist/fs.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,UAAU,EACV,cAAc,EACd,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AQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,IAAI,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,oFAAoF;AACpF,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,QAAQ;IACR,cAAc;IACd,SAAS;IACT,eAAe;IACf,OAAO;IACP,IAAI;IACJ,KAAK;IACL,MAAM;CACP,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Global keyboard shortcut module.
3
+ * Provides registration of global hotkeys that work even when the app is not focused.
4
+ * Requires `permissions: ['globalShortcut']` in volt.config.ts.
5
+ */
6
+ type ShortcutCallback = () => void;
7
+ /**
8
+ * Register a global keyboard shortcut.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * globalShortcut.register('CmdOrCtrl+Shift+P', () => {
13
+ * console.log('Shortcut triggered!');
14
+ * });
15
+ * ```
16
+ */
17
+ declare function register(accelerator: string, callback: ShortcutCallback): boolean;
18
+ /** Unregister a global keyboard shortcut. */
19
+ declare function unregister(accelerator: string): void;
20
+ /** Unregister all global keyboard shortcuts. */
21
+ declare function unregisterAll(): void;
22
+ /** Check if a shortcut is registered. */
23
+ declare function isRegistered(accelerator: string): boolean;
24
+ /** Global shortcut APIs. Requires `permissions: ['globalShortcut']` in volt.config.ts. */
25
+ export declare const globalShortcut: {
26
+ register: typeof register;
27
+ unregister: typeof unregister;
28
+ unregisterAll: typeof unregisterAll;
29
+ isRegistered: typeof isRegistered;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=globalShortcut.d.ts.map