js-dos 8.1.5 → 8.1.7
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/dist/emulators/emulators.js +2 -0
- package/dist/emulators/emulators.js.map +1 -0
- package/dist/emulators/types/build.d.ts +28 -0
- package/dist/emulators/types/dos/bundle/dos-bundle.d.ts +20 -0
- package/dist/emulators/types/dos/dosbox/ts/direct.d.ts +3 -0
- package/dist/emulators/types/dos/dosbox/ts/worker.d.ts +3 -0
- package/dist/emulators/types/emulators.d.ts +76 -0
- package/dist/emulators/types/http.d.ts +9 -0
- package/dist/emulators/types/impl/ci-impl.d.ts +29 -0
- package/dist/emulators/types/impl/emulators-impl.d.ts +26 -0
- package/dist/emulators/types/impl/modules.d.ts +38 -0
- package/dist/emulators/types/libzip/libzip.d.ts +16 -0
- package/dist/emulators/types/protocol/messages-queue.d.ts +8 -0
- package/dist/emulators/types/protocol/protocol.d.ts +128 -0
- package/dist/emulators/wdosbox-x.js +55 -0
- package/dist/emulators/wdosbox-x.js.symbols +8760 -0
- package/dist/emulators/wdosbox-x.wasm +0 -0
- package/dist/emulators/wdosbox.js +55 -0
- package/dist/emulators/wdosbox.js.symbols +3001 -0
- package/dist/emulators/wdosbox.wasm +0 -0
- package/dist/emulators/wlibzip.js +21 -0
- package/dist/emulators/wlibzip.js.symbols +268 -0
- package/dist/emulators/wlibzip.wasm +0 -0
- package/dist/js-dos.css +1 -0
- package/dist/js-dos.js +22 -0
- package/dist/js-dos.js.map +1 -0
- package/package.json +1 -1
- package/release.zip +0 -0
- package/.eslintrc.json +0 -43
- package/.github/workflows/build.yml +0 -51
- package/.gitmodules +0 -4
- package/index.html +0 -110
- package/postcss.config.cjs +0 -8
- package/src/app.css +0 -14
- package/src/base.css +0 -10
- package/src/components/checkbox.tsx +0 -41
- package/src/components/close-button.tsx +0 -17
- package/src/components/components.css +0 -28
- package/src/components/dos-option-checkbox.tsx +0 -94
- package/src/components/dos-option-select.tsx +0 -108
- package/src/components/dos-option-slider.tsx +0 -35
- package/src/components/error.tsx +0 -16
- package/src/components/loading.tsx +0 -26
- package/src/components/lock.tsx +0 -10
- package/src/components/select.tsx +0 -33
- package/src/components/slider.tsx +0 -69
- package/src/download-file.ts +0 -18
- package/src/frame/account-frame.tsx +0 -156
- package/src/frame/editor/defaults.ts +0 -419
- package/src/frame/editor/editor-conf-frame.tsx +0 -227
- package/src/frame/editor/editor-frame.css +0 -55
- package/src/frame/editor/editor-fs-frame.tsx +0 -314
- package/src/frame/fat-drives-frame.tsx +0 -199
- package/src/frame/frame.css +0 -119
- package/src/frame/frame.tsx +0 -34
- package/src/frame/image-rendering-frame.tsx +0 -8
- package/src/frame/network-frame.tsx +0 -157
- package/src/frame/quick-save-frame.tsx +0 -98
- package/src/frame/settings-frame.tsx +0 -14
- package/src/frame/stats-frame.tsx +0 -87
- package/src/host/bundle-storage.ts +0 -91
- package/src/host/fullscreen.ts +0 -35
- package/src/host/lcache.ts +0 -203
- package/src/host/lstorage.ts +0 -156
- package/src/i18n.ts +0 -185
- package/src/index.css +0 -7
- package/src/load.ts +0 -132
- package/src/login/login.css +0 -9
- package/src/login/login.tsx +0 -77
- package/src/main.tsx +0 -197
- package/src/public/types.ts +0 -45
- package/src/sidebar/account-button.tsx +0 -33
- package/src/sidebar/cloud-save-button.tsx +0 -89
- package/src/sidebar/diskette-icon.tsx +0 -14
- package/src/sidebar/fullscreen-button.tsx +0 -44
- package/src/sidebar/network-button.tsx +0 -39
- package/src/sidebar/sidebar-button.tsx +0 -244
- package/src/sidebar/sidebar.css +0 -47
- package/src/sidebar/sidebar.tsx +0 -30
- package/src/sockdrive/LICENSE +0 -674
- package/src/sockdrive/README.md +0 -45
- package/src/sockdrive/include/sockdrive.h +0 -23
- package/src/sockdrive/js/.eslintrc.json +0 -43
- package/src/sockdrive/js/package.json +0 -29
- package/src/sockdrive/js/src/fatfs/chains.js +0 -318
- package/src/sockdrive/js/src/fatfs/dir.js +0 -385
- package/src/sockdrive/js/src/fatfs/helpers.js +0 -210
- package/src/sockdrive/js/src/fatfs/index.js +0 -606
- package/src/sockdrive/js/src/fatfs/structs.js +0 -255
- package/src/sockdrive/js/src/fatfs/vol.js +0 -166
- package/src/sockdrive/js/src/sockdrive/cache.ts +0 -56
- package/src/sockdrive/js/src/sockdrive/drive.ts +0 -471
- package/src/sockdrive/js/src/sockdrive/lru.ts +0 -221
- package/src/sockdrive/js/src/sockdrive/types.ts +0 -14
- package/src/sockdrive/js/src/sockdrive-fat.d.ts +0 -64
- package/src/sockdrive/js/src/sockdrive-fat.ts +0 -226
- package/src/sockdrive/js/src/sockdrive-native.ts +0 -100
- package/src/sockdrive/js/src/test/test.ts +0 -289
- package/src/sockdrive/js/tsconfig.json +0 -11
- package/src/sockdrive/js/webpack.config.js +0 -68
- package/src/sockdrive/js/yarn.lock +0 -1808
- package/src/store/auth.ts +0 -115
- package/src/store/dos.ts +0 -305
- package/src/store/editor.ts +0 -61
- package/src/store/init.ts +0 -48
- package/src/store/storage.ts +0 -32
- package/src/store/ui.ts +0 -191
- package/src/store.tsx +0 -116
- package/src/ui.tsx +0 -140
- package/src/v8/changes.ts +0 -56
- package/src/v8/config.ts +0 -20
- package/src/v8/subscriptions.ts +0 -62
- package/src/vite-env.d.ts +0 -5
- package/src/window/dos/controls/keyboard.ts +0 -32
- package/src/window/dos/controls/keys.ts +0 -331
- package/src/window/dos/controls/mouse/mount.ts +0 -99
- package/src/window/dos/controls/mouse/mouse-locked.ts +0 -51
- package/src/window/dos/controls/mouse/mouse-not-locked.ts +0 -84
- package/src/window/dos/controls/mouse/mouse-swipe.ts +0 -57
- package/src/window/dos/controls/mouse/pointer.ts +0 -85
- package/src/window/dos/controls/mouse.ts +0 -21
- package/src/window/dos/dos-dhry2.tsx +0 -191
- package/src/window/dos/dos-runtime.tsx +0 -216
- package/src/window/dos/dos-window.tsx +0 -91
- package/src/window/dos/render/canvas.ts +0 -65
- package/src/window/dos/render/resize.ts +0 -31
- package/src/window/dos/render/webgl.ts +0 -173
- package/src/window/dos/sound/audio-node.ts +0 -148
- package/src/window/error-window.tsx +0 -9
- package/src/window/loading-window.tsx +0 -54
- package/src/window/prerun-window.tsx +0 -121
- package/src/window/select-window.tsx +0 -118
- package/src/window/window.css +0 -78
- package/src/window/window.tsx +0 -49
- package/src/ws/ws-sockdrive.ts +0 -123
- package/src/ws/ws-transport-layer.ts +0 -468
- package/tailwind.config.cjs +0 -48
- package/tsconfig.json +0 -32
- package/tsconfig.node.json +0 -9
- package/vite.config.ts +0 -25
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
|
-
|
|
3
|
-
export const KBD_NONE = 0;
|
|
4
|
-
export const KBD_0 = 48;
|
|
5
|
-
export const KBD_1 = 49;
|
|
6
|
-
export const KBD_2 = 50;
|
|
7
|
-
export const KBD_3 = 51;
|
|
8
|
-
export const KBD_4 = 52;
|
|
9
|
-
export const KBD_5 = 53;
|
|
10
|
-
export const KBD_6 = 54;
|
|
11
|
-
export const KBD_7 = 55;
|
|
12
|
-
export const KBD_8 = 56;
|
|
13
|
-
export const KBD_9 = 57;
|
|
14
|
-
export const KBD_a = 65;
|
|
15
|
-
export const KBD_b = 66;
|
|
16
|
-
export const KBD_c = 67;
|
|
17
|
-
export const KBD_d = 68;
|
|
18
|
-
export const KBD_e = 69;
|
|
19
|
-
export const KBD_f = 70;
|
|
20
|
-
export const KBD_g = 71;
|
|
21
|
-
export const KBD_h = 72;
|
|
22
|
-
export const KBD_i = 73;
|
|
23
|
-
export const KBD_j = 74;
|
|
24
|
-
export const KBD_k = 75;
|
|
25
|
-
export const KBD_l = 76;
|
|
26
|
-
export const KBD_m = 77;
|
|
27
|
-
export const KBD_n = 78;
|
|
28
|
-
export const KBD_o = 79;
|
|
29
|
-
export const KBD_p = 80;
|
|
30
|
-
export const KBD_q = 81;
|
|
31
|
-
export const KBD_r = 82;
|
|
32
|
-
export const KBD_s = 83;
|
|
33
|
-
export const KBD_t = 84;
|
|
34
|
-
export const KBD_u = 85;
|
|
35
|
-
export const KBD_v = 86;
|
|
36
|
-
export const KBD_w = 87;
|
|
37
|
-
export const KBD_x = 88;
|
|
38
|
-
export const KBD_y = 89;
|
|
39
|
-
export const KBD_z = 90;
|
|
40
|
-
export const KBD_f1 = 290;
|
|
41
|
-
export const KBD_f2 = 291;
|
|
42
|
-
export const KBD_f3 = 292;
|
|
43
|
-
export const KBD_f4 = 293;
|
|
44
|
-
export const KBD_f5 = 294;
|
|
45
|
-
export const KBD_f6 = 295;
|
|
46
|
-
export const KBD_f7 = 296;
|
|
47
|
-
export const KBD_f8 = 297;
|
|
48
|
-
export const KBD_f9 = 298;
|
|
49
|
-
export const KBD_f10 = 299;
|
|
50
|
-
export const KBD_f11 = 300;
|
|
51
|
-
export const KBD_f12 = 301;
|
|
52
|
-
|
|
53
|
-
export const KBD_kp0 = 320;
|
|
54
|
-
export const KBD_kp1 = 321;
|
|
55
|
-
export const KBD_kp2 = 322;
|
|
56
|
-
export const KBD_kp3 = 323;
|
|
57
|
-
export const KBD_kp4 = 324;
|
|
58
|
-
export const KBD_kp5 = 325;
|
|
59
|
-
export const KBD_kp6 = 326;
|
|
60
|
-
export const KBD_kp7 = 327;
|
|
61
|
-
export const KBD_kp8 = 328;
|
|
62
|
-
export const KBD_kp9 = 329;
|
|
63
|
-
|
|
64
|
-
export const KBD_kpperiod = 330;
|
|
65
|
-
export const KBD_kpdivide = 331;
|
|
66
|
-
export const KBD_kpmultiply = 332;
|
|
67
|
-
export const KBD_kpminus = 333;
|
|
68
|
-
export const KBD_kpplus = 334;
|
|
69
|
-
export const KBD_kpenter = 335;
|
|
70
|
-
|
|
71
|
-
export const KBD_esc = 256;
|
|
72
|
-
export const KBD_tab = 258;
|
|
73
|
-
export const KBD_backspace = 259;
|
|
74
|
-
export const KBD_enter = 257;
|
|
75
|
-
export const KBD_space = 32;
|
|
76
|
-
export const KBD_leftalt = 342;
|
|
77
|
-
export const KBD_rightalt = 346;
|
|
78
|
-
export const KBD_leftctrl = 341;
|
|
79
|
-
export const KBD_rightctrl = 345;
|
|
80
|
-
export const KBD_leftshift = 340;
|
|
81
|
-
export const KBD_rightshift = 344;
|
|
82
|
-
export const KBD_capslock = 280;
|
|
83
|
-
export const KBD_scrolllock = 281;
|
|
84
|
-
export const KBD_numlock = 282;
|
|
85
|
-
export const KBD_grave = 96;
|
|
86
|
-
export const KBD_minus = 45;
|
|
87
|
-
export const KBD_equals = 61;
|
|
88
|
-
export const KBD_backslash = 92;
|
|
89
|
-
export const KBD_leftbracket = 91;
|
|
90
|
-
export const KBD_rightbracket = 93;
|
|
91
|
-
export const KBD_semicolon = 59;
|
|
92
|
-
export const KBD_quote = 39;
|
|
93
|
-
export const KBD_period = 46;
|
|
94
|
-
export const KBD_comma = 44;
|
|
95
|
-
export const KBD_slash = 47;
|
|
96
|
-
export const KBD_printscreen = 283;
|
|
97
|
-
export const KBD_pause = 284;
|
|
98
|
-
export const KBD_insert = 260;
|
|
99
|
-
export const KBD_home = 268;
|
|
100
|
-
export const KBD_pageup = 266;
|
|
101
|
-
export const KBD_delete = 261;
|
|
102
|
-
export const KBD_end = 269;
|
|
103
|
-
export const KBD_pagedown = 267;
|
|
104
|
-
export const KBD_left = 263;
|
|
105
|
-
export const KBD_up = 265;
|
|
106
|
-
export const KBD_down = 264;
|
|
107
|
-
export const KBD_right = 262;
|
|
108
|
-
export const KBD_extra_lt_gt = 348; // ???
|
|
109
|
-
|
|
110
|
-
export const domToKeyCodes: {[index: number]: number} = {
|
|
111
|
-
8: KBD_backspace,
|
|
112
|
-
9: KBD_tab,
|
|
113
|
-
13: KBD_enter,
|
|
114
|
-
16: KBD_leftshift,
|
|
115
|
-
17: KBD_leftctrl,
|
|
116
|
-
18: KBD_leftalt,
|
|
117
|
-
19: KBD_pause,
|
|
118
|
-
27: KBD_esc,
|
|
119
|
-
32: KBD_space,
|
|
120
|
-
33: KBD_pageup,
|
|
121
|
-
34: KBD_pagedown,
|
|
122
|
-
35: KBD_end,
|
|
123
|
-
36: KBD_home,
|
|
124
|
-
37: KBD_left,
|
|
125
|
-
38: KBD_up,
|
|
126
|
-
39: KBD_right,
|
|
127
|
-
40: KBD_down,
|
|
128
|
-
45: KBD_insert,
|
|
129
|
-
46: KBD_delete,
|
|
130
|
-
48: KBD_0,
|
|
131
|
-
49: KBD_1,
|
|
132
|
-
50: KBD_2,
|
|
133
|
-
51: KBD_3,
|
|
134
|
-
52: KBD_4,
|
|
135
|
-
53: KBD_5,
|
|
136
|
-
54: KBD_6,
|
|
137
|
-
55: KBD_7,
|
|
138
|
-
56: KBD_8,
|
|
139
|
-
57: KBD_9,
|
|
140
|
-
59: KBD_semicolon,
|
|
141
|
-
64: KBD_equals,
|
|
142
|
-
65: KBD_a,
|
|
143
|
-
66: KBD_b,
|
|
144
|
-
67: KBD_c,
|
|
145
|
-
68: KBD_d,
|
|
146
|
-
69: KBD_e,
|
|
147
|
-
70: KBD_f,
|
|
148
|
-
71: KBD_g,
|
|
149
|
-
72: KBD_h,
|
|
150
|
-
73: KBD_i,
|
|
151
|
-
74: KBD_j,
|
|
152
|
-
75: KBD_k,
|
|
153
|
-
76: KBD_l,
|
|
154
|
-
77: KBD_m,
|
|
155
|
-
78: KBD_n,
|
|
156
|
-
79: KBD_o,
|
|
157
|
-
80: KBD_p,
|
|
158
|
-
81: KBD_q,
|
|
159
|
-
82: KBD_r,
|
|
160
|
-
83: KBD_s,
|
|
161
|
-
84: KBD_t,
|
|
162
|
-
85: KBD_u,
|
|
163
|
-
86: KBD_v,
|
|
164
|
-
87: KBD_w,
|
|
165
|
-
88: KBD_x,
|
|
166
|
-
89: KBD_y,
|
|
167
|
-
90: KBD_z,
|
|
168
|
-
91: KBD_leftbracket,
|
|
169
|
-
93: KBD_rightbracket,
|
|
170
|
-
96: KBD_kp0,
|
|
171
|
-
97: KBD_kp1,
|
|
172
|
-
98: KBD_kp2,
|
|
173
|
-
99: KBD_kp3,
|
|
174
|
-
100: KBD_kp4,
|
|
175
|
-
101: KBD_kp5,
|
|
176
|
-
102: KBD_kp6,
|
|
177
|
-
103: KBD_kp7,
|
|
178
|
-
104: KBD_kp8,
|
|
179
|
-
105: KBD_kp9,
|
|
180
|
-
// 106: KBD_kpmultiply,
|
|
181
|
-
// 107: KBD_kpadd,
|
|
182
|
-
// 109: KBD_kpsubtract,
|
|
183
|
-
// 110: KBD_kpdecimal,
|
|
184
|
-
111: KBD_kpdivide,
|
|
185
|
-
112: KBD_f1,
|
|
186
|
-
113: KBD_f2,
|
|
187
|
-
114: KBD_f3,
|
|
188
|
-
115: KBD_f4,
|
|
189
|
-
116: KBD_f5,
|
|
190
|
-
117: KBD_f6,
|
|
191
|
-
118: KBD_f7,
|
|
192
|
-
119: KBD_f8,
|
|
193
|
-
120: KBD_f9,
|
|
194
|
-
121: KBD_f10,
|
|
195
|
-
122: KBD_f11,
|
|
196
|
-
123: KBD_f12,
|
|
197
|
-
144: KBD_numlock,
|
|
198
|
-
145: KBD_scrolllock,
|
|
199
|
-
173: KBD_minus,
|
|
200
|
-
186: KBD_semicolon,
|
|
201
|
-
187: KBD_equals,
|
|
202
|
-
188: KBD_comma,
|
|
203
|
-
189: KBD_minus,
|
|
204
|
-
190: KBD_period,
|
|
205
|
-
191: KBD_slash,
|
|
206
|
-
// 192: KBD_graveaccent,
|
|
207
|
-
219: KBD_leftbracket,
|
|
208
|
-
220: KBD_backslash,
|
|
209
|
-
221: KBD_rightbracket,
|
|
210
|
-
// 222: KBD_apostrophe,
|
|
211
|
-
// 224: KBD_left_super,
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export const namedKeyCodes: {[name: string]: number} = {
|
|
215
|
-
"KBD_NONE": KBD_NONE,
|
|
216
|
-
"KBD_0": KBD_0,
|
|
217
|
-
"KBD_1": KBD_1,
|
|
218
|
-
"KBD_2": KBD_2,
|
|
219
|
-
"KBD_3": KBD_3,
|
|
220
|
-
"KBD_4": KBD_4,
|
|
221
|
-
"KBD_5": KBD_5,
|
|
222
|
-
"KBD_6": KBD_6,
|
|
223
|
-
"KBD_7": KBD_7,
|
|
224
|
-
"KBD_8": KBD_8,
|
|
225
|
-
"KBD_9": KBD_9,
|
|
226
|
-
"KBD_a": KBD_a,
|
|
227
|
-
"KBD_b": KBD_b,
|
|
228
|
-
"KBD_c": KBD_c,
|
|
229
|
-
"KBD_d": KBD_d,
|
|
230
|
-
"KBD_e": KBD_e,
|
|
231
|
-
"KBD_f": KBD_f,
|
|
232
|
-
"KBD_g": KBD_g,
|
|
233
|
-
"KBD_h": KBD_h,
|
|
234
|
-
"KBD_i": KBD_i,
|
|
235
|
-
"KBD_j": KBD_j,
|
|
236
|
-
"KBD_k": KBD_k,
|
|
237
|
-
"KBD_l": KBD_l,
|
|
238
|
-
"KBD_m": KBD_m,
|
|
239
|
-
"KBD_n": KBD_n,
|
|
240
|
-
"KBD_o": KBD_o,
|
|
241
|
-
"KBD_p": KBD_p,
|
|
242
|
-
"KBD_q": KBD_q,
|
|
243
|
-
"KBD_r": KBD_r,
|
|
244
|
-
"KBD_s": KBD_s,
|
|
245
|
-
"KBD_t": KBD_t,
|
|
246
|
-
"KBD_u": KBD_u,
|
|
247
|
-
"KBD_v": KBD_v,
|
|
248
|
-
"KBD_w": KBD_w,
|
|
249
|
-
"KBD_x": KBD_x,
|
|
250
|
-
"KBD_y": KBD_y,
|
|
251
|
-
"KBD_z": KBD_z,
|
|
252
|
-
"KBD_f1": KBD_f1,
|
|
253
|
-
"KBD_f2": KBD_f2,
|
|
254
|
-
"KBD_f3": KBD_f3,
|
|
255
|
-
"KBD_f4": KBD_f4,
|
|
256
|
-
"KBD_f5": KBD_f5,
|
|
257
|
-
"KBD_f6": KBD_f6,
|
|
258
|
-
"KBD_f7": KBD_f7,
|
|
259
|
-
"KBD_f8": KBD_f8,
|
|
260
|
-
"KBD_f9": KBD_f9,
|
|
261
|
-
"KBD_f10": KBD_f10,
|
|
262
|
-
"KBD_f11": KBD_f11,
|
|
263
|
-
"KBD_f12": KBD_f12,
|
|
264
|
-
|
|
265
|
-
"KBD_kp0": KBD_kp0,
|
|
266
|
-
"KBD_kp1": KBD_kp1,
|
|
267
|
-
"KBD_kp2": KBD_kp2,
|
|
268
|
-
"KBD_kp3": KBD_kp3,
|
|
269
|
-
"KBD_kp4": KBD_kp4,
|
|
270
|
-
"KBD_kp5": KBD_kp5,
|
|
271
|
-
"KBD_kp6": KBD_kp6,
|
|
272
|
-
"KBD_kp7": KBD_kp7,
|
|
273
|
-
"KBD_kp8": KBD_kp8,
|
|
274
|
-
"KBD_kp9": KBD_kp9,
|
|
275
|
-
|
|
276
|
-
"KBD_kpperiod": KBD_kpperiod,
|
|
277
|
-
"KBD_kpdivide": KBD_kpdivide,
|
|
278
|
-
"KBD_kpmultiply": KBD_kpmultiply,
|
|
279
|
-
"KBD_kpminus": KBD_kpminus,
|
|
280
|
-
"KBD_kpplus": KBD_kpplus,
|
|
281
|
-
"KBD_kpenter": KBD_kpenter,
|
|
282
|
-
|
|
283
|
-
"KBD_esc": KBD_esc,
|
|
284
|
-
"KBD_tab": KBD_tab,
|
|
285
|
-
"KBD_backspace": KBD_backspace,
|
|
286
|
-
"KBD_enter": KBD_enter,
|
|
287
|
-
"KBD_space": KBD_space,
|
|
288
|
-
"KBD_leftalt": KBD_leftalt,
|
|
289
|
-
"KBD_rightalt": KBD_rightalt,
|
|
290
|
-
"KBD_leftctrl": KBD_leftctrl,
|
|
291
|
-
"KBD_rightctrl": KBD_rightctrl,
|
|
292
|
-
"KBD_leftshift": KBD_leftshift,
|
|
293
|
-
"KBD_rightshift": KBD_rightshift,
|
|
294
|
-
"KBD_capslock": KBD_capslock,
|
|
295
|
-
"KBD_scrolllock": KBD_scrolllock,
|
|
296
|
-
"KBD_numlock": KBD_numlock,
|
|
297
|
-
"KBD_grave": KBD_grave,
|
|
298
|
-
"KBD_minus": KBD_minus,
|
|
299
|
-
"KBD_equals": KBD_equals,
|
|
300
|
-
"KBD_backslash": KBD_backslash,
|
|
301
|
-
"KBD_leftbracket": KBD_leftbracket,
|
|
302
|
-
"KBD_rightbracket": KBD_rightbracket,
|
|
303
|
-
"KBD_semicolon": KBD_semicolon,
|
|
304
|
-
"KBD_quote": KBD_quote,
|
|
305
|
-
"KBD_period": KBD_period,
|
|
306
|
-
"KBD_comma": KBD_comma,
|
|
307
|
-
"KBD_slash": KBD_slash,
|
|
308
|
-
"KBD_printscreen": KBD_printscreen,
|
|
309
|
-
"KBD_pause": KBD_pause,
|
|
310
|
-
"KBD_insert": KBD_insert,
|
|
311
|
-
"KBD_home": KBD_home,
|
|
312
|
-
"KBD_pageup": KBD_pageup,
|
|
313
|
-
"KBD_delete": KBD_delete,
|
|
314
|
-
"KBD_end": KBD_end,
|
|
315
|
-
"KBD_pagedown": KBD_pagedown,
|
|
316
|
-
"KBD_left": KBD_left,
|
|
317
|
-
"KBD_up": KBD_up,
|
|
318
|
-
"KBD_down": KBD_down,
|
|
319
|
-
"KBD_right": KBD_right,
|
|
320
|
-
"KBD_extra_lt_gt": KBD_extra_lt_gt,
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
export const keyCodesToDom: {[index: number]: number} = {};
|
|
324
|
-
for (const next of Object.keys(domToKeyCodes)) {
|
|
325
|
-
const key = Number.parseInt(next, 10);
|
|
326
|
-
keyCodesToDom[domToKeyCodes[key]] = key;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export function domToKeyCode(domCode: number) {
|
|
330
|
-
return domToKeyCodes[domCode] || 0;
|
|
331
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { pointer, getPointerState } from "./pointer";
|
|
2
|
-
|
|
3
|
-
export function mount(el: HTMLElement,
|
|
4
|
-
pointerButton: number,
|
|
5
|
-
onMouseDown: (x: number, y: number, button: number) => void,
|
|
6
|
-
onMouseMove: (x: number, y: number, mX: number, mY: number) => void,
|
|
7
|
-
onMouseUp: (x: number, y: number, button: number) => void,
|
|
8
|
-
onMouseLeave: (x: number, y: number) => void) {
|
|
9
|
-
// eslint-disable-next-line
|
|
10
|
-
function preventDefaultIfNeeded(e: Event) {
|
|
11
|
-
// not needed yet
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
let pressedButton = 0;
|
|
15
|
-
const onStart = (e: Event) => {
|
|
16
|
-
if (e.target !== el) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const state = getPointerState(e, el);
|
|
21
|
-
pressedButton = state.button === undefined ? pointerButton : state.button;
|
|
22
|
-
onMouseDown(state.x, state.y, pressedButton);
|
|
23
|
-
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
preventDefaultIfNeeded(e);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const onChange = (e: Event) => {
|
|
29
|
-
if (e.target !== el) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const state = getPointerState(e, el);
|
|
34
|
-
onMouseMove(state.x, state.y, state.mX, state.mY);
|
|
35
|
-
e.stopPropagation();
|
|
36
|
-
preventDefaultIfNeeded(e);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const onEnd = (e: Event) => {
|
|
40
|
-
const state = getPointerState(e, el);
|
|
41
|
-
onMouseUp(state.x, state.y, pressedButton);
|
|
42
|
-
e.stopPropagation();
|
|
43
|
-
preventDefaultIfNeeded(e);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const onLeave = (e: Event) => {
|
|
47
|
-
if (e.target !== el) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const state = getPointerState(e, el);
|
|
52
|
-
onMouseLeave(state.x, state.y);
|
|
53
|
-
e.stopPropagation();
|
|
54
|
-
preventDefaultIfNeeded(e);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const onPrevent = (e: Event) => {
|
|
58
|
-
e.stopPropagation();
|
|
59
|
-
preventDefaultIfNeeded(e);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const options = {
|
|
63
|
-
capture: false,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
for (const next of pointer.starters) {
|
|
67
|
-
el.addEventListener(next, onStart, options);
|
|
68
|
-
}
|
|
69
|
-
for (const next of pointer.changers) {
|
|
70
|
-
el.addEventListener(next, onChange, options);
|
|
71
|
-
}
|
|
72
|
-
for (const next of pointer.enders) {
|
|
73
|
-
el.addEventListener(next, onEnd, options);
|
|
74
|
-
}
|
|
75
|
-
for (const next of pointer.prevents) {
|
|
76
|
-
el.addEventListener(next, onPrevent, options);
|
|
77
|
-
}
|
|
78
|
-
for (const next of pointer.leavers) {
|
|
79
|
-
el.addEventListener(next, onLeave, options);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return () => {
|
|
83
|
-
for (const next of pointer.starters) {
|
|
84
|
-
el.removeEventListener(next, onStart, options);
|
|
85
|
-
}
|
|
86
|
-
for (const next of pointer.changers) {
|
|
87
|
-
el.removeEventListener(next, onChange, options);
|
|
88
|
-
}
|
|
89
|
-
for (const next of pointer.enders) {
|
|
90
|
-
el.removeEventListener(next, onEnd, options);
|
|
91
|
-
}
|
|
92
|
-
for (const next of pointer.prevents) {
|
|
93
|
-
el.removeEventListener(next, onPrevent, options);
|
|
94
|
-
}
|
|
95
|
-
for (const next of pointer.leavers) {
|
|
96
|
-
el.removeEventListener(next, onLeave, options);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { CommandInterface } from "emulators";
|
|
2
|
-
import { mount } from "./mount";
|
|
3
|
-
|
|
4
|
-
export function mouseCapture(sensitivity: number,
|
|
5
|
-
pointerButton: number,
|
|
6
|
-
el: HTMLElement,
|
|
7
|
-
ci: CommandInterface) {
|
|
8
|
-
function isNotLocked() {
|
|
9
|
-
return document.pointerLockElement !== el;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function onMouseDown(x: number, y: number, button: number) {
|
|
13
|
-
if (isNotLocked()) {
|
|
14
|
-
const requestPointerLock = el.requestPointerLock ||
|
|
15
|
-
(el as any).mozRequestPointerLock ||
|
|
16
|
-
(el as any).webkitRequestPointerLock;
|
|
17
|
-
|
|
18
|
-
requestPointerLock.call(el);
|
|
19
|
-
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
ci.sendMouseButton(button, true);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function onMouseUp(x: number, y: number, button: number) {
|
|
27
|
-
if (isNotLocked()) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
ci.sendMouseButton(button, false);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function onMouseMove(x: number, y: number, mX: number, mY: number) {
|
|
35
|
-
if (isNotLocked()) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (mX === 0 && mY === 0) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
(ci as any).sendMouseRelativeMotion(mX * sensitivity, mY * sensitivity);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function onMouseLeave(x: number, y: number) {
|
|
47
|
-
// nothing to do
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return mount(el, pointerButton, onMouseDown, onMouseMove, onMouseUp, onMouseLeave);
|
|
51
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { CommandInterface } from "emulators";
|
|
2
|
-
import { mount } from "./mount";
|
|
3
|
-
|
|
4
|
-
const insensitivePadding = 1 / 100;
|
|
5
|
-
|
|
6
|
-
export function mouseDefault(pointerNumber: number,
|
|
7
|
-
el: HTMLElement,
|
|
8
|
-
ci: CommandInterface) {
|
|
9
|
-
const mapXY = (x: number, y: number) => doMapXY(x, y, el, ci);
|
|
10
|
-
|
|
11
|
-
if (document.pointerLockElement === el) {
|
|
12
|
-
document.exitPointerLock();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function onMouseDown(x: number, y: number, button: number) {
|
|
16
|
-
const xy = mapXY(x, y);
|
|
17
|
-
ci.sendMouseMotion(xy.x, xy.y);
|
|
18
|
-
ci.sendMouseButton(button, true);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function onMouseUp(x: number, y: number, button: number) {
|
|
22
|
-
const xy = mapXY(x, y);
|
|
23
|
-
ci.sendMouseMotion(xy.x, xy.y);
|
|
24
|
-
ci.sendMouseButton(button, false);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function onMouseMove(x: number, y: number, mX: number, mY: number) {
|
|
28
|
-
const xy = mapXY(x, y);
|
|
29
|
-
ci.sendMouseMotion(xy.x, xy.y);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function onMouseLeave(x: number, y: number) {
|
|
33
|
-
const xy = mapXY(x, y);
|
|
34
|
-
ci.sendMouseMotion(xy.x, xy.y);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return mount(el, pointerNumber, onMouseDown, onMouseMove, onMouseUp, onMouseLeave);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function doMapXY(eX: number,
|
|
41
|
-
eY: number,
|
|
42
|
-
el: HTMLElement,
|
|
43
|
-
ci: CommandInterface) {
|
|
44
|
-
const { width: containerWidth, height: containerHeight } = el.getBoundingClientRect();
|
|
45
|
-
const frameWidth = ci.width();
|
|
46
|
-
const frameHeight = ci.height();
|
|
47
|
-
|
|
48
|
-
const aspect = frameWidth / frameHeight;
|
|
49
|
-
|
|
50
|
-
let width = containerWidth;
|
|
51
|
-
let height = containerWidth / aspect;
|
|
52
|
-
|
|
53
|
-
if (height > containerHeight) {
|
|
54
|
-
height = containerHeight;
|
|
55
|
-
width = containerHeight * aspect;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const top = (containerHeight - height) / 2;
|
|
59
|
-
const left = (containerWidth - width) / 2;
|
|
60
|
-
|
|
61
|
-
let x = Math.max(0, Math.min(1, (eX - left) / width));
|
|
62
|
-
let y = Math.max(0, Math.min(1, (eY - top) / height));
|
|
63
|
-
|
|
64
|
-
if (x <= insensitivePadding) {
|
|
65
|
-
x = 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (x >= (1 - insensitivePadding)) {
|
|
69
|
-
x = 1;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (y <= insensitivePadding) {
|
|
73
|
-
y = 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (y >= (1 - insensitivePadding)) {
|
|
77
|
-
y = 1;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
x,
|
|
82
|
-
y,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { CommandInterface } from "emulators";
|
|
2
|
-
import { mount } from "./mount";
|
|
3
|
-
|
|
4
|
-
const clickDelay = 500;
|
|
5
|
-
const clickThreshold = 50;
|
|
6
|
-
|
|
7
|
-
export function mouseSwipe(sensitivity: number,
|
|
8
|
-
pointerButton: number,
|
|
9
|
-
el: HTMLElement,
|
|
10
|
-
ci: CommandInterface) {
|
|
11
|
-
let startedAt = -1;
|
|
12
|
-
let acc = 0;
|
|
13
|
-
let prevX = 0;
|
|
14
|
-
let prevY = 0;
|
|
15
|
-
|
|
16
|
-
const onMouseDown = (x: number, y: number) => {
|
|
17
|
-
startedAt = Date.now();
|
|
18
|
-
acc = 0;
|
|
19
|
-
prevX = x;
|
|
20
|
-
prevY = y;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function onMouseMove(x: number, y: number, mX: number, mY: number) {
|
|
24
|
-
if (mX === undefined) {
|
|
25
|
-
mX = x - prevX;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (mY === undefined) {
|
|
29
|
-
mY = y - prevY;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
prevX = x;
|
|
33
|
-
prevY = y;
|
|
34
|
-
|
|
35
|
-
if (mX === 0 && mY === 0) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
acc += Math.abs(mX) + Math.abs(mY);
|
|
40
|
-
|
|
41
|
-
(ci as any).sendMouseRelativeMotion(mX * sensitivity * 2, mY * sensitivity * 2);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const onMouseUp = (x: number, y: number) => {
|
|
45
|
-
const delay = Date.now() - startedAt;
|
|
46
|
-
|
|
47
|
-
if (delay < clickDelay && acc < clickThreshold) {
|
|
48
|
-
const button = pointerButton ?? 0;
|
|
49
|
-
ci.sendMouseButton(button, true);
|
|
50
|
-
setTimeout(() => ci.sendMouseButton(button, false), 60);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const noop = () => {};
|
|
55
|
-
|
|
56
|
-
return mount(el, pointerButton, onMouseDown, onMouseMove, onMouseUp, noop);
|
|
57
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
function initBind() {
|
|
2
|
-
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
3
|
-
const isTouch = isMobile && !!("ontouchstart" in window);
|
|
4
|
-
const isPointer = isMobile && (window.PointerEvent ? true : false);
|
|
5
|
-
const isMSPointer = isMobile && ((window as any).MSPointerEvent ? true : false);
|
|
6
|
-
let canLock = !isMobile;
|
|
7
|
-
|
|
8
|
-
const starters: string[] = [];
|
|
9
|
-
const changers: string[] = [];
|
|
10
|
-
const enders: string[] = [];
|
|
11
|
-
const leavers: string[] = [];
|
|
12
|
-
const prevents: string[] = [];
|
|
13
|
-
|
|
14
|
-
if (isPointer) {
|
|
15
|
-
starters.push("pointerdown");
|
|
16
|
-
enders.push("pointerup", "pointercancel");
|
|
17
|
-
changers.push("pointermove");
|
|
18
|
-
prevents.push("touchstart", "touchmove", "touchend");
|
|
19
|
-
} else if (isMSPointer) {
|
|
20
|
-
starters.push("MSPointerDown");
|
|
21
|
-
changers.push("MSPointerMove");
|
|
22
|
-
enders.push("MSPointerUp");
|
|
23
|
-
} else if (isTouch) {
|
|
24
|
-
canLock = false;
|
|
25
|
-
starters.push("touchstart", "mousedown");
|
|
26
|
-
changers.push("touchmove");
|
|
27
|
-
enders.push("touchend", "touchcancel", "mouseup");
|
|
28
|
-
} else {
|
|
29
|
-
starters.push("mousedown");
|
|
30
|
-
changers.push("mousemove");
|
|
31
|
-
enders.push("mouseup");
|
|
32
|
-
leavers.push("mouseleave");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
mobile: isMobile,
|
|
37
|
-
canLock,
|
|
38
|
-
starters,
|
|
39
|
-
changers,
|
|
40
|
-
enders,
|
|
41
|
-
prevents,
|
|
42
|
-
leavers,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface PointerState {
|
|
47
|
-
x: number,
|
|
48
|
-
y: number,
|
|
49
|
-
mX: number,
|
|
50
|
-
mY: number,
|
|
51
|
-
button?: number,
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function getPointerState(e: Event, el: HTMLElement): PointerState {
|
|
55
|
-
if (e.type.match(/^touch/)) {
|
|
56
|
-
const evt = e as TouchEvent;
|
|
57
|
-
const rect = el.getBoundingClientRect();
|
|
58
|
-
return {
|
|
59
|
-
x: evt.targetTouches[0].clientX - rect.x,
|
|
60
|
-
y: evt.targetTouches[0].clientY - rect.y,
|
|
61
|
-
mX: 0,
|
|
62
|
-
mY: 0,
|
|
63
|
-
};
|
|
64
|
-
} else if (e.type.match(/^pointer/)) {
|
|
65
|
-
const evt = e as PointerEvent;
|
|
66
|
-
return {
|
|
67
|
-
x: evt.offsetX,
|
|
68
|
-
y: evt.offsetY,
|
|
69
|
-
mX: evt.movementX,
|
|
70
|
-
mY: evt.movementY,
|
|
71
|
-
};
|
|
72
|
-
} else {
|
|
73
|
-
const evt = e as MouseEvent;
|
|
74
|
-
return {
|
|
75
|
-
x: evt.offsetX,
|
|
76
|
-
y: evt.offsetY,
|
|
77
|
-
mX: evt.movementX,
|
|
78
|
-
mY: evt.movementY,
|
|
79
|
-
button: evt.button === 0 ? 0 : 1,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const pointer = initBind();
|
|
85
|
-
|