@proton-app/preload 0.0.1

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.
@@ -0,0 +1,22 @@
1
+ import type { IpcRenderer } from "electron";
2
+ type IpcClient = Pick<IpcRenderer, "send" | "invoke">;
3
+ export interface AppBridge {
4
+ minimize: () => void;
5
+ close: () => void;
6
+ choosePath: () => Promise<string | null>;
7
+ openLink: (url: string) => void;
8
+ getValue: <T>(key: string) => T;
9
+ setValue: <T>(key: string, value: T) => T;
10
+ syncAuth: (accessToken: string) => void;
11
+ }
12
+ export declare const APP_CHANNELS: {
13
+ readonly minimize: "app:minimize";
14
+ readonly close: "app:close";
15
+ readonly choosePath: "app:choose-path";
16
+ readonly openLink: "app:open-link";
17
+ readonly getValue: "app:get-value";
18
+ readonly setValue: "app:set-value";
19
+ readonly syncAuth: "app:sync-auth";
20
+ };
21
+ export declare function createAppBridge(ipc: IpcClient): AppBridge;
22
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APP_CHANNELS = void 0;
4
+ exports.createAppBridge = createAppBridge;
5
+ exports.APP_CHANNELS = {
6
+ minimize: "app:minimize",
7
+ close: "app:close",
8
+ choosePath: "app:choose-path",
9
+ openLink: "app:open-link",
10
+ getValue: "app:get-value",
11
+ setValue: "app:set-value",
12
+ syncAuth: "app:sync-auth"
13
+ };
14
+ function createAppBridge(ipc) {
15
+ return {
16
+ minimize: () => {
17
+ ipc.send(exports.APP_CHANNELS.minimize);
18
+ },
19
+ close: () => {
20
+ ipc.send(exports.APP_CHANNELS.close);
21
+ },
22
+ choosePath: () => {
23
+ return ipc.invoke(exports.APP_CHANNELS.choosePath);
24
+ },
25
+ openLink: (url) => {
26
+ ipc.send(exports.APP_CHANNELS.openLink, url);
27
+ },
28
+ getValue: (key) => {
29
+ return ipc.invoke(exports.APP_CHANNELS.getValue, key);
30
+ },
31
+ setValue: (key, value) => {
32
+ return ipc.invoke(exports.APP_CHANNELS.setValue, key, value);
33
+ },
34
+ syncAuth: (accessToken) => {
35
+ return ipc.send(exports.APP_CHANNELS.syncAuth, accessToken);
36
+ }
37
+ };
38
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+
3
+ "name": "@proton-app/preload",
4
+ "version": "0.0.1",
5
+ "description": "",
6
+ "keywords": [],
7
+ "author": "",
8
+ "license": "ISC",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "default": "./dist/index.js",
20
+ "types": "./dist/index.d.ts"
21
+ },
22
+ "./types": "./dist/index.d.ts"
23
+ },
24
+ "engines": {},
25
+
26
+ "scripts": {
27
+ "build": "tsc"
28
+ },
29
+
30
+ "dependencies": {
31
+ "path": "^0.12.7"
32
+ },
33
+
34
+ "devDependencies": {
35
+ "@types/react": "^19.2.13",
36
+ "electron": "^39.2.7",
37
+ "react-router-dom": "^7.12.0",
38
+ "typescript": "^5.9.3"
39
+ }
40
+
41
+ }