@proton-app/main 0.0.3 → 0.0.4

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,24 @@
1
+ export declare function setupAppIpc(): void;
2
+ export type IpcSchema = Record<string, Record<string, {
3
+ input?: unknown;
4
+ result: unknown;
5
+ }>>;
6
+ type Input<S extends IpcSchema, N extends keyof S, K extends keyof S[N]> = S[N][K] extends {
7
+ input: infer I;
8
+ } ? I : undefined;
9
+ type Result<S extends IpcSchema, N extends keyof S, K extends keyof S[N]> = S[N][K] extends {
10
+ result: infer R;
11
+ } ? R : never;
12
+ type Namespace<S extends IpcSchema, N extends keyof S> = {
13
+ on<K extends keyof S[N] & string>(key: K, handler: (input: Input<S, N, K>) => Result<S, N, K> | Promise<Result<S, N, K>>): void;
14
+ };
15
+ type Client<S extends IpcSchema> = {
16
+ [N in keyof S]: Namespace<S, N>;
17
+ };
18
+ export declare class IpcManager<S extends IpcSchema> {
19
+ private delimiter;
20
+ readonly ipc: Client<S>;
21
+ constructor(delimiter?: string);
22
+ private makeNamespace;
23
+ }
24
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import "./types/ipc.d.ts";
1
+ import "./ipc";
2
2
  export * from "./csp";
3
3
  export * from "./files";
4
- export * from "./ipc";
4
+ export * from "./communication";
5
5
  export * from "./window";
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /// <reference path="./types/ipc.d.ts" />
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -15,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
15
  };
17
16
  Object.defineProperty(exports, "__esModule", { value: true });
18
- require("./types/ipc.d.ts");
17
+ /// <reference path="./ipc.d.ts" />
18
+ require("./ipc");
19
19
  __exportStar(require("./csp"), exports);
20
20
  __exportStar(require("./files"), exports);
21
- __exportStar(require("./ipc"), exports);
21
+ __exportStar(require("./communication"), exports);
22
22
  __exportStar(require("./window"), exports);
package/dist/ipc.d.ts CHANGED
@@ -1,24 +1,25 @@
1
- export declare function setupAppIpc(): void;
2
- export type IpcSchema = Record<string, Record<string, {
3
- input?: unknown;
4
- result: unknown;
5
- }>>;
6
- type Input<S extends IpcSchema, N extends keyof S, K extends keyof S[N]> = S[N][K] extends {
7
- input: infer I;
8
- } ? I : undefined;
9
- type Result<S extends IpcSchema, N extends keyof S, K extends keyof S[N]> = S[N][K] extends {
10
- result: infer R;
11
- } ? R : never;
12
- type Namespace<S extends IpcSchema, N extends keyof S> = {
13
- on<K extends keyof S[N] & string>(key: K, handler: (input: Input<S, N, K>) => Result<S, N, K> | Promise<Result<S, N, K>>): void;
14
- };
15
- type Client<S extends IpcSchema> = {
16
- [N in keyof S]: Namespace<S, N>;
17
- };
18
- export declare class IpcManager<S extends IpcSchema> {
19
- private delimiter;
20
- readonly ipc: Client<S>;
21
- constructor(delimiter?: string);
22
- private makeNamespace;
23
- }
24
- export {};
1
+ export {};
2
+
3
+ type ChoosePathProps = {
4
+ title: string;
5
+ default?: "music";
6
+ };
7
+
8
+ declare global {
9
+
10
+ interface IpcApi {
11
+
12
+ app: {
13
+ minimize: () => void;
14
+ close: () => void;
15
+ choosePath: (opts: ChoosePathProps) => Promise<string | null>;
16
+ openLink: (url: string) => void;
17
+ };
18
+
19
+ }
20
+
21
+ interface Window {
22
+ api: IpcApi;
23
+ }
24
+
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proton-app/main",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
 
6
6
  "keywords": [],
@@ -1,25 +0,0 @@
1
- export {};
2
-
3
- type ChoosePathProps = {
4
- title: string;
5
- default?: "music";
6
- };
7
-
8
- declare global {
9
-
10
- interface IpcApi {
11
-
12
- app: {
13
- minimize: () => void;
14
- close: () => void;
15
- choosePath: (opts: ChoosePathProps) => Promise<string | null>;
16
- openLink: (url: string) => void;
17
- };
18
-
19
- }
20
-
21
- interface Window {
22
- api: IpcApi;
23
- }
24
-
25
- }
File without changes