@raydiant/playlist-window-manager 0.0.0-test32 → 0.0.0-test34
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.
|
@@ -69,17 +69,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
73
|
-
var t = {};
|
|
74
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
75
|
-
t[p] = s[p];
|
|
76
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
77
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
78
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
79
|
-
t[p[i]] = s[p[i]];
|
|
80
|
-
}
|
|
81
|
-
return t;
|
|
82
|
-
};
|
|
83
72
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
84
73
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
85
74
|
};
|
|
@@ -98,7 +87,6 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
98
87
|
this.offscreenWindow = new electron_1.BrowserWindow({
|
|
99
88
|
show: false,
|
|
100
89
|
frame: this.opts.frame,
|
|
101
|
-
fullscreen: this.opts.fullscreen,
|
|
102
90
|
hasShadow: this.opts.hasShadow,
|
|
103
91
|
webPreferences: {
|
|
104
92
|
preload: path.join(__dirname, 'preload.js'),
|
|
@@ -106,15 +94,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
106
94
|
},
|
|
107
95
|
});
|
|
108
96
|
this.proxySettings = null;
|
|
109
|
-
|
|
110
|
-
show: false,
|
|
111
|
-
frame: this.opts.frame,
|
|
112
|
-
fullscreen: this.opts.fullscreen,
|
|
113
|
-
hasShadow: this.opts.hasShadow,
|
|
114
|
-
}), ")"));
|
|
115
|
-
if (!opts.fullscreen) {
|
|
116
|
-
this.offscreenWindow.setBounds(opts.bounds);
|
|
117
|
-
}
|
|
97
|
+
this.offscreenWindow.setBounds(opts.bounds);
|
|
118
98
|
if (opts.proxySettings) {
|
|
119
99
|
this.proxySettings = opts.proxySettings;
|
|
120
100
|
}
|
|
@@ -131,13 +111,6 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
131
111
|
return __generator(this, function (_c) {
|
|
132
112
|
switch (_c.label) {
|
|
133
113
|
case 0:
|
|
134
|
-
this.logger.info("BrowserWindowRenderer.createWindow(".concat(JSON.stringify({
|
|
135
|
-
windowId: windowId,
|
|
136
|
-
parentWindowId: parentWindowId,
|
|
137
|
-
bounds: bounds,
|
|
138
|
-
}), ")"));
|
|
139
|
-
this.logger.info("BrowserWindowRenderer.createWindow adjust bounds: ".concat(parentWindowId && !this.opts.renderChildWindowsAsBrowserViews, ". New Bounds ").concat(JSON.stringify(parentWindowId && !this.opts.renderChildWindowsAsBrowserViews
|
|
140
|
-
? __assign(__assign({}, bounds), { x: bounds.x + this.opts.bounds.x, y: bounds.y + this.opts.bounds.y }) : bounds), "\n "));
|
|
141
114
|
window = {
|
|
142
115
|
parentWindowId: parentWindowId,
|
|
143
116
|
// If we are creating a child window and renderChildWindowsAsBrowserViews is true,
|
|
@@ -149,17 +122,21 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
149
122
|
contextIsolation: false,
|
|
150
123
|
},
|
|
151
124
|
})
|
|
152
|
-
: this.createOrGetPooledBrowserWindow(windowId,
|
|
125
|
+
: this.createOrGetPooledBrowserWindow(windowId, {
|
|
126
|
+
show: false,
|
|
127
|
+
frame: this.opts.frame,
|
|
153
128
|
// NOTE: useWindowPool: true does not work with renderChildWindowsAsBrowserViews: false
|
|
154
129
|
// because the parent can't be changed after creating the BrowserWindow.
|
|
155
130
|
parent: parentWindowId
|
|
156
131
|
? this.getParentBrowserView(parentWindowId)
|
|
157
|
-
: undefined,
|
|
132
|
+
: undefined,
|
|
133
|
+
transparent: backgroundColor === 'transparent',
|
|
134
|
+
hasShadow: this.opts.hasShadow,
|
|
135
|
+
webPreferences: {
|
|
158
136
|
preload: path.join(__dirname, 'preload.js'),
|
|
159
137
|
contextIsolation: false,
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
: {}))),
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
163
140
|
// If we are creating a child window and renderChildWindowsAsBrowserViews is false that means
|
|
164
141
|
// we are rendering child windows with BrowserWindow. BrowserWindows are positioned absolutely so
|
|
165
142
|
// to place them in the correct spot relative to their parent we need to add the main window's x / y.
|
|
@@ -198,9 +175,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
198
175
|
// Electron issue: https://github.com/electron/electron/issues/20357
|
|
199
176
|
window.view.setBackgroundColor(backgroundColor === 'transparent' ? '#00000000' : backgroundColor);
|
|
200
177
|
}
|
|
201
|
-
|
|
202
|
-
window.view.setBounds(window.bounds);
|
|
203
|
-
}
|
|
178
|
+
window.view.setBounds(window.bounds);
|
|
204
179
|
if (!this.proxySettings) return [3 /*break*/, 2];
|
|
205
180
|
return [4 /*yield*/, window.view.webContents.session.setProxy(this.proxySettings)];
|
|
206
181
|
case 1:
|
|
@@ -420,10 +395,6 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
420
395
|
}
|
|
421
396
|
}
|
|
422
397
|
if (!browserWindow) {
|
|
423
|
-
// TODO remove
|
|
424
|
-
var parent_1 = options.parent, webPreferences = options.webPreferences, rest = __rest(options, ["parent", "webPreferences"]);
|
|
425
|
-
var newOptions = __assign(__assign({}, rest), { parentId: parent_1 === null || parent_1 === void 0 ? void 0 : parent_1.id });
|
|
426
|
-
this.logger.info("BrowserWindowRenderer.createOrGetPooledBrowserWindow, new BrowserWindow(".concat(JSON.stringify(newOptions), ")"));
|
|
427
398
|
browserWindow = new electron_1.BrowserWindow(options);
|
|
428
399
|
if (this.opts.useWindowPool) {
|
|
429
400
|
this.browserWindowPool.add(browserWindow);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raydiant/playlist-window-manager",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-test34",
|
|
4
4
|
"description": "Window manager for playlist playback.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@types/jschannel": "^1.0.1",
|
|
23
23
|
"@types/jest": "^24.0.15",
|
|
24
24
|
"@types/uuid": "8.3.0",
|
|
25
|
-
"electron": "28.
|
|
25
|
+
"electron": "28.3.0",
|
|
26
26
|
"jest": "^24.8.0",
|
|
27
27
|
"ts-jest": "^24.0.2",
|
|
28
28
|
"typescript": "^4.1.2"
|
|
@@ -45,7 +45,6 @@ interface BrowserWindowRendererOptions {
|
|
|
45
45
|
renderChildWindowsAsBrowserViews: boolean;
|
|
46
46
|
useWindowPool: boolean;
|
|
47
47
|
logger: Logger;
|
|
48
|
-
fullscreen?: boolean;
|
|
49
48
|
proxySettings?: ProxySettings;
|
|
50
49
|
windowCrashHandler?: () => void;
|
|
51
50
|
}
|
|
@@ -65,7 +64,6 @@ export default class BrowserWindowRenderer
|
|
|
65
64
|
private offscreenWindow = new BrowserWindow({
|
|
66
65
|
show: false,
|
|
67
66
|
frame: this.opts.frame,
|
|
68
|
-
fullscreen: this.opts.fullscreen,
|
|
69
67
|
hasShadow: this.opts.hasShadow,
|
|
70
68
|
webPreferences: {
|
|
71
69
|
preload: path.join(__dirname, 'preload.js'),
|
|
@@ -78,17 +76,7 @@ export default class BrowserWindowRenderer
|
|
|
78
76
|
private logger: Logger;
|
|
79
77
|
|
|
80
78
|
constructor(private opts: BrowserWindowRendererOptions) {
|
|
81
|
-
|
|
82
|
-
`offscreenWindow = new BrowserWindow(${JSON.stringify({
|
|
83
|
-
show: false,
|
|
84
|
-
frame: this.opts.frame,
|
|
85
|
-
fullscreen: this.opts.fullscreen,
|
|
86
|
-
hasShadow: this.opts.hasShadow,
|
|
87
|
-
})})`
|
|
88
|
-
);
|
|
89
|
-
if (!opts.fullscreen) {
|
|
90
|
-
this.offscreenWindow.setBounds(opts.bounds);
|
|
91
|
-
}
|
|
79
|
+
this.offscreenWindow.setBounds(opts.bounds);
|
|
92
80
|
if (opts.proxySettings) {
|
|
93
81
|
this.proxySettings = opts.proxySettings;
|
|
94
82
|
}
|
|
@@ -108,28 +96,6 @@ export default class BrowserWindowRenderer
|
|
|
108
96
|
receiveMessageCallback,
|
|
109
97
|
errorCallback,
|
|
110
98
|
}: CreateWindowOptions) {
|
|
111
|
-
this.logger.info(
|
|
112
|
-
`BrowserWindowRenderer.createWindow(${JSON.stringify({
|
|
113
|
-
windowId,
|
|
114
|
-
parentWindowId,
|
|
115
|
-
bounds,
|
|
116
|
-
})})`
|
|
117
|
-
);
|
|
118
|
-
this.logger.info(
|
|
119
|
-
`BrowserWindowRenderer.createWindow adjust bounds: ${
|
|
120
|
-
parentWindowId && !this.opts.renderChildWindowsAsBrowserViews
|
|
121
|
-
}. New Bounds ${JSON.stringify(
|
|
122
|
-
parentWindowId && !this.opts.renderChildWindowsAsBrowserViews
|
|
123
|
-
? {
|
|
124
|
-
...bounds,
|
|
125
|
-
x: bounds.x + this.opts.bounds.x,
|
|
126
|
-
y: bounds.y + this.opts.bounds.y,
|
|
127
|
-
}
|
|
128
|
-
: bounds
|
|
129
|
-
)}
|
|
130
|
-
`
|
|
131
|
-
);
|
|
132
|
-
|
|
133
99
|
const window: BrowserWindowRendererWindow = {
|
|
134
100
|
parentWindowId,
|
|
135
101
|
// If we are creating a child window and renderChildWindowsAsBrowserViews is true,
|
|
@@ -145,7 +111,6 @@ export default class BrowserWindowRenderer
|
|
|
145
111
|
: this.createOrGetPooledBrowserWindow(windowId, {
|
|
146
112
|
show: false,
|
|
147
113
|
frame: this.opts.frame,
|
|
148
|
-
fullscreen: this.opts.fullscreen,
|
|
149
114
|
// NOTE: useWindowPool: true does not work with renderChildWindowsAsBrowserViews: false
|
|
150
115
|
// because the parent can't be changed after creating the BrowserWindow.
|
|
151
116
|
parent: parentWindowId
|
|
@@ -157,9 +122,6 @@ export default class BrowserWindowRenderer
|
|
|
157
122
|
preload: path.join(__dirname, 'preload.js'),
|
|
158
123
|
contextIsolation: false,
|
|
159
124
|
},
|
|
160
|
-
...(this.opts.fullscreen
|
|
161
|
-
? { width: bounds.width, height: bounds.height }
|
|
162
|
-
: {}),
|
|
163
125
|
}),
|
|
164
126
|
// If we are creating a child window and renderChildWindowsAsBrowserViews is false that means
|
|
165
127
|
// we are rendering child windows with BrowserWindow. BrowserWindows are positioned absolutely so
|
|
@@ -238,9 +200,7 @@ export default class BrowserWindowRenderer
|
|
|
238
200
|
);
|
|
239
201
|
}
|
|
240
202
|
|
|
241
|
-
|
|
242
|
-
window.view.setBounds(window.bounds);
|
|
243
|
-
}
|
|
203
|
+
window.view.setBounds(window.bounds);
|
|
244
204
|
|
|
245
205
|
if (this.proxySettings) {
|
|
246
206
|
await window.view.webContents.session.setProxy(this.proxySettings);
|
|
@@ -503,15 +463,6 @@ export default class BrowserWindowRenderer
|
|
|
503
463
|
}
|
|
504
464
|
|
|
505
465
|
if (!browserWindow) {
|
|
506
|
-
// TODO remove
|
|
507
|
-
const { parent, webPreferences, ...rest } = options;
|
|
508
|
-
const newOptions = { ...rest, parentId: parent?.id };
|
|
509
|
-
this.logger.info(
|
|
510
|
-
`BrowserWindowRenderer.createOrGetPooledBrowserWindow, new BrowserWindow(${JSON.stringify(
|
|
511
|
-
newOptions
|
|
512
|
-
)})`
|
|
513
|
-
);
|
|
514
|
-
|
|
515
466
|
browserWindow = new BrowserWindow(options);
|
|
516
467
|
if (this.opts.useWindowPool) {
|
|
517
468
|
this.browserWindowPool.add(browserWindow);
|