@bouko/electron 1.0.2 → 1.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,8 @@
1
+ import { BrowserWindow } from "electron";
2
+ type Props = {
3
+ window: BrowserWindow;
4
+ title: string;
5
+ defaultPath?: "music";
6
+ };
7
+ export declare function choosePath({ window, title, defaultPath }: Props): Promise<string | null>;
8
+ export {};
@@ -0,0 +1,12 @@
1
+ import { app, dialog } from "electron";
2
+ export async function choosePath({ window, title, defaultPath }) {
3
+ const result = await dialog.showOpenDialog(window, {
4
+ title,
5
+ defaultPath: defaultPath ? app.getPath(defaultPath) : undefined,
6
+ properties: ["openDirectory", "createDirectory"]
7
+ });
8
+ if (result.canceled || result.filePaths.length === 0)
9
+ return null;
10
+ return result.filePaths[0];
11
+ }
12
+ ;
@@ -0,0 +1,2 @@
1
+ export * from "./paths";
2
+ export * from "./dialog";
@@ -0,0 +1,2 @@
1
+ export * from "./paths";
2
+ export * from "./dialog";
@@ -0,0 +1 @@
1
+ export declare const getUserDataPath: (x: string) => string;
@@ -0,0 +1,3 @@
1
+ import { app } from "electron";
2
+ import { join } from "path";
3
+ export const getUserDataPath = (x) => join(app.getPath("userData"), x);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const getUserDataPath: (x: string) => string;
2
1
  export * from "./ipc";
2
+ export * from "./files";
3
3
  export * from "./csp";
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import { app } from "electron";
2
- import path from "path";
3
- export const getUserDataPath = (x) => path.join(app.getPath("userData"), x);
4
1
  export * from "./ipc";
2
+ export * from "./files";
5
3
  export * from "./csp";
@@ -0,0 +1,2 @@
1
+ export * from "./manager";
2
+ export * from "./app";
@@ -0,0 +1,2 @@
1
+ export * from "./manager";
2
+ export * from "./app";
@@ -0,0 +1,5 @@
1
+ export declare class IpcManager {
2
+ id: string;
3
+ constructor(id: string);
4
+ handle<T, K>(channel: string, cb: (params?: T) => Promise<K>): void;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { ipcMain } from "electron";
2
+ export class IpcManager {
3
+ id;
4
+ constructor(id) {
5
+ this.id = id;
6
+ }
7
+ handle(channel, cb) {
8
+ ipcMain.handle(`${this.id}:${channel}`, (_, params) => cb(params));
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,58 +1,34 @@
1
1
  {
2
2
 
3
3
  "name": "@bouko/electron",
4
-
5
- "version": "1.0.2",
6
-
4
+ "version": "1.0.4",
7
5
  "description": "",
8
-
9
6
  "keywords": [],
10
-
11
7
  "author": "",
12
-
13
8
  "license": "ISC",
14
-
15
9
  "main": "./dist/index.js",
16
-
17
10
  "types": "./dist/index.d.ts",
18
-
19
11
  "files": [
20
-
21
12
  "dist"
22
-
23
13
  ],
24
-
25
14
  "publishConfig": {
26
-
27
15
  "access": "public"
28
-
29
16
  },
30
-
31
17
  "engines": {},
32
18
 
33
19
  "scripts": {
34
-
35
20
  "build": "tsc"
36
-
37
21
  },
38
22
 
39
23
  "dependencies": {
40
-
41
24
  "@bouko/ts": "^0.3.8",
42
-
43
25
  "path": "^0.12.7"
44
-
45
26
  },
46
27
 
47
28
  "devDependencies": {
48
-
49
29
  "electron": "^39.2.7",
50
-
51
30
  "react-router-dom": "^7.12.0",
52
-
53
31
  "typescript": "^5.9.3"
54
-
55
32
  }
56
33
 
57
- }
58
-
34
+ }
File without changes
File without changes
File without changes
File without changes