ms-vite-plugin 1.2.6 → 1.2.8

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.
@@ -406,6 +406,36 @@ if (success) {
406
406
  }
407
407
  ```
408
408
 
409
+ ### inputSimple - 基础文本输入
410
+
411
+ 不使用剪切板或 IME,而是把文本字符数组一次性传给 Action 模块的 `sendKey`。仅支持可映射为 USB HID Keyboard/Keypad usage 的 ASCII 字符,不支持中文。
412
+
413
+ ```typescript
414
+ function inputSimple(text: string): boolean;
415
+ ```
416
+
417
+ **参数说明:**
418
+
419
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
420
+ | ------ | ------ | -------- | ------ | ---------------- |
421
+ | `text` | string | 是 | - | 要输入的文本内容 |
422
+
423
+ **返回值:**
424
+
425
+ | 类型 | 描述 |
426
+ | --------- | ------------ |
427
+ | `boolean` | 输入是否成功 |
428
+
429
+ **示例:**
430
+
431
+ ```typescript
432
+ // 一次性发送基础文本按键数组
433
+ const success = action.inputSimple("hello_123");
434
+ if (success) {
435
+ logi("成功输入基础文本");
436
+ }
437
+ ```
438
+
409
439
  ### backspace - 删除文本
410
440
 
411
441
  ```typescript
@@ -533,6 +563,41 @@ for (let i = 0; i < 5; i++) {
533
563
  }
534
564
  ```
535
565
 
566
+ ### sendKey - 发送键盘组合键
567
+
568
+ 发送键盘组合键。Action 模块最终发送标准 USB HID Keyboard/Keypad usage。
569
+
570
+ 参数可以直接传标准 usage 数字,也可以传单个 ASCII 字符、按键名称字符串,或现有 `hidKey` 常量;`hidKey` 常量会按兼容规则转换为标准 usage。
571
+
572
+ ```typescript
573
+ function sendKey(key: Array<number | string>): boolean;
574
+ ```
575
+
576
+ **参数说明:**
577
+
578
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
579
+ | ------ | ---------------------- | -------- | ------ | -------------------------------------------------------------------- |
580
+ | `key` | Array<number \| string> | 是 | - | 要发送的按键数组;数字表示标准 USB HID usage,字符串表示按键名或字符 |
581
+
582
+ **返回值:**
583
+
584
+ | 类型 | 描述 |
585
+ | --------- | ------------ |
586
+ | `boolean` | 发送是否成功 |
587
+
588
+ **示例:**
589
+
590
+ ```typescript
591
+ // 发送 Command+C。字符串名称会转换为标准 USB HID usage。
592
+ action.sendKey(["COMMAND", "c"]);
593
+
594
+ // 也可以直接传标准 USB HID usage:0xE3 = Left GUI/Command,0x06 = C。
595
+ action.sendKey([0xe3, 0x06]);
596
+
597
+ // 兼容现有 hidKey 常量,会先转换为标准 USB HID usage。
598
+ action.sendKey([hidKey.COMMAND, "v"]);
599
+ ```
600
+
536
601
  ## W3C Actions
537
602
 
538
603
  ### w3cActions - 执行 W3C Actions JSON
@@ -397,6 +397,36 @@ if (是否成功) {
397
397
  }
398
398
  ```
399
399
 
400
+ ### 输入简易文本
401
+
402
+ 不使用剪切板或 IME,而是把文本字符数组一次性传给动作模块的 `发送按键`。仅支持可映射为 USB HID Keyboard/Keypad usage 的 ASCII 字符,不支持中文。
403
+
404
+ ```typescript
405
+ function 输入简易文本(文本: 字符串): 布尔值;
406
+ ```
407
+
408
+ **参数说明:**
409
+
410
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
411
+ | ------ | ------ | -------- | ------ | ---------------- |
412
+ | `文本` | 字符串 | 是 | - | 要输入的文本内容 |
413
+
414
+ **返回值:**
415
+
416
+ | 类型 | 描述 |
417
+ | -------- | ------------ |
418
+ | `布尔值` | 输入是否成功 |
419
+
420
+ **示例:**
421
+
422
+ ```typescript
423
+ // 一次性发送基础文本按键数组
424
+ const 是否成功 = $动作.输入简易文本("hello_123");
425
+ if (是否成功) {
426
+ $打印信息日志("成功输入基础文本");
427
+ }
428
+ ```
429
+
400
430
  ### 删除文本
401
431
 
402
432
  ```typescript
@@ -527,6 +557,41 @@ for (let i = 0; i < 5; i++) {
527
557
  }
528
558
  ```
529
559
 
560
+ ### 发送按键 - 发送键盘组合键
561
+
562
+ 发送键盘组合键。动作模块最终发送标准 USB HID Keyboard/Keypad usage。
563
+
564
+ 参数可以直接传标准 usage 数字,也可以传单个 ASCII 字符、按键名称字符串,或现有 `hidKey` 常量;`hidKey` 常量会按兼容规则转换为标准 usage。
565
+
566
+ ```typescript
567
+ function 发送按键(按键: 数组<数字 | 字符串>): 布尔值;
568
+ ```
569
+
570
+ **参数说明:**
571
+
572
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
573
+ | ------ | ---------------- | -------- | ------ | -------------------------------------------------------------------- |
574
+ | `按键` | 数组<数字 \| 字符串> | 是 | - | 要发送的按键数组;数字表示标准 USB HID usage,字符串表示按键名或字符 |
575
+
576
+ **返回值:**
577
+
578
+ | 类型 | 描述 |
579
+ | -------- | ------------ |
580
+ | `布尔值` | 发送是否成功 |
581
+
582
+ **示例:**
583
+
584
+ ```typescript
585
+ // 发送 Command+C。字符串名称会转换为标准 USB HID usage。
586
+ $动作.发送按键(["COMMAND", "c"]);
587
+
588
+ // 也可以直接传标准 USB HID usage:0xE3 = Left GUI/Command,0x06 = C。
589
+ $动作.发送按键([0xe3, 0x06]);
590
+
591
+ // 兼容现有 hidKey 常量,会先转换为标准 USB HID usage。
592
+ $动作.发送按键([hidKey.COMMAND, "v"]);
593
+ ```
594
+
530
595
  ## W3C Actions
531
596
 
532
597
  ### 执行W3C动作 - 执行 W3C Actions JSON
@@ -380,6 +380,35 @@ if action.input("hello 快点JS"):
380
380
  print("成功输入文本")
381
381
  ```
382
382
 
383
+ ### inputSimple - 基础文本输入
384
+
385
+ 不使用剪切板或 IME,而是把文本字符列表一次性传给 Action 模块的 `sendKey`。仅支持可映射为 USB HID Keyboard/Keypad usage 的 ASCII 字符,不支持中文。
386
+
387
+ ```python
388
+ def inputSimple(text: str) -> bool
389
+ ```
390
+
391
+ **参数说明:**
392
+
393
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
394
+ | ------ | ---- | -------- | ------ | ---------------- |
395
+ | `text` | str | 是 | - | 要输入的文本内容 |
396
+
397
+ **返回值:**
398
+
399
+ | 类型 | 描述 |
400
+ | ------ | ------------ |
401
+ | `bool` | 输入是否成功 |
402
+
403
+ **示例:**
404
+
405
+ ```python
406
+ from kuaijs import action
407
+
408
+ if action.inputSimple("hello_123"):
409
+ print("成功输入基础文本")
410
+ ```
411
+
383
412
  ### backspace - 删除文本
384
413
 
385
414
  ```python
@@ -503,6 +532,40 @@ for i in range(5):
503
532
  action.pressButton("volumeup")
504
533
  ```
505
534
 
535
+ ### sendKey - 发送键盘组合键
536
+
537
+ 发送键盘组合键。Action 模块最终发送标准 USB HID Keyboard/Keypad usage。
538
+
539
+ 参数可以直接传标准 usage 数字,也可以传单个 ASCII 字符、按键名称字符串,或现有 `hidKey` 常量;`hidKey` 常量会按兼容规则转换为标准 usage。
540
+
541
+ ```python
542
+ def sendKey(key: List[Union[int, str]]) -> bool
543
+ ```
544
+
545
+ **参数说明:**
546
+
547
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
548
+ | ------ | --------------------- | -------- | ------ | -------------------------------------------------------------------- |
549
+ | `key` | List[Union[int, str]] | 是 | - | 要发送的按键列表;数字表示标准 USB HID usage,字符串表示按键名或字符 |
550
+
551
+ **返回值:**
552
+
553
+ | 类型 | 描述 |
554
+ | ------ | ------------ |
555
+ | `bool` | 发送是否成功 |
556
+
557
+ **示例:**
558
+
559
+ ```python
560
+ from kuaijs import action
561
+
562
+ # 发送 Command+C。字符串名称会转换为标准 USB HID usage。
563
+ action.sendKey(["COMMAND", "c"])
564
+
565
+ # 也可以直接传标准 USB HID usage:0xE3 = Left GUI/Command,0x06 = C。
566
+ action.sendKey([0xE3, 0x06])
567
+ ```
568
+
506
569
  ## W3C Actions
507
570
 
508
571
  ### w3cActions - 执行 W3C Actions JSON
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {