@aiot-toolkit/emulator 2.0.5-widget-provider-beta.2 → 2.0.6-alpha.0

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.
Files changed (50) hide show
  1. package/README.md +173 -173
  2. package/lib/emulatorutil/constants.js +11 -11
  3. package/lib/emulatorutil/running.js +14 -6
  4. package/lib/index.d.ts +5 -2
  5. package/lib/index.js +48 -0
  6. package/lib/instance/common.d.ts +5 -2
  7. package/lib/instance/common.js +26 -5
  8. package/lib/instance/dev.d.ts +4 -1
  9. package/lib/instance/dev.js +9 -9
  10. package/lib/instance/index.js +7 -7
  11. package/lib/instance/minisound.js +6 -6
  12. package/lib/instance/miwear.d.ts +5 -1
  13. package/lib/instance/miwear.js +44 -22
  14. package/lib/instance/miwear5.d.ts +0 -1
  15. package/lib/instance/miwear5.js +0 -1
  16. package/lib/instance/pre.d.ts +4 -1
  17. package/lib/instance/pre.js +9 -9
  18. package/lib/instance/vela5.d.ts +5 -0
  19. package/lib/instance/vela5.js +63 -4
  20. package/lib/shared/index.d.ts +9 -0
  21. package/lib/shared/index.js +16 -4
  22. package/lib/static/advancedFeatures.ini +1 -1
  23. package/lib/static/avdConfigIni.json +45 -39
  24. package/lib/static/debugger_ip.cfg +1 -1
  25. package/lib/static/proto/README.MD +2 -2
  26. package/lib/static/proto/emulator_controller.proto +1476 -1321
  27. package/lib/static/proto/rtc_service.proto +117 -117
  28. package/lib/static/proto/ui_controller_service.proto +147 -0
  29. package/lib/typing/Instance.js +3 -3
  30. package/lib/typing/Vvd.d.ts +3 -3
  31. package/lib/typing/Vvd.js +1 -2
  32. package/lib/utils/file.d.ts +8 -0
  33. package/lib/utils/file.js +48 -1
  34. package/lib/utils/index.js +19 -19
  35. package/lib/vvd/grpc/index.d.ts +16 -7
  36. package/lib/vvd/grpc/index.js +89 -11
  37. package/lib/vvd/grpc/types/GrpcClient.d.ts +43 -2
  38. package/lib/vvd/grpc/types/UiControllerClient.d.ts +23 -0
  39. package/lib/vvd/grpc/types/index.d.ts +3 -0
  40. package/lib/vvd/grpc/types/index.js +38 -0
  41. package/lib/vvd/grpc/types/proto-types.d.ts +178 -0
  42. package/lib/vvd/grpc/types/proto-types.js +50 -0
  43. package/lib/vvd/index.d.ts +7 -3
  44. package/lib/vvd/index.js +141 -50
  45. package/lib/vvd/logcat.js +3 -3
  46. package/package.json +4 -8
  47. package/lib/vvd/grpc/types/KeyEvent.d.ts +0 -19
  48. package/lib/vvd/grpc/types/KeyEvent.js +0 -20
  49. package/lib/vvd/grpc/types/MouseEvent.d.ts +0 -30
  50. /package/lib/vvd/grpc/types/{MouseEvent.js → UiControllerClient.js} +0 -0
package/lib/vvd/index.js CHANGED
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VvdManager = void 0;
6
+ exports.isHeadlessEnvironment = exports.VvdManager = void 0;
7
7
  var _ColorConsole = _interopRequireDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
8
+ var _promises = _interopRequireDefault(require("fs/promises"));
8
9
  var _fs = _interopRequireDefault(require("fs"));
9
10
  var _os = _interopRequireDefault(require("os"));
10
11
  var _path = _interopRequireDefault(require("path"));
@@ -26,6 +27,7 @@ var _logcat = require("./logcat");
26
27
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
27
28
  var _ILog = require("@aiot-toolkit/shared-utils/lib/interface/ILog");
28
29
  var _grpc = require("./grpc");
30
+ var _file = require("../utils/file");
29
31
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
32
  // TODO: 升级构建工具支持 esm @xujunjie
31
33
  const getPort = (async () => {
@@ -42,15 +44,31 @@ const EAvdParamsToIni = {
42
44
  abiType: 'arm64-v8a'
43
45
  }
44
46
  };
47
+ const isHeadlessEnvironment = () => {
48
+ // 检查是否在 Docker 容器中
49
+ if (_fs.default.existsSync('/.dockerenv')) return true;
50
+
51
+ // 检查是否在 WSL 环境中
52
+ if (process.env.WSL_DISTRO_NAME) return true;
53
+
54
+ // 检查是否设置了 DISPLAY 环境变量(Linux)
55
+ if (process.platform === 'linux' && !process.env.DISPLAY) return true;
56
+
57
+ // 检查是否在 CI 环境中
58
+ if (process.env.CI) return true;
59
+ return false;
60
+ };
61
+ exports.isHeadlessEnvironment = isHeadlessEnvironment;
45
62
  class VvdManager {
46
63
  // 需要复制的文件
47
64
  binFiles = ['system.img', 'data.img', 'coredump.core', 'vela_data.bin', 'vela_resource.bin', 'vela_system.bin'];
48
- constructor(vvdResourcePaths) {
65
+ constructor() {
66
+ let vvdResourcePaths = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
49
67
  const {
50
- vvdHome: avdHome,
68
+ vvdHome,
51
69
  sdkHome
52
70
  } = vvdResourcePaths;
53
- this.vvdHome = avdHome || _constants.defaultVvdHome;
71
+ this.vvdHome = vvdHome || _constants.defaultVvdHome;
54
72
  this.sdkHome = sdkHome || _constants.defaultSDKHome;
55
73
  if (!_fs.default.existsSync(this.vvdHome)) {
56
74
  _fs.default.mkdirSync(this.vvdHome, {
@@ -62,13 +80,13 @@ class VvdManager {
62
80
  return _path.default.resolve(__dirname, '../static/debugger_ip.cfg');
63
81
  }
64
82
 
65
- /**
66
- * 创建Vela端的 VVD ,统一保存在 .vela/vvd 目录下
67
- * 1. 创建.vela/advancedFeatures.ini文件
68
- * 2. 创建.vela/vvd/${avdName}.ini文件
69
- * 3. 创建.vela/vvd/${avdName}.vvd/config.ini文件
70
- * @param vvdParams VVD参数,宽高、绑定的镜像路径等
71
- * @returns
83
+ /**
84
+ * 创建Vela端的 VVD ,统一保存在 .vela/vvd 目录下
85
+ * 1. 创建.vela/advancedFeatures.ini文件
86
+ * 2. 创建.vela/vvd/${avdName}.ini文件
87
+ * 3. 创建.vela/vvd/${avdName}.vvd/config.ini文件
88
+ * @param vvdParams VVD参数,宽高、绑定的镜像路径等
89
+ * @returns
72
90
  */
73
91
  createVvd(vvdParams) {
74
92
  const {
@@ -144,10 +162,13 @@ class VvdManager {
144
162
  }
145
163
  }
146
164
  getVvdDir(vvdName) {
147
- // 模拟器有可能在 .vvd .avd 目录下
148
- let res = _path.default.resolve(this.vvdHome, `${vvdName}.vvd`);
149
- if (!_fs.default.existsSync(res)) res = _path.default.resolve(this.vvdHome, `${vvdName}.avd`);
150
- return res;
165
+ const maybe = [_path.default.join(this.vvdHome, `${vvdName}.ini`), _path.default.join(_os.default.homedir(), '.android', 'avd', `${vvdName}.ini`), _path.default.join(_os.default.homedir(), '.android', 'vvd', `${vvdName}.ini`)];
166
+ for (const file of maybe) {
167
+ if (_fs.default.existsSync(file)) {
168
+ return (0, _ini.parse)(_fs.default.readFileSync(file, 'utf-8')).path;
169
+ }
170
+ }
171
+ throw new Error(`VVD directory for ${vvdName} not found`);
151
172
  }
152
173
 
153
174
  /** 根据AVD名字获取模拟器的详细信息 */
@@ -161,7 +182,7 @@ class VvdManager {
161
182
  skin: '',
162
183
  imageDir: '',
163
184
  customLcdRadius: '',
164
- imageType: _Vvd.VelaImageType.REL
185
+ imageType: _Vvd.VelaImageType.VELA_MIWEAR_WATCH_5
165
186
  };
166
187
  let currVvdDir = this.getVvdDir(vvdName);
167
188
  const configIni = _path.default.resolve(currVvdDir, 'config.ini');
@@ -176,7 +197,7 @@ class VvdManager {
176
197
  vvdInfo.imageDir = config['image.sysdir.2'];
177
198
  vvdInfo.customImagePath = config['image.sysdir.1'];
178
199
  vvdInfo.customLcdRadius = config['ide.lcd.radius'];
179
- vvdInfo.imageType = config['ide.image.type'];
200
+ if (config['ide.image.type']) vvdInfo.imageType = config['ide.image.type'];
180
201
  if (vvdInfo.skin) {
181
202
  try {
182
203
  vvdInfo.skinInfo = this.getSkinInfo(vvdInfo.skin, config['skin.path']);
@@ -218,7 +239,12 @@ class VvdManager {
218
239
  const matcher = fileName.match(regex);
219
240
  if (matcher) {
220
241
  const avdName = matcher[1];
221
- const avdInfo = this.getVvdInfo(avdName);
242
+ let avdInfo;
243
+ try {
244
+ avdInfo = this.getVvdInfo(avdName);
245
+ } catch (error) {
246
+ continue;
247
+ }
222
248
  avdList.push(avdInfo);
223
249
  }
224
250
  }
@@ -333,6 +359,54 @@ class VvdManager {
333
359
  const emulatorHome = _path.default.resolve(sdkHome, 'emulator');
334
360
  return _path.default.resolve(emulatorHome, `${platform}-${arch}`, 'emulator');
335
361
  }
362
+
363
+ // 旧的模拟器迁移
364
+ async oldEmulatorMigrate(vvdName) {
365
+ const configIni = _path.default.join(this.getVvdDir(vvdName), 'config.ini');
366
+ const contents = await _promises.default.readFile(configIni, 'utf-8');
367
+ const config = (0, _ini.parse)(contents);
368
+ let needUpdate = false;
369
+
370
+ // 检查 ramsize 调整为 1024
371
+ if (config['hw.ramSize'] < 1024) {
372
+ needUpdate = true;
373
+ config['hw.ramSize'] = 1024;
374
+ }
375
+ // 检查皮肤路径
376
+ if (config['skin.path']?.includes('.export_dev/skins')) {
377
+ if (config['skin.path'].includes('.export_dev/skins/user')) {
378
+ // 自定义的皮肤,将自定义皮肤迁移到新的 sdk 目录中
379
+ const oldUserSkinDir = _path.default.join(_os.default.homedir(), '.export_dev/skins/user');
380
+ const newUserSkinDir = _path.default.join(this.sdkHome, 'skins', 'user');
381
+ const userSkins = await _promises.default.readdir(oldUserSkinDir, {
382
+ withFileTypes: true
383
+ });
384
+ for (const skin of userSkins) {
385
+ if (!skin.isDirectory()) continue;
386
+ const oldSkinPath = _path.default.join(oldUserSkinDir, skin.name);
387
+ const newSkinPath = _path.default.join(newUserSkinDir, skin.name);
388
+ if (!_fs.default.existsSync(newSkinPath)) {
389
+ await _promises.default.mkdir(newSkinPath, {
390
+ recursive: true
391
+ });
392
+ }
393
+ await (0, _file.copyDir)(oldSkinPath, newSkinPath);
394
+ }
395
+ }
396
+ needUpdate = true;
397
+ config['skin.path'] = config['skin.path'].replace('.export_dev/skins', '.vela/sdk/skins');
398
+ }
399
+
400
+ // 检查镜像路径
401
+ if (config['image.sysdir.2']?.includes('.export_dev/system-images')) {
402
+ needUpdate = true;
403
+ config['image.sysdir.2'] = config['image.sysdir.2'].replace('.export_dev/system-images', '.vela/sdk/system-images');
404
+ }
405
+ if (needUpdate) {
406
+ await _promises.default.writeFile(configIni, (0, _ini.stringify)(config));
407
+ _ColorConsole.default.log(`update ${vvdName} config.ini`);
408
+ }
409
+ }
336
410
  async getVvdStartCmd(options) {
337
411
  const vvdName = options.vvdName;
338
412
 
@@ -365,7 +439,11 @@ class VvdManager {
365
439
  const qemuOption = `-device virtio-snd,bus=virtio-mmio-bus.2 -allow-host-audio -semihosting`;
366
440
 
367
441
  // qt windows 配置
368
- const windowOption = options.qtHideWindow ? `-no-window` : '';
442
+ // docker,wls,等无界面平台上用 -no-window ,否则用 -qt-hide-window
443
+ // 使用 -no-window 时 extended control 不可用
444
+ // 在无界面平台上必须使用 -no-window 否则会报错 qt `Could not load the Qt platform plugin \"xcb\"
445
+ const noWindowOption = isHeadlessEnvironment() ? `-no-window` : '-qt-hide-window';
446
+ const windowOption = options.qtHideWindow ? noWindowOption : '';
369
447
  let grpcStr = options.grpcPort ? `-grpc ${options.grpcPort}` : '';
370
448
  let serialStr = ``;
371
449
  if (options.serialPort) {
@@ -379,7 +457,9 @@ class VvdManager {
379
457
  // 启动模拟器的命令和参数
380
458
  const cmd = `${emulatorBin} -vela -avd ${options.vvdName} ${serialStr} -show-kernel ${portMappingStr} ${windowOption} ${grpcStr} ${verboseOption} -qemu ${qemuOption}`;
381
459
  const vvdInfo = this.getVvdInfo(vvdName);
382
- if (!vvdInfo.imageDir) {
460
+ await this.oldEmulatorMigrate(vvdName);
461
+ const imageDir = vvdInfo.customImagePath || vvdInfo.imageDir;
462
+ if (!imageDir) {
383
463
  const errMsg = `${vvdName} is not supported`;
384
464
  _ColorConsole.default.throw(errMsg);
385
465
  throw new Error(errMsg);
@@ -394,12 +474,14 @@ class VvdManager {
394
474
  } else continue;
395
475
  if (!_fs.default.existsSync(pOfVvd)) {
396
476
  // 文件不存在则直接复制
477
+ _ColorConsole.default.log(`${file} not found, copy from ${pOfImageDir}`);
397
478
  _fs.default.copyFileSync(pOfImageDir, pOfVvd);
398
479
  } else {
399
480
  // 文件存在但过时
400
481
  const statsInAvd = _fs.default.statSync(pOfVvd);
401
482
  const stats = _fs.default.statSync(pOfImageDir);
402
483
  if ((0, _dayjs.default)(stats.mtime).isAfter(statsInAvd.mtime)) {
484
+ _ColorConsole.default.log(`${file} file is outdate, update from ${pOfImageDir}`);
403
485
  _fs.default.copyFileSync(pOfImageDir, pOfVvd);
404
486
  }
405
487
  }
@@ -448,7 +530,8 @@ class VvdManager {
448
530
  return {
449
531
  coldBoot: false,
450
532
  emulatorInstance,
451
- getAgent: () => (0, _grpc.createGrpcClient)(e)
533
+ getAgent: () => (0, _grpc.createGrpcClient)(e),
534
+ grpcConfig: e
452
535
  };
453
536
  }
454
537
 
@@ -471,10 +554,9 @@ class VvdManager {
471
554
 
472
555
  // 利用 readline 接口可解决子进程日志换行的问题
473
556
  const readlines = (0, _logcat.attachReadline)(emulatorProcess, onStdout, onErrout);
474
- const emulatorStartedHandler = async msg => {
557
+ const emulatorStartedHandler = msg => {
475
558
  if (func(msg)) {
476
- const runningVvds = await (0, _emulatorutil.getRunningVvds)();
477
- const e = runningVvds.find(e => e['avd.id'] === vvdName);
559
+ const e = (0, _emulatorutil.getRunningAvdConfigByName)(vvdName);
478
560
  if (e) {
479
561
  const emulatorInstance = (0, _instance.findInstance)(vvdInfo.imageType, {
480
562
  serialPort: e['port.serial'],
@@ -491,7 +573,8 @@ class VvdManager {
491
573
  resolve({
492
574
  coldBoot: true,
493
575
  emulatorInstance,
494
- getAgent: () => (0, _grpc.createGrpcClient)(e)
576
+ getAgent: () => (0, _grpc.createGrpcClient)(e),
577
+ grpcConfig: e
495
578
  });
496
579
  } else {
497
580
  reject('get emulator running config failed');
@@ -663,31 +746,31 @@ class VvdManager {
663
746
  }
664
747
  }
665
748
 
666
- /**
667
- * 下载 SDK,默认只下载需要更新的部分
668
- * @param opt.force 强制下载所有部分
669
- *
670
- * @example
671
- * async function main() {
672
- * const sdkHome = path.resolve(os.homedir(), '.export_dev1')
673
- * const velaAvdCls = new VelaAvdCls({ sdkHome })
674
- *
675
- * const downloder = await velaAvdCls.downloadSDK({
676
- * force: true,
677
- * cliProgress: false,
678
- * parallelDownloads: 6
679
- * })
680
- *
681
- * downloder.on('progress', (progress) => {
682
- * console.log(
683
- * `progress: ${progress.formattedSpeed} ${progress.formattedPercentage} ${progress.formatTotal} ${progress.formatTimeLeft}`
684
- * )
685
- * })
686
- *
687
- * await downloder.downlodPromise
688
- *
689
- * console.log('download success')
690
- * }
749
+ /**
750
+ * 下载 SDK,默认只下载需要更新的部分
751
+ * @param opt.force 强制下载所有部分
752
+ *
753
+ * @example
754
+ * async function main() {
755
+ * const sdkHome = path.resolve(os.homedir(), '.export_dev1')
756
+ * const velaAvdCls = new VelaAvdCls({ sdkHome })
757
+ *
758
+ * const downloder = await velaAvdCls.downloadSDK({
759
+ * force: true,
760
+ * cliProgress: false,
761
+ * parallelDownloads: 6
762
+ * })
763
+ *
764
+ * downloder.on('progress', (progress) => {
765
+ * console.log(
766
+ * `progress: ${progress.formattedSpeed} ${progress.formattedPercentage} ${progress.formatTotal} ${progress.formatTimeLeft}`
767
+ * )
768
+ * })
769
+ *
770
+ * await downloder.downlodPromise
771
+ *
772
+ * console.log('download success')
773
+ * }
691
774
  */
692
775
  async downloadSDK(opt) {
693
776
  const updateList = opt.force ? Object.values(_Vvd.SDKParts) : await this.hasSDKPartUpdate();
@@ -744,6 +827,10 @@ class VvdManager {
744
827
  zip.extractAllTo(targetDir, true, true);
745
828
  await _fs.default.promises.rm(zipFile, {
746
829
  force: true
830
+ }).catch(e => {
831
+ _ColorConsole.default.info(`remove ${zipFile} failed: ${e}`);
832
+ // my be failed on windows as resource busy or locked, don't care
833
+ return Promise.resolve();
747
834
  });
748
835
  }
749
836
  const verFile = this.getSDKVersionPath();
@@ -773,6 +860,10 @@ class VvdManager {
773
860
  zip.extractAllTo(_path.default.resolve(this.sdkHome, _Vvd.SDKParts.SYSTEM_IMAGES, imageId), true, true);
774
861
  await _fs.default.promises.rm(zipFile, {
775
862
  force: true
863
+ }).catch(e => {
864
+ _ColorConsole.default.info(`remove ${zipFile} failed: ${e}`);
865
+ // my be failed on windows as resource busy or locked, don't care
866
+ return Promise.resolve();
776
867
  });
777
868
  });
778
869
  return Object.assign(downloader, {
package/lib/vvd/logcat.js CHANGED
@@ -27,7 +27,7 @@ function attachReadline(p, onStdout, onErrout) {
27
27
  let stderrReadline;
28
28
 
29
29
  // 利用 readline 接口可解决子进程日志换行的问题
30
- if (p.stdout) {
30
+ if (p?.stdout) {
31
31
  stdoutReadline = _readline.default.createInterface({
32
32
  input: p.stdout
33
33
  });
@@ -39,7 +39,7 @@ function attachReadline(p, onStdout, onErrout) {
39
39
  stdoutReadline = undefined;
40
40
  });
41
41
  }
42
- if (p.stderr) {
42
+ if (p?.stderr) {
43
43
  stderrReadline = _readline.default.createInterface({
44
44
  input: p.stderr
45
45
  });
@@ -59,7 +59,7 @@ function attachReadline(p, onStdout, onErrout) {
59
59
  stdoutReadline = undefined;
60
60
  stderrReadline = undefined;
61
61
  }
62
- p.on('exit', () => {
62
+ p?.on('exit', () => {
63
63
  dispose();
64
64
  });
65
65
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/emulator",
3
- "version": "2.0.5-widget-provider-beta.2",
3
+ "version": "2.0.6-alpha.0",
4
4
  "description": "vela emulator tool.",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -23,10 +23,6 @@
23
23
  "type": "git",
24
24
  "url": ""
25
25
  },
26
- "author": {
27
- "name": "juancao816",
28
- "email": "caojuan2019@163.com"
29
- },
30
26
  "engines": {
31
27
  "node": ">=12.0"
32
28
  },
@@ -36,10 +32,10 @@
36
32
  "emulator"
37
33
  ],
38
34
  "dependencies": {
39
- "@aiot-toolkit/shared-utils": "2.0.5-widget-provider-beta.2",
35
+ "@aiot-toolkit/shared-utils": "2.0.6-alpha.0",
40
36
  "@grpc/grpc-js": "^1.13.3",
41
37
  "@grpc/proto-loader": "^0.7.13",
42
- "@miwt/adb": "0.10.1",
38
+ "@miwt/adb": "0.10.5",
43
39
  "adm-zip": "^0.5.16",
44
40
  "dayjs": "^1.11.12",
45
41
  "find-process": "^1.4.7",
@@ -53,5 +49,5 @@
53
49
  "@types/adm-zip": "^0.5.5",
54
50
  "@types/ini": "^4.1.1"
55
51
  },
56
- "gitHead": "4a8894bc66a9c78cd835ed6c1af74d054300e064"
52
+ "gitHead": "d62548a25ca507fac9532e34983e87a8cdee36f5"
57
53
  }
@@ -1,19 +0,0 @@
1
- export declare enum KeyEventType {
2
- KEYDOWN = 0,
3
- KEYUP = 1,
4
- KEYPRESS = 2
5
- }
6
- export declare enum KeyCodeType {
7
- USB = 0,
8
- EVDEV = 1,
9
- XKB = 2,
10
- WIN = 3,
11
- MAC = 4
12
- }
13
- export interface GrpcKeyboardEvent {
14
- codeType?: KeyCodeType;
15
- eventType?: KeyEventType;
16
- keyCode?: number | string;
17
- key?: string;
18
- text?: string;
19
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.KeyEventType = exports.KeyCodeType = void 0;
7
- let KeyEventType = exports.KeyEventType = /*#__PURE__*/function (KeyEventType) {
8
- KeyEventType[KeyEventType["KEYDOWN"] = 0] = "KEYDOWN";
9
- KeyEventType[KeyEventType["KEYUP"] = 1] = "KEYUP";
10
- KeyEventType[KeyEventType["KEYPRESS"] = 2] = "KEYPRESS";
11
- return KeyEventType;
12
- }({});
13
- let KeyCodeType = exports.KeyCodeType = /*#__PURE__*/function (KeyCodeType) {
14
- KeyCodeType[KeyCodeType["USB"] = 0] = "USB";
15
- KeyCodeType[KeyCodeType["EVDEV"] = 1] = "EVDEV";
16
- KeyCodeType[KeyCodeType["XKB"] = 2] = "XKB";
17
- KeyCodeType[KeyCodeType["WIN"] = 3] = "WIN";
18
- KeyCodeType[KeyCodeType["MAC"] = 4] = "MAC";
19
- return KeyCodeType;
20
- }({});
@@ -1,30 +0,0 @@
1
- export interface MouseEvent {
2
- /**
3
- * The horizontal coordinate. This is the physical location on the
4
- * screen For example 0 indicates the leftmost coordinate.
5
- */
6
- x?: number;
7
- /**
8
- * The vertical coordinate. This is the physical location on the screen
9
- * For example 0 indicates the top left coordinate.
10
- */
11
- y?: number;
12
- /**
13
- * Indicates which buttons are pressed.
14
- * 0: No button was pressed
15
- * 1: Primary button (left)
16
- * 2: Secondary button (right)
17
- */
18
- buttons?: number;
19
- /**
20
- * The display device where the mouse event occurred.
21
- * Omitting or using the value 0 indicates the main display.
22
- */
23
- display?: number;
24
- }
25
- export interface MouseEventOutput {
26
- x: number;
27
- y: number;
28
- buttons: number;
29
- display: number;
30
- }