@lynker-desktop/electron-window-manager 0.0.8-alpha.8 → 0.0.9-alpha.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.
- package/common/index.d.ts +4 -0
- package/common/index.d.ts.map +1 -1
- package/esm/common/index.d.ts +4 -0
- package/esm/common/index.d.ts.map +1 -1
- package/esm/main/index.d.ts +1 -0
- package/esm/main/index.d.ts.map +1 -1
- package/esm/main/index.js +44 -3
- package/esm/main/index.js.map +1 -1
- package/esm/renderer/index.d.ts +95 -15
- package/esm/renderer/index.d.ts.map +1 -1
- package/esm/renderer/index.js +294 -135
- package/esm/renderer/index.js.map +1 -1
- package/main/index.d.ts +1 -0
- package/main/index.d.ts.map +1 -1
- package/main/index.js +44 -3
- package/main/index.js.map +1 -1
- package/package.json +2 -2
- package/renderer/index.d.ts +95 -15
- package/renderer/index.d.ts.map +1 -1
- package/renderer/index.js +294 -134
- package/renderer/index.js.map +1 -1
package/esm/renderer/index.d.ts
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Electron 窗口管理器 - 渲染进程模块
|
|
3
|
+
* 提供窗口创建、管理、查询等功能
|
|
4
|
+
*
|
|
5
|
+
* @author Lynker Desktop Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
*/
|
|
1
8
|
import { BVItem, BWItem, ElectronWindowsManagerOptions } from '../common';
|
|
2
9
|
/**
|
|
3
10
|
* 创建窗口
|
|
4
|
-
*
|
|
5
|
-
*
|
|
11
|
+
* 支持创建 BrowserWindow 和 BrowserView
|
|
12
|
+
*
|
|
13
|
+
* @param options - 窗口创建选项
|
|
14
|
+
* @returns Promise<BWItem | BVItem> 创建的窗口实例
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // 创建 BrowserWindow
|
|
19
|
+
* const window = await create({
|
|
20
|
+
* type: 'BW',
|
|
21
|
+
* name: 'main-window',
|
|
22
|
+
* url: 'https://example.com'
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // 创建 BrowserView
|
|
26
|
+
* const view = await create({
|
|
27
|
+
* type: 'BV',
|
|
28
|
+
* name: 'sidebar-view',
|
|
29
|
+
* url: 'https://example.com/sidebar'
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
6
32
|
*/
|
|
7
33
|
export declare function create(options: Omit<ElectronWindowsManagerOptions, 'type'> & {
|
|
8
34
|
type?: 'BW';
|
|
@@ -13,41 +39,95 @@ export declare function create(options: ElectronWindowsManagerOptions & {
|
|
|
13
39
|
export declare function create(options: ElectronWindowsManagerOptions): Promise<BWItem | BVItem>;
|
|
14
40
|
/**
|
|
15
41
|
* 获取当前窗口实例
|
|
42
|
+
*
|
|
43
|
+
* @returns Promise<BWItem | BVItem | undefined> 当前窗口实例
|
|
16
44
|
*/
|
|
17
45
|
export declare const getCurrentWindow: () => Promise<BWItem | BVItem | undefined>;
|
|
18
46
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @
|
|
47
|
+
* 根据 ID 或名称获取窗口
|
|
48
|
+
*
|
|
49
|
+
* @param idOrName - 窗口 ID 或名称
|
|
50
|
+
* @returns Promise<BWItem | BVItem | undefined> 窗口实例
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // 通过 ID 获取
|
|
55
|
+
* const window = await get(1);
|
|
56
|
+
*
|
|
57
|
+
* // 通过名称获取
|
|
58
|
+
* const window = await get('main-window');
|
|
59
|
+
* ```
|
|
22
60
|
*/
|
|
23
61
|
export declare const get: (idOrName: string | number) => Promise<BWItem | BVItem | undefined>;
|
|
24
62
|
/**
|
|
25
63
|
* 获取所有窗口
|
|
26
|
-
*
|
|
64
|
+
* 支持按类型过滤
|
|
65
|
+
*
|
|
66
|
+
* @param type - 窗口类型过滤 ('BW' | 'BV')
|
|
67
|
+
* @returns Promise<Map<number, BWItem | BVItem>> 窗口映射表
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // 获取所有窗口
|
|
72
|
+
* const allWindows = await getAll();
|
|
73
|
+
*
|
|
74
|
+
* // 只获取 BrowserWindow
|
|
75
|
+
* const browserWindows = await getAll('BW');
|
|
76
|
+
*
|
|
77
|
+
* // 只获取 BrowserView
|
|
78
|
+
* const browserViews = await getAll('BV');
|
|
79
|
+
* ```
|
|
27
80
|
*/
|
|
28
81
|
export declare function getAll(type: 'BW'): Promise<Map<number, BWItem>>;
|
|
29
82
|
export declare function getAll(type: 'BV'): Promise<Map<number, BVItem>>;
|
|
30
83
|
export declare function getAll(): Promise<Map<number, BWItem | BVItem>>;
|
|
31
84
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
85
|
+
* 关闭指定窗口
|
|
86
|
+
*
|
|
87
|
+
* @param idOrName - 窗口 ID 或名称
|
|
88
|
+
* @returns Promise<boolean> 操作是否成功
|
|
35
89
|
*/
|
|
36
90
|
export declare const close: (idOrName: string | number) => Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* 关闭所有窗口
|
|
93
|
+
*
|
|
94
|
+
* @returns Promise<boolean> 操作是否成功
|
|
95
|
+
*/
|
|
37
96
|
export declare const closeAll: () => Promise<boolean>;
|
|
38
97
|
/**
|
|
39
|
-
*
|
|
40
|
-
|
|
98
|
+
* 根据 WebContents ID 查找对应的窗口
|
|
99
|
+
*
|
|
100
|
+
* @param webContentId - WebContents ID
|
|
101
|
+
* @returns Promise<BWItem | BVItem | undefined> 窗口实例
|
|
102
|
+
*/
|
|
41
103
|
export declare const getWindowForWebContentId: (webContentId: number) => Promise<BWItem | BVItem | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* 重命名窗口
|
|
106
|
+
*
|
|
107
|
+
* @param idOrName - 窗口 ID 或名称
|
|
108
|
+
* @param newName - 新名称
|
|
109
|
+
* @returns Promise<BWItem | BVItem | undefined> 重命名后的窗口实例
|
|
110
|
+
*/
|
|
42
111
|
export declare const rename: (idOrName: string | number, newName: string) => Promise<BWItem | BVItem | undefined>;
|
|
43
112
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
113
|
+
* 重置窗口初始化URL
|
|
114
|
+
*
|
|
115
|
+
* @param idOrName - 窗口 ID 或名称
|
|
116
|
+
* @param url - 新URL
|
|
117
|
+
* @returns Promise<BWItem | BVItem | undefined> 重置后的窗口实例
|
|
118
|
+
*/
|
|
119
|
+
export declare const reInitUrl: (idOrName: string | number, url: string) => Promise<BWItem | BVItem | undefined>;
|
|
120
|
+
/**
|
|
121
|
+
* 设置预加载 WebContents URL
|
|
122
|
+
*
|
|
123
|
+
* @param preloadWebContentsUrl - 预加载 URL
|
|
46
124
|
*/
|
|
47
125
|
export declare const setPreloadWebContentsUrl: (preloadWebContentsUrl: string) => Promise<void>;
|
|
48
126
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
127
|
+
* 获取预加载脚本路径
|
|
128
|
+
* 使用缓存机制避免重复请求
|
|
129
|
+
*
|
|
130
|
+
* @returns Promise<string | undefined> 预加载脚本路径
|
|
51
131
|
*/
|
|
52
132
|
export declare const getPreload: () => Promise<string | undefined>;
|
|
53
133
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/renderer/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/renderer/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAiK1E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,6BAA6B,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE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