@lvce-editor/shared-process 0.26.0 → 0.26.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/package.json +3 -3
- package/src/parts/ConnectIpcToElectron/ConnectIpcToElectron.js +8 -0
- package/src/parts/EmbedsProcessPath/EmbedsProcessPath.js +1 -1
- package/src/parts/LaunchEmbedsProcess/LaunchEmbedsProcess.js +5 -9
- package/src/parts/LaunchProcessExplorer/LaunchProcessExplorer.js +3 -7
- package/src/parts/Module/Module.js +0 -14
- package/src/parts/ModuleId/ModuleId.js +0 -7
- package/src/parts/ModuleMap/ModuleMap.js +0 -50
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/ElectronBrowserView/ElectronBrowserView.ipc.js +0 -6
- package/src/parts/ElectronBrowserView/ElectronBrowserView.js +0 -21
- package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.ipc.js +0 -18
- package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.js +0 -35
- package/src/parts/ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js +0 -15
- package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.ipc.js +0 -6
- package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.js +0 -7
- package/src/parts/ElectronBrowserViewState/ElectronBrowserViewState.js +0 -12
- package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.ipc.js +0 -7
- package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.js +0 -10
- package/src/parts/ElectronWebContents/ElectronWebContents.ipc.js +0 -12
- package/src/parts/ElectronWebContents/ElectronWebContents.js +0 -61
- package/src/parts/ElectronWebContentsView/ElectronWebContentsView.ipc.js +0 -6
- package/src/parts/ElectronWebContentsView/ElectronWebContentsView.js +0 -18
- package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.ipc.js +0 -18
- package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.js +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.26.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.26.1",
|
|
22
22
|
"@lvce-editor/ipc": "^5.1.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "^1.3.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "^1.2.0",
|
|
25
25
|
"@lvce-editor/pretty-error": "^1.5.0",
|
|
26
|
-
"@lvce-editor/pty-host": "0.26.
|
|
26
|
+
"@lvce-editor/pty-host": "0.26.1",
|
|
27
27
|
"@lvce-editor/verror": "^1.2.0",
|
|
28
28
|
"@lvce-editor/web-socket-server": "^1.1.0",
|
|
29
29
|
"debug": "^4.3.4",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as GetPortTuple from '../GetPortTuple/GetPortTuple.js';
|
|
2
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
3
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
4
|
+
export const connectIpcToElectron = async (ipc) => {
|
|
5
|
+
const { port1, port2 } = await GetPortTuple.getPortTuple();
|
|
6
|
+
await JsonRpc.invokeAndTransfer(ipc, [port1], 'HandleElectronMessagePort.handleElectronMessagePort', /* isElectron */ true);
|
|
7
|
+
await ParentIpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', [port2]);
|
|
8
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as Path from '../Path/Path.js';
|
|
2
2
|
import * as Root from '../Root/Root.js';
|
|
3
|
-
export const embedsProcessPath = Path.join(Root.root, 'packages', 'embeds-process', '
|
|
3
|
+
export const embedsProcessPath = Path.join(Root.root, 'packages', 'embeds-process', 'dist', 'embedsProcessMain.js');
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
import * as ConnectIpcToElectron from '../ConnectIpcToElectron/ConnectIpcToElectron.js';
|
|
1
2
|
import * as EmbedsProcessPath from '../EmbedsProcessPath/EmbedsProcessPath.js';
|
|
2
|
-
import * as GetPortTuple from '../GetPortTuple/GetPortTuple.js';
|
|
3
3
|
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
4
4
|
import * as IpcParent from '../IpcParent/IpcParent.js';
|
|
5
5
|
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
6
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
7
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
8
6
|
export const launchEmbedsProcess = async () => {
|
|
9
|
-
const
|
|
7
|
+
const ipc = await IpcParent.create({
|
|
10
8
|
method: IpcParentType.ElectronUtilityProcess,
|
|
11
9
|
path: EmbedsProcessPath.embedsProcessPath,
|
|
12
10
|
argv: [],
|
|
13
11
|
stdio: 'inherit',
|
|
14
12
|
name: 'Embeds Process',
|
|
15
13
|
});
|
|
16
|
-
HandleIpc.handleIpc(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await ParentIpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', [port2]);
|
|
20
|
-
return embedsProcess;
|
|
14
|
+
HandleIpc.handleIpc(ipc);
|
|
15
|
+
await ConnectIpcToElectron.connectIpcToElectron(ipc);
|
|
16
|
+
return ipc;
|
|
21
17
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ConnectIpcToElectron from '../ConnectIpcToElectron/ConnectIpcToElectron.js';
|
|
2
2
|
import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
3
3
|
import * as IpcParent from '../IpcParent/IpcParent.js';
|
|
4
4
|
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
5
|
-
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
6
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
7
5
|
import * as ProcessExplorerPath from '../ProcessExplorerPath/ProcessExplorerPath.js';
|
|
8
6
|
export const launchProcessExplorer = async () => {
|
|
9
7
|
const ipc = await IpcParent.create({
|
|
@@ -11,11 +9,9 @@ export const launchProcessExplorer = async () => {
|
|
|
11
9
|
path: ProcessExplorerPath.processExplorerPath,
|
|
12
10
|
argv: [],
|
|
13
11
|
stdio: 'inherit',
|
|
14
|
-
name: 'Process
|
|
12
|
+
name: 'Process Explorer',
|
|
15
13
|
});
|
|
16
14
|
HandleIpc.handleIpc(ipc);
|
|
17
|
-
|
|
18
|
-
await JsonRpc.invokeAndTransfer(ipc, [port1], 'HandleElectronMessagePort.handleElectronMessagePort');
|
|
19
|
-
await ParentIpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', [port2]);
|
|
15
|
+
await ConnectIpcToElectron.connectIpcToElectron(ipc);
|
|
20
16
|
return ipc;
|
|
21
17
|
};
|
|
@@ -5,8 +5,6 @@ export const load = (moduleId) => {
|
|
|
5
5
|
return import('../AttachDebugger/AttachDebugger.ipc.js');
|
|
6
6
|
case ModuleId.AutoUpdater:
|
|
7
7
|
return import('../AutoUpdater/AutoUpdater.ipc.js');
|
|
8
|
-
case ModuleId.ElectronBrowserViewFunctions:
|
|
9
|
-
return import('../ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.ipc.js');
|
|
10
8
|
case ModuleId.AutoUpdaterAppImage:
|
|
11
9
|
return import('../AutoUpdaterAppImage/AutoUpdaterAppImage.ipc.js');
|
|
12
10
|
case ModuleId.GetWindowId:
|
|
@@ -27,8 +25,6 @@ export const load = (moduleId) => {
|
|
|
27
25
|
return import('../Download/Download.ipc.js');
|
|
28
26
|
case ModuleId.ElectronApplicationMenu:
|
|
29
27
|
return import('../ElectronApplicationMenu/ElectronApplicationMenu.ipc.js');
|
|
30
|
-
case ModuleId.ElectronBrowserView:
|
|
31
|
-
return import('../ElectronBrowserView/ElectronBrowserView.ipc.js');
|
|
32
28
|
case ModuleId.ElectronContentTracing:
|
|
33
29
|
return import('../ElectronContentTracing/ElectronContentTracing.ipc.js');
|
|
34
30
|
case ModuleId.ElectronDeveloper:
|
|
@@ -47,8 +43,6 @@ export const load = (moduleId) => {
|
|
|
47
43
|
return import('../ElectronSafeStorage/ElectronSafeStorage.ipc.js');
|
|
48
44
|
case ModuleId.Window:
|
|
49
45
|
return import('../ElectronWindow/ElectronWindow.ipc.js');
|
|
50
|
-
case ModuleId.ElectronBrowserViewQuickPick:
|
|
51
|
-
return import('../ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.ipc.js');
|
|
52
46
|
case ModuleId.ElectronWindowAbout:
|
|
53
47
|
return import('../ElectronWindowAbout/ElectronWindowAbout.ipc.js');
|
|
54
48
|
case ModuleId.ElectronWindowProcessExplorer:
|
|
@@ -111,8 +105,6 @@ export const load = (moduleId) => {
|
|
|
111
105
|
return import('../TextDocument/TextDocument.ipc.js');
|
|
112
106
|
case ModuleId.Search:
|
|
113
107
|
return import('../TextSearch/TextSearch.ipc.js');
|
|
114
|
-
case ModuleId.ElectronBrowserViewSuggestions:
|
|
115
|
-
return import('../ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.ipc.js');
|
|
116
108
|
case ModuleId.WebSocketServer:
|
|
117
109
|
return import('../WebSocketServer/WebSocketServer.ipc.js');
|
|
118
110
|
case ModuleId.Workspace:
|
|
@@ -137,12 +129,6 @@ export const load = (moduleId) => {
|
|
|
137
129
|
return import('../HandleRemoteRequest/HandleRemoteRequest.ipc.js');
|
|
138
130
|
case ModuleId.HandleMessagePortForExtensionHostHelperProcess:
|
|
139
131
|
return import('../HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.ipc.js');
|
|
140
|
-
case ModuleId.ElectronWebContents:
|
|
141
|
-
return import('../ElectronWebContents/ElectronWebContents.ipc.js');
|
|
142
|
-
case ModuleId.ElectronWebContentsView:
|
|
143
|
-
return import('../ElectronWebContentsView/ElectronWebContentsView.ipc.js');
|
|
144
|
-
case ModuleId.ElectronWebContentsViewFunctions:
|
|
145
|
-
return import('../ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.ipc.js');
|
|
146
132
|
case ModuleId.ContentSecurityPolicy:
|
|
147
133
|
return import('../ContentSecurityPolicy/ContentSecurityPolicy.ipc.js');
|
|
148
134
|
case ModuleId.HandleMessagePortForProcessExplorer:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export const ElectronBrowserViewSuggestions = 111;
|
|
2
1
|
export const ClipBoard = 1;
|
|
3
2
|
export const Developer = 2;
|
|
4
3
|
export const ExtensionHost = 3;
|
|
@@ -22,7 +21,6 @@ export const Download = 19;
|
|
|
22
21
|
export const ElectronPowerSaveBlocker = 222;
|
|
23
22
|
export const GitLsFiles = 20;
|
|
24
23
|
export const BulkReplacement = 21;
|
|
25
|
-
export const ElectronBrowserViewQuickPick = 999;
|
|
26
24
|
export const InstallExtension = 22;
|
|
27
25
|
export const AutoUpdater = 23;
|
|
28
26
|
export const IsAutoUpdateSupported = 24;
|
|
@@ -32,7 +30,6 @@ export const RebuildNodePty = 27;
|
|
|
32
30
|
export const ElectronInitialize = 28;
|
|
33
31
|
export const HandleWebSocket = 29;
|
|
34
32
|
export const Process = 30;
|
|
35
|
-
export const ElectronBrowserViewFunctions = 200;
|
|
36
33
|
export const AttachDebugger = 31;
|
|
37
34
|
export const HandleElectronMessagePort = 32;
|
|
38
35
|
export const HandleNodeMessagePort = 33;
|
|
@@ -53,7 +50,6 @@ export const ElectronSafeStorage = 47;
|
|
|
53
50
|
export const ElectronDeveloper = 100;
|
|
54
51
|
export const ElectronProcess = 48;
|
|
55
52
|
export const ElectronContextMenu = 49;
|
|
56
|
-
export const ElectronBrowserView = 50;
|
|
57
53
|
export const Window = 51;
|
|
58
54
|
export const PassThroughElectronMessagePort = 52;
|
|
59
55
|
export const Exit = 53;
|
|
@@ -69,9 +65,6 @@ export const TemporaryMessagePort = 62;
|
|
|
69
65
|
export const GetElectronFileResponse = 63;
|
|
70
66
|
export const HandleRemoteRequest = 64;
|
|
71
67
|
export const HandleMessagePortForExtensionHostHelperProcess = 65;
|
|
72
|
-
export const ElectronWebContents = 66;
|
|
73
|
-
export const ElectronWebContentsView = 67;
|
|
74
|
-
export const ElectronWebContentsViewFunctions = 68;
|
|
75
68
|
export const HandleRequestTest = 69;
|
|
76
69
|
export const ContentSecurityPolicy = 70;
|
|
77
70
|
export const HandleMessagePortForEmbedsProcess = 72;
|
|
@@ -41,10 +41,6 @@ export const getModuleId = (commandId) => {
|
|
|
41
41
|
case 'ElectronApplicationMenu.handleClick':
|
|
42
42
|
case 'ElectronApplicationMenu.setItems':
|
|
43
43
|
return ModuleId.ElectronApplicationMenu;
|
|
44
|
-
case 'ElectronBrowserView.createBrowserView':
|
|
45
|
-
case 'ElectronBrowserView.disposeBrowserView':
|
|
46
|
-
case 'ElectronBrowserView.getAll':
|
|
47
|
-
return ModuleId.ElectronBrowserView;
|
|
48
44
|
case 'ElectronClipBoard.writeText':
|
|
49
45
|
return ModuleId.ElectronClipBoard;
|
|
50
46
|
case 'ElectronContentTracing.startRecording':
|
|
@@ -73,9 +69,6 @@ export const getModuleId = (commandId) => {
|
|
|
73
69
|
return ModuleId.ElectronWindowProcessExplorer;
|
|
74
70
|
case 'Exit.exit':
|
|
75
71
|
return ModuleId.Exit;
|
|
76
|
-
case 'ElectronBrowserViewQuickPick.createBrowserViewQuickPick':
|
|
77
|
-
case 'ElectronBrowserViewQuickPick.disposeBrowserViewQuickPick':
|
|
78
|
-
return ModuleId.ElectronBrowserViewQuickPick;
|
|
79
72
|
case 'ExtensionHost.dispose':
|
|
80
73
|
case 'ExtensionHost.enableExtension':
|
|
81
74
|
case 'ExtensionHost.executeCommand':
|
|
@@ -136,34 +129,6 @@ export const getModuleId = (commandId) => {
|
|
|
136
129
|
case 'ExtensionManagement.install':
|
|
137
130
|
case 'ExtensionManagement.uninstall':
|
|
138
131
|
return ModuleId.ExtensionManagement;
|
|
139
|
-
case 'ElectronBrowserViewFunctions.resizeBrowserView':
|
|
140
|
-
case 'ElectronBrowserViewFunctions.setIframeSrc':
|
|
141
|
-
case 'ElectronBrowserViewFunctions.focus':
|
|
142
|
-
case 'ElectronBrowserViewFunctions.openDevtools':
|
|
143
|
-
case 'ElectronBrowserViewFunctions.reload':
|
|
144
|
-
case 'ElectronBrowserViewFunctions.forward':
|
|
145
|
-
case 'ElectronBrowserViewFunctions.backward':
|
|
146
|
-
case 'ElectronBrowserViewFunctions.cancelNavigation':
|
|
147
|
-
case 'ElectronBrowserViewFunctions.hide':
|
|
148
|
-
case 'ElectronBrowserViewFunctions.inspectElement':
|
|
149
|
-
case 'ElectronBrowserViewFunctions.copyImageAt':
|
|
150
|
-
case 'ElectronBrowserViewFunctions.setFallthroughKeyBindings':
|
|
151
|
-
case 'ElectronBrowserViewFunctions.getStats':
|
|
152
|
-
return ModuleId.ElectronBrowserViewFunctions;
|
|
153
|
-
case 'ElectronWebContentsViewFunctions.resizeBrowserView':
|
|
154
|
-
case 'ElectronWebContentsViewFunctions.setIframeSrc':
|
|
155
|
-
case 'ElectronWebContentsViewFunctions.focus':
|
|
156
|
-
case 'ElectronWebContentsViewFunctions.openDevtools':
|
|
157
|
-
case 'ElectronWebContentsViewFunctions.reload':
|
|
158
|
-
case 'ElectronWebContentsViewFunctions.forward':
|
|
159
|
-
case 'ElectronWebContentsViewFunctions.backward':
|
|
160
|
-
case 'ElectronWebContentsViewFunctions.cancelNavigation':
|
|
161
|
-
case 'ElectronWebContentsViewFunctions.hide':
|
|
162
|
-
case 'ElectronWebContentsViewFunctions.inspectElement':
|
|
163
|
-
case 'ElectronWebContentsViewFunctions.copyImageAt':
|
|
164
|
-
case 'ElectronWebContentsViewFunctions.setFallthroughKeyBindings':
|
|
165
|
-
case 'ElectronWebContentsViewFunctions.getStats':
|
|
166
|
-
return ModuleId.ElectronWebContentsViewFunctions;
|
|
167
132
|
case 'FileSystem.chmod':
|
|
168
133
|
case 'FileSystem.copy':
|
|
169
134
|
case 'FileSystem.createFile':
|
|
@@ -177,10 +142,6 @@ export const getModuleId = (commandId) => {
|
|
|
177
142
|
case 'FileSystem.rename':
|
|
178
143
|
case 'FileSystem.writeFile':
|
|
179
144
|
return ModuleId.FileSystem;
|
|
180
|
-
case 'ElectronBrowserViewSuggestions.createBrowserView':
|
|
181
|
-
case 'ElectronBrowserViewSuggestions.disposeBrowserView':
|
|
182
|
-
case 'ElectronBrowserViewSuggestions.setSuggestions':
|
|
183
|
-
return ModuleId.ElectronBrowserViewSuggestions;
|
|
184
145
|
case 'GetTerminalSpawnOptions.getTerminalSpawnOptions':
|
|
185
146
|
return ModuleId.GetTerminalSpawnOptions;
|
|
186
147
|
case 'GitLsFiles.gitLsFiles':
|
|
@@ -309,17 +270,6 @@ export const getModuleId = (commandId) => {
|
|
|
309
270
|
return ModuleId.HandleRemoteRequest;
|
|
310
271
|
case 'HandleMessagePortForExtensionHostHelperProcess.handleMessagePortForExtensionHostHelperProcess':
|
|
311
272
|
return ModuleId.HandleMessagePortForExtensionHostHelperProcess;
|
|
312
|
-
case 'ElectronWebContents.dispose':
|
|
313
|
-
case 'ElectronWebContents.handleKeyBinding':
|
|
314
|
-
case 'ElectronWebContents.handleWindowOpen':
|
|
315
|
-
case 'ElectronWebContents.handleWillNavigate':
|
|
316
|
-
case 'ElectronWebContents.handleDidNavigate':
|
|
317
|
-
case 'ElectronWebContents.handleContextMenu':
|
|
318
|
-
case 'ElectronWebContents.handlePageTitleUpdated':
|
|
319
|
-
return ModuleId.ElectronWebContents;
|
|
320
|
-
case 'ElectronWebContentsView.createWebContentsView':
|
|
321
|
-
case 'ElectronWebContentsView.disposeWebContentsView':
|
|
322
|
-
return ModuleId.ElectronWebContentsView;
|
|
323
273
|
case 'HandleRequestTest.handleRequestTest':
|
|
324
274
|
return ModuleId.HandleRequestTest;
|
|
325
275
|
case 'ContentSecurityPolicy.set':
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.26.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-04-
|
|
44
|
+
export const version = '0.26.1';
|
|
45
|
+
export const commit = 'a044a77';
|
|
46
|
+
export const date = '2024-04-21T08:08:58.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewIpcState from '../ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js';
|
|
2
|
-
import * as ElectronBrowserViewState from '../ElectronBrowserViewState/ElectronBrowserViewState.js';
|
|
3
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
4
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
5
|
-
export const createBrowserView = async (ipc, restoreId, fallthroughKeyBindings) => {
|
|
6
|
-
const webContentsId = await ParentIpc.invoke('ElectronBrowserView.createBrowserView2', restoreId);
|
|
7
|
-
ElectronBrowserViewIpcState.add(webContentsId, ipc);
|
|
8
|
-
// TODO get window id from renderer worker
|
|
9
|
-
await ParentIpc.invoke('ElectronBrowserView.attachEventListeners', webContentsId);
|
|
10
|
-
await ParentIpc.invoke('ElectronBrowserViewFunctions.setBackgroundColor', webContentsId, 'white');
|
|
11
|
-
return webContentsId;
|
|
12
|
-
};
|
|
13
|
-
export const disposeBrowserView = async (id) => {
|
|
14
|
-
ElectronBrowserViewState.remove(id);
|
|
15
|
-
await ParentIpc.invoke('ElectronBrowserView.disposeBrowserView', id);
|
|
16
|
-
await ElectronWebContents.dispose(id);
|
|
17
|
-
};
|
|
18
|
-
export const handleBrowserViewCreated = (id) => {
|
|
19
|
-
console.log('created', id);
|
|
20
|
-
ElectronBrowserViewState.add(id);
|
|
21
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewFunctions from './ElectronBrowserViewFunctions.js';
|
|
2
|
-
export const name = 'ElectronBrowserViewFunctions';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
resizeBrowserView: ElectronBrowserViewFunctions.resizeBrowserView,
|
|
5
|
-
setIframeSrc: ElectronBrowserViewFunctions.setIframeSrc,
|
|
6
|
-
focus: ElectronBrowserViewFunctions.focus,
|
|
7
|
-
openDevtools: ElectronBrowserViewFunctions.openDevtools,
|
|
8
|
-
reload: ElectronBrowserViewFunctions.reload,
|
|
9
|
-
forward: ElectronBrowserViewFunctions.forward,
|
|
10
|
-
backward: ElectronBrowserViewFunctions.backward,
|
|
11
|
-
cancelNavigation: ElectronBrowserViewFunctions.cancelNavigation,
|
|
12
|
-
show: ElectronBrowserViewFunctions.show,
|
|
13
|
-
hide: ElectronBrowserViewFunctions.hide,
|
|
14
|
-
inspectElement: ElectronBrowserViewFunctions.inspectElement,
|
|
15
|
-
copyImageAt: ElectronBrowserViewFunctions.copyImageAt,
|
|
16
|
-
setFallthroughKeyBindings: ElectronBrowserViewFunctions.setFallthroughKeyBindings,
|
|
17
|
-
getStats: ElectronBrowserViewFunctions.getStats,
|
|
18
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
3
|
-
export const resizeBrowserView = (id, x, y, width, height) => {
|
|
4
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.resizeBrowserView', id, x, y, width, height);
|
|
5
|
-
};
|
|
6
|
-
export const setIframeSrc = async (id, iframeSrc) => {
|
|
7
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.setIframeSrc', id, iframeSrc);
|
|
8
|
-
};
|
|
9
|
-
const callFunction = (id, functionName) => {
|
|
10
|
-
return ParentIpc.invoke('ElectronWebContents.callFunction', id, functionName);
|
|
11
|
-
};
|
|
12
|
-
export const focus = ElectronWebContents.focus;
|
|
13
|
-
export const openDevtools = ElectronWebContents.openDevtools;
|
|
14
|
-
export const reload = ElectronWebContents.reload;
|
|
15
|
-
export const forward = ElectronWebContents.forward;
|
|
16
|
-
export const backward = ElectronWebContents.backward;
|
|
17
|
-
export const cancelNavigation = (id) => {
|
|
18
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.cancelNavigation', id);
|
|
19
|
-
};
|
|
20
|
-
export const show = (id) => {
|
|
21
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.show', id);
|
|
22
|
-
};
|
|
23
|
-
export const hide = (id) => {
|
|
24
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.hide', id);
|
|
25
|
-
};
|
|
26
|
-
export const inspectElement = ElectronWebContents.inspectElement;
|
|
27
|
-
export const copyImageAt = (id, x, y) => {
|
|
28
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.copyImageAt', id, x, y);
|
|
29
|
-
};
|
|
30
|
-
export const setFallthroughKeyBindings = (fallthroughKeyBindings) => {
|
|
31
|
-
return ParentIpc.invoke('ElectronBrowserViewFunctions.setFallthroughKeyBindings', fallthroughKeyBindings);
|
|
32
|
-
};
|
|
33
|
-
export const getStats = (id) => {
|
|
34
|
-
return ParentIpc.invoke('ElectronWebContents.getStats', id);
|
|
35
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const state = {
|
|
2
|
-
ipcMap: Object.create(null),
|
|
3
|
-
};
|
|
4
|
-
export const add = (id, ipc) => {
|
|
5
|
-
state.ipcMap[id] = ipc;
|
|
6
|
-
};
|
|
7
|
-
export const get = (id) => {
|
|
8
|
-
return state.ipcMap[id];
|
|
9
|
-
};
|
|
10
|
-
export const remove = (id) => {
|
|
11
|
-
delete state.ipcMap[id];
|
|
12
|
-
};
|
|
13
|
-
export const getAll = () => {
|
|
14
|
-
return Object.values(state.ipcMap);
|
|
15
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewQuickPick from './ElectronBrowserViewQuickPick.js';
|
|
2
|
-
export const name = 'ElectronBrowserViewQuickPick';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
startLogging: ElectronBrowserViewQuickPick.createBrowserViewQuickPick,
|
|
5
|
-
disposeBrowserViewQuickPick: ElectronBrowserViewQuickPick.disposeBrowserViewQuickPick,
|
|
6
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
export const createBrowserViewQuickPick = (x, y, width, height) => {
|
|
3
|
-
return ParentIpc.invoke('ElectronBrowserViewQuickPick.createBrowserViewQuickPick', x, y, width, height);
|
|
4
|
-
};
|
|
5
|
-
export const disposeBrowserViewQuickPick = () => {
|
|
6
|
-
return ParentIpc.invoke('ElectronBrowserViewQuickPick.disposeBrowserViewQuickPick');
|
|
7
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const state = {
|
|
2
|
-
browserViews: Object.create(null),
|
|
3
|
-
};
|
|
4
|
-
export const add = (id) => {
|
|
5
|
-
state.browserViews[id] = id;
|
|
6
|
-
};
|
|
7
|
-
export const remove = (id) => {
|
|
8
|
-
delete state.browserViews[id];
|
|
9
|
-
};
|
|
10
|
-
export const getAll = () => {
|
|
11
|
-
return Object.values(state.browserViews);
|
|
12
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewSuggestions from './ElectronBrowserViewSuggestions.js';
|
|
2
|
-
export const name = 'ElectronBrowserViewSuggestions';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
createBrowserView: ElectronBrowserViewSuggestions.createBrowserView,
|
|
5
|
-
disposeBrowserView: ElectronBrowserViewSuggestions.disposeBrowserView,
|
|
6
|
-
setSuggestions: ElectronBrowserViewSuggestions.setSuggestions,
|
|
7
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
export const createBrowserView = (x, y, width, height) => {
|
|
3
|
-
return ParentIpc.invoke('ElectronBrowserViewSuggestions.createBrowserView', x, y, width, height);
|
|
4
|
-
};
|
|
5
|
-
export const disposeBrowserView = () => {
|
|
6
|
-
return ParentIpc.invoke('ElectronBrowserViewSuggestions.disposeBrowserView');
|
|
7
|
-
};
|
|
8
|
-
export const setSuggestions = (suggestions) => {
|
|
9
|
-
return ParentIpc.invoke('ElectronBrowserViewSuggestions.setSuggestions', suggestions);
|
|
10
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as ElectronWebContents from './ElectronWebContents.js';
|
|
2
|
-
export const name = 'ElectronWebContents';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
dispose: ElectronWebContents.dispose,
|
|
5
|
-
handleKeyBinding: ElectronWebContents.handleKeyBinding,
|
|
6
|
-
handleWindowOpen: ElectronWebContents.handleWindowOpen,
|
|
7
|
-
handleWillNavigate: ElectronWebContents.handleWillNavigate,
|
|
8
|
-
handleDidNavigate: ElectronWebContents.handleDidNavigate,
|
|
9
|
-
handleContextMenu: ElectronWebContents.handleContextMenu,
|
|
10
|
-
handleTitleUpdated: ElectronWebContents.handleTitleUpdated,
|
|
11
|
-
handleBrowserViewDestroyed: ElectronWebContents.handleBrowserViewDestroyed, // TODO rename to webcontents
|
|
12
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewIpcState from '../ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js';
|
|
2
|
-
import * as ElectronBrowserViewState from '../ElectronBrowserViewState/ElectronBrowserViewState.js';
|
|
3
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
4
|
-
export const dispose = async (id) => {
|
|
5
|
-
await ParentIpc.invoke('ElectronWebContents.dispose', id);
|
|
6
|
-
};
|
|
7
|
-
export const callFunction = (webContentsId, method, ...params) => {
|
|
8
|
-
return ParentIpc.invoke(`ElectronWebContents.callFunction`, webContentsId, method, ...params);
|
|
9
|
-
};
|
|
10
|
-
export const focus = (webContentsId) => {
|
|
11
|
-
return callFunction(webContentsId, 'focus');
|
|
12
|
-
};
|
|
13
|
-
export const openDevtools = (webContentsId) => {
|
|
14
|
-
return callFunction(webContentsId, 'openDevTools');
|
|
15
|
-
};
|
|
16
|
-
export const reload = (webContentsId) => {
|
|
17
|
-
return callFunction(webContentsId, 'reload');
|
|
18
|
-
};
|
|
19
|
-
export const forward = (webContentsId) => {
|
|
20
|
-
return callFunction(webContentsId, 'goForward');
|
|
21
|
-
};
|
|
22
|
-
export const backward = (webContentsId) => {
|
|
23
|
-
return callFunction(webContentsId, 'goBack');
|
|
24
|
-
};
|
|
25
|
-
export const inspectElement = (webContentsId, x, y) => {
|
|
26
|
-
return callFunction(webContentsId, `inspectElement`, x, y);
|
|
27
|
-
};
|
|
28
|
-
export const handleWindowOpen = (webContentsId, url) => {
|
|
29
|
-
// TODO
|
|
30
|
-
};
|
|
31
|
-
const forwardEvent = (method, webContentsId, ...params) => {
|
|
32
|
-
const ipc = ElectronBrowserViewIpcState.get(webContentsId);
|
|
33
|
-
if (!ipc) {
|
|
34
|
-
console.log(`[shared-process] no ipc for webcontents ${webContentsId}`);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
ipc.send({
|
|
38
|
-
jsonrpc: '2.0',
|
|
39
|
-
method: `SimpleBrowser.${method}`,
|
|
40
|
-
params,
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
export const handleWillNavigate = (...args) => {
|
|
44
|
-
return forwardEvent('handleWillNavigate', ...args);
|
|
45
|
-
};
|
|
46
|
-
export const handleDidNavigate = (...args) => {
|
|
47
|
-
return forwardEvent('handleDidNavigate', ...args);
|
|
48
|
-
};
|
|
49
|
-
export const handleContextMenu = (...args) => {
|
|
50
|
-
return forwardEvent('handleContextMenu', ...args);
|
|
51
|
-
};
|
|
52
|
-
export const handleTitleUpdated = (...args) => {
|
|
53
|
-
return forwardEvent('handleTitleUpdated', ...args);
|
|
54
|
-
};
|
|
55
|
-
export const handleKeyBinding = (...args) => {
|
|
56
|
-
forwardEvent('handleKeyBinding', ...args);
|
|
57
|
-
};
|
|
58
|
-
export const handleBrowserViewDestroyed = (id) => {
|
|
59
|
-
ElectronBrowserViewState.remove(id);
|
|
60
|
-
ElectronBrowserViewIpcState.remove(id);
|
|
61
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as ElectronWebContentsView from './ElectronWebContentsView.js';
|
|
2
|
-
export const name = 'ElectronWebContentsView';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
createWebContentsView: ElectronWebContentsView.createWebContentsView,
|
|
5
|
-
disposeWebContentsView: ElectronWebContentsView.disposeWebContentsView,
|
|
6
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ElectronBrowserViewIpcState from '../ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js';
|
|
2
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
3
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
4
|
-
import * as Assert from '../Assert/Assert.js';
|
|
5
|
-
export const createWebContentsView = async (ipc, restoreId, fallthroughKeyBindings) => {
|
|
6
|
-
Assert.object(ipc);
|
|
7
|
-
Assert.number(restoreId);
|
|
8
|
-
const webContentsId = await ParentIpc.invoke('ElectronWebContentsView.createWebContentsView', restoreId);
|
|
9
|
-
ElectronBrowserViewIpcState.add(webContentsId, ipc);
|
|
10
|
-
// TODO get window id from renderer worker
|
|
11
|
-
await ParentIpc.invoke('ElectronWebContentsView.attachEventListeners', webContentsId);
|
|
12
|
-
await ParentIpc.invoke('ElectronWebContentsViewFunctions.setBackgroundColor', webContentsId, 'white');
|
|
13
|
-
return webContentsId;
|
|
14
|
-
};
|
|
15
|
-
export const disposeWebContentsView = async (id) => {
|
|
16
|
-
await ParentIpc.invoke('ElectronWebContentsView.disposeWebContentsView', id);
|
|
17
|
-
await ElectronWebContents.dispose(id);
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as ElectronWebContentsViewFunctions from './ElectronWebContentsViewFunctions.js';
|
|
2
|
-
export const name = 'ElectronWebContentsViewFunctions';
|
|
3
|
-
export const Commands = {
|
|
4
|
-
resizeBrowserView: ElectronWebContentsViewFunctions.resizeBrowserView,
|
|
5
|
-
setIframeSrc: ElectronWebContentsViewFunctions.setIframeSrc,
|
|
6
|
-
focus: ElectronWebContentsViewFunctions.focus,
|
|
7
|
-
openDevtools: ElectronWebContentsViewFunctions.openDevtools,
|
|
8
|
-
reload: ElectronWebContentsViewFunctions.reload,
|
|
9
|
-
forward: ElectronWebContentsViewFunctions.forward,
|
|
10
|
-
backward: ElectronWebContentsViewFunctions.backward,
|
|
11
|
-
cancelNavigation: ElectronWebContentsViewFunctions.cancelNavigation,
|
|
12
|
-
show: ElectronWebContentsViewFunctions.show,
|
|
13
|
-
hide: ElectronWebContentsViewFunctions.hide,
|
|
14
|
-
inspectElement: ElectronWebContentsViewFunctions.inspectElement,
|
|
15
|
-
copyImageAt: ElectronWebContentsViewFunctions.copyImageAt,
|
|
16
|
-
setFallthroughKeyBindings: ElectronWebContentsViewFunctions.setFallthroughKeyBindings,
|
|
17
|
-
getStats: ElectronWebContentsViewFunctions.getStats,
|
|
18
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
2
|
-
import * as ElectronWebContents from '../ElectronWebContents/ElectronWebContents.js';
|
|
3
|
-
export const resizeBrowserView = (id, x, y, width, height) => {
|
|
4
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.resizeBrowserView', id, x, y, width, height);
|
|
5
|
-
};
|
|
6
|
-
export const setIframeSrc = async (id, iframeSrc) => {
|
|
7
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.setIframeSrc', id, iframeSrc);
|
|
8
|
-
};
|
|
9
|
-
const callFunction = (id, functionName) => {
|
|
10
|
-
return ParentIpc.invoke('ElectronWebContents.callFunction', id, functionName);
|
|
11
|
-
};
|
|
12
|
-
export const focus = ElectronWebContents.focus;
|
|
13
|
-
export const openDevtools = ElectronWebContents.openDevtools;
|
|
14
|
-
export const reload = ElectronWebContents.reload;
|
|
15
|
-
export const forward = ElectronWebContents.forward;
|
|
16
|
-
export const backward = ElectronWebContents.backward;
|
|
17
|
-
export const cancelNavigation = (id) => {
|
|
18
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.cancelNavigation', id);
|
|
19
|
-
};
|
|
20
|
-
export const show = (id) => {
|
|
21
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.show', id);
|
|
22
|
-
};
|
|
23
|
-
export const hide = (id) => {
|
|
24
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.hide', id);
|
|
25
|
-
};
|
|
26
|
-
export const inspectElement = ElectronWebContents.inspectElement;
|
|
27
|
-
export const copyImageAt = (id, x, y) => {
|
|
28
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.copyImageAt', id, x, y);
|
|
29
|
-
};
|
|
30
|
-
export const setFallthroughKeyBindings = (fallthroughKeyBindings) => {
|
|
31
|
-
return ParentIpc.invoke('ElectronWebContentsViewFunctions.setFallthroughKeyBindings', fallthroughKeyBindings);
|
|
32
|
-
};
|
|
33
|
-
export const getStats = (id) => {
|
|
34
|
-
return ParentIpc.invoke('ElectronWebContents.getStats', id);
|
|
35
|
-
};
|