win_webview2 1.0.10 → 1.0.13
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 +15 -7
- package/tsDist/logprint.d.ts +1 -0
- package/tsDist/logprint.js +6 -0
- package/tsDist/srcBuilder/build_copyDir.d.ts +1 -0
- package/tsDist/srcBuilder/build_copyDir.js +24 -0
- package/tsDist/srcBuilder/builder_tp.d.ts +7 -0
- package/tsDist/srcBuilder/builder_tp.js +2 -0
- package/tsDist/srcBuilder/ww2_build_promp.d.ts +1 -0
- package/tsDist/srcBuilder/ww2_build_promp.js +31 -0
- package/tsDist/srcBuilder/ww2_buildercore.d.ts +14 -0
- package/tsDist/srcBuilder/ww2_buildercore.js +124 -0
- package/tsDist/tsExport/winwebview2.d.ts +28 -0
- package/tsDist/tsExport/winwebview2.js +105 -0
- package/tsDistRun.js +7 -0
- package/{ww2_builder_log.mjs → tsSrc/logprint.ts} +2 -2
- package/tsSrc/srcBuilder/build_copyDir.ts +32 -0
- package/tsSrc/srcBuilder/builder_tp.ts +7 -0
- package/tsSrc/srcBuilder/ww2_build_promp.ts +30 -0
- package/{ww2_builder_deploy.mjs → tsSrc/srcBuilder/ww2_buildercore.ts} +181 -184
- package/{winWebview2.mjs → tsSrc/tsExport/winwebview2.ts} +160 -162
- package/tsconfig.json +13 -0
- package/win_lib/Win32/CmdWebview2.exe +0 -0
- package/win_lib/Win32/splash.png +0 -0
- package/win_lib/x64/CmdWebview2.exe +0 -0
- package/win_lib/x64/splash.png +0 -0
- package/argtype.ts +0 -22
- package/winWebview2.d.ts +0 -19
- package/ww2_builder.mjs +0 -73
- package/ww2_builder_type.ts +0 -7
|
@@ -1,162 +1,160 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
//"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
export type OpenWebArg = {
|
|
5
|
+
url: string
|
|
6
|
+
width: number
|
|
7
|
+
height: number
|
|
8
|
+
kiosk: boolean
|
|
9
|
+
maximize: boolean
|
|
10
|
+
title: string
|
|
11
|
+
isDebugMode : boolean
|
|
12
|
+
winClassName : string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type OpenDialogFileArg = {
|
|
16
|
+
winClassName : string
|
|
17
|
+
filter : string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export type OpenDialogArg = {
|
|
22
|
+
winClassName : string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const jsonConfigFilePath = "./win_webview2.json";
|
|
26
|
+
async function readConfig() {
|
|
27
|
+
let str = await readFile(jsonConfigFilePath);
|
|
28
|
+
let jsonObj = JSON.parse(str.toString());
|
|
29
|
+
|
|
30
|
+
return jsonObj;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function getExecPath() {
|
|
34
|
+
let jsonConfig = await readConfig();
|
|
35
|
+
let exeFilePath = jsonConfig.appname + ".exe";
|
|
36
|
+
|
|
37
|
+
return exeFilePath;
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function openWeb(arg : OpenWebArg) {
|
|
42
|
+
let jsonConfig = await readConfig();
|
|
43
|
+
let exeFilePath = jsonConfig.appname + ".exe";
|
|
44
|
+
|
|
45
|
+
let arrOpen = [
|
|
46
|
+
"fun=openwebview",
|
|
47
|
+
"wndClassName=" + arg.winClassName,
|
|
48
|
+
"url=" + arg.url,
|
|
49
|
+
"width=" + arg.width,
|
|
50
|
+
"height=" + arg.height,
|
|
51
|
+
//"kiosk=true",
|
|
52
|
+
//"maximize=true",
|
|
53
|
+
"title=auto",
|
|
54
|
+
//"isDebugMode=true"
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
if (arg.maximize) {
|
|
58
|
+
arrOpen.push("maximize=true");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (arg.kiosk) {
|
|
62
|
+
|
|
63
|
+
arrOpen.push("kiosk=true");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (arg.isDebugMode) {
|
|
67
|
+
arrOpen.push("isDebugMode=true");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
execFile(exeFilePath, arrOpen, (err, data) => {
|
|
74
|
+
console.log( err)
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function openDialogFile(arg : OpenDialogFileArg) {
|
|
79
|
+
let exeFilePath = await getExecPath();
|
|
80
|
+
return new Promise((r, x) => {
|
|
81
|
+
execFile(exeFilePath,
|
|
82
|
+
[
|
|
83
|
+
"fun=openFileDialog",
|
|
84
|
+
"wndClassName="+arg.winClassName,
|
|
85
|
+
"filter=" + arg.filter,
|
|
86
|
+
|
|
87
|
+
], (/** @type {any} */ err, /** @type {string} */ data) => {
|
|
88
|
+
|
|
89
|
+
let filepath = "";
|
|
90
|
+
for (let l of data.split("\r\n")) {
|
|
91
|
+
if (l.startsWith("result:")) {
|
|
92
|
+
filepath = l.substring(7, l.length);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
r(filepath);
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function openDialogFolder(arg : OpenDialogArg) {
|
|
102
|
+
let exeFilePath = await getExecPath();
|
|
103
|
+
return new Promise((r, x) => {
|
|
104
|
+
execFile(exeFilePath,
|
|
105
|
+
[
|
|
106
|
+
"fun=openFolderDialog",
|
|
107
|
+
"wndClassName=" + arg.winClassName,
|
|
108
|
+
|
|
109
|
+
], (
|
|
110
|
+
/** @type {any} */
|
|
111
|
+
err,
|
|
112
|
+
/** @type {string} */
|
|
113
|
+
data
|
|
114
|
+
) => {
|
|
115
|
+
|
|
116
|
+
let filepath = "";
|
|
117
|
+
for (let l of data.split("\r\n")) {
|
|
118
|
+
if (l.startsWith("result:")) {
|
|
119
|
+
filepath = l.substring(7, l.length);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
r(filepath);
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export async function controlWindow(arg : {
|
|
129
|
+
winClassName: string,
|
|
130
|
+
controlcmd : "close" | "maximize" | "minimize" | "move" | "resize",
|
|
131
|
+
left : number,
|
|
132
|
+
top : number,
|
|
133
|
+
width : number,
|
|
134
|
+
height : number,
|
|
135
|
+
}) {
|
|
136
|
+
let exeFilePath = await getExecPath();
|
|
137
|
+
return new Promise((r, x) => {
|
|
138
|
+
execFile(exeFilePath,
|
|
139
|
+
[
|
|
140
|
+
"fun=controlwindow",
|
|
141
|
+
"wndClassName=" + arg.winClassName,
|
|
142
|
+
"controlcmd="+arg.controlcmd,
|
|
143
|
+
|
|
144
|
+
"left="+arg.left,
|
|
145
|
+
"top="+arg.top,
|
|
146
|
+
"width="+arg.width,
|
|
147
|
+
"height="+arg.height,
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
], (
|
|
151
|
+
/** @type {any} */
|
|
152
|
+
err,
|
|
153
|
+
/** @type {string} */
|
|
154
|
+
data) => {
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
r(data);
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
}
|
package/tsconfig.json
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/argtype.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type OpenWebArg = {
|
|
4
|
-
url: string
|
|
5
|
-
width: number
|
|
6
|
-
height: number
|
|
7
|
-
kiosk: boolean
|
|
8
|
-
maximize: boolean
|
|
9
|
-
title: string
|
|
10
|
-
isDebugMode : boolean
|
|
11
|
-
winClassName : string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type OpenDialogFileArg = {
|
|
15
|
-
winClassName : string
|
|
16
|
-
filter : string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export type OpenDialogArg = {
|
|
21
|
-
winClassName : string
|
|
22
|
-
}
|
package/winWebview2.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { OpenDialogArg, OpenDialogFileArg, OpenWebArg } from "./argtype";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Open WebView window via IPC
|
|
6
|
-
*/
|
|
7
|
-
export function openWeb(arg: OpenWebArg): void;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Open file dialog and return selected file path
|
|
11
|
-
*/
|
|
12
|
-
export function openDialogFile(arg: OpenDialogFileArg): Promise<string>;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Open folder dialog and return selected folder path
|
|
16
|
-
*/
|
|
17
|
-
export function openDialogFolder(arg : OpenDialogArg): Promise<string>;
|
|
18
|
-
export function closeWindowWebView(arg : OpenDialogArg): Promise<string>;
|
|
19
|
-
|
package/ww2_builder.mjs
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import prompts from "prompts";
|
|
5
|
-
import fs from 'fs'
|
|
6
|
-
import sharp from "sharp"
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { logPrint } from "./ww2_builder_log.mjs";
|
|
9
|
-
import { WW2Deploy } from "./ww2_builder_deploy.mjs";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/** @typedef {import("./ww2_builder_type").ConfigWW2} ConfigWW2 */
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @param {string} msg
|
|
17
|
-
* @param {string[]} list
|
|
18
|
-
* @returns {Promise<string>}
|
|
19
|
-
*/
|
|
20
|
-
async function askWhitList(msg, list) {
|
|
21
|
-
let p = await prompts([
|
|
22
|
-
{
|
|
23
|
-
type: 'select', // Tipe pertanyaan list (menu dropdown)
|
|
24
|
-
name: 'hasilnya',
|
|
25
|
-
message: msg,
|
|
26
|
-
choices: list.map((val) => {
|
|
27
|
-
let r = {
|
|
28
|
-
title: val,
|
|
29
|
-
value: val
|
|
30
|
-
}
|
|
31
|
-
return r
|
|
32
|
-
}), // Opsi
|
|
33
|
-
},
|
|
34
|
-
]);
|
|
35
|
-
return p.hasilnya;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
async function run() {
|
|
46
|
-
console.log("v-22");
|
|
47
|
-
|
|
48
|
-
let p = await askWhitList("menu", [
|
|
49
|
-
"init_webview2",
|
|
50
|
-
"deploy",
|
|
51
|
-
"back",
|
|
52
|
-
"exit"
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
|
-
if (p == "init_webview2") {
|
|
56
|
-
|
|
57
|
-
await WW2Deploy.initWW2();
|
|
58
|
-
|
|
59
|
-
} else if (p == "deploy") {
|
|
60
|
-
await WW2Deploy.startDeploy();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (p == "exit") {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
run();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
run();
|