@lynker-desktop/electron-window-manager 0.0.9-alpha.10 → 0.0.9-alpha.12
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 +15 -0
- package/common/index.d.ts.map +1 -1
- package/esm/common/index.d.ts +15 -0
- package/esm/common/index.d.ts.map +1 -1
- package/esm/main/index.d.ts +7 -7
- package/esm/main/index.d.ts.map +1 -1
- package/esm/main/index.js +106 -65
- package/esm/main/index.js.map +1 -1
- package/esm/renderer/index.d.ts +4 -4
- package/esm/renderer/index.d.ts.map +1 -1
- package/esm/renderer/index.js +6 -6
- package/esm/renderer/index.js.map +1 -1
- package/main/index.d.ts +7 -7
- package/main/index.d.ts.map +1 -1
- package/main/index.js +106 -65
- package/main/index.js.map +1 -1
- package/package.json +2 -2
- package/renderer/index.d.ts +4 -4
- package/renderer/index.d.ts.map +1 -1
- package/renderer/index.js +6 -6
- package/renderer/index.js.map +1 -1
package/main/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { WebContents } from 'electron';
|
|
2
|
-
import type { ElectronWindowsManagerOptions, BWItem, BVItem } from '../common';
|
|
2
|
+
import type { ElectronWindowsManagerOptions, BWItem, BVItem, PreloadWebContentsConfig } from '../common';
|
|
3
3
|
export declare const getCustomSession: () => Electron.Session;
|
|
4
4
|
export declare const enable: (win: WebContents) => void;
|
|
5
5
|
export declare class WindowsManager {
|
|
6
6
|
loadingViewUrl: string | undefined;
|
|
7
7
|
errorViewUrl: string | undefined;
|
|
8
8
|
preload?: string;
|
|
9
|
-
|
|
9
|
+
preloadWebContentsConfig?: PreloadWebContentsConfig;
|
|
10
10
|
windows: Map<number, BWItem | BVItem>;
|
|
11
11
|
preloadedBW: BWItem | null;
|
|
12
12
|
preloadedBW_FramelessWithButtons: BWItem | null;
|
|
@@ -32,12 +32,12 @@ export declare class WindowsManager {
|
|
|
32
32
|
* - 不带点的(如 example.com)只匹配主域名。
|
|
33
33
|
* - 'localhost'、'127.0.0.1'、'::1' 以及局域网 IP(如 192.168.x.x、10.x.x.x、172.16.x.x~172.31.x.x)都视为本地白名单。
|
|
34
34
|
*/
|
|
35
|
-
constructor(preload?: string, loadingViewUrl?: string, errorViewUrl?: string,
|
|
35
|
+
constructor(preload?: string, loadingViewUrl?: string, errorViewUrl?: string, preloadWebContentsConfig?: PreloadWebContentsConfig, webviewDomainWhiteList?: string[]);
|
|
36
36
|
/**
|
|
37
|
-
* 设置预加载的webContents
|
|
38
|
-
* @param
|
|
37
|
+
* 设置预加载的webContents配置
|
|
38
|
+
* @param preloadWebContentsConfig 预加载的webContents配置
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
setPreloadWebContentsConfig(preloadWebContentsConfig: PreloadWebContentsConfig): void;
|
|
41
41
|
/**
|
|
42
42
|
* 预加载实例
|
|
43
43
|
*/
|
|
@@ -83,5 +83,5 @@ export declare class WindowsManager {
|
|
|
83
83
|
createPreloadWebContents(url: string): Promise<unknown>;
|
|
84
84
|
}
|
|
85
85
|
export declare let isInitialized: boolean;
|
|
86
|
-
export declare const initialize: (preload?: string, loadingViewUrl?: string, errorViewUrl?: string,
|
|
86
|
+
export declare const initialize: (preload?: string, loadingViewUrl?: string, errorViewUrl?: string, preloadWebContentsConfig?: PreloadWebContentsConfig, webviewDomainWhiteList?: string[]) => WindowsManager;
|
|
87
87
|
//# sourceMappingURL=index.d.ts.map
|
package/main/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,WAAW,EAAiG,MAAM,UAAU,CAAA;AAItK,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC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/main/index.js
CHANGED
|
@@ -69,7 +69,7 @@ class WindowsManager {
|
|
|
69
69
|
* - 不带点的(如 example.com)只匹配主域名。
|
|
70
70
|
* - 'localhost'、'127.0.0.1'、'::1' 以及局域网 IP(如 192.168.x.x、10.x.x.x、172.16.x.x~172.31.x.x)都视为本地白名单。
|
|
71
71
|
*/
|
|
72
|
-
constructor(preload, loadingViewUrl, errorViewUrl,
|
|
72
|
+
constructor(preload, loadingViewUrl, errorViewUrl, preloadWebContentsConfig, webviewDomainWhiteList) {
|
|
73
73
|
// 预加载的窗口
|
|
74
74
|
this.preloadedBW = null;
|
|
75
75
|
// 预加载的窗口(无边框,有按钮)
|
|
@@ -87,25 +87,25 @@ class WindowsManager {
|
|
|
87
87
|
this.windows = new Map();
|
|
88
88
|
this.loadingViewUrl = `${loadingViewUrl ?? ''}`;
|
|
89
89
|
this.errorViewUrl = `${errorViewUrl ?? ''}`;
|
|
90
|
-
this.
|
|
90
|
+
this.preloadWebContentsConfig = preloadWebContentsConfig;
|
|
91
91
|
this.webviewDomainWhiteList = webviewDomainWhiteList || [];
|
|
92
|
-
log('log', '
|
|
93
|
-
if (this.
|
|
92
|
+
log('log', 'preloadWebContentsConfig: ', this.preloadWebContentsConfig);
|
|
93
|
+
if (this.preloadWebContentsConfig) {
|
|
94
94
|
electron.app.on('ready', () => {
|
|
95
|
-
if (this.
|
|
96
|
-
this.
|
|
95
|
+
if (this.preloadWebContentsConfig) {
|
|
96
|
+
this.setPreloadWebContentsConfig(this.preloadWebContentsConfig);
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* 设置预加载的webContents
|
|
103
|
-
* @param
|
|
102
|
+
* 设置预加载的webContents配置
|
|
103
|
+
* @param preloadWebContentsConfig 预加载的webContents配置
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
setPreloadWebContentsConfig(preloadWebContentsConfig) {
|
|
106
106
|
try {
|
|
107
|
-
this.
|
|
108
|
-
if (this.
|
|
107
|
+
this.preloadWebContentsConfig = preloadWebContentsConfig;
|
|
108
|
+
if (this.preloadWebContentsConfig) {
|
|
109
109
|
this._preloadInstances();
|
|
110
110
|
}
|
|
111
111
|
else {
|
|
@@ -116,7 +116,7 @@ class WindowsManager {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
catch (error) {
|
|
119
|
-
log('error', '
|
|
119
|
+
log('error', 'setPreloadWebContentsConfig error:', error);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -127,23 +127,52 @@ class WindowsManager {
|
|
|
127
127
|
return;
|
|
128
128
|
this.preloading = true;
|
|
129
129
|
try {
|
|
130
|
-
if (this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
130
|
+
if (this.preloadWebContentsConfig) {
|
|
131
|
+
log('log', 'preloadWebContentsConfig: ', this.preloadWebContentsConfig);
|
|
132
|
+
// 根据配置决定是否预加载普通窗口
|
|
133
|
+
if (this.preloadWebContentsConfig.enableBW !== false) {
|
|
134
|
+
if (!this.preloadedBW) {
|
|
135
|
+
this._createPreloadBW({}).then(i => {
|
|
136
|
+
this.preloadedBW = i;
|
|
137
|
+
log('log', 'init preloadedBW: ', !!this.preloadedBW);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// 根据配置决定是否预加载无边框有按钮的窗口
|
|
142
|
+
if (this.preloadWebContentsConfig.enableBW_FramelessWithButtons !== false) {
|
|
143
|
+
if (!this.preloadedBW_FramelessWithButtons) {
|
|
144
|
+
this._createPreloadBW({
|
|
145
|
+
frame: false,
|
|
146
|
+
transparent: true,
|
|
147
|
+
titleBarStyle: 'hidden',
|
|
148
|
+
}).then(i => {
|
|
149
|
+
this.preloadedBW_FramelessWithButtons = i;
|
|
150
|
+
log('log', 'init preloadedBW_FramelessWithButtons: ', !!this.preloadedBW_FramelessWithButtons);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// 根据配置决定是否预加载无边框无按钮的窗口
|
|
155
|
+
if (this.preloadWebContentsConfig.enableBW_FramelessNoButtons !== false) {
|
|
156
|
+
if (!this.preloadedBW_FramelessNoButtons) {
|
|
157
|
+
this._createPreloadBW({
|
|
158
|
+
frame: false,
|
|
159
|
+
transparent: true,
|
|
160
|
+
titleBarStyle: 'customButtonsOnHover',
|
|
161
|
+
}).then(i => {
|
|
162
|
+
this.preloadedBW_FramelessNoButtons = i;
|
|
163
|
+
log('log', 'init preloadedBW_FramelessNoButtons: ', !!this.preloadedBW_FramelessNoButtons);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// 根据配置决定是否预加载浏览器视图
|
|
168
|
+
if (this.preloadWebContentsConfig.enableBV !== false) {
|
|
169
|
+
if (!this.preloadedBV) {
|
|
170
|
+
this._createPreloadBV().then(i => {
|
|
171
|
+
this.preloadedBV = i;
|
|
172
|
+
log('log', 'init preloadedBV: ', !!this.preloadedBV);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
147
176
|
}
|
|
148
177
|
}
|
|
149
178
|
catch (e) {
|
|
@@ -159,8 +188,8 @@ class WindowsManager {
|
|
|
159
188
|
_createPreloadBW(options = {}) {
|
|
160
189
|
return new Promise((resolve) => {
|
|
161
190
|
const preload = this.preload;
|
|
162
|
-
const url = this.
|
|
163
|
-
if (this.
|
|
191
|
+
const url = this.preloadWebContentsConfig?.url;
|
|
192
|
+
if (this.preloadWebContentsConfig?.url) {
|
|
164
193
|
const webPreferences = (options.webPreferences || {});
|
|
165
194
|
const instance = new electron.BrowserWindow({
|
|
166
195
|
...options,
|
|
@@ -191,7 +220,7 @@ class WindowsManager {
|
|
|
191
220
|
log('error', '预加载 BW 设置 _id 失败', error);
|
|
192
221
|
}
|
|
193
222
|
// @ts-ignore
|
|
194
|
-
log('log', '创建预BW: ', instance._id, this.
|
|
223
|
+
log('log', '创建预BW: ', instance._id, this.preloadWebContentsConfig?.url);
|
|
195
224
|
// instance.webContents.once('did-finish-load', () => {
|
|
196
225
|
// resolve(instance as BWItem);
|
|
197
226
|
// });
|
|
@@ -201,6 +230,9 @@ class WindowsManager {
|
|
|
201
230
|
instance.loadURL(url ? `${url}` : 'about:blank');
|
|
202
231
|
resolve(instance);
|
|
203
232
|
}
|
|
233
|
+
else {
|
|
234
|
+
resolve(null);
|
|
235
|
+
}
|
|
204
236
|
});
|
|
205
237
|
}
|
|
206
238
|
/**
|
|
@@ -210,8 +242,8 @@ class WindowsManager {
|
|
|
210
242
|
_createPreloadBV(options = {}) {
|
|
211
243
|
return new Promise((resolve) => {
|
|
212
244
|
const preload = this.preload;
|
|
213
|
-
const url = this.
|
|
214
|
-
if (this.
|
|
245
|
+
const url = this.preloadWebContentsConfig?.url;
|
|
246
|
+
if (this.preloadWebContentsConfig?.url) {
|
|
215
247
|
const webPreferences = (options.webPreferences || {});
|
|
216
248
|
const instance = new electron.BrowserView({
|
|
217
249
|
webPreferences: {
|
|
@@ -239,7 +271,7 @@ class WindowsManager {
|
|
|
239
271
|
log('error', '预加载 BV 设置 _id 失败', error);
|
|
240
272
|
}
|
|
241
273
|
// @ts-ignore
|
|
242
|
-
log('log', '创建预BV: ', instance._id, this.
|
|
274
|
+
log('log', '创建预BV: ', instance._id, this.preloadWebContentsConfig?.url);
|
|
243
275
|
// instance.webContents.once('did-finish-load', () => {
|
|
244
276
|
// resolve(instance as BVItem);
|
|
245
277
|
// });
|
|
@@ -249,6 +281,9 @@ class WindowsManager {
|
|
|
249
281
|
instance.webContents.loadURL(url || 'about:blank');
|
|
250
282
|
resolve(instance);
|
|
251
283
|
}
|
|
284
|
+
else {
|
|
285
|
+
resolve(null);
|
|
286
|
+
}
|
|
252
287
|
});
|
|
253
288
|
}
|
|
254
289
|
create(options) {
|
|
@@ -291,44 +326,50 @@ class WindowsManager {
|
|
|
291
326
|
options.type = type;
|
|
292
327
|
// 优先复用预创建实例
|
|
293
328
|
let preloadWin = null;
|
|
294
|
-
if (type === 'BW' && usePreload && this.
|
|
329
|
+
if (type === 'BW' && usePreload && this.preloadWebContentsConfig?.url) {
|
|
295
330
|
const bwOptions = browserWindowOptions || {};
|
|
296
331
|
if (bwOptions.frame === false) {
|
|
297
332
|
if (bwOptions.titleBarStyle === 'customButtonsOnHover') {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
333
|
+
if (this.preloadWebContentsConfig.enableBW_FramelessNoButtons !== false) {
|
|
334
|
+
preloadWin = this.preloadedBW_FramelessNoButtons;
|
|
335
|
+
this.preloadedBW_FramelessNoButtons = await this._createPreloadBW({
|
|
336
|
+
frame: false,
|
|
337
|
+
transparent: true,
|
|
338
|
+
titleBarStyle: 'customButtonsOnHover',
|
|
339
|
+
webPreferences: {
|
|
340
|
+
preload: bwOptions?.webPreferences?.preload || this.preload,
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
307
344
|
}
|
|
308
345
|
else {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
346
|
+
if (this.preloadWebContentsConfig.enableBW_FramelessWithButtons !== false) {
|
|
347
|
+
preloadWin = this.preloadedBW_FramelessWithButtons;
|
|
348
|
+
this.preloadedBW_FramelessWithButtons = await this._createPreloadBW({
|
|
349
|
+
frame: false,
|
|
350
|
+
transparent: true,
|
|
351
|
+
titleBarStyle: 'hidden',
|
|
352
|
+
webPreferences: {
|
|
353
|
+
preload: this.preload,
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
if (this.preloadWebContentsConfig.enableBW !== false) {
|
|
361
|
+
preloadWin = this.preloadedBW;
|
|
362
|
+
this.preloadedBW = await this._createPreloadBW({
|
|
314
363
|
webPreferences: {
|
|
315
|
-
preload: this.preload,
|
|
364
|
+
preload: bwOptions?.webPreferences?.preload || this.preload,
|
|
316
365
|
}
|
|
317
366
|
});
|
|
318
367
|
}
|
|
319
368
|
}
|
|
320
|
-
else {
|
|
321
|
-
preloadWin = this.preloadedBW;
|
|
322
|
-
this.preloadedBW = await this._createPreloadBW({
|
|
323
|
-
webPreferences: {
|
|
324
|
-
preload: bwOptions?.webPreferences?.preload || this.preload,
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
369
|
}
|
|
329
|
-
if (type === 'BV' && usePreload && this.
|
|
370
|
+
if (type === 'BV' && usePreload && this.preloadWebContentsConfig?.url) {
|
|
330
371
|
const bvOptions = browserWindowOptions || {};
|
|
331
|
-
if (this.
|
|
372
|
+
if (this.preloadWebContentsConfig.enableBV !== false) {
|
|
332
373
|
preloadWin = this.preloadedBV;
|
|
333
374
|
this.preloadedBV = await this._createPreloadBV({
|
|
334
375
|
webPreferences: {
|
|
@@ -993,7 +1034,7 @@ class WindowsManager {
|
|
|
993
1034
|
// @ts-ignore
|
|
994
1035
|
global['__ELECTRON_WINDOWS_MANAGER__'] = undefined;
|
|
995
1036
|
exports.isInitialized = false;
|
|
996
|
-
const initialize = (preload, loadingViewUrl, errorViewUrl,
|
|
1037
|
+
const initialize = (preload, loadingViewUrl, errorViewUrl, preloadWebContentsConfig, webviewDomainWhiteList) => {
|
|
997
1038
|
// @ts-ignore
|
|
998
1039
|
if (exports.isInitialized && global['__ELECTRON_WINDOWS_MANAGER__']) {
|
|
999
1040
|
// @ts-ignore
|
|
@@ -1001,7 +1042,7 @@ const initialize = (preload, loadingViewUrl, errorViewUrl, preloadWebContentsUrl
|
|
|
1001
1042
|
}
|
|
1002
1043
|
exports.isInitialized = true;
|
|
1003
1044
|
// @ts-ignore
|
|
1004
|
-
const wm = global['__ELECTRON_WINDOWS_MANAGER__'] = new WindowsManager(preload, loadingViewUrl, errorViewUrl,
|
|
1045
|
+
const wm = global['__ELECTRON_WINDOWS_MANAGER__'] = new WindowsManager(preload, loadingViewUrl, errorViewUrl, preloadWebContentsConfig, webviewDomainWhiteList);
|
|
1005
1046
|
eIpc.mainIPC.handleRenderer('__ELECTRON_WINDOW_MANAGER_IPC_CHANNEL__', async (data) => {
|
|
1006
1047
|
if (data?.type === 'create') {
|
|
1007
1048
|
const opt = data;
|
|
@@ -1161,9 +1202,9 @@ const initialize = (preload, loadingViewUrl, errorViewUrl, preloadWebContentsUrl
|
|
|
1161
1202
|
return undefined;
|
|
1162
1203
|
}
|
|
1163
1204
|
// 是否开启预加载窗口
|
|
1164
|
-
if (data?.type === '
|
|
1205
|
+
if (data?.type === 'setPreloadWebContentsConfig') {
|
|
1165
1206
|
const opt = data;
|
|
1166
|
-
wm.
|
|
1207
|
+
wm.setPreloadWebContentsConfig(opt.data);
|
|
1167
1208
|
}
|
|
1168
1209
|
if (data?.type === 'createPreloadWebContents') {
|
|
1169
1210
|
const opt = data;
|