@lvce-editor/shared-process 0.20.14 → 0.20.15
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 +5 -5
- package/src/parts/AppWindow/AppWindow.js +46 -0
- package/src/parts/AppWindowStates/AppWindowStates.js +62 -0
- package/src/parts/Authority/Authority.js +1 -0
- package/src/parts/DefaultUrl/DefaultUrl.js +4 -0
- package/src/parts/Module/Module.js +2 -0
- package/src/parts/ModuleId/ModuleId.js +1 -0
- package/src/parts/ModuleMap/ModuleMap.js +4 -0
- package/src/parts/Platform/Platform.js +5 -3
- package/src/parts/Screen/Screen.ipc.js +9 -0
- package/src/parts/Screen/Screen.js +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.15",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/code-frame": "^7.23.5",
|
|
21
|
-
"@lvce-editor/extension-host": "0.20.
|
|
22
|
-
"@lvce-editor/extension-host-helper-process": "0.20.
|
|
21
|
+
"@lvce-editor/extension-host": "0.20.15",
|
|
22
|
+
"@lvce-editor/extension-host-helper-process": "0.20.15",
|
|
23
23
|
"@lvce-editor/json-rpc": "^0.4.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "^1.1.0",
|
|
25
25
|
"@lvce-editor/pretty-error": "^1.2.2",
|
|
26
|
-
"@lvce-editor/pty-host": "0.20.
|
|
26
|
+
"@lvce-editor/pty-host": "0.20.15",
|
|
27
27
|
"@lvce-editor/verror": "^1.1.2",
|
|
28
28
|
"debug": "^4.3.4",
|
|
29
29
|
"execa": "^8.0.1",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"p-queue": "^8.0.0",
|
|
35
35
|
"parse-json": "^8.1.0",
|
|
36
36
|
"tar-fs": "^3.0.4",
|
|
37
|
-
"ws": "^8.
|
|
37
|
+
"ws": "^8.15.0",
|
|
38
38
|
"xdg-basedir": "^5.1.0"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as DefaultUrl from '../DefaultUrl/DefaultUrl.js'
|
|
2
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
3
|
+
import * as Platform from '../Platform/Platform.js'
|
|
4
|
+
import * as Preferences from '../Preferences/Preferences.js'
|
|
5
|
+
import * as Screen from '../Screen/Screen.js'
|
|
6
|
+
|
|
7
|
+
const getWindowOptions = async (preferencs, screenWidth, screenHeight) => {
|
|
8
|
+
const titleBarPreference = preferencs['window.titleBarStyle']
|
|
9
|
+
const frame = titleBarPreference !== 'custom'
|
|
10
|
+
const titleBarStyle = titleBarPreference === 'custom' ? 'hidden' : undefined
|
|
11
|
+
const zoomLevelPreference = preferencs['window.zoomLevel']
|
|
12
|
+
const zoomLevel = zoomLevelPreference
|
|
13
|
+
const windowControlsOverlayPreference = Platform.isWindows && preferencs['window.controlsOverlay.enabled']
|
|
14
|
+
|
|
15
|
+
const titleBarOverlay = windowControlsOverlayPreference
|
|
16
|
+
? {
|
|
17
|
+
color: '#1e2324',
|
|
18
|
+
symbolColor: '#74b1be',
|
|
19
|
+
height: 29,
|
|
20
|
+
}
|
|
21
|
+
: undefined
|
|
22
|
+
return {
|
|
23
|
+
y: 0,
|
|
24
|
+
x: screenWidth - 800,
|
|
25
|
+
width: 800,
|
|
26
|
+
height: screenHeight,
|
|
27
|
+
menu: true,
|
|
28
|
+
background: '#1e2324',
|
|
29
|
+
titleBarStyle,
|
|
30
|
+
frame,
|
|
31
|
+
zoomLevel,
|
|
32
|
+
titleBarOverlay,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const createAppWindow = async (preferences, parsedArgs, workingDirectory, url = DefaultUrl.defaultUrl) => {
|
|
37
|
+
const screenWidth = await Screen.getWidth()
|
|
38
|
+
const screenHeight = await Screen.getHeight()
|
|
39
|
+
const windowOptions = getWindowOptions(preferences, screenWidth, screenHeight)
|
|
40
|
+
return ParentIpc.invoke('Appwindow.createAppWindow2', windowOptions, parsedArgs, workingDirectory, url)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const openNew = async (url) => {
|
|
44
|
+
const preferences = await Preferences.getAll()
|
|
45
|
+
return createAppWindow(preferences, [], '', url)
|
|
46
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const state = {
|
|
2
|
+
/**
|
|
3
|
+
* @type {any[]}
|
|
4
|
+
*/
|
|
5
|
+
windowStates: [],
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const findByWindowId = (windowId) => {
|
|
9
|
+
const { windowStates } = state
|
|
10
|
+
for (const windowState of windowStates) {
|
|
11
|
+
if (windowState.windowId === windowId) {
|
|
12
|
+
return windowState
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return undefined
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const findByWebContentsId = (webContentsId) => {
|
|
19
|
+
const { windowStates } = state
|
|
20
|
+
for (const windowState of windowStates) {
|
|
21
|
+
if (windowState.webContentsId === webContentsId) {
|
|
22
|
+
return windowState
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const findIndexById = (id) => {
|
|
29
|
+
const { windowStates } = state
|
|
30
|
+
for (let i = 0; i < windowStates.length; i++) {
|
|
31
|
+
const windowState = windowStates[i]
|
|
32
|
+
if (windowState.windowId === id) {
|
|
33
|
+
return i
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return -1
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const remove = (windowId) => {
|
|
40
|
+
const index = findIndexById(windowId)
|
|
41
|
+
if (index === -1) {
|
|
42
|
+
throw new Error(`expected window ${windowId} to be in windows array`)
|
|
43
|
+
}
|
|
44
|
+
state.windowStates.splice(index, 1)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const getAll = () => {
|
|
48
|
+
return state.windowStates
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const add = (config) => {
|
|
52
|
+
state.windowStates.push(config)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const findByPort = (port) => {
|
|
56
|
+
for (const config of state.windowStates) {
|
|
57
|
+
if (config.port === port) {
|
|
58
|
+
return config
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return undefined
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Authority = '-'
|
|
@@ -124,6 +124,8 @@ export const load = (moduleId) => {
|
|
|
124
124
|
return import('../Workspace/Workspace.ipc.js')
|
|
125
125
|
case ModuleId.ElectronNet:
|
|
126
126
|
return import('../ElectronNet/ElectronNet.ipc.js')
|
|
127
|
+
case ModuleId.Screen:
|
|
128
|
+
return import('../Screen/Screen.ipc.js')
|
|
127
129
|
default:
|
|
128
130
|
throw new Error(`module ${moduleId} not found`)
|
|
129
131
|
}
|
|
@@ -277,6 +277,10 @@ export const getModuleId = (commandId) => {
|
|
|
277
277
|
return ModuleId.Workspace
|
|
278
278
|
case 'ElectronNet.getJson':
|
|
279
279
|
return ModuleId.ElectronNet
|
|
280
|
+
case 'Screen.getWidth':
|
|
281
|
+
case 'Screen.getHeight':
|
|
282
|
+
case 'Screen.getBounds':
|
|
283
|
+
return ModuleId.Screen
|
|
280
284
|
default:
|
|
281
285
|
throw new CommandNotFoundError(commandId)
|
|
282
286
|
}
|
|
@@ -13,6 +13,8 @@ export const isMacOs = platform === 'darwin'
|
|
|
13
13
|
|
|
14
14
|
export const isDeb = false
|
|
15
15
|
|
|
16
|
+
export const scheme = 'lvce-oss'
|
|
17
|
+
|
|
16
18
|
export const getPathSeparator = () => {
|
|
17
19
|
return sep
|
|
18
20
|
}
|
|
@@ -51,11 +53,11 @@ export const getSetupName = () => {
|
|
|
51
53
|
return 'Lvce-Setup'
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
export const version = '0.20.
|
|
56
|
+
export const version = '0.20.15'
|
|
55
57
|
|
|
56
|
-
export const commit = '
|
|
58
|
+
export const commit = '7202220'
|
|
57
59
|
|
|
58
|
-
export const date = '2023-12-
|
|
60
|
+
export const date = '2023-12-10T20:01:56.000Z'
|
|
59
61
|
|
|
60
62
|
export const getVersion = () => {
|
|
61
63
|
return version
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
2
|
+
|
|
3
|
+
export const getWidth = () => {
|
|
4
|
+
return ParentIpc.invoke('Screen.getWidth')
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const getHeight = () => {
|
|
8
|
+
return ParentIpc.invoke('Screen.getHeight')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const getBounds = () => {
|
|
12
|
+
return ParentIpc.invoke('Screen.getBounds')
|
|
13
|
+
}
|